00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _EBPATCHADVECT_H_
00012 #define _EBPATCHADVECT_H_
00013
00014 #include "EBPatchGodunov.H"
00015 #include "EBPatchGodunovFactory.H"
00016 #include "NamespaceHeader.H"
00017
00019
00023 class EBPatchAdvect : public EBPatchGodunov
00024 {
00025 public:
00026
00028 EBPatchAdvect();
00029
00031 ~EBPatchAdvect();
00032
00034
00037 virtual int numPrimitives() const
00038 {
00039 return 1;
00040 }
00041
00043
00046 virtual int numFluxes() const
00047 {
00048 return 1;
00049 }
00050
00052
00055 virtual int numConserved() const
00056 {
00057 return 1;
00058 }
00059
00061
00063 virtual int numSlopes() const
00064 {
00065 return 1;
00066 }
00067
00069
00071 void
00072 normalPred(EBCellFAB& a_primLo,
00073 EBCellFAB& a_primHi,
00074 const EBCellFAB& a_primState,
00075 const EBCellFAB& a_slopePrim,
00076 const Real& a_scale,
00077 const int& a_dir,
00078 const Box& a_box);
00079
00081
00083 void
00084 interpolateFluxToCentroids(BaseIFFAB<Real> a_centroidFlux[SpaceDim],
00085 const EBFluxFAB& a_fluxInterpolant,
00086 const IntVectSet& a_irregIVS);
00087
00089
00091 void
00092 extrapToCoveredFaces(BaseIVFAB<Real>& a_extendedPrim,
00093 const EBFaceFAB& a_primFace,
00094 const EBCellFAB& a_primState,
00095 const Vector<VolIndex>& a_coveredFaces,
00096 const int& a_faceDir,
00097 const Side::LoHiSide& a_sd,
00098 const Box& a_box);
00099
00101
00103 void
00104 pointExtrapToCovered2D(Vector<Real>& a_extrapVal,
00105 const EBFaceFAB& a_primFace,
00106 const EBCellFAB& a_primState,
00107 const int& a_faceDir,
00108 const VolIndex& a_vof,
00109 const RealVect& a_normal,
00110 const Side::LoHiSide& a_sd,
00111 const int& a_numPrim);
00112
00114
00116 void
00117 pointExtrapToCovered3D(Vector<Real>& a_extrapVal,
00118 const EBFaceFAB& a_primFace,
00119 const EBCellFAB& a_primState,
00120 const int& a_faceDir,
00121 const VolIndex& a_vof,
00122 const RealVect& a_normal,
00123 const Side::LoHiSide& a_sd,
00124 const int& a_numPrim);
00126
00130 virtual void
00131 updatePrim(EBCellFAB& a_primMinu,
00132 EBCellFAB& a_primPlus,
00133 const EBFaceFAB& a_flux,
00134 const BaseIVFAB<Real>& a_coveredFluxMinu,
00135 const BaseIVFAB<Real>& a_coveredFluxPlus,
00136 const Vector<VolIndex>& a_coveredFaceMinu,
00137 const Vector<VolIndex>& a_coveredFacePlus,
00138 const int& a_dir,
00139 const Box& a_box,
00140 const Real& a_scale);
00141
00142 void
00143 upwindSlope(EBCellFAB& a_slopeUpWi,
00144 const EBCellFAB& a_primState,
00145 const int& a_dir,
00146 const Box& a_box);
00147
00149 virtual void
00150 floorPrimitives(EBCellFAB& a_primState,
00151 const Box& a_box)
00152 {
00153 if(m_isMaxMinSet)
00154 {
00155 CH_assert(numPrimitives()==1);
00156 IntVectSet ivsIrreg = m_ebisBox.getIrregIVS(a_box);
00157 for(VoFIterator vofit(ivsIrreg, m_ebisBox.getEBGraph());vofit.ok(); ++vofit)
00158 {
00159 const VolIndex& vof = vofit();
00160 a_primState(vof, 0) = Min(a_primState(vof, 0), m_maxVal);
00161 a_primState(vof, 0) = Max(a_primState(vof, 0), m_minVal);
00162 }
00163 }
00164 }
00165
00167 virtual void
00168 floorConserved(EBCellFAB& a_consState,
00169 const Box& a_box)
00170 {
00171 if(m_isMaxMinSet)
00172 {
00173 MayDay::Error("EBPatchAdvect::floorConserved::EBCellFAB:: unexpected case");
00174 }
00175 }
00176
00178 virtual void
00179 floorPrimitives(BaseIVFAB<Real>& a_primState,
00180 const IntVectSet& a_set)
00181 {
00182 if(m_isMaxMinSet)
00183 {
00184 CH_assert(numPrimitives()==1);
00185 for(VoFIterator vofit(a_set, m_ebisBox.getEBGraph());vofit.ok(); ++vofit)
00186 {
00187 const VolIndex& vof = vofit();
00188 a_primState(vof, 0) = Min(a_primState(vof, 0), m_maxVal);
00189 a_primState(vof, 0) = Max(a_primState(vof, 0), m_minVal);
00190 }
00191 }
00192 }
00193
00195 virtual void
00196 floorConserved(BaseIVFAB<Real>& a_consState,
00197 const IntVectSet& a_set)
00198 {
00199 if(m_isMaxMinSet)
00200 {
00201 MayDay::Error("EBPatchAdvect::floorConserved::BaseIVFAB:: unexpected case");
00202 }
00203 }
00204
00206 virtual void getCoveredValuesPrim(Vector<Real>& a_covValues)
00207 {;}
00208
00210 virtual void getCoveredValuesCons(Vector<Real>& a_covValues)
00211 {;}
00212
00214 virtual void setCoveredConsVals(EBCellFAB& a_consState)
00215 {;}
00216
00218
00221 virtual void
00222 consToPrim(EBCellFAB& a_primState,
00223 const EBCellFAB& a_conState,
00224 const Box& a_box,
00225 int a_logflag,
00226 bool a_verbose=false);
00227
00229
00232 virtual void
00233 consToPrim(BaseIVFAB<Real>& a_primState,
00234 const BaseIVFAB<Real>& a_conState,
00235 const IntVectSet& a_ivs);
00236
00238
00241 virtual void
00242 consToPrim(BaseIVFAB<Real>& a_primState,
00243 const EBCellFAB& a_conState,
00244 const IntVectSet& a_ivs);
00245
00247
00250 virtual void
00251 primToCons(EBCellFAB& a_primState,
00252 const EBCellFAB& a_conState,
00253 const Box& a_box);
00254
00256
00259 virtual void
00260 primToCons(BaseIVFAB<Real>& a_primState,
00261 const BaseIVFAB<Real>& a_conState,
00262 const IntVectSet& a_ivs);
00263
00265
00268 virtual void
00269 riemann(EBFaceFAB& a_primState,
00270 const EBCellFAB& a_primLeft,
00271 const EBCellFAB& a_primRight,
00272 const int& a_dir,
00273 const Box& a_box);
00274
00276
00279 virtual void
00280 riemann(BaseIVFAB<Real>& a_coveredFlux,
00281 const BaseIVFAB<Real>& a_extendedState,
00282 const EBCellFAB& a_primState,
00283 const Vector<VolIndex>& a_region,
00284 const int& a_dir,
00285 const Side::LoHiSide& a_sd,
00286 const Box& a_box);
00287
00289
00292 virtual void
00293 computeEBIrregFlux(BaseIVFAB<Real>& a_ebIrregFlux,
00294 const EBCellFAB& a_primState,
00295 const EBCellFAB a_slopePrim[SpaceDim],
00296 const IntVectSet& a_irregIVS,
00297 const EBCellFAB& a_source);
00298
00300
00302 void
00303 extrapolatePrim(EBFluxFAB& a_flux,
00304 EBCellFAB& a_primState,
00305 EBCellFAB a_slopePrim[SpaceDim],
00306 EBCellFAB a_slopeNLim[SpaceDim],
00307 Vector<BaseIVFAB<Real> * >& a_coveredFluxMinu,
00308 Vector<BaseIVFAB<Real> * >& a_coveredFluxPlus,
00309 const Vector<IntVectSet >& a_coveredSetsMinu,
00310 const Vector<IntVectSet >& a_coveredSetsPlus,
00311 const Vector<Vector<VolIndex> >& a_coveredFaceMinu,
00312 const Vector<Vector<VolIndex> >& a_coveredFacePlus,
00313 const EBCellFAB& a_flattening,
00314 const EBCellFAB& a_consState,
00315 const EBCellFAB& a_source,
00316 const Box& a_box,
00317 const DataIndex& a_dit,
00318 bool a_verbose);
00319
00321 virtual void
00322 advectiveDerivative(EBCellFAB & a_udotDelRho,
00323 const EBFluxFAB & a_faceRho,
00324 const EBFluxFAB & a_faceVel,
00325 const Vector<BaseIVFAB<Real>*> & a_coveredRhoMinu,
00326 const Vector<BaseIVFAB<Real>*> & a_coveredRhoPlus,
00327 const Vector<BaseIVFAB<Real>*> & a_coveredVelMinu,
00328 const Vector<BaseIVFAB<Real>*> & a_coveredVelPlus,
00329 const Vector<Vector<VolIndex> >& a_coveredFaceMinu,
00330 const Vector<Vector<VolIndex> >& a_coveredFacePlus,
00331 const Box & a_box);
00332
00333
00335
00338 virtual bool usesFlattening() const;
00339
00341
00344 virtual bool usesArtificialViscosity() const;
00345
00346 virtual void
00347 slope(EBCellFAB& a_slopePrim,
00348 EBCellFAB& a_slopeNLim,
00349 const EBCellFAB& a_primState,
00350 const EBCellFAB& a_flattening,
00351 const int& a_dir,
00352 const Box& a_box);
00353
00354 virtual void
00355 doSecondOrderSlopes(EBCellFAB& a_delta2W,
00356 EBCellFAB& a_deltaWL,
00357 EBCellFAB& a_deltaWR,
00358 EBCellFAB& a_deltaWC,
00359 const EBCellFAB& a_primState,
00360 const int& a_dir,
00361 const Box& a_box);
00362
00364
00368 virtual bool usesFourthOrderSlopes() const;
00369
00371 void
00372 averageVelToCC(EBCellFAB& a_normalVel,
00373 const EBFluxFAB& a_advectionVel,
00374 const Vector<BaseIVFAB<Real> * >& a_coveredVeloLo,
00375 const Vector<BaseIVFAB<Real> * >& a_coveredVeloHi,
00376 const Vector<Vector<VolIndex> >& a_coveredFaceLo,
00377 const Vector<Vector<VolIndex> >& a_coveredFaceHi,
00378 const Box& a_box) const;
00379
00380 virtual void setVelocities(const EBCellFAB& a_normalVel,
00381 const EBFluxFAB& a_advectionVel);
00382
00383 virtual void
00384 setValidBox(const Box& a_validBox,
00385 const EBISBox& a_ebisBox,
00386 const IntVectSet& a_coarseFineIVS,
00387 const Real& a_time,
00388 const Real& a_dt);
00389
00390 virtual void setTimeAndDt(const Real& a_time, const Real& a_dt)
00391 {
00392 m_time = a_time;
00393 m_dt = a_dt;
00394 }
00395
00397 virtual Vector<string> stateNames();
00399 virtual Vector<string> primNames();
00400
00402 void useLimiting(bool a_limiting);
00403
00404
00405
00407 Real
00408 getMaxWaveSpeed(const EBCellFAB& a_consState,
00409 const Box& a_box)
00410 {
00411 MayDay::Error("should not be called ");
00412 return -1.0;
00413 }
00415 void
00416 getFlux(EBFaceFAB& a_flux,
00417 const EBFaceFAB& a_prim,
00418 const int& a_dir,
00419 const Box& a_box)
00420 {
00421 MayDay::Error("should not be called ");
00422 }
00423
00425
00428 Interval velocityInterval() const
00429 {
00430 MayDay::Error("should not be called");
00431 Interval retval;
00432 return retval;
00433 }
00434
00436
00442 virtual int densityIndex() const
00443 {
00444 return 0;
00445 }
00446
00447
00449
00454 int pressureIndex() const
00455 {
00456 return -1;
00457 }
00458
00460 int bulkModulusIndex() const
00461 {
00462 MayDay::Error("should not be called");
00463 return -1;
00464 }
00465
00467 Real artificialViscosityCoefficient() const
00468 {
00469 MayDay::Error("should not be called");
00470 return -1.0;
00471 }
00472
00473 void setMaxMin(const Real& a_maxVal,
00474 const Real& a_minVal)
00475 {
00476 m_isMaxMinSet = true;
00477 m_maxVal = a_maxVal;
00478 m_minVal = a_minVal;
00479 }
00480 EBCellFAB& getPrimState()
00481 {
00482 return m_primState;
00483 }
00484
00485
00486
00487 protected:
00488
00489 const EBFluxFAB* m_advectionVelPtr;
00490 const EBCellFAB* m_normalVelPtr;
00491
00492 bool m_isVelSet;
00493 bool m_isMaxMinSet;
00494 Real m_maxVal;
00495 Real m_minVal;
00496 private:
00497
00498 void operator=(const EBPatchAdvect& a_input)
00499 {
00500 MayDay::Error("invalid operator");
00501 }
00502 EBPatchAdvect(const EBPatchAdvect& a_input)
00503 {
00504 MayDay::Error("invalid operator");
00505 }
00506
00507 };
00508
00509
00511
00513 class EBPatchAdvectFactory: public EBPatchGodunovFactory
00514 {
00515 public:
00517
00519 virtual ~EBPatchAdvectFactory();
00520
00522
00524 EBPatchGodunov* create() const;
00525
00527
00529 EBPatchAdvectFactory(RefCountedPtr<EBPhysIBCFactory>& a_bc,
00530 const bool& a_useLimiting,
00531 const Real& a_maxVal =-1.e99,
00532 const Real& a_minVal = 1.e99,
00533 const bool& a_setMaxMin = false);
00534
00535 protected:
00536 RefCountedPtr<EBPhysIBCFactory> m_bcFactoryPtr;
00537 bool m_useLimiting;
00538 bool m_setMaxMin;
00539 Real m_maxVal;
00540 Real m_minVal;
00541
00542 private:
00543
00544
00545 EBPatchAdvectFactory()
00546 {
00547 MayDay::Error("invalid operator");
00548 }
00549 void operator=(const EBPatchAdvectFactory& a_input)
00550 {
00551 MayDay::Error("invalid operator");
00552 }
00553 EBPatchAdvectFactory(const EBPatchAdvectFactory& a_input)
00554 {
00555 MayDay::Error("invalid operator");
00556 }
00557 };
00558
00559 #include "NamespaceFooter.H"
00560 #endif