Chombo + EB + MF  3.2
RThetaPhiCS.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 _RTHETAPHICS_H_
12 #define _RTHETAPHICS_H_
13 
14 #include "CONSTANTS.H"
15 #include "NewFourthOrderCoordSys.H"
16 #include "NamespaceHeader.H"
17 
18 /// Mapping from spherical coordinates (Xi) to real coodinates.
19 /**
20  * <ul>
21  * <li> \f$\theta\f$ is the azimuthal angle (counter-clockwise from +x axis
22  * in xy plane)
23  * <li> \f$\varphi\f$ is the inclination angle measure from +z axis
24  * </ul>
25  *
26  * \f$ x = r\sin\varphi\cos\theta \f$<br/>
27  * \f$ y = r\sin\varphi\sin\theta \f$<br/>
28  * \f$ z = r\cos\varphi \f$
29  *
30  * <p> But to avoid singularities, we define<br/>
31  * \f$ r = \mbox(stretch)(\hat(r) + r_(\min)) \f$<br/>
32  * \f$ \theta = 2\pi\hat(\theta) \f$<br/>
33  * \f$ \varphi = \hat(\varphi)(\pi - 2\varphi_(\min)) + \varphi_(\min) \f$<br/>
34  * where \f$0 <= \hat(r), \hat(\theta), \hat(\varphi) <= 1 \f$. stretch,
35  * \f$r_(\min)\f$, and \f$\varphi_(\min)\f$ are defined by input. Note that
36  * \f$\varphi_(\min)\f$ is the minimum angle with the z-axis.
37  *
38  */
39 
41 {
42 public:
43  /// Constructor
44  RThetaPhiCS(const RealVect& a_dx,
45  const Real a_stretch = 1.,
46  const Real a_rMin = 1.,
47  const Real a_phiMin = Pi/4.);
48 
49  /// Destructor
50  virtual ~RThetaPhiCS();
51 
52  /// Given coordinate in mapped space, return its location in real space
53  virtual RealVect realCoord(const RealVect& a_hatXi) const;
54 
55  /// Given coordinate in real space, return its location in the mapped space
56  virtual RealVect mappedCoord(const RealVect& a_x) const;
57 
58  // Calculate the derivative of each coordinate vector
59  virtual Real dXdXi(const RealVect& a_Xi, int a_dirX, int a_dirXi) const;
60 
61 private:
62  /// Normalize the mapped coordinates \f$(0 <= \hat{\xi} <= 1)\f$
63  RealVect normalize(const RealVect & a_Xi) const;
64 
65  /// Unnormalized the mapped coordinates
66  RealVect unnormalize(const RealVect & a_hatXi) const;
67 
68  /// Return location in real space of an unnormalized Coord. from mapped space
69  RealVect realCoordUN(const RealVect& a_Xi) const;
70 
71 protected:
72  Real m_stretch; ///< Stretching in the r direction
73  Real m_rMin; ///< Min r (> 0 avoids singularity there)
74  Real m_phiMin; ///< Min angle between r and z-axis. (>0
75  ///< avoids singularity there)
76 };
77 
78 
79 /// Factory for RThetaPhiCS
80 /**
81  */
82 class
84 {
85 
86 public:
87  /// Constructor
88  RThetaPhiCSFactory(const Real a_stretch = 1.,
89  const Real a_rMin = 1.,
90  const Real a_phiMin = Pi/4.);
91 
92  ///
93  virtual NewCoordSys* getCoordSys(const ProblemDomain& a_domain,
94  const RealVect& a_dx) const;
95 
96 protected:
97 
98  ///
102 };
103 
104 #include "NamespaceFooter.H"
105 
106 #endif
RealVect unnormalize(const RealVect &a_hatXi) const
Unnormalized the mapped coordinates.
Mapping from spherical coordinates (Xi) to real coodinates.
Definition: RThetaPhiCS.H:40
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Virtual base class encapsulating mapped-grid coordinate systems.
Definition: NewFourthOrderCoordSys.H:77
virtual RealVect mappedCoord(const RealVect &a_x) const
Given coordinate in real space, return its location in the mapped space.
RealVect realCoordUN(const RealVect &a_Xi) const
Return location in real space of an unnormalized Coord. from mapped space.
virtual Real dXdXi(const RealVect &a_Xi, int a_dirX, int a_dirXi) const
note that a_Xi is in mapped space.
Real m_rMin
Definition: RThetaPhiCS.H:100
Factory for RThetaPhiCS.
Definition: RThetaPhiCS.H:82
virtual RealVect realCoord(const RealVect &a_hatXi) const
Given coordinate in mapped space, return its location in real space.
Real m_phiMin
Definition: RThetaPhiCS.H:74
pure-virtual base class defining factory interface for CoordSys
Definition: NewCoordSys.H:236
Real m_rMin
Min r (> 0 avoids singularity there)
Definition: RThetaPhiCS.H:73
double Real
Definition: REAL.H:33
Real m_stretch
Stretching in the r direction.
Definition: RThetaPhiCS.H:72
Real m_phiMin
Definition: RThetaPhiCS.H:101
RealVect normalize(const RealVect &a_Xi) const
Normalize the mapped coordinates .
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
RThetaPhiCS(const RealVect &a_dx, const Real a_stretch=1., const Real a_rMin=1., const Real a_phiMin=Pi/4.)
Constructor.
virtual ~RThetaPhiCS()
Destructor.
Virtual base class encapsulating mapped-grid coordinate systems.
Definition: NewCoordSys.H:30
Real m_stretch
Definition: RThetaPhiCS.H:99