Chombo + EB + MF  3.2
SchwarzChristoffelRampCS.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 _SCHWARZCHRISTOFFELRAMPCS_H_
12 #define _SCHWARZCHRISTOFFELRAMPCS_H_
13 
14 #include "CONSTANTS.H"
15 #include "NewFourthOrderCoordSys.H"
16 #include "NamespaceHeader.H"
17 
18 
19 /*******************************************************************************
20  */
21 /// Conformal Schwarz-Christoffel mapping of a ramp
22 /** \verbatim
23  * Physical-space (z) Computational Space
24  *
25  * ^ ^
26  * i | ,-+ i |
27  * ,--' |
28  * ,--' \ +-----------+
29  * +-' ,+ | |
30  * \ ,-' | |
31  * | ,-' alpha | |
32  * +--*'- - - - - - > +--*--------+ - - - >
33  * 0 \hat(xi)_0
34  * \endverbatim
35  * <p>
36  * \f$ z = k(xi - \hat(xi))^c e^(i\alpha)\f$</br/>
37  * where</br>
38  * \f$alpha\f$ = angle of ramp</br>
39  * \f$\hat(xi)_0\f$ = location of corner</br>
40  * \f$c = 1 - \alpha/\pi\f$</br>
41  * \f$k = len/(\hat(xi)_0^c + (1 - \hat(xi)_0)^c)\f$ where len is the length
42  * of the bottom boundary (both the horizontal and following the ramp) in
43  * physical space
44  *
45  * \note
46  * <ul>
47  * <li> In computational space, the domain extends from 0 to 1 in the x
48  * direction and the corner is anchored at m_xiCorner. The cells
49  * are square and the domain extends from 0 in the y direction (height
50  * is not specified)
51  * <li> In the physical space, the corner is anchored at (0, 0) and the
52  * length of the bottom boundary is specified.
53  * <li> If a third dimension is hanging around, it is scaled by k
54  * <li> Tolerances tested up to 1024 cells in X-Dir.
55  * </ul>
56  *
57  ******************************************************************************/
58 
60 {
61 public:
62  /// Constructor
64  const int a_nCellBaseDir0, // See .cpp for
65  const Real a_alpha = Pi/6., // details
66  const Real a_XLeadLength = 0.5,
67  const Real a_XRampLength = 4.5);
68 
69  /// Destructor
70  virtual ~SchwarzChristoffelRampCS();
71 
72  /// Given coordinate in mapped space, return its location in real space
73  virtual RealVect realCoord(const RealVect& a_hatXi) const;
74 
75  /// Given coordinate in real space, return its location in the mapped space
76  virtual RealVect mappedCoord(const RealVect& a_x) const;
77 
78  /// Calculate the derivative of each coordinate vector
79  virtual Real dXdXi(const RealVect& a_Xi, int a_dirX, int a_dirXi) const;
80 
81  /// Return the angle of the ramp in radians
82  Real rampAngle() const;
83 
84  /// Return the location of the corner point in mapped space
85  const RealVect& mappedCorner() const;
86 
87  /// Return the x-location of lower left domain corner in physical space
88  Real physicalDomainX0Min() const;
89 
90 protected:
91 
92  /// Get a complex in polar coordinates
93  RealVect getPolar(const RealVect& a_Xi) const;
94 
95  const Real m_alpha; ///< Ramp angle (0 <= m_alpha < Pi)
96  const Real m_c; ///< Exponent coefficient
97  Real m_k; ///< Scaling between mapped and physical
98  ///< space
99  RealVect m_XiCorner; ///< Corner in mapped space
100 };
101 
102 
103 /*******************************************************************************
104  */
105 /// Factory for SchwarzChristoffelRampCS
106 /*
107  ******************************************************************************/
108 
110 {
111 public:
112  /// Constructor
114  const int a_nCellBaseDir0, // See .cpp for details
115  const Real a_alpha = Pi/6.,
116  const Real a_XLeadLength = 0.5,
117  const Real a_XRampLength = 4.0);
118 
119  ///
120  virtual NewCoordSys* getCoordSys(const ProblemDomain& a_domain,
121  const RealVect& a_dx) const;
122 
123 protected:
124 
125  const int m_nCellBaseDir0;
126  const Real m_alpha;
129 };
130 
131 
132 /*******************************************************************************
133  *
134  * Class SchwarzChristoffelRampCS: inline member definitions
135  *
136  ******************************************************************************/
137 
138 /*--------------------------------------------------------------------*/
139 // Return the angle of the ramp in radians
140 /*--------------------------------------------------------------------*/
141 
142 inline Real
144 {
145  return m_alpha;
146 }
147 
148 /*--------------------------------------------------------------------*/
149 // Return the location of the corner point in mapped space
150 /*--------------------------------------------------------------------*/
151 
152 inline const RealVect&
154 {
155  return m_XiCorner;
156 }
157 
158 /*--------------------------------------------------------------------*/
159 // Return the x-location of lower left domain corner in physical
160 // space
161 /*--------------------------------------------------------------------*/
162 
163 inline Real
165 {
166  return -m_k*std::pow(std::fabs(m_XiCorner[0]), m_c);
167 }
168 
169 #include "NamespaceFooter.H"
170 
171 #endif
Factory for SchwarzChristoffelRampCS.
Definition: SchwarzChristoffelRampCS.H:109
const int m_nCellBaseDir0
Definition: SchwarzChristoffelRampCS.H:125
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
virtual RealVect mappedCoord(const RealVect &a_x) const
Given coordinate in real space, return its location in the mapped space.
virtual RealVect realCoord(const RealVect &a_hatXi) const
Given coordinate in mapped space, return its location in real space.
virtual ~SchwarzChristoffelRampCS()
Destructor.
Virtual base class encapsulating mapped-grid coordinate systems.
Definition: NewFourthOrderCoordSys.H:77
Real m_k
Definition: SchwarzChristoffelRampCS.H:97
const Real m_XLeadLength
Definition: SchwarzChristoffelRampCS.H:127
Real rampAngle() const
Return the angle of the ramp in radians.
Definition: SchwarzChristoffelRampCS.H:143
const Real m_c
Exponent coefficient.
Definition: SchwarzChristoffelRampCS.H:96
SchwarzChristoffelRampCS(const RealVect &a_dx, const int a_nCellBaseDir0, const Real a_alpha=Pi/6., const Real a_XLeadLength=0.5, const Real a_XRampLength=4.5)
Constructor.
Conformal Schwarz-Christoffel mapping of a ramp.
Definition: SchwarzChristoffelRampCS.H:59
pure-virtual base class defining factory interface for CoordSys
Definition: NewCoordSys.H:236
double Real
Definition: REAL.H:33
RealVect m_XiCorner
Corner in mapped space.
Definition: SchwarzChristoffelRampCS.H:99
virtual Real dXdXi(const RealVect &a_Xi, int a_dirX, int a_dirXi) const
Calculate the derivative of each coordinate vector.
RealVect getPolar(const RealVect &a_Xi) const
Get a complex in polar coordinates.
const RealVect & mappedCorner() const
Return the location of the corner point in mapped space.
Definition: SchwarzChristoffelRampCS.H:153
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
Real physicalDomainX0Min() const
Return the x-location of lower left domain corner in physical space.
Definition: SchwarzChristoffelRampCS.H:164
const Real m_alpha
Ramp angle (0 <= m_alpha < Pi)
Definition: SchwarzChristoffelRampCS.H:95
const Real m_XRampLength
Definition: SchwarzChristoffelRampCS.H:128
const Real m_alpha
Definition: SchwarzChristoffelRampCS.H:126
Virtual base class encapsulating mapped-grid coordinate systems.
Definition: NewCoordSys.H:30