00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _EBCONDUCTIVITYOP_H_
00012 #define _EBCONDUCTIVITYOP_H_
00013
00014 #include "REAL.H"
00015 #include "Box.H"
00016 #include "FArrayBox.H"
00017 #include "Vector.H"
00018 #include <map>
00019 #include "RefCountedPtr.H"
00020
00021 #include "AMRMultiGrid.H"
00022
00023 #include "EBIndexSpace.H"
00024 #include "EBCellFAB.H"
00025 #include "EBCellFactory.H"
00026 #include "EBStencil.H"
00027
00028 #include "EBLevelDataOps.H"
00029 #include "BaseEBBC.H"
00030 #include "BaseDomainBC.H"
00031 #include "CFIVS.H"
00032 #include "EBFluxRegister.H"
00033 #include "EBFastFR.H"
00034 #include "EBMGAverage.H"
00035 #include "EBMGInterp.H"
00036 #include "PolyGeom.H"
00037 #include "EBQuadCFInterp.H"
00038 #include "EBLevelGrid.H"
00039 #include "AMRTGA.H"
00040 #include "AMRPoissonOp.H"
00041 #include "CFRegion.H"
00042 #include "NamespaceHeader.H"
00043
00044
00046
00049 class EBConductivityOp: public LevelTGAHelmOp<LevelData<EBCellFAB>, EBFluxFAB >
00050 {
00051 public:
00052
00053
00054 virtual void setAlphaAndBeta(const Real& a_alpha,
00055 const Real& a_beta);
00056
00057
00058 virtual void diagonalScale(LevelData<EBCellFAB> & a_rhs);
00059
00061 virtual void fillGrad(const LevelData<EBCellFAB>& a_phi)
00062 {;}
00063
00065 virtual void getFlux(EBFluxFAB& a_flux,
00066 const LevelData<EBCellFAB>& a_data,
00067 const Box& a_grid,
00068 const DataIndex& a_dit,
00069 Real a_scale);
00070
00071 void getFlux(EBFaceFAB& a_fluxCentroid,
00072 const EBCellFAB& a_phi,
00073 const Box& a_ghostedBox,
00074 const Box& a_fabBox,
00075 const ProblemDomain& a_domain,
00076 const EBISBox& a_ebisBox,
00077 const Real& a_dx,
00078 const DataIndex& a_datInd,
00079 const int& a_idir);
00080
00082 virtual ~EBConductivityOp()
00083 {;}
00084
00086 EBConductivityOp()
00087 {;}
00088
00090
00091 void AMRResidualNC(LevelData<EBCellFAB>& a_residual,
00092 const LevelData<EBCellFAB>& a_phiFine,
00093 const LevelData<EBCellFAB>& a_phi,
00094 const LevelData<EBCellFAB>& a_rhs,
00095 bool a_homogeneousBC,
00096 AMRLevelOp<LevelData<EBCellFAB> >* a_finerOp);
00097
00098
00100
00101 void AMROperatorNC(LevelData<EBCellFAB>& a_LofPhi,
00102 const LevelData<EBCellFAB>& a_phiFine,
00103 const LevelData<EBCellFAB>& a_phi,
00104 bool a_homogeneousBC,
00105 AMRLevelOp<LevelData<EBCellFAB> >* a_finerOp);
00106
00108
00133 EBConductivityOp(const EBLevelGrid & a_eblgFine,
00134 const EBLevelGrid & a_eblg,
00135 const EBLevelGrid & a_eblgCoar,
00136 const EBLevelGrid & a_eblgCoarMG,
00137 const RefCountedPtr<EBQuadCFInterp>& a_quadCFI,
00138 const RefCountedPtr<ConductivityBaseDomainBC>& a_domainBC,
00139 const RefCountedPtr<ConductivityBaseEBBC>& a_ebBC,
00140 const Real & a_dx,
00141 const Real & a_dxCoar,
00142 const int& a_refToFine,
00143 const int& a_refToCoar,
00144 const bool& a_hasFine,
00145 const bool& a_hasCoar,
00146 const bool& a_hasMGObjects,
00147 const bool& a_layoutChanged,
00148 const Real& a_alpha,
00149 const Real& a_beta,
00150 const RefCountedPtr<LevelData<EBCellFAB> >& a_acoef,
00151 const RefCountedPtr<LevelData<EBFluxFAB> >& a_bcoef,
00152 const RefCountedPtr<LevelData<BaseIVFAB<Real> > >& a_bcoIrreg,
00153 const IntVect& a_ghostCellsPhi,
00154 const IntVect& a_ghostCellsRHS);
00155
00156
00157
00159
00161 virtual void residual(LevelData<EBCellFAB>& a_residual,
00162 const LevelData<EBCellFAB>& a_phi,
00163 const LevelData<EBCellFAB>& a_rhs,
00164 bool a_homogeneousPhysBC=false);
00165
00167
00169 virtual void preCond(LevelData<EBCellFAB>& a_opPhi,
00170 const LevelData<EBCellFAB>& a_phi);
00171
00173
00177 virtual void applyOp(LevelData<EBCellFAB>& a_opPhi,
00178 const LevelData<EBCellFAB>& a_phi,
00179 const LevelData<EBCellFAB>* const a_phiCoarse,
00180 const bool& a_homogeneousPhysBC,
00181 const bool& a_homogeneousCFBC);
00182
00184 virtual void applyOpNoBoundary(LevelData<EBCellFAB>& a_opPhi,
00185 const LevelData<EBCellFAB>& a_phi);
00186
00188
00191 virtual void applyOp(LevelData<EBCellFAB>& a_opPhi,
00192 const LevelData<EBCellFAB>& a_phi,
00193 bool a_homogeneousPhysBC);
00194
00196
00198 virtual void create(LevelData<EBCellFAB>& a_lhs,
00199 const LevelData<EBCellFAB>& a_rhs);
00200
00202 virtual void createCoarsened(LevelData<EBCellFAB>& a_lhs,
00203 const LevelData<EBCellFAB>& a_rhs,
00204 const int& a_refRat);
00205
00206 Real
00207 AMRNorm(const LevelData<EBCellFAB>& a_coarResid,
00208 const LevelData<EBCellFAB>& a_fineResid,
00209 const int& a_refRat,
00210 const int& a_ord);
00211
00213
00215 virtual void assign(LevelData<EBCellFAB>& a_lhs,
00216 const LevelData<EBCellFAB>& a_rhs);
00217
00219
00221 virtual Real dotProduct(const LevelData<EBCellFAB>& a_1,
00222 const LevelData<EBCellFAB>& a_2);
00223
00225
00227 virtual void incr(LevelData<EBCellFAB>& a_lhs,
00228 const LevelData<EBCellFAB>& a_x,
00229 Real a_scale);
00230
00232
00234 virtual void axby(LevelData<EBCellFAB>& a_lhs,
00235 const LevelData<EBCellFAB>& a_x,
00236 const LevelData<EBCellFAB>& a_y,
00237 Real a_a,
00238 Real a_b);
00239
00241
00243 virtual void scale(LevelData<EBCellFAB>& a_lhs,
00244 const Real& a_scale);
00245
00247
00249 virtual Real norm(const LevelData<EBCellFAB>& a_rhs,
00250 int a_ord);
00251
00253
00255 virtual void setToZero(LevelData<EBCellFAB>& a_lhs);
00256
00258
00260 virtual void setVal(LevelData<EBCellFAB>& a_lhs, const Real& a_value);
00261
00263
00265 virtual void createCoarser(LevelData<EBCellFAB>& a_coarse,
00266 const LevelData<EBCellFAB>& a_fine,
00267 bool a_ghosted);
00268
00270
00272 virtual void relax(LevelData<EBCellFAB>& a_e,
00273 const LevelData<EBCellFAB>& a_residual,
00274 int a_iterations);
00275
00277
00281 virtual void restrictResidual(LevelData<EBCellFAB>& a_resCoarse,
00282 LevelData<EBCellFAB>& a_phiFine,
00283 const LevelData<EBCellFAB>& a_rhsFine);
00284
00286
00290 virtual void prolongIncrement(LevelData<EBCellFAB>& a_phiThisLevel,
00291 const LevelData<EBCellFAB>& a_correctCoarse);
00292
00294
00296 virtual int refToCoarser();
00297
00299
00301 virtual int refToFiner();
00302
00304
00305 virtual void AMRResidual(LevelData<EBCellFAB>& a_residual,
00306 const LevelData<EBCellFAB>& a_phiFine,
00307 const LevelData<EBCellFAB>& a_phi,
00308 const LevelData<EBCellFAB>& a_phiCoarse,
00309 const LevelData<EBCellFAB>& a_rhs,
00310 bool a_homogeneousBC,
00311 AMRLevelOp<LevelData<EBCellFAB> >* a_finerOp);
00312
00314
00315 virtual void AMRResidualNF(LevelData<EBCellFAB>& a_residual,
00316 const LevelData<EBCellFAB>& a_phi,
00317 const LevelData<EBCellFAB>& a_phiCoarse,
00318 const LevelData<EBCellFAB>& a_rhs,
00319 bool a_homogeneousBC);
00320
00321
00323
00324 virtual void AMROperator(LevelData<EBCellFAB>& a_LofPhi,
00325 const LevelData<EBCellFAB>& a_phiFine,
00326 const LevelData<EBCellFAB>& a_phi,
00327 const LevelData<EBCellFAB>& a_phiCoarse,
00328 bool a_homogeneousBC,
00329 AMRLevelOp<LevelData<EBCellFAB> >* a_finerOp);
00330
00332
00333 virtual void AMROperatorNF(LevelData<EBCellFAB>& a_LofPhi,
00334 const LevelData<EBCellFAB>& a_phi,
00335 const LevelData<EBCellFAB>& a_phiCoarse,
00336 bool a_homogeneousBC);
00337
00339
00340 virtual void AMRRestrict(LevelData<EBCellFAB>& a_resCoarse,
00341 const LevelData<EBCellFAB>& a_residual,
00342 const LevelData<EBCellFAB>& a_correction,
00343 const LevelData<EBCellFAB>& a_coarseCorrection);
00344
00346
00347 virtual void AMRProlong(LevelData<EBCellFAB>& a_correction,
00348 const LevelData<EBCellFAB>& a_coarseCorrection);
00349
00351
00352 virtual void AMRUpdateResidual(LevelData<EBCellFAB>& a_residual,
00353 const LevelData<EBCellFAB>& a_correction,
00354 const LevelData<EBCellFAB>& a_coarseCorrection);
00355
00356 void reflux(LevelData<EBCellFAB>& a_residual,
00357 const LevelData<EBCellFAB>& a_phiFine,
00358 const LevelData<EBCellFAB>& a_phi,
00359 AMRLevelOp<LevelData<EBCellFAB> >* a_finerOp);
00360
00361 void gsrbColor(LevelData<EBCellFAB>& a_phi,
00362 const LevelData<EBCellFAB>& a_lph,
00363 const LevelData<EBCellFAB>& a_rhs,
00364 const IntVect& a_color);
00365
00366 void getDivFStencil(VoFStencil& a_vofStencil,
00367 const VolIndex& a_vof,
00368 const DataIndex& a_dit);
00369
00370 void getFluxStencil(VoFStencil& a_fluxStencil,
00371 const FaceIndex& a_face,
00372 const DataIndex& a_dit);
00373
00374 void getFaceCenteredFluxStencil(VoFStencil& a_fluxStencil,
00375 const FaceIndex& a_face,
00376 const DataIndex& a_dit);
00377
00378 void incrOpRegularDir(EBCellFAB& a_lhs,
00379 const EBCellFAB& a_phi,
00380 const bool& a_homogeneous,
00381 const int& a_dir,
00382 const DataIndex& a_datInd);
00383 void applyOpIrregular(EBCellFAB& a_lhs,
00384 const EBCellFAB& a_phi,
00385 const bool& a_homogeneous,
00386 const DataIndex& a_datInd);
00387 protected:
00388
00389 static bool s_turnOffBCs;
00390 void defineStencils();
00391
00392 const IntVect m_ghostCellsPhi;
00393 const IntVect m_ghostCellsRHS;
00394
00395 RefCountedPtr<EBQuadCFInterp> m_quadCFIWithCoar;
00396
00397 EBLevelGrid m_eblg;
00398 EBLevelGrid m_eblgFine;
00399 EBLevelGrid m_eblgCoar;
00400 EBLevelGrid m_eblgCoarMG;
00401 EBLevelGrid m_eblgCoarsenedFine;
00402
00403 RefCountedPtr<ConductivityBaseDomainBC> m_domainBC;
00404 RefCountedPtr<ConductivityBaseEBBC> m_ebBC;
00405
00406 Real m_dxFine;
00407 Real m_dx;
00408 Real m_dxCoar;
00409 RefCountedPtr<LevelData<EBCellFAB> > m_acoef;
00410 RefCountedPtr<LevelData<EBFluxFAB> > m_bcoef;
00411 RefCountedPtr<LevelData<BaseIVFAB<Real> > > m_bcoIrreg;
00412
00413 Real m_alpha;
00414 Real m_beta;
00415 int m_refToFine;
00416 int m_refToCoar;
00417 bool m_hasFine;
00418 bool m_hasInterpAve;
00419 bool m_hasCoar;
00420
00421
00422 EBMGAverage m_ebAverage;
00423
00424 EBMGInterp m_ebInterp;
00425
00426
00427 LayoutData<RefCountedPtr<EBStencil> > m_opEBStencil;
00428
00429 LevelData<EBCellFAB> m_relCoef;
00430
00431
00432
00433 LayoutData<VoFIterator > m_vofIterIrreg;
00434 LayoutData<VoFIterator > m_vofIterMulti;
00435
00436 LayoutData<VoFIterator > m_vofIterDomLo[CH_SPACEDIM];
00437 LayoutData<VoFIterator > m_vofIterDomHi[CH_SPACEDIM];
00438
00439
00440 LayoutData<CFIVS> m_loCFIVS[SpaceDim];
00441 LayoutData<CFIVS> m_hiCFIVS[SpaceDim];
00442
00443
00444 EBFastFR m_fastFR;
00445
00446
00447
00448
00449
00450 bool m_hasMGObjects;
00451 bool m_layoutChanged;
00452
00453 EBMGAverage m_ebAverageMG;
00454 EBMGInterp m_ebInterpMG;
00455 DisjointBoxLayout m_dblCoarMG;
00456 EBISLayout m_ebislCoarMG;
00457 ProblemDomain m_domainCoarMG;
00458
00459 Vector<IntVect> m_colors;
00460
00461 private:
00462
00463 void incrementFRCoar(EBFastFR& a_fluxReg,
00464 const LevelData<EBCellFAB>& a_phiFine,
00465 const LevelData<EBCellFAB>& a_phi);
00466
00467 void incrementFRFine(EBFastFR& a_fluxReg,
00468 const LevelData<EBCellFAB>& a_phiFine,
00469 const LevelData<EBCellFAB>& a_phi,
00470 AMRLevelOp<LevelData<EBCellFAB> >* a_finerOp);
00471
00472 void getFlux(FArrayBox& a_flux,
00473 const FArrayBox& a_phi,
00474 const Box& a_faceBox,
00475 const int& a_idir,
00476 const Real& a_dx,
00477 const DataIndex& a_datInd);
00478
00479
00480
00481 void applyCFBCs(LevelData<EBCellFAB>& a_phi,
00482 const LevelData<EBCellFAB>* const a_phiCoarse,
00483 bool a_homogeneousCFBC);
00484
00485 void getOpVoFStencil(VoFStencil& a_stencil,
00486 const EBISBox& a_ebisbox,
00487 const VolIndex& a_vof);
00488
00489 void getOpVoFStencil(VoFStencil& a_stencil,
00490 const int& a_dir,
00491 const Vector<VolIndex>& a_allMonotoneVoFs,
00492 const EBISBox& a_ebisbox,
00493 const VolIndex& a_vof,
00494 const bool& a_lowOrder);
00495
00496
00497 void getOpFaceStencil(VoFStencil& a_stencil,
00498 const Vector<VolIndex>& a_allMonotoneVofs,
00499 const EBISBox& a_ebisbox,
00500 const VolIndex& a_vof,
00501 int a_dir,
00502 const Side::LoHiSide& a_side,
00503 const FaceIndex& a_face,
00504 const bool& a_lowOrder);
00505
00506 void levelJacobi(LevelData<EBCellFAB>& a_phi,
00507 const LevelData<EBCellFAB>& a_rhs);
00508
00509 void applyHomogeneousCFBCs(LevelData<EBCellFAB>& a_phi);
00510
00511 void applyHomogeneousCFBCs(EBCellFAB& a_phi,
00512 const DataIndex& a_datInd,
00513 int a_idir,
00514 Side::LoHiSide a_hiorlo);
00515 private:
00516
00517 EBConductivityOp(const EBConductivityOp& a_opin)
00518 {
00519 MayDay::Error("invalid operator");
00520 }
00521
00522 void operator=(const EBConductivityOp& a_opin)
00523 {
00524 MayDay::Error("invalid operator");
00525 }
00526 };
00527
00528
00529 #include "NamespaceFooter.H"
00530 #endif