chombo-discharge
Loading...
Searching...
No Matches
CD_EBHelmholtzOpFactory.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_EBHELMHOLTZOPFACTORY_H
14#define CD_EBHELMHOLTZOPFACTORY_H
15
16// Chombo includes
17#include <RealVect.H>
18#include <EBLevelGrid.H>
19#include <EBCellFAB.H>
20#include <EBFluxFAB.H>
21#include <BaseIVFAB.H>
22#include <ConductivityBaseDomainBC.H>
23#include <BaseEBBC.H>
24
25// Our includes
26#include <CD_Location.H>
27#include <CD_EBCoarAve.H>
28#include <CD_EBReflux.H>
30#include <CD_EBHelmholtzOp.H>
31#include <CD_EBHelmholtzEBBCFactory.H>
32#include <CD_EBHelmholtzDomainBCFactory.H>
33#include <CD_NamespaceHeader.H>
34
42class EBHelmholtzOpFactory : public AMRLevelOpFactory<LevelData<EBCellFAB>>
43{
44public:
45 // Various alias for cutting down on typing.
46
51
55 using AmrLevelGrids = Vector<RefCountedPtr<EBLevelGrid>>;
56
60 using AmrMask = Vector<RefCountedPtr<LevelData<BaseFab<bool>>>>;
61
65 using AmrInterpolators = Vector<RefCountedPtr<EBMultigridInterpolator>>;
66
70 using AmrFluxRegisters = Vector<RefCountedPtr<EBReflux>>;
71
75 using AmrCoarseners = Vector<RefCountedPtr<EBCoarAve>>;
76
80 using AmrCellData = Vector<RefCountedPtr<LevelData<EBCellFAB>>>;
81
85 using AmrFluxData = Vector<RefCountedPtr<LevelData<EBFluxFAB>>>;
86
90 using AmrIrreData = Vector<RefCountedPtr<LevelData<BaseIVFAB<Real>>>>;
91
95 using AmrResolutions = Vector<Real>;
96
100 using AmrRefRatios = Vector<int>;
101
105 using DomainBCFactory = RefCountedPtr<EBHelmholtzDomainBCFactory>; // Will be replaced with better BC class...
106
110 using EBBCFactory = RefCountedPtr<EBHelmholtzEBBCFactory>;
111
116
120 EBHelmholtzOpFactory(const EBHelmholtzOpFactory& a_otherFactory) = delete;
121
125 EBHelmholtzOpFactory(const EBHelmholtzOpFactory&& a_otherFactory) = delete;
126
166 const Real& a_alpha,
167 const Real& a_beta,
168 const RealVect& a_probLo,
169 const AmrLevelGrids& a_amrLevelGrids,
170 const AmrMask& a_validCells,
171 const AmrInterpolators& a_amrInterpolators,
172 const AmrFluxRegisters& a_amrFluxRegisters,
173 const AmrCoarseners& a_amrCoarseners,
174 const AmrRefRatios& a_amrRefRatios,
175 const AmrResolutions& a_amrResolutions,
176 const AmrCellData& a_amrAcoef,
177 const AmrFluxData& a_amrBcoef,
178 const AmrIrreData& a_amrBcoefIrreg,
179 const DomainBCFactory& a_domainBcFactory,
180 const EBBCFactory& a_ebbcFactory,
181 const IntVect& a_ghostPhi,
182 const IntVect& a_ghostRHS,
183 const Smoother& a_smoother,
184 const Real& a_relaxFactor,
185 const int& a_chebyOrder,
186 const Real& a_chebyEigRatio,
187 const int& a_rasInnerSweeps,
188 const ProblemDomain& a_bottomDomain,
189 const int& a_mgBlockingFactor,
190 const bool a_refluxFree = false,
191 const AmrLevelGrids& a_deeperLevelGrids = AmrLevelGrids());
192
196 ~EBHelmholtzOpFactory() override;
197
201 void
202 operator=(const EBHelmholtzOpFactory& a_opin) = delete;
203
207 void
208 operator=(const EBHelmholtzOpFactory&& a_opin) = delete;
209
213 void
215
225 MGnewOp(const ProblemDomain& a_fineDomain, int a_depth, bool a_homogeneousOnly = true) final;
226
233 AMRnewOp(const ProblemDomain& a_domain) final;
234
241 int
242 refToFiner(const ProblemDomain& a_domain) const final;
243
244protected:
248 static constexpr int m_comp = 0;
249
253 static constexpr int m_nComp = 1;
254
259
264
269
274
280
285
289 IntVect m_ghostPhi;
290
294 IntVect m_ghostRhs;
295
300
304 Real m_beta;
305
310
315
319 RealVect m_probLo;
320
321 // Things that pertain to AMR levels. The first entry corresponds to the coarsest AMR level.
322
327
332
337
342
347
352
357
362
367
372
377
382
386 ProblemDomain m_bottomDomain;
387
392
398
402 std::vector<bool> m_hasMgLevels;
403
409
415
421
427
431 void
433
440 static bool
441 isCoarser(const ProblemDomain& a_domainOne, const ProblemDomain& B);
442
449 static bool
450 isFiner(const ProblemDomain& a_domainOne, const ProblemDomain& B);
451
461 bool
462 getCoarserLayout(EBLevelGrid& a_coarEblg, const EBLevelGrid& a_fineEblg, int a_refRat, int a_blockingFactor) const;
463
476 static void
477 coarsenCoefficients(LevelData<EBCellFAB>& a_coarAcoef,
478 LevelData<EBFluxFAB>& a_coarBcoef,
479 LevelData<BaseIVFAB<Real>>& a_coarBcoefIrreg,
480 const LevelData<EBCellFAB>& a_fineAcoef,
481 const LevelData<EBFluxFAB>& a_fineBcoef,
482 const LevelData<BaseIVFAB<Real>>& a_fineBcoefIrreg,
483 const EBLevelGrid& a_eblgCoar,
484 const EBLevelGrid& a_eblgFine,
485 int a_refRat);
486
493 int
494 findAmrLevel(const ProblemDomain& a_domain) const;
495};
496
497#include <CD_NamespaceFooter.H>
498
499#endif
Declaration of conservative coarsening utility.
Declaration of Helmholtz multigrid operators.
Parent base class for multigrid interpolation.
Declaration of a class which can reflux over the coarse-fine interface.
Declaration of cell positions.
Factory class for making variable-coefficient Helmholtz operators.
Definition CD_EBHelmholtzOpFactory.H:43
Vector< AmrIrreData > m_mgBcoefIrreg
B-coefficient on deeper grids. Always weird to write this but e.g. m_mgLevelGrids[0] corresponds to t...
Definition CD_EBHelmholtzOpFactory.H:426
int m_mgBlockingFactor
Blocking factor for when we create intermediate and deep multigrid levels.
Definition CD_EBHelmholtzOpFactory.H:391
AmrIrreData m_amrBcoefIrreg
Helmholtz B-coefficient (on EB faces.
Definition CD_EBHelmholtzOpFactory.H:371
AmrCoarseners m_amrCoarseners
Data coarseners.
Definition CD_EBHelmholtzOpFactory.H:346
EBHelmholtzOp * MGnewOp(const ProblemDomain &a_fineDomain, int a_depth, bool a_homogeneousOnly=true) final
Create multigrid operator.
Definition CD_EBHelmholtzOpFactory.cpp:435
AmrResolutions m_amrResolutions
Resolutions one each level.
Definition CD_EBHelmholtzOpFactory.H:356
Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > AmrMask
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:60
std::vector< bool > m_hasMgLevels
For checking if an AMR level has multigrid levels.
Definition CD_EBHelmholtzOpFactory.H:402
EBHelmholtzOpFactory()=delete
Disallowed constructor. Use the full constructor.
int refToFiner(const ProblemDomain &a_domain) const final
Get refinement ratio to next finest level.
Definition CD_EBHelmholtzOpFactory.cpp:664
Vector< AmrCellData > m_mgAcoef
A-coefficient on deeper grids. Always weird to write this but e.g. m_mgLevelGrids[0] corresponds to t...
Definition CD_EBHelmholtzOpFactory.H:414
int findAmrLevel(const ProblemDomain &a_domain) const
Find level corresponding to amr level.
Definition CD_EBHelmholtzOpFactory.cpp:687
IntVect m_ghostRhs
Number of ghost cells that are used. Need because of Chombo prolongation objects.
Definition CD_EBHelmholtzOpFactory.H:294
EBBCFactory m_ebBcFactory
EB BC factory.
Definition CD_EBHelmholtzOpFactory.H:381
Vector< RefCountedPtr< EBCoarAve > > AmrCoarseners
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:75
Vector< RefCountedPtr< EBLevelGrid > > AmrLevelGrids
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:55
Vector< RefCountedPtr< EBMultigridInterpolator > > AmrInterpolators
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:65
EBHelmholtzOpFactory(const EBHelmholtzOpFactory &&a_otherFactory)=delete
Disallowed move constructor. Use the full constructor.
AmrFluxRegisters m_amrFluxRegisters
Flux registers.
Definition CD_EBHelmholtzOpFactory.H:341
void operator=(const EBHelmholtzOpFactory &&a_opin)=delete
Disallowed move assignment.
static constexpr int m_comp
Component number that is solved for.
Definition CD_EBHelmholtzOpFactory.H:248
Vector< AmrLevelGrids > m_mgLevelGrids
Deeper grids. Always weird to write this but e.g. m_mgLevelGrids[0] corresponds to the the multigrid ...
Definition CD_EBHelmholtzOpFactory.H:408
bool m_refluxFree
Use reflux-free AMR operator.
Definition CD_EBHelmholtzOpFactory.H:314
AmrLevelGrids m_deeperLevelGrids
This is for using pre-defined grids for the deeper multigrid levels, i.e. for the levels that are coa...
Definition CD_EBHelmholtzOpFactory.H:397
static bool isCoarser(const ProblemDomain &a_domainOne, const ProblemDomain &B)
Check if a domain is coarser than the other.
Definition CD_EBHelmholtzOpFactory.cpp:350
EBHelmholtzOp * AMRnewOp(const ProblemDomain &a_domain) final
Create AMR operator for specified domain.
Definition CD_EBHelmholtzOpFactory.cpp:578
Real m_chebyEigRatio
Chebyshev eigenvalue ratio lambda_max/lambda_min (only used when m_smoother is Smoother::Chebyshev)
Definition CD_EBHelmholtzOpFactory.H:273
void operator=(const EBHelmholtzOpFactory &a_opin)=delete
Disallowed assignment operator.
ProblemDomain m_bottomDomain
Bottom domain, i.e. the coarsest domain which will be used in multigrid.
Definition CD_EBHelmholtzOpFactory.H:386
Smoother m_smoother
Smoother.
Definition CD_EBHelmholtzOpFactory.H:263
int m_numAmrLevels
Number of AMR levels.
Definition CD_EBHelmholtzOpFactory.H:284
Vector< RefCountedPtr< LevelData< BaseIVFAB< Real > > > > AmrIrreData
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:90
EBHelmholtzOpFactory(const EBHelmholtzOpFactory &a_otherFactory)=delete
Disallowed constructor. Use the full constructor.
Location::Cell m_dataLocation
Data location.
Definition CD_EBHelmholtzOpFactory.H:258
Vector< AmrFluxData > m_mgBcoef
B-coefficient on deeper grids. Always weird to write this but e.g. m_mgLevelGrids[0] corresponds to t...
Definition CD_EBHelmholtzOpFactory.H:420
IntVect m_ghostPhi
Number of ghost cells that are used. Need because of Chombo prolongation objects.
Definition CD_EBHelmholtzOpFactory.H:289
RefCountedPtr< EBHelmholtzEBBCFactory > EBBCFactory
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:110
static constexpr int m_nComp
Number of components that we solve for.
Definition CD_EBHelmholtzOpFactory.H:253
AmrFluxData m_amrBcoef
Helmholtz B-coefficient.
Definition CD_EBHelmholtzOpFactory.H:366
Vector< RefCountedPtr< EBReflux > > AmrFluxRegisters
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:70
bool getCoarserLayout(EBLevelGrid &a_coarEblg, const EBLevelGrid &a_fineEblg, int a_refRat, int a_blockingFactor) const
Construct coarsening of a grid level.
Definition CD_EBHelmholtzOpFactory.cpp:366
~EBHelmholtzOpFactory() override
Destructor. Does nothing.
Definition CD_EBHelmholtzOpFactory.cpp:96
Real m_relaxFactor
Relaxation factor.
Definition CD_EBHelmholtzOpFactory.H:309
AmrLevelGrids m_amrLevelGrids
AMR grids.
Definition CD_EBHelmholtzOpFactory.H:326
AmrMask m_validCells
Valid cells.
Definition CD_EBHelmholtzOpFactory.H:331
AmrCellData m_amrAcoef
Helmholtz A-coefficient.
Definition CD_EBHelmholtzOpFactory.H:361
static void coarsenCoefficients(LevelData< EBCellFAB > &a_coarAcoef, LevelData< EBFluxFAB > &a_coarBcoef, LevelData< BaseIVFAB< Real > > &a_coarBcoefIrreg, const LevelData< EBCellFAB > &a_fineAcoef, const LevelData< EBFluxFAB > &a_fineBcoef, const LevelData< BaseIVFAB< Real > > &a_fineBcoefIrreg, const EBLevelGrid &a_eblgCoar, const EBLevelGrid &a_eblgFine, int a_refRat)
Coarsen coefficients (conservatively)
Definition CD_EBHelmholtzOpFactory.cpp:309
void coarsenCoefficientsMG()
Go through all MG levels and coarsen the coefficients from the finer levels.
Definition CD_EBHelmholtzOpFactory.cpp:261
void defineMultigridLevels()
Function which defines the multigrid levels for this operator factory.
Definition CD_EBHelmholtzOpFactory.cpp:102
Real m_beta
Operator beta.
Definition CD_EBHelmholtzOpFactory.H:304
static bool isFiner(const ProblemDomain &a_domainOne, const ProblemDomain &B)
Check if a domain is finer than the other.
Definition CD_EBHelmholtzOpFactory.cpp:358
DomainBCFactory m_domainBcFactory
Domain BC factory.
Definition CD_EBHelmholtzOpFactory.H:376
Vector< RefCountedPtr< LevelData< EBCellFAB > > > AmrCellData
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:80
AmrRefRatios m_amrRefRatios
Refinement ratios.
Definition CD_EBHelmholtzOpFactory.H:351
int m_rasInnerSweeps
Number of inner frozen-ghost sweeps per restricted-additive-Schwarz iteration (only used when m_smoot...
Definition CD_EBHelmholtzOpFactory.H:279
RealVect m_probLo
Lower-left corner of computational domain.
Definition CD_EBHelmholtzOpFactory.H:319
Real m_alpha
Operator alpha.
Definition CD_EBHelmholtzOpFactory.H:299
Vector< RefCountedPtr< LevelData< EBFluxFAB > > > AmrFluxData
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:85
Vector< Real > AmrResolutions
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:95
RefCountedPtr< EBHelmholtzDomainBCFactory > DomainBCFactory
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:105
Vector< int > AmrRefRatios
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:100
AmrInterpolators m_amrInterpolators
Ghost cell interpolations.
Definition CD_EBHelmholtzOpFactory.H:336
int m_chebyOrder
Chebyshev polynomial degree (only used when m_smoother is Smoother::Chebyshev)
Definition CD_EBHelmholtzOpFactory.H:268
Helmholtz operator for equations like alpha*a(x)*phi(x) + beta*div(b(x)*grad(phi(x))) = rho.
Definition CD_EBHelmholtzOp.H:42
Smoother
Relaxation method for the operators.
Definition CD_EBHelmholtzOp.H:48
Namespace for encapsulating various data centerings.
Definition CD_Location.H:25
Cell
Enum for distinguishing between cell locations.
Definition CD_Location.H:31