Chombo + EB + MF  3.2
WarpedCS.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _WARPEDCS_H_
12 #define _WARPEDCS_H_
13 
14 #include "NewFourthOrderCoordSys.H"
15 
16 
17 #include "NamespaceHeader.H"
18 
19 #ifdef CH_USE_FLOAT
20 # define RTOL 1.e-6
21 # define ATOL 1.e-7
22 #else
23 # define RTOL 1.e-12
24 # define ATOL 1.e-13
25 #endif
26 
27 /// "warped" Coordinate mapping (non-constant Jacobian)
28 ///
29 /**
30 */
32 {
33 public:
34  /// constructor
35  WarpedCS(const RealVect& a_dX,
36  const RealVect& a_scale,
37  const Real a_rtol=RTOL,
38  const Real a_atol=ATOL,
39  const int a_imax=100);
40 
41  /**
42  Destructor.
43  */
44  virtual ~WarpedCS();
45 
46  /// given coordinate in mapped space, return its location in real space
47  RealVect realCoord(const RealVect& a_Xi) const;
48 
49  /// given coordinate in real space, return its location in the mapped space
50  RealVect mappedCoord(const RealVect& a_x) const;
51 
52  // Calculate the derivative of each coordinate vector
53  virtual Real dXdXi(const RealVect& a_Xi, int a_dirX, int a_dirXi) const;
54 
55  /// Sets the time for moving grids and adjusts m_scale
56  virtual void setTime(const Real& a_time) const;
57 
58  /// initialize scale
59  void scale(const RealVect& a_scale);
60 
61 protected:
62  // scale for displacement
63  mutable RealVect m_scale; ///< The 'c'
64  const RealVect m_staticScale; ///< Preserves initial scale argument
65  ///< given to constructor for moving grids
66 
67  // parameters for fixed-point iteration for inverse mapping
70  int m_imax;
71 
72  // convenience
73  const Real m_twoPi;
74  mutable int m_rootDir;
75 
76  // RHS of fixed-point iteration for inverse mapping
77  Real g( const Real xi, const RealVect& x ) const;
78 
79 
80 };
81 
82 
83 /// factory for WarpedCS
84 /**
85  */
86 class
88 {
89 
90 public:
91  /// constructor
92  WarpedCSFactory(const RealVect& a_scale,
93  const Real a_rtol=RTOL,
94  const Real a_atol=ATOL,
95  const int a_imax=100);
96 
97  ///
98  virtual NewCoordSys* getCoordSys(const ProblemDomain& a_domain,
99  const RealVect& a_dx) const;
100 
101 protected:
102 
103  ///
107  int m_imax;
108 };
109 
110 
111 #include "NamespaceFooter.H"
112 
113 #endif
int m_imax
Definition: WarpedCS.H:107
RealVect mappedCoord(const RealVect &a_x) const
given coordinate in real space, return its location in the mapped space
#define ATOL
Definition: WarpedCS.H:24
virtual ~WarpedCS()
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
WarpedCS(const RealVect &a_dX, const RealVect &a_scale, const Real a_rtol=RTOL, const Real a_atol=ATOL, const int a_imax=100)
constructor
RealVect m_scale
Definition: WarpedCS.H:104
Real m_rtol
Definition: WarpedCS.H:105
Virtual base class encapsulating mapped-grid coordinate systems.
Definition: NewFourthOrderCoordSys.H:77
Real m_atol
Definition: WarpedCS.H:106
Real g(const Real xi, const RealVect &x) const
RealVect m_scale
The &#39;c&#39;.
Definition: WarpedCS.H:63
virtual void setTime(const Real &a_time) const
Sets the time for moving grids and adjusts m_scale.
const Real m_twoPi
Definition: WarpedCS.H:73
Real m_rtol
Definition: WarpedCS.H:68
RealVect realCoord(const RealVect &a_Xi) const
given coordinate in mapped space, return its location in real space
#define RTOL
Definition: WarpedCS.H:23
Real m_atol
Definition: WarpedCS.H:69
int m_rootDir
Definition: WarpedCS.H:74
pure-virtual base class defining factory interface for CoordSys
Definition: NewCoordSys.H:236
double Real
Definition: REAL.H:33
const RealVect m_staticScale
Definition: WarpedCS.H:64
Definition: WarpedCS.H:31
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
factory for WarpedCS
Definition: WarpedCS.H:86
virtual Real dXdXi(const RealVect &a_Xi, int a_dirX, int a_dirXi) const
note that a_Xi is in mapped space.
void scale(const RealVect &a_scale)
initialize scale
Virtual base class encapsulating mapped-grid coordinate systems.
Definition: NewCoordSys.H:30
int m_imax
Definition: WarpedCS.H:70