chombo-discharge
Loading...
Searching...
No Matches
CD_MFHelmholtzOp.H
Go to the documentation of this file.
1/* chombo-discharge
2 * Copyright © 2021 SINTEF Energy Research.
3 * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4 */
5
12#ifndef CD_MFHelmholtzOp_H
13#define CD_MFHelmholtzOp_H
14
15// Std includes
16#include <map>
17#include <chrono>
18
19// Chombo includes
20#include <MFCellFAB.H>
21#include <MFFluxFAB.H>
22
23// Our includes
24#include <CD_Location.H>
26#include <CD_MFCoarAve.H>
27#include <CD_MFReflux.H>
28#include <CD_MFLevelGrid.H>
29#include <CD_MFBaseIVFAB.H>
31#include <CD_EBHelmholtzOp.H>
32#include <CD_MFHelmholtzDomainBCFactory.H>
35#include <CD_NamespaceHeader.H>
36
42class MFHelmholtzOp : public LevelTGAHelmOp<LevelData<MFCellFAB>, MFFluxFAB>
43{
44public:
48 enum class Smoother
49 {
50 PointJacobi,
51 GauSaiRedBlack,
52 GauSaiMultiColor,
53 };
54
58 MFHelmholtzOp() = delete;
59
64
68 MFHelmholtzOp(const MFHelmholtzOp&& a_op) = delete;
69
107 const MFLevelGrid& a_mflgFine,
108 const MFLevelGrid& a_mflg,
109 const MFLevelGrid& a_mflgCoFi,
110 const MFLevelGrid& a_mflgCoar,
113 const MFReflux& a_fluxReg,
114 const MFCoarAve& a_coarAve,
119 const RealVect& a_probLo,
120 const Real& a_dx,
121 const int& a_refToFine,
122 const int& a_refToCoar,
123 const bool& a_hasFine,
124 const bool& a_hasCoar,
125 const bool& a_hasMGObjects,
126 const bool& a_isMGOperator,
127 const Real& a_alpha,
128 const Real& a_beta,
132 const IntVect& a_ghostPhi,
133 const IntVect& a_ghostRhs,
134 const int& a_jumpOrder,
135 const int& a_jumpWeight,
136 const int& a_preCondSmooth,
137 const Smoother& a_smoother,
138 const Real& a_relaxFactor);
139
143 virtual ~MFHelmholtzOp();
144
150
155 operator=(const MFHelmholtzOp&& a_oper) = delete;
156
163 void
167
173 getAcoef();
174
180 getBcoef();
181
188
192 void
194
199 getHelmOp(const int a_phase);
200
204 int
206
212 void
214
219 void
221
225 void
227
232 void
234
243 void
249
257 void
262
269 void
271
279 void
281
288 template <typename Duration = std::chrono::microseconds>
289 Vector<long long>
291
298 void
300
307 void
309
316 void
318
325 void
327
333 void
335
342 void
344
351 void
353
360 void
362
366 Real
368
374 void
376
381 void
383
389 void
391
400 void
402
408 void
410
417 void
419
425 Real
427
436 void
440 const Real a_a,
442
449 void
453
459 void
461
468 void
472
481 void
487
493 void
495
506 void
514
523 void
529
539 void
546
555 void
560
569 void
575
581
586
591
596
601
606
611
616
621
626
631
636
641
646
651
656
661
666
671
676
681
686
691
696
701
706
711
716
721
726
731
737 void
739
744 void
746
754 void
756
766 void
772
783 void
790};
791
792#include <CD_NamespaceFooter.H>
793
795
796#endif
Declaration of Helmholtz multigrid operators.
Declaration of cell positions.
Declaration of a multiphase BaseIVFAB<Real>
Wrapper class for holding multifluid EBCoarAves.
Declaration of an EB boundary condition factory class for MFHelmholtzOp.
Declaration of a factory class for making MFHelmholtzJumpBC objects for use in a multifluid MFHelmhol...
Declaration of class for computing "jump interface" boundary conditions for multifluid Helmholtz code...
Implementation of CD_MFHelmholtzOp.H.
Declaration of a wrapper for wrapping multifluid EBLevelGrids.
Declaration of a wrapper class for holding multifluid EBMultigridInterpolators.
Declaration of a class for refluxing in a multiphase context.
Helmholtz operator for equations like alpha*a(x)*phi(x) + beta*div(b(x)*grad(phi(x))) = rho.
Definition CD_EBHelmholtzOp.H:41
Multiphase BaseIVFAB<Real>.
Definition CD_MFBaseIVFAB.H:29
Class for coarsening data in a multifluid context.
Definition CD_MFCoarAve.H:26
Class for computing "jump interface" boundary conditions for multifluid code.
Definition CD_MFHelmholtzJumpBC.H:42
Operator for solving multifluid Helmholtz on a grid level.
Definition CD_MFHelmholtzOp.H:43
void AMROperator(LevelData< MFCellFAB > &a_Lphi, const LevelData< MFCellFAB > &a_phiFine, const LevelData< MFCellFAB > &a_phi, const LevelData< MFCellFAB > &a_phiCoar, const bool a_homogeneousPhysBC, AMRLevelOp< LevelData< MFCellFAB > > *a_finerOp) override
Apply the AMR operator, i.e. compute L(phi) in an AMR context.
Definition CD_MFHelmholtzOp.cpp:1194
void fillGrad(const LevelData< MFCellFAB > &a_phi) override final
Not called, I think.
Definition CD_MFHelmholtzOp.cpp:326
RefCountedPtr< MFHelmholtzJumpBC > m_jumpBC
BC jump object. This is the one that has the stencils and can compute derivatives.
Definition CD_MFHelmholtzOp.H:610
MFHelmholtzOp()=delete
Constructor. Must subsequently call define(...)
Copier m_exchangeCopier
Copier for exchange operation.
Definition CD_MFHelmholtzOp.H:680
void prolongIncrement(LevelData< MFCellFAB > &a_phi, const LevelData< MFCellFAB > &a_correctCoarse) override final
Prolongation method.
Definition CD_MFHelmholtzOp.cpp:949
void scale(LevelData< MFCellFAB > &a_lhs, const Real &a_scale) override final
Scale function.
Definition CD_MFHelmholtzOp.cpp:358
MFHelmholtzOp(const MFHelmholtzOp &a_op)=delete
No copy construction allowed.
void incr(LevelData< MFCellFAB > &a_lhs, const LevelData< MFCellFAB > &a_rhs, Real a_scale) override final
Increment function.
Definition CD_MFHelmholtzOp.cpp:350
const RefCountedPtr< LevelData< MFFluxFAB > > & getBcoef()
Get the Helmholtz B-coefficient on faces.
Definition CD_MFHelmholtzOp.cpp:258
Real dotProduct(const LevelData< MFCellFAB > &a_lhs, const LevelData< MFCellFAB > &a_2) override final
Dot product.
Definition CD_MFHelmholtzOp.cpp:425
void applyOpNoBoundary(LevelData< MFCellFAB > &a_ans, const LevelData< MFCellFAB > &a_phi) override final
Apply operator but turn off all BCs.
Definition CD_MFHelmholtzOp.cpp:310
MFLevelGrid m_mflg
Level grid.
Definition CD_MFHelmholtzOp.H:630
void preCond(LevelData< MFCellFAB > &a_corr, const LevelData< MFCellFAB > &a_residual) override final
Precondition system before bottom solve.
Definition CD_MFHelmholtzOp.cpp:543
MFLevelGrid m_mflgCoar
Coarse grid.
Definition CD_MFHelmholtzOp.H:640
void getFlux(MFFluxFAB &a_flux, const LevelData< MFCellFAB > &a_data, const Box &a_grid, const DataIndex &a_dit, Real a_scale) override final
Fill flux.
Definition CD_MFHelmholtzOp.cpp:340
static constexpr int m_nComp
Number of components that we solve for.
Definition CD_MFHelmholtzOp.H:585
void createCoarser(LevelData< MFCellFAB > &a_coarse, const LevelData< MFCellFAB > &a_fine, bool a_ghosted) override final
Create coarsened data.
Definition CD_MFHelmholtzOp.cpp:511
RefCountedPtr< LevelData< BaseFab< bool > > > m_validCells
Valid grid cells (will be nullpointer on MG levels)
Definition CD_MFHelmholtzOp.H:620
void AMRResidual(LevelData< MFCellFAB > &a_residual, const LevelData< MFCellFAB > &a_phiFine, const LevelData< MFCellFAB > &a_phi, const LevelData< MFCellFAB > &a_phiCoar, const LevelData< MFCellFAB > &a_rhs, bool a_homogeneousPhysBC, AMRLevelOp< LevelData< MFCellFAB > > *a_finerOp) override final
Compute residual on this level. AMR version.
Definition CD_MFHelmholtzOp.cpp:1058
void AMRProlong(LevelData< MFCellFAB > &a_correction, const LevelData< MFCellFAB > &a_coarseCorrection) override final
Prolongation onto AMR level.
Definition CD_MFHelmholtzOp.cpp:1042
void relax(LevelData< MFCellFAB > &a_correction, const LevelData< MFCellFAB > &a_residual, int a_iterations) override final
Relaxation method. This does smoothing for the system L(correction) = residual.
Definition CD_MFHelmholtzOp.cpp:726
MFCoarAve m_coarAve
Coarsener.
Definition CD_MFHelmholtzOp.H:660
void assign(LevelData< MFCellFAB > &a_lhs, const LevelData< MFCellFAB > &a_rhs) override final
Assignment fucntion.
Definition CD_MFHelmholtzOp.cpp:374
int m_numPhases
Number of phases.
Definition CD_MFHelmholtzOp.H:700
void applyOp(LevelData< MFCellFAB > &a_Lphi, const LevelData< MFCellFAB > &a_phi, bool a_homogeneousPhysBc) override final
Apply operator.
Definition CD_MFHelmholtzOp.cpp:564
int m_numSmoothPreCond
Number of smoothings in the preconditioner.
Definition CD_MFHelmholtzOp.H:695
bool m_hasFine
True if there is a finer AMR level.
Definition CD_MFHelmholtzOp.H:725
const RefCountedPtr< LevelData< MFBaseIVFAB > > & getBcoefIrreg()
Get the Helmholtz B-coefficient on the EB.
Definition CD_MFHelmholtzOp.cpp:264
RefCountedPtr< LevelData< MFFluxFAB > > m_Bcoef
Helmholtz B-coefficeint.
Definition CD_MFHelmholtzOp.H:670
void restrictResidual(LevelData< MFCellFAB > &a_resCoar, LevelData< MFCellFAB > &a_phi, const LevelData< MFCellFAB > &a_rhs) override final
Restrict residual onto coarse level.
Definition CD_MFHelmholtzOp.cpp:922
IntVect m_ghostPhi
Number of ghost cells.
Definition CD_MFHelmholtzOp.H:710
std::map< int, RefCountedPtr< LevelData< BaseIVFAB< Real > > > > m_dirichletBcValues
Dirichlet BC values for each phase.
Definition CD_MFHelmholtzOp.H:625
Location::Cell m_dataLocation
Interpretation of data. Either on cell center or on cell centroid.
Definition CD_MFHelmholtzOp.H:590
void divideByIdentityCoef(LevelData< MFCellFAB > &a_rhs) override final
Divide by the a-coefficient.
Definition CD_MFHelmholtzOp.cpp:296
void AMROperatorNF(LevelData< MFCellFAB > &a_Lphi, const LevelData< MFCellFAB > &a_phi, const LevelData< MFCellFAB > &a_phiCoar, bool a_homogeneousPhysBC) override final
Apply the AMR operator, i.e. compute L(phi) in an AMR context, assuming no finer levels.
Definition CD_MFHelmholtzOp.cpp:1108
virtual ~MFHelmholtzOp()
Destructor.
Definition CD_MFHelmholtzOp.cpp:217
void AMRUpdateResidual(LevelData< MFCellFAB > &a_residual, const LevelData< MFCellFAB > &a_correction, const LevelData< MFCellFAB > &a_coarseCorrection) override final
Update AMR residual.
Definition CD_MFHelmholtzOp.cpp:965
void axby(LevelData< MFCellFAB > &a_lhs, const LevelData< MFCellFAB > &a_x, const LevelData< MFCellFAB > &a_y, const Real a_a, const Real a_b) override final
Set a_lhs = a*x + b*y.
Definition CD_MFHelmholtzOp.cpp:682
void AMROperatorNC(LevelData< MFCellFAB > &a_Lphi, const LevelData< MFCellFAB > &a_phi, const LevelData< MFCellFAB > &a_phiCoar, bool a_homogeneousPhysBC, AMRLevelOp< LevelData< MFCellFAB > > *a_finerOp) override final
Apply the AMR operator, i.e. compute L(phi) in an AMR context, assuming no coarser AMR levels.
Definition CD_MFHelmholtzOp.cpp:1144
void residual(LevelData< MFCellFAB > &a_residual, const LevelData< MFCellFAB > &a_phi, const LevelData< MFCellFAB > &a_rhs, const bool a_homogeneousPhysBc) override final
Compute residual on this level.
Definition CD_MFHelmholtzOp.cpp:668
void relaxGSMultiColor(LevelData< MFCellFAB > &a_correction, const LevelData< MFCellFAB > &a_residual, const int a_iterations)
Multi-colored gauss-seidel relaxation.
Definition CD_MFHelmholtzOp.cpp:864
static constexpr int m_comp
Component that we solve for.
Definition CD_MFHelmholtzOp.H:580
bool m_multifluid
Multifluid operator or not.
Definition CD_MFHelmholtzOp.H:685
void AMRRestrict(LevelData< MFCellFAB > &a_residualCoarse, const LevelData< MFCellFAB > &a_residual, const LevelData< MFCellFAB > &a_correction, const LevelData< MFCellFAB > &a_coarseCorrection, bool a_skip_res) override final
Restrict residual.
Definition CD_MFHelmholtzOp.cpp:1002
bool m_hasMGObjects
Has MG objects or not.
Definition CD_MFHelmholtzOp.H:690
void AMRResidualNC(LevelData< MFCellFAB > &a_residual, const LevelData< MFCellFAB > &a_phiFine, const LevelData< MFCellFAB > &a_phi, const LevelData< MFCellFAB > &a_rhs, bool a_homogeneousPhysBC, AMRLevelOp< LevelData< MFCellFAB > > *a_finerOp) override final
Compute AMR residual on coarsest.
Definition CD_MFHelmholtzOp.cpp:1092
Vector< IntVect > m_colors
"Colors" for the multi-coloered relaxation method
Definition CD_MFHelmholtzOp.H:600
void relaxPointJacobi(LevelData< MFCellFAB > &a_correction, const LevelData< MFCellFAB > &a_residual, const int a_iterations)
Jacobi relaxation.
Definition CD_MFHelmholtzOp.cpp:757
void setAcoAndBco(const RefCountedPtr< LevelData< MFCellFAB > > &a_Acoef, const RefCountedPtr< LevelData< MFFluxFAB > > &a_Bcoef, const RefCountedPtr< LevelData< MFBaseIVFAB > > &a_BcoefIrreg)
Update operators with new coefficients.
Definition CD_MFHelmholtzOp.cpp:225
void interpolateCF(const LevelData< MFCellFAB > &a_phi, const LevelData< MFCellFAB > *a_phiCoar, const bool a_homogeneousCF)
Do coarse-fine interpolation.
Definition CD_MFHelmholtzOp.cpp:617
IntVect m_ghostRhs
Number of ghost cells.
Definition CD_MFHelmholtzOp.H:715
MFHelmholtzOp & operator=(const MFHelmholtzOp &&a_oper)=delete
No move assigment allowed.
bool m_hasMGObjcts
True if there are multigrid levels.
Definition CD_MFHelmholtzOp.H:730
void AMRResidualNF(LevelData< MFCellFAB > &a_residual, const LevelData< MFCellFAB > &a_phi, const LevelData< MFCellFAB > &a_phiCoar, const LevelData< MFCellFAB > &a_rhs, bool a_homogeneousPhysBC) override final
Compute AMR residual on finest AMR level.
Definition CD_MFHelmholtzOp.cpp:1076
void relaxGSRedBlack(LevelData< MFCellFAB > &a_correction, const LevelData< MFCellFAB > &a_residual, const int a_iterations)
Jacobi relaxation.
Definition CD_MFHelmholtzOp.cpp:809
RefCountedPtr< LevelData< BaseIVFAB< Real > > > m_jump
Actual BC jump in data-based format. This is the right-hand side of dphi/dn1 + dphi/dn2 = jump.
Definition CD_MFHelmholtzOp.H:615
void setToZero(LevelData< MFCellFAB > &a_lhs) override final
Set to zero.
Definition CD_MFHelmholtzOp.cpp:366
void createCoarsened(LevelData< MFCellFAB > &a_lhs, const LevelData< MFCellFAB > &a_rhs, const int &a_refRat) override final
Create coarsening of data holder.
Definition CD_MFHelmholtzOp.cpp:527
std::map< int, RefCountedPtr< EBHelmholtzOp > > m_helmOps
Helmholtz operators on each phase. Note that I'm using int rather than Phase as identifier because th...
Definition CD_MFHelmholtzOp.H:605
Smoother m_smoother
Relaxation method.
Definition CD_MFHelmholtzOp.H:595
RefCountedPtr< EBHelmholtzOp > & getHelmOp(const int a_phase)
Get Helmholtz operator.
void updateJumpBC(const LevelData< MFCellFAB > &a_phi, const bool a_homogeneousPhysBC)
Update the jump condition.
Definition CD_MFHelmholtzOp.cpp:704
Vector< long long > computeOperatorLoads(LevelData< MFCellFAB > &a_phi, const int a_numApply) noexcept
Time the applyOp routine. Template parameter is std::chrono duration. E.g. std::chrono::microseconds.
Definition CD_MFHelmholtzOpImplem.H:19
MFLevelGrid m_mflgCoFi
Coarsened version of this grid.
Definition CD_MFHelmholtzOp.H:645
MFHelmholtzOp(const MFHelmholtzOp &&a_op)=delete
No move construction allowed.
bool m_hasCoar
True if there is a coarser AMR level.
Definition CD_MFHelmholtzOp.H:720
void assignCopier(LevelData< MFCellFAB > &a_lhs, const LevelData< MFCellFAB > &a_rhs, const Copier &a_copier) override final
Assign lhs.
Definition CD_MFHelmholtzOp.cpp:382
int refToCoarser() override final
Return coarsening factor to coarser level (1 if there is no coarser level);.
Definition CD_MFHelmholtzOp.cpp:278
MFLevelGrid m_mflgFine
Fine level grid.
Definition CD_MFHelmholtzOp.H:635
Real norm(const LevelData< MFCellFAB > &a_lhs, int a_order) override final
Compute solution norm.
Definition CD_MFHelmholtzOp.cpp:406
void setAlphaAndBeta(const Real &a_alpha, const Real &a_beta) override final
Set alpha and beta.
Definition CD_MFHelmholtzOp.cpp:286
RefCountedPtr< LevelData< MFBaseIVFAB > > m_BcoefIrreg
Helmholtz B-coefficeint on EB.
Definition CD_MFHelmholtzOp.H:675
int m_refToCoar
Refinement factor to coarser AMR level.
Definition CD_MFHelmholtzOp.H:705
const RefCountedPtr< LevelData< MFCellFAB > > & getAcoef()
Get the Helmholtz A-coefficient on cell centers.
Definition CD_MFHelmholtzOp.cpp:252
RefCountedPtr< LevelData< MFCellFAB > > m_Acoef
Helmholtz A-coefficeint.
Definition CD_MFHelmholtzOp.H:665
void setJump(RefCountedPtr< LevelData< BaseIVFAB< Real > > > &a_jump)
Set the jump boundary condition.
Definition CD_MFHelmholtzOp.cpp:270
MFMultigridInterpolator m_interpolator
Multi grid interpolator.
Definition CD_MFHelmholtzOp.H:655
MFHelmholtzOp & operator=(const MFHelmholtzOp &a_oper)=delete
No copy assigment allowed.
MFLevelGrid m_mflgCoarMG
Coarse multigrid-grid.
Definition CD_MFHelmholtzOp.H:650
void assignLocal(LevelData< MFCellFAB > &a_lhs, const LevelData< MFCellFAB > &a_rhs) override final
Local assignment function.
Definition CD_MFHelmholtzOp.cpp:390
void buildCopier(Copier &a_copier, const LevelData< MFCellFAB > &a_lhs, const LevelData< MFCellFAB > &a_rhs) override
Build copier.
Definition CD_MFHelmholtzOp.cpp:398
Smoother
Relaxation methods for this operator.
Definition CD_MFHelmholtzOp.H:49
void create(LevelData< MFCellFAB > &a_lhs, const LevelData< MFCellFAB > &a_rhs) override final
Create method.
Definition CD_MFHelmholtzOp.cpp:495
void exchangeGhost(const LevelData< MFCellFAB > &a_phi) const
Perform an exchange operation, event if the data is const.
Definition CD_MFHelmholtzOp.cpp:712
Wrapper class for holding multifluid EBLevelGrids.
Definition CD_MFLevelGrid.H:29
Wrapper class for holding multifluid EBMultigridInterpolators.
Definition CD_MFMultigridInterpolator.H:26
Class which wraps EBRefluxs in multiphase.
Definition CD_MFReflux.H:26
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
Namespace for encapsulating various data centerings.
Definition CD_Location.H:24
Cell
Enum for distinguishing between cell locations.
Definition CD_Location.H:30