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
12
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
175 MFHelmholtzOpFactory(const MFIS& a_mfis,
176 const Location::Cell a_dataLocation,
177 const Real& a_alpha,
178 const Real& a_beta,
179 const RealVect& a_probLo,
180 const AmrLevelGrids& a_amrLevelGrids,
181 const AmrMask& a_validCells,
182 const AmrInterpolators& a_amrInterpolators,
183 const AmrFluxRegisters& a_amrFluxRegisters,
184 const AmrCoarseners& a_amrCoarseners,
185 const AmrRefRatios& a_amrRefRatios,
186 const AmrResolutions& a_amrResolutions,
187 const AmrCellData& a_amrAcoef,
188 const AmrFluxData& a_amrBcoef,
189 const AmrIrreData& a_amrBcoefIrreg,
190 const DomainBCFactory& a_domainBcFactory,
191 const EBBCFactory& a_ebBcFactory,
192 const JumpBCFactory& a_jumpBcFactory,
193 const IntVect& a_ghostPhi,
194 const IntVect& a_ghostRhs,
195 const Smoother& a_smoother,
196 const Real& a_relaxFactor,
197 const int& a_chebyOrder,
198 const Real& a_chebyEigRatio,
199 const int& a_rasInnerSweeps,
200 const int& a_jumpOrder,
201 const int& a_jumpWeight,
202 const int& a_preCondSmooth,
203 const Vector<AmrLevelGrids>& a_mgLevelGrids,
204 const Vector<AmrLevelGrids>& a_mgLevelGridsCoFi,
205 const Vector<AmrCoarseners>& a_mgCoarseners,
206 const AmrLevelGrids& a_amrLevelGridsCoFi,
207 const ProblemDomain& a_bottomDomain,
208 const bool a_refluxFree);
209
213 virtual ~MFHelmholtzOpFactory();
214
220 void
221 setJump(const EBAMRIVData& a_sigma, const Real& a_scale);
222
227 void
228 setJump(const Real& a_sigma, const Real& a_scale);
229
234 const EBAMRIVData&
235 getSigma() const;
236
240 void
242
252 MGnewOp(const ProblemDomain& a_fineDomain, int a_depth, bool a_homogeneousOnly = true) override final;
253
260 AMRnewOp(const ProblemDomain& a_domain) override final;
261
268 int
269 refToFiner(const ProblemDomain& a_domain) const override final;
270
271protected:
275 static constexpr int m_comp = 0;
276
280 static constexpr int m_nComp = 1;
281
285 static constexpr int m_mainPhase = 0;
286
291
296
301
306
311
317
322
327
331 IntVect m_ghostPhi;
332
336 IntVect m_ghostRhs;
337
342
346 Real m_beta;
347
352
357
361 RealVect m_probLo;
362
367
372
377
382
387
392
397
402
407
412
417
422
427
431 EBAMRIVData m_amrJump;
432
436 ProblemDomain m_bottomDomain;
437
442
447
452
456 std::vector<bool> m_hasMgLevels;
457
463
469
475
481
485 Vector<EBAMRIVData> m_mgJump;
486
492
498
506 void
507 defineMultigridLevels(const Vector<AmrLevelGrids>& a_mgLevelGrids,
508 const Vector<AmrLevelGrids>& a_mgLevelGridsCoFi,
509 const Vector<AmrCoarseners>& a_mgCoarseners);
510
514 void
515 defineJump();
516
523 static bool
524 isCoarser(const ProblemDomain& a_domainOne, const ProblemDomain& B);
525
532 static bool
533 isFiner(const ProblemDomain& a_domainOne, const ProblemDomain& B);
534
541 int
542 findAmrLevel(const ProblemDomain& a_domain) const;
543};
544
545#include <CD_NamespaceFooter.H>
546
547#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.
static constexpr int m_comp
Component that this operator solves for.
Definition CD_MFHelmholtzOpFactory.H:275
ProblemDomain m_bottomDomain
Coarsest level where we run multigrid.
Definition CD_MFHelmholtzOpFactory.H:436
Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > AmrMask
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:84
static bool isCoarser(const ProblemDomain &a_domainOne, const ProblemDomain &B)
Check if a domain is coarser than the other.
Definition CD_MFHelmholtzOpFactory.cpp:662
Vector< EBAMRIVData > m_mgJump
Jump coefficient on deeper grids.
Definition CD_MFHelmholtzOpFactory.H:485
EBBCFactory m_ebBcFactory
EB BC factory.
Definition CD_MFHelmholtzOpFactory.H:421
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:474
std::vector< bool > m_hasMgLevels
For checking if an AMR level has multigrid levels.
Definition CD_MFHelmholtzOpFactory.H:456
EBAMRIVData m_amrJump
Jump on multiphase cells.
Definition CD_MFHelmholtzOpFactory.H:431
Vector< MFReflux > AmrFluxRegisters
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:64
AmrFluxData m_amrBcoef
Operator B-coefficient.
Definition CD_MFHelmholtzOpFactory.H:406
AmrFluxRegisters m_amrFluxRegisters
Flux registers.
Definition CD_MFHelmholtzOpFactory.H:381
Real m_chebyEigRatio
Chebyshev eigenvalue ratio lambda_max/lambda_min (only used when m_smoother is Smoother::Chebyshev).
Definition CD_MFHelmholtzOpFactory.H:310
Location::Cell m_dataLocation
Data centering.
Definition CD_MFHelmholtzOpFactory.H:295
MFHelmholtzOp * AMRnewOp(const ProblemDomain &a_domain) override final
Create AMR operator for specified domain.
Definition CD_MFHelmholtzOpFactory.cpp:572
MFHelmholtzOpFactory()=delete
Disallowed constructor.
Vector< RefCountedPtr< LevelData< MFBaseIVFAB > > > AmrIrreData
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:99
int m_numAmrLevels
Number of AMR levels.
Definition CD_MFHelmholtzOpFactory.H:321
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:462
Real m_alpha
Operator alpha.
Definition CD_MFHelmholtzOpFactory.H:341
int m_jumpWeight
Weighting for least squares reconstruction in jump cells.
Definition CD_MFHelmholtzOpFactory.H:451
AmrCoarseners m_amrCoarseners
Data coarseners.
Definition CD_MFHelmholtzOpFactory.H:386
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:356
const EBAMRIVData & getSigma() const
Get the BC jump factor.
Definition CD_MFHelmholtzOpFactory.cpp:180
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:468
Vector< AmrLevelGrids > m_mgLevelGridsCoFi
Coarsened grids between consecutive multigrid levels. m_mgLevelGridsCoFi[lvl][k] is m_mgLevelGrids[lv...
Definition CD_MFHelmholtzOpFactory.H:497
AmrIrreData m_amrBcoefIrreg
Operator B-coefficient.
Definition CD_MFHelmholtzOpFactory.H:411
JumpBCFactory m_jumpBcFactory
Jump BC factory.
Definition CD_MFHelmholtzOpFactory.H:426
AmrLevelGrids m_amrLevelGrids
AMR grids.
Definition CD_MFHelmholtzOpFactory.H:366
int m_rasInnerSweeps
Number of inner frozen-ghost sweeps per restricted-additive-Schwarz iteration (only used when m_smoot...
Definition CD_MFHelmholtzOpFactory.H:316
static constexpr int m_nComp
Number of components that this operator solves for.
Definition CD_MFHelmholtzOpFactory.H:280
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:290
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:331
AmrMask m_validCells
Valid cells.
Definition CD_MFHelmholtzOpFactory.H:371
Real m_relaxFactor
Relaxation factor.
Definition CD_MFHelmholtzOpFactory.H:351
AmrResolutions m_amrResolutions
Grid resolutions.
Definition CD_MFHelmholtzOpFactory.H:396
static constexpr int m_mainPhase
Main phase.
Definition CD_MFHelmholtzOpFactory.H:285
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:119
DomainBCFactory m_domainBcFactory
Domain BC factory.
Definition CD_MFHelmholtzOpFactory.H:416
AmrLevelGrids m_amrLevelGridsCoFi
Coarsened grids between AMR levels. Entry lvl is AMR level lvl+1 coarsened to AMR level lvl.
Definition CD_MFHelmholtzOpFactory.H:441
int findAmrLevel(const ProblemDomain &a_domain) const
Find level corresponding to amr level.
Definition CD_MFHelmholtzOpFactory.cpp:694
MFHelmholtzOp::Smoother Smoother
Smoother type alias.
Definition CD_MFHelmholtzOpFactory.H:119
Vector< Real > AmrResolutions
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:74
Vector< RefCountedPtr< LevelData< MFCellFAB > > > AmrCellData
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:89
int m_chebyOrder
Chebyshev polynomial degree (only used when m_smoother is Smoother::Chebyshev).
Definition CD_MFHelmholtzOpFactory.H:305
Vector< RefCountedPtr< LevelData< MFFluxFAB > > > AmrFluxData
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:94
Smoother m_smoother
Smoother.
Definition CD_MFHelmholtzOpFactory.H:300
RefCountedPtr< MultiFluidIndexSpace > MFIS
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:49
RealVect m_probLo
Lower-left corner of computational domain.
Definition CD_MFHelmholtzOpFactory.H:361
Vector< AmrCoarseners > m_mgCoarseners
Coarse averaging between consecutive multigrid levels. m_mgCoarseners[lvl][k] averages from m_mgLevel...
Definition CD_MFHelmholtzOpFactory.H:491
AmrRefRatios m_amrRefRatios
Refinement ratios.
Definition CD_MFHelmholtzOpFactory.H:391
IntVect m_ghostRhs
Number of ghost cells that are used. Need because of Chombo prolongation objects.
Definition CD_MFHelmholtzOpFactory.H:336
MFHelmholtzOp * MGnewOp(const ProblemDomain &a_fineDomain, int a_depth, bool a_homogeneousOnly=true) override final
Create multigrid operator.
Definition CD_MFHelmholtzOpFactory.cpp:417
void coarsenCoefficientsMG()
Go through all MG levels and coarsen the coefficients from the finer levels.
Definition CD_MFHelmholtzOpFactory.cpp:358
AmrCellData m_amrAcoef
Operator A-coefficient.
Definition CD_MFHelmholtzOpFactory.H:401
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_MFHelmholtzOpFactory.cpp:227
AmrInterpolators m_amrInterpolators
Multigrid interpolators.
Definition CD_MFHelmholtzOpFactory.H:376
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:480
Vector< int > AmrRefRatios
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:79
Real m_beta
Operator beta.
Definition CD_MFHelmholtzOpFactory.H:346
static bool isFiner(const ProblemDomain &a_domainOne, const ProblemDomain &B)
Check if a domain is finer than the other.
Definition CD_MFHelmholtzOpFactory.cpp:670
int m_numPreCondSmooth
Number of smoothings in the preconditioner. Passed directly to the operators.
Definition CD_MFHelmholtzOpFactory.H:326
int refToFiner(const ProblemDomain &a_domain) const override final
Get refinement ratio to next finest level.
Definition CD_MFHelmholtzOpFactory.cpp:678
void defineJump()
Define jump data.
Definition CD_MFHelmholtzOpFactory.cpp:188
Vector< MFLevelGrid > AmrLevelGrids
alias type alias.
Definition CD_MFHelmholtzOpFactory.H:54
virtual ~MFHelmholtzOpFactory()
Destructor. Does nothing.
Definition CD_MFHelmholtzOpFactory.cpp:113
int m_jumpOrder
Stencil order in jump cells.
Definition CD_MFHelmholtzOpFactory.H:446
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
Namespace for encapsulating various data centerings.
Definition CD_Location.H:25
Cell
Enum for distinguishing between cell locations.
Definition CD_Location.H:31