chombo-discharge
Loading...
Searching...
No Matches
CD_MFHelmholtzOpFactory.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_MFHELMHOLTZOPFACTORY_H
14#define CD_MFHELMHOLTZOPFACTORY_H
15
16// Chombo includes
17#include <MFCellFAB.H>
18#include <MFFluxFAB.H>
19
20// Our includes
22#include <CD_Location.H>
23#include <CD_EBAMRData.H>
24#include <CD_MFHelmholtzOp.H>
25#include <CD_MFCoarAve.H>
26#include <CD_MFReflux.H>
28#include <CD_MFLevelGrid.H>
29#include <CD_MFBaseIVFAB.H>
32#include <CD_NamespaceHeader.H>
33
41class MFHelmholtzOpFactory : public AMRLevelOpFactory<LevelData<MFCellFAB>>
42{
43public:
44 // Various alias for cutting down on typing.
45
49 using MFIS = RefCountedPtr<MultiFluidIndexSpace>;
50
54 using AmrLevelGrids = Vector<MFLevelGrid>;
55
59 using AmrInterpolators = Vector<MFMultigridInterpolator>;
60
64 using AmrFluxRegisters = Vector<MFReflux>;
65
69 using AmrCoarseners = Vector<MFCoarAve>;
70
74 using AmrResolutions = Vector<Real>;
75
79 using AmrRefRatios = Vector<int>;
80
84 using AmrMask = Vector<RefCountedPtr<LevelData<BaseFab<bool>>>>;
85
89 using AmrCellData = Vector<RefCountedPtr<LevelData<MFCellFAB>>>;
90
94 using AmrFluxData = Vector<RefCountedPtr<LevelData<MFFluxFAB>>>;
95
99 using AmrIrreData = Vector<RefCountedPtr<LevelData<MFBaseIVFAB>>>;
100
104 using DomainBCFactory = RefCountedPtr<MFHelmholtzDomainBCFactory>;
105
109 using EBBCFactory = RefCountedPtr<MFHelmholtzEBBCFactory>;
110
114 using JumpBCFactory = RefCountedPtr<MFHelmholtzJumpBCFactory>;
115
120
125
129 MFHelmholtzOpFactory(const MFHelmholtzOpFactory& a_otherFactory) = delete;
130
169 MFHelmholtzOpFactory(const MFIS& a_mfis,
170 const Location::Cell a_dataLocation,
171 const Real& a_alpha,
172 const Real& a_beta,
173 const RealVect& a_probLo,
174 const AmrLevelGrids& a_amrLevelGrids,
175 const AmrMask& a_validCells,
176 const AmrInterpolators& a_amrInterpolators,
177 const AmrFluxRegisters& a_amrFluxRegisters,
178 const AmrCoarseners& a_amrCoarseners,
179 const AmrRefRatios& a_amrRefRatios,
180 const AmrResolutions& a_amrResolutions,
181 const AmrCellData& a_amrAcoef,
182 const AmrFluxData& a_amrBcoef,
183 const AmrIrreData& a_amrBcoefIrreg,
184 const DomainBCFactory& a_domainBcFactory,
185 const EBBCFactory& a_ebBcFactory,
186 const JumpBCFactory& a_jumpBcFactory,
187 const IntVect& a_ghostPhi,
188 const IntVect& a_ghostRhs,
189 const Smoother& a_smoother,
190 const Real& a_relaxFactor,
191 const int& a_chebyOrder,
192 const Real& a_chebyEigRatio,
193 const int& a_rasInnerSweeps,
194 const ProblemDomain& a_bottomDomain,
195 const int& a_jumpOrder,
196 const int& a_jumpWeight,
197 const int& a_preCondSmooth,
198 const int& a_blockingFactor,
199 const bool a_refluxFree = false,
200 const AmrLevelGrids& a_deeperLevelGrids = AmrLevelGrids());
201
205 virtual ~MFHelmholtzOpFactory();
206
212 void
213 setJump(const EBAMRIVData& a_sigma, const Real& a_scale);
214
219 void
220 setJump(const Real& a_sigma, const Real& a_scale);
221
226 const EBAMRIVData&
227 getSigma() const;
228
232 void
234
244 MGnewOp(const ProblemDomain& a_fineDomain, int a_depth, bool a_homogeneousOnly = true) override final;
245
252 AMRnewOp(const ProblemDomain& a_domain) override final;
253
260 int
261 refToFiner(const ProblemDomain& a_domain) const override final;
262
263protected:
267 static constexpr int m_comp = 0;
268
272 static constexpr int m_nComp = 1;
273
277 static constexpr int m_mainPhase = 0;
278
283
288
293
298
303
309
314
319
323 IntVect m_ghostPhi;
324
328 IntVect m_ghostRhs;
329
334
338 Real m_beta;
339
344
349
353 RealVect m_probLo;
354
359
364
369
374
379
384
389
394
399
404
409
414
419
423 EBAMRIVData m_amrJump;
424
428 ProblemDomain m_bottomDomain;
429
434
439
444
449
453 std::vector<bool> m_hasMgLevels;
454
460
466
472
478
482 Vector<EBAMRIVData> m_mgJump;
483
487 Vector<Vector<RefCountedPtr<EBCoarAve>>> m_mgAveOp;
488
492 void
494
498 void
499 defineJump();
500
507 static bool
508 isCoarser(const ProblemDomain& a_domainOne, const ProblemDomain& B);
509
516 static bool
517 isFiner(const ProblemDomain& a_domainOne, const ProblemDomain& B);
518
528 bool
529 getCoarserLayout(MFLevelGrid& a_coarMflg,
530 const MFLevelGrid& a_fineMflg,
531 const int a_refRat,
532 const int a_blockingFactor) const;
533
546 static void
547 coarsenCoefficients(LevelData<MFCellFAB>& a_coarAcoef,
548 LevelData<MFFluxFAB>& a_coarBcoef,
549 LevelData<MFBaseIVFAB>& a_coarBcoefIrreg,
550 const LevelData<MFCellFAB>& a_fineAcoef,
551 const LevelData<MFFluxFAB>& a_fineBcoef,
552 const LevelData<MFBaseIVFAB>& a_fineBcoefIrreg,
553 const MFLevelGrid& a_mflgCoar,
554 const MFLevelGrid& a_mflgFine,
555 const int a_refRat);
556
563 int
564 findAmrLevel(const ProblemDomain& a_domain) const;
565};
566
567#include <CD_NamespaceFooter.H>
568
569#endif
Class for holding data across EBAMR hierarchies.
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 a class for solving multiphase Helmholtz equations.
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.
Multi-fluid index space.
Class which replaces data at coarse level of refinement with average at fine level of refinement.
Definition CD_EBCoarAve.H:32
Multiphase BaseIVFAB<Real>.
Definition CD_MFBaseIVFAB.H:30
Factory class for making MFHelmholtzOp.
Definition CD_MFHelmholtzOpFactory.H:42
static constexpr int m_comp
Component that this operator solves for.
Definition CD_MFHelmholtzOpFactory.H:267
ProblemDomain m_bottomDomain
Coarsest level where we run multigrid.
Definition CD_MFHelmholtzOpFactory.H:428
static bool isCoarser(const ProblemDomain &a_domainOne, const ProblemDomain &B)
Check if a domain is coarser than the other.
Definition CD_MFHelmholtzOpFactory.cpp:826
Vector< EBAMRIVData > m_mgJump
Jump coefficient on deeper grids.
Definition CD_MFHelmholtzOpFactory.H:482
EBBCFactory m_ebBcFactory
EB BC factory.
Definition CD_MFHelmholtzOpFactory.H:413
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_MFHelmholtzOpFactory.H:471
std::vector< bool > m_hasMgLevels
For checking if an AMR level has multigrid levels.
Definition CD_MFHelmholtzOpFactory.H:453
Vector< RefCountedPtr< LevelData< MFFluxFAB > > > AmrFluxData
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:94
EBAMRIVData m_amrJump
Jump on multiphase cells.
Definition CD_MFHelmholtzOpFactory.H:423
Vector< MFReflux > AmrFluxRegisters
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:64
AmrFluxData m_amrBcoef
Operator B-coefficient.
Definition CD_MFHelmholtzOpFactory.H:398
int m_mgBlockingFactor
Blocking factor for grid aggregation.
Definition CD_MFHelmholtzOpFactory.H:433
AmrFluxRegisters m_amrFluxRegisters
Flux registers.
Definition CD_MFHelmholtzOpFactory.H:373
Real m_chebyEigRatio
Chebyshev eigenvalue ratio lambda_max/lambda_min (only used when m_smoother is Smoother::Chebyshev)
Definition CD_MFHelmholtzOpFactory.H:302
Location::Cell m_dataLocation
Data centering.
Definition CD_MFHelmholtzOpFactory.H:287
MFHelmholtzOp * AMRnewOp(const ProblemDomain &a_domain) override final
Create AMR operator for specified domain.
Definition CD_MFHelmholtzOpFactory.cpp:737
MFHelmholtzOpFactory()=delete
Disallowed constructor.
int m_numAmrLevels
Number of AMR levels.
Definition CD_MFHelmholtzOpFactory.H:313
Vector< AmrLevelGrids > m_mgLevelGrids
Deeper grids. Always weird to write this but e.g. m_mgLevelGrids[0] corresponds to the the multigrid ...
Definition CD_MFHelmholtzOpFactory.H:459
Real m_alpha
Operator alpha.
Definition CD_MFHelmholtzOpFactory.H:333
int m_jumpWeight
Weighting for least squares reconstruction in jump cells.
Definition CD_MFHelmholtzOpFactory.H:443
bool getCoarserLayout(MFLevelGrid &a_coarMflg, const MFLevelGrid &a_fineMflg, const int a_refRat, const int a_blockingFactor) const
Construct coarsening of a grid level.
Definition CD_MFHelmholtzOpFactory.cpp:513
Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > AmrMask
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:84
AmrCoarseners m_amrCoarseners
Data coarseners.
Definition CD_MFHelmholtzOpFactory.H:378
RefCountedPtr< MFHelmholtzEBBCFactory > EBBCFactory
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:109
Vector< MFCoarAve > AmrCoarseners
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:69
bool m_refluxFree
Use reflux-free AMR operator.
Definition CD_MFHelmholtzOpFactory.H:348
const EBAMRIVData & getSigma() const
Get the BC jump factor.
Definition CD_MFHelmholtzOpFactory.cpp:197
MFHelmholtzOpFactory(const MFHelmholtzOpFactory &a_otherFactory)=delete
Disallowed constructor.
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_MFHelmholtzOpFactory.H:465
static void coarsenCoefficients(LevelData< MFCellFAB > &a_coarAcoef, LevelData< MFFluxFAB > &a_coarBcoef, LevelData< MFBaseIVFAB > &a_coarBcoefIrreg, const LevelData< MFCellFAB > &a_fineAcoef, const LevelData< MFFluxFAB > &a_fineBcoef, const LevelData< MFBaseIVFAB > &a_fineBcoefIrreg, const MFLevelGrid &a_mflgCoar, const MFLevelGrid &a_mflgFine, const int a_refRat)
Coarsen coefficients (conservatively)
Definition CD_MFHelmholtzOpFactory.cpp:449
AmrIrreData m_amrBcoefIrreg
Operator B-coefficient.
Definition CD_MFHelmholtzOpFactory.H:403
JumpBCFactory m_jumpBcFactory
Jump BC factory.
Definition CD_MFHelmholtzOpFactory.H:418
AmrLevelGrids m_amrLevelGrids
AMR grids.
Definition CD_MFHelmholtzOpFactory.H:358
int m_rasInnerSweeps
Number of inner frozen-ghost sweeps per restricted-additive-Schwarz iteration (only used when m_smoot...
Definition CD_MFHelmholtzOpFactory.H:308
static constexpr int m_nComp
Number of components that this operator solves for.
Definition CD_MFHelmholtzOpFactory.H:272
Vector< MFMultigridInterpolator > AmrInterpolators
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:59
RefCountedPtr< MFHelmholtzJumpBCFactory > JumpBCFactory
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:114
MFIS m_mfis
Index space.
Definition CD_MFHelmholtzOpFactory.H:282
RefCountedPtr< MFHelmholtzDomainBCFactory > DomainBCFactory
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:104
IntVect m_ghostPhi
Number of ghost cells that are used. Need because of Chombo prolongation objects.
Definition CD_MFHelmholtzOpFactory.H:323
AmrMask m_validCells
Valid cells.
Definition CD_MFHelmholtzOpFactory.H:363
Real m_relaxFactor
Relaxation factor.
Definition CD_MFHelmholtzOpFactory.H:343
AmrResolutions m_amrResolutions
Grid resolutions.
Definition CD_MFHelmholtzOpFactory.H:388
static constexpr int m_mainPhase
Main phase.
Definition CD_MFHelmholtzOpFactory.H:277
void setJump(const EBAMRIVData &a_sigma, const Real &a_scale)
Set jump condition. This is passed to the operators by reference.
Definition CD_MFHelmholtzOpFactory.cpp:117
DomainBCFactory m_domainBcFactory
Domain BC factory.
Definition CD_MFHelmholtzOpFactory.H:408
int findAmrLevel(const ProblemDomain &a_domain) const
Find level corresponding to amr level.
Definition CD_MFHelmholtzOpFactory.cpp:858
Vector< Real > AmrResolutions
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:74
int m_chebyOrder
Chebyshev polynomial degree (only used when m_smoother is Smoother::Chebyshev)
Definition CD_MFHelmholtzOpFactory.H:297
Vector< RefCountedPtr< LevelData< MFCellFAB > > > AmrCellData
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:89
Smoother m_smoother
Smoother.
Definition CD_MFHelmholtzOpFactory.H:292
RefCountedPtr< MultiFluidIndexSpace > MFIS
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:49
RealVect m_probLo
Lower-left corner of computational domain.
Definition CD_MFHelmholtzOpFactory.H:353
AmrRefRatios m_amrRefRatios
Refinement ratios.
Definition CD_MFHelmholtzOpFactory.H:383
AmrLevelGrids m_deeperLevelGrids
Deeper grids.
Definition CD_MFHelmholtzOpFactory.H:448
Vector< RefCountedPtr< LevelData< MFBaseIVFAB > > > AmrIrreData
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:99
Vector< Vector< RefCountedPtr< EBCoarAve > > > m_mgAveOp
Coarsneing operator on deeper grids (used for coarsening jump)
Definition CD_MFHelmholtzOpFactory.H:487
IntVect m_ghostRhs
Number of ghost cells that are used. Need because of Chombo prolongation objects.
Definition CD_MFHelmholtzOpFactory.H:328
MFHelmholtzOp * MGnewOp(const ProblemDomain &a_fineDomain, int a_depth, bool a_homogeneousOnly=true) override final
Create multigrid operator.
Definition CD_MFHelmholtzOpFactory.cpp:586
void coarsenCoefficientsMG()
Go through all MG levels and coarsen the coefficients from the finer levels.
Definition CD_MFHelmholtzOpFactory.cpp:401
AmrCellData m_amrAcoef
Operator A-coefficient.
Definition CD_MFHelmholtzOpFactory.H:393
AmrInterpolators m_amrInterpolators
Multigrid interpolators.
Definition CD_MFHelmholtzOpFactory.H:368
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_MFHelmholtzOpFactory.H:477
Vector< int > AmrRefRatios
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:79
Real m_beta
Operator beta.
Definition CD_MFHelmholtzOpFactory.H:338
void defineMultigridLevels()
Function which defines the multigrid levels for this operator factory.
Definition CD_MFHelmholtzOpFactory.cpp:244
static bool isFiner(const ProblemDomain &a_domainOne, const ProblemDomain &B)
Check if a domain is finer than the other.
Definition CD_MFHelmholtzOpFactory.cpp:834
int m_numPreCondSmooth
Number of smoothings in the preconditioner. Passed directly to the operators.
Definition CD_MFHelmholtzOpFactory.H:318
int refToFiner(const ProblemDomain &a_domain) const override final
Get refinement ratio to next finest level.
Definition CD_MFHelmholtzOpFactory.cpp:842
void defineJump()
Define jump data.
Definition CD_MFHelmholtzOpFactory.cpp:205
Vector< MFLevelGrid > AmrLevelGrids
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:54
virtual ~MFHelmholtzOpFactory()
Destructor. Does nothing.
Definition CD_MFHelmholtzOpFactory.cpp:111
int m_jumpOrder
Stencil order in jump cells.
Definition CD_MFHelmholtzOpFactory.H:438
Operator for solving multifluid Helmholtz on a grid level.
Definition CD_MFHelmholtzOp.H:44
Smoother
Relaxation methods for this operator.
Definition CD_MFHelmholtzOp.H:50
Wrapper class for holding multifluid EBLevelGrids.
Definition CD_MFLevelGrid.H:30
Namespace for encapsulating various data centerings.
Definition CD_Location.H:25
Cell
Enum for distinguishing between cell locations.
Definition CD_Location.H:31