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
12
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
168 const Real& a_alpha,
169 const Real& a_beta,
170 const RealVect& a_probLo,
171 const AmrLevelGrids& a_amrLevelGrids,
172 const AmrMask& a_validCells,
173 const AmrInterpolators& a_amrInterpolators,
174 const AmrFluxRegisters& a_amrFluxRegisters,
175 const AmrCoarseners& a_amrCoarseners,
176 const AmrRefRatios& a_amrRefRatios,
177 const AmrResolutions& a_amrResolutions,
178 const AmrCellData& a_amrAcoef,
179 const AmrFluxData& a_amrBcoef,
180 const AmrIrreData& a_amrBcoefIrreg,
181 const DomainBCFactory& a_domainBcFactory,
182 const EBBCFactory& a_ebbcFactory,
183 const IntVect& a_ghostPhi,
184 const IntVect& a_ghostRHS,
185 const Smoother& a_smoother,
186 const Real& a_relaxFactor,
187 const int& a_chebyOrder,
188 const Real& a_chebyEigRatio,
189 const int& a_rasInnerSweeps,
190 const Vector<AmrLevelGrids>& a_mgLevelGrids,
191 const Vector<AmrLevelGrids>& a_mgLevelGridsCoFi,
192 const Vector<AmrCoarseners>& a_mgCoarseners,
193 const AmrLevelGrids& a_amrLevelGridsCoFi,
194 const ProblemDomain& a_bottomDomain,
195 const bool a_refluxFree);
196
200 ~EBHelmholtzOpFactory() override;
201
205 void
206 operator=(const EBHelmholtzOpFactory& a_opin) = delete;
207
211 void
212 operator=(const EBHelmholtzOpFactory&& a_opin) = delete;
213
217 void
219
229 MGnewOp(const ProblemDomain& a_fineDomain, int a_depth, bool a_homogeneousOnly = true) final;
230
237 AMRnewOp(const ProblemDomain& a_domain) final;
238
245 int
246 refToFiner(const ProblemDomain& a_domain) const final;
247
248protected:
252 static constexpr int m_comp = 0;
253
257 static constexpr int m_nComp = 1;
258
263
268
273
278
284
289
293 IntVect m_ghostPhi;
294
298 IntVect m_ghostRhs;
299
304
308 Real m_beta;
309
314
319
323 RealVect m_probLo;
324
325 // Things that pertain to AMR levels. The first entry corresponds to the coarsest AMR level.
326
331
336
341
346
351
356
361
366
371
376
381
386
390 ProblemDomain m_bottomDomain;
391
396
400 std::vector<bool> m_hasMgLevels;
401
407
413
419
425
431
437
445 void
446 defineMultigridLevels(const Vector<AmrLevelGrids>& a_mgLevelGrids,
447 const Vector<AmrLevelGrids>& a_mgLevelGridsCoFi,
448 const Vector<AmrCoarseners>& a_mgCoarseners);
449
456 static bool
457 isCoarser(const ProblemDomain& a_domainOne, const ProblemDomain& B);
458
465 static bool
466 isFiner(const ProblemDomain& a_domainOne, const ProblemDomain& B);
467
474 int
475 findAmrLevel(const ProblemDomain& a_domain) const;
476};
477
478#include <CD_NamespaceFooter.H>
479
480#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.
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:424
Vector< AmrLevelGrids > m_mgLevelGridsCoFi
Coarsened grids between consecutive multigrid levels. m_mgLevelGridsCoFi[lvl][k] is m_mgLevelGrids[lv...
Definition CD_EBHelmholtzOpFactory.H:436
AmrIrreData m_amrBcoefIrreg
Helmholtz B-coefficient (on EB faces.
Definition CD_EBHelmholtzOpFactory.H:375
AmrCoarseners m_amrCoarseners
Data coarseners.
Definition CD_EBHelmholtzOpFactory.H:350
EBHelmholtzOp * MGnewOp(const ProblemDomain &a_fineDomain, int a_depth, bool a_homogeneousOnly=true) final
Create multigrid operator.
Definition CD_EBHelmholtzOpFactory.cpp:303
AmrResolutions m_amrResolutions
Resolutions one each level.
Definition CD_EBHelmholtzOpFactory.H:360
Vector< RefCountedPtr< EBMultigridInterpolator > > AmrInterpolators
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:65
std::vector< bool > m_hasMgLevels
For checking if an AMR level has multigrid levels.
Definition CD_EBHelmholtzOpFactory.H:400
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:539
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:412
void defineMultigridLevels(const Vector< AmrLevelGrids > &a_mgLevelGrids, const Vector< AmrLevelGrids > &a_mgLevelGridsCoFi, const Vector< AmrCoarseners > &a_mgCoarseners)
Define the multigrid levels for this operator factory, and the coefficients on them.
Definition CD_EBHelmholtzOpFactory.cpp:104
int findAmrLevel(const ProblemDomain &a_domain) const
Find level corresponding to amr level.
Definition CD_EBHelmholtzOpFactory.cpp:562
IntVect m_ghostRhs
Number of ghost cells that are used. Need because of Chombo prolongation objects.
Definition CD_EBHelmholtzOpFactory.H:298
EBBCFactory m_ebBcFactory
EB BC factory.
Definition CD_EBHelmholtzOpFactory.H:385
EBHelmholtzOpFactory(const EBHelmholtzOpFactory &&a_otherFactory)=delete
Disallowed move constructor. Use the full constructor.
AmrFluxRegisters m_amrFluxRegisters
Flux registers.
Definition CD_EBHelmholtzOpFactory.H:345
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:252
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:406
bool m_refluxFree
Use reflux-free AMR operator.
Definition CD_EBHelmholtzOpFactory.H:318
static bool isCoarser(const ProblemDomain &a_domainOne, const ProblemDomain &B)
Check if a domain is coarser than the other.
Definition CD_EBHelmholtzOpFactory.cpp:287
EBHelmholtzOp * AMRnewOp(const ProblemDomain &a_domain) final
Create AMR operator for specified domain.
Definition CD_EBHelmholtzOpFactory.cpp:450
Real m_chebyEigRatio
Chebyshev eigenvalue ratio lambda_max/lambda_min (only used when m_smoother is Smoother::Chebyshev).
Definition CD_EBHelmholtzOpFactory.H:277
Vector< RefCountedPtr< LevelData< BaseIVFAB< Real > > > > AmrIrreData
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:90
Vector< RefCountedPtr< EBCoarAve > > AmrCoarseners
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:75
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:390
Smoother m_smoother
Smoother.
Definition CD_EBHelmholtzOpFactory.H:267
int m_numAmrLevels
Number of AMR levels.
Definition CD_EBHelmholtzOpFactory.H:288
EBHelmholtzOpFactory(const EBHelmholtzOpFactory &a_otherFactory)=delete
Disallowed constructor. Use the full constructor.
Location::Cell m_dataLocation
Data location.
Definition CD_EBHelmholtzOpFactory.H:262
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:418
IntVect m_ghostPhi
Number of ghost cells that are used. Need because of Chombo prolongation objects.
Definition CD_EBHelmholtzOpFactory.H:293
AmrLevelGrids m_amrLevelGridsCoFi
Coarsened grids between AMR levels. Entry lvl is AMR level lvl+1 coarsened to AMR level lvl.
Definition CD_EBHelmholtzOpFactory.H:395
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:257
AmrFluxData m_amrBcoef
Helmholtz B-coefficient.
Definition CD_EBHelmholtzOpFactory.H:370
Vector< RefCountedPtr< LevelData< EBFluxFAB > > > AmrFluxData
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:85
Vector< RefCountedPtr< LevelData< EBCellFAB > > > AmrCellData
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:80
EBHelmholtzOp::Smoother Smoother
Smoother type alias.
Definition CD_EBHelmholtzOpFactory.H:50
~EBHelmholtzOpFactory() override
Destructor. Does nothing.
Definition CD_EBHelmholtzOpFactory.cpp:98
Real m_relaxFactor
Relaxation factor.
Definition CD_EBHelmholtzOpFactory.H:313
Vector< RefCountedPtr< EBLevelGrid > > AmrLevelGrids
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:55
AmrLevelGrids m_amrLevelGrids
AMR grids.
Definition CD_EBHelmholtzOpFactory.H:330
Vector< RefCountedPtr< EBReflux > > AmrFluxRegisters
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:70
AmrMask m_validCells
Valid cells.
Definition CD_EBHelmholtzOpFactory.H:335
AmrCellData m_amrAcoef
Helmholtz A-coefficient.
Definition CD_EBHelmholtzOpFactory.H:365
void coarsenCoefficientsMG()
Go through all MG levels and coarsen the coefficients from the finer levels.
Definition CD_EBHelmholtzOpFactory.cpp:241
Real m_beta
Operator beta.
Definition CD_EBHelmholtzOpFactory.H:308
static bool isFiner(const ProblemDomain &a_domainOne, const ProblemDomain &B)
Check if a domain is finer than the other.
Definition CD_EBHelmholtzOpFactory.cpp:295
DomainBCFactory m_domainBcFactory
Domain BC factory.
Definition CD_EBHelmholtzOpFactory.H:380
AmrRefRatios m_amrRefRatios
Refinement ratios.
Definition CD_EBHelmholtzOpFactory.H:355
int m_rasInnerSweeps
Number of inner frozen-ghost sweeps per restricted-additive-Schwarz iteration (only used when m_smoot...
Definition CD_EBHelmholtzOpFactory.H:283
RealVect m_probLo
Lower-left corner of computational domain.
Definition CD_EBHelmholtzOpFactory.H:323
Vector< AmrCoarseners > m_mgCoarseners
Coarse averaging between consecutive multigrid levels. m_mgCoarseners[lvl][k] averages from m_mgLevel...
Definition CD_EBHelmholtzOpFactory.H:430
Real m_alpha
Operator alpha.
Definition CD_EBHelmholtzOpFactory.H:303
Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > AmrMask
alias type alias.
Definition CD_EBHelmholtzOpFactory.H:60
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:340
int m_chebyOrder
Chebyshev polynomial degree (only used when m_smoother is Smoother::Chebyshev).
Definition CD_EBHelmholtzOpFactory.H:272
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