4343class PhysBCUtil
4444{
4545public:
46+ // Scalar info -------------------------------------------------------------
47+ // This controls the number of scalars in the simulation, their names,
48+ // the number of components for each scalar, etc...
49+
50+ // These can be used to identify a specific scalar.
51+ // WARNING: Do not add scalars. SOMAR can't handle it yet.
52+ struct ScalarIndex {
53+ enum {
54+ BUOYANCY_DEVIATION = 0 ,
55+ _COUNT
56+ };
57+ };
58+
59+ // Basic accessors
60+ static inline unsigned int getNumScalars ();
61+ static inline const std::string& getName (unsigned int a_idx);
62+ static inline int getNumComps (unsigned int a_idx);
63+ static inline const IntVect& getGhostVect (unsigned int a_idx);
64+
65+
66+ // Construction / destruction ----------------------------------------------
67+
4668 // Constructor
4769 PhysBCUtil ();
4870
4971 // Destructor
5072 virtual ~PhysBCUtil ();
5173
52- // Derived classes should be thier own factories.
74+ // Derived classes should be their own factories.
5375 virtual PhysBCUtil* newPhysBCUtil () const = 0;
5476
55- // Reads BC data from file
77+ // Overridable constructor
5678 virtual void define ();
5779
80+ // Performs static initialization (IO, etc).
81+ static void staticDefine ();
82+ static inline bool isStaticDefined ();
83+
5884
5985 // ICs / background fields -------------------------------------------------
6086 // These functions have defaults that just set the FABs to zero and should
61- // be overriden as needed.
87+ // be overridden as needed.
6288
6389 // Fills a FAB with the initial velocity.
6490 // Locations are in mapped space, but components are Cartesian.
@@ -82,7 +108,7 @@ public:
82108
83109
84110 // Utility functions -------------------------------------------------------
85- // Most of these functions just call thier FAB versions and should not
111+ // Most of these functions just call their FAB versions and should not
86112 // need to be overridden.
87113
88114 // Sets the velocity ICs over an entire level
@@ -115,6 +141,7 @@ public:
115141 const Real a_time,
116142 const LevelGeometry& a_levGeo) const ;
117143
144+ // TODO: This should be moved to StratUtils.
118145 // Computes the Brunt–Väisälä frequency on a single grid.
119146 // All ins and outs must be CC.
120147 // a_bFAB is the background buoyancy field.
@@ -127,6 +154,7 @@ public:
127154 const Box& a_destBox,
128155 const RealVect& a_dx) const ;
129156
157+ // TODO: This should be moved to StratUtils.
130158 // Computes the Brunt–Väisälä frequency over an entire level.
131159 // a_Nsq must be CC.
132160 virtual void computeNSq (LevelData<FArrayBox>& a_Nsq,
@@ -139,8 +167,8 @@ public:
139167 // This is in case the BC's have an effect on the timestep.
140168 // Pass in currently computed dt, along with the cfl and dx. If the effect
141169 // of the BCs requires a decreased timestep, then the newly reduced timestep
142- // is returned. In the default case, this just returns a_dt back; however,
143- // derived classes may actually have an effect .
170+ // is returned. In the default case, this just returns a_dt back. Derived
171+ // classes may need this .
144172 virtual void computeBoundaryDt (Real& a_dt,
145173 const Real a_cfl,
146174 const LevelGeometry& a_levGeo) const ;
@@ -201,7 +229,7 @@ public:
201229 // Sets ghosts needed to calculate the viscous source term nu.L[vel]
202230 virtual Tuple<BCMethodHolder, SpaceDim> viscousSourceFuncBC () const ;
203231
204- // Used in single-compoent velocity TGA solves
232+ // Used in single-component velocity TGA solves
205233 virtual BCMethodHolder viscousSolveFuncBC (int a_dir) const ;
206234
207235 // returns single-component BC for viscous refluxing solves
@@ -319,10 +347,13 @@ protected:
319347 // Member variables and utility functions ----------------------------------
320348
321349 // Have we read params from the input file yet?
322- static bool s_staticMembersSet ;
350+ static bool m_isStaticDefined ;
323351
324352 static RealVect s_domLength;
353+
325354 static bool s_useBackgroundScalar;
355+ static int s_bgScalarProfile;
356+ static RefCountedPtr<EllipticBCValueClass> s_stdProfilePtr;
326357
327358 static RealVect s_tidalU0;
328359 static Real s_tidalOmega;
@@ -331,10 +362,61 @@ protected:
331362 static bool s_useSpongeLayer;
332363 static Real s_spongeWidth[CH_SPACEDIM][2 ];
333364 static Real s_spongeDtMult[CH_SPACEDIM][2 ];
365+
366+ // Scalar metadata
367+ struct ScalarMetaData
368+ {
369+ std::string name;
370+ int numComps;
371+ IntVect ghostVect;
372+ };
373+ static const ScalarMetaData s_scalarMetaData[ScalarIndex::_COUNT];
334374};
335375
336376
337377
378+ // -----------------------------------------------------------------------------
379+ // Simple accessor
380+ // -----------------------------------------------------------------------------
381+ inline bool PhysBCUtil::isStaticDefined ()
382+ {
383+ return m_isStaticDefined;
384+ }
385+
386+
387+ // -----------------------------------------------------------------------------
388+ // Simple accessor
389+ // -----------------------------------------------------------------------------
390+ inline unsigned int PhysBCUtil::getNumScalars ()
391+ {
392+ return ScalarIndex::_COUNT;
393+ }
394+
395+
396+ // -----------------------------------------------------------------------------
397+ // Simple accessor
398+ // -----------------------------------------------------------------------------
399+ inline const std::string& PhysBCUtil::getName (unsigned int a_idx) {
400+ return s_scalarMetaData[a_idx].name ;
401+ }
402+
403+
404+ // -----------------------------------------------------------------------------
405+ // Simple accessor
406+ // -----------------------------------------------------------------------------
407+ inline int PhysBCUtil::getNumComps (unsigned int a_idx) {
408+ return s_scalarMetaData[a_idx].numComps ;
409+ }
410+
411+
412+ // -----------------------------------------------------------------------------
413+ // Simple accessor
414+ // -----------------------------------------------------------------------------
415+ inline const IntVect& PhysBCUtil::getGhostVect (unsigned int a_idx) {
416+ return s_scalarMetaData[a_idx].ghostVect ;
417+ }
418+
419+
338420// -----------------------------------------------------------------------------
339421// Simple accessor
340422// -----------------------------------------------------------------------------
0 commit comments