21 #ifndef FUB_AMREX_MultiBlock_INTEGRATOR_CONTEXT2_HPP
22 #define FUB_AMREX_MultiBlock_INTEGRATOR_CONTEXT2_HPP
37 template <
typename TubeEquation,
typename PlenumEquation>
39 const PlenumEquation& plenum_equation,
40 std::vector<IntegratorContext> tubes,
41 std::vector<cutcell::IntegratorContext> plena,
42 std::vector<BlockConnection> connectivity);
60 [[nodiscard]] std::ptrdiff_t
GetCycles(
int level = 0) const;
69 [[nodiscard]] const std::shared_ptr<CounterRegistry>&
123 std::pair<
int,
int> subcycle);
177 template <typename TubeEquation, typename PlenumEquation>
179 const TubeEquation& tube_equation, const PlenumEquation& plenum_equation,
184 std::vector<std::shared_ptr<GriddingAlgorithm>> tube_grids(
tubes_.size());
187 [](IntegratorContext& ctx) { return ctx.GetGriddingAlgorithm(); });
188 std::vector<std::shared_ptr<cutcell::GriddingAlgorithm>> plenum_grids(
190 std::transform(
plena_.begin(),
plena_.end(), plenum_grids.begin(),
191 [](cutcell::IntegratorContext& ctx) {
192 return ctx.GetGriddingAlgorithm();
194 gridding_ = std::make_shared<MultiBlockGriddingAlgorithm2>(
195 tube_equation, plenum_equation, std::move(tube_grids),
196 std::move(plenum_grids), std::move(connectivity));
This class is used by the HypebrolicSplitLevelIntegrator and delegates AMR related tasks to the AMReX...
Definition: AMReX/IntegratorContext.hpp:49
Definition: MultiBlockBoundary.hpp:64
Definition: MultiBlockGriddingAlgorithm2.hpp:37
Definition: MultiBlockIntegratorContext2.hpp:35
span< IntegratorContext > Tubes() noexcept
Returns the current time level for data at the specified refinement level and direction.
void UpdateConservatively(int level, Duration dt, Direction dir)
Apply a conservative time update for each conservative variable on the specified level number and dir...
void SetTimePoint(Duration t, int level)
Sets the time point for a specific level number and direction.
void CompleteFromCons(int level, Duration dt)
Reconstruct complete state variables from conservative ones.
span< cutcell::IntegratorContext > Plena() noexcept
Returns the current time level for data at the specified refinement level and direction.
void CopyDataToScratch(int level)
Replaces the underlying gridding algorithm with the specified one.
void PreAdvanceHierarchy()
On each first subcycle this will regrid the data if neccessary.
MultiBlockBoundary & GetBoundaryCondition(int level)
Returns the current boundary condition for the specified level.
void PostAdvanceHierarchy()
On each first subcycle this will regrid the data if neccessary.
void FillGhostLayerTwoLevels(int level, int coarse)
Fills the ghost layer of the scratch data and interpolates in the coarse fine layer.
const std::shared_ptr< MultiBlockGriddingAlgorithm2 > & GetGriddingAlgorithm() const noexcept
Returns the current time level for data at the specified refinement level and direction.
void ComputeNumericFluxes(int level, Duration dt, Direction dir)
Fill the flux MultiFab with numeric fluxes based on current states in scratch.
Result< void, TimeStepTooLarge > PostAdvanceLevel(int level_num, Duration dt, std::pair< int, int > subcycle)
Increases the internal time stamps and cycle counters for the specified level number and direction.
void AccumulateCoarseFineFluxes(int level, double time_scale, Direction dir)
Accumulate fluxes on the coarse fine interfaces for a specified fine level number.
void ResetCoarseFineFluxes(int fine, int coarse)
Resets all accumulates fluxes to zero.
Duration ComputeStableDt(int level, Direction dir)
Returns a estimate for a stable time step size which can be taken for specified level number in direc...
void SetCycles(std::ptrdiff_t cycle, int level)
Sets the cycle count for a specific level number and direction.
void CopyScratchToData(int level)
Replaces the underlying gridding algorithm with the specified one.
MultiBlockIntegratorContext2(const TubeEquation &tube_equation, const PlenumEquation &plenum_equation, std::vector< IntegratorContext > tubes, std::vector< cutcell::IntegratorContext > plena, std::vector< BlockConnection > connectivity)
Definition: MultiBlockIntegratorContext2.hpp:178
void ResetHierarchyConfiguration(std::shared_ptr< MultiBlockGriddingAlgorithm2 > gridding)
Replaces the underlying gridding algorithm with the specified one.
void ApplyBoundaryCondition(int level, Direction dir)
Applies the boundary condition for the scratch space on level level in direcition dir.
void ApplyFluxCorrection(int fine, int coarse, Duration dt)
Replace the coarse fluxes by accumulated fine fluxes on the coarse fine interfaces.
MPI_Comm GetMpiCommunicator() const noexcept
std::vector< cutcell::IntegratorContext > plena_
Definition: MultiBlockIntegratorContext2.hpp:173
void FillGhostLayerSingleLevel(int level)
Fills the ghost layer of the scratch data and does nothing in the coarse fine layer.
int GetRatioToCoarserLevel(int level, Direction dir) const noexcept
Returns the refinement ratio in the specified direction.
int PreAdvanceLevel(int level_num, Duration dt, std::pair< int, int > subcycle)
On each first subcycle this will regrid the data if neccessary.
Duration GetTimePoint(int level=0) const
Returns the current time level for data at the specified refinement level and direction.
void CoarsenConservatively(int fine, int coarse)
Coarsen scratch data from a fine level number to a coarse level number.
std::shared_ptr< MultiBlockGriddingAlgorithm2 > gridding_
Definition: MultiBlockIntegratorContext2.hpp:174
std::vector< IntegratorContext > tubes_
Definition: MultiBlockIntegratorContext2.hpp:172
bool LevelExists(int level) const noexcept
Returns true if the data exists for the specified level number.
const std::shared_ptr< CounterRegistry > & GetCounterRegistry() const noexcept
Returns a shared pointer to the counter registry.
std::ptrdiff_t GetCycles(int level=0) const
Returns the current number of cycles for data at the specified refinement level and direction.
A span is a view over a contiguous sequence of objects, the storage of which is owned by some other o...
Definition: span.hpp:81
The amrex namespace.
Definition: AverageState.hpp:33
std::chrono::duration< double > Duration
Definition: Duration.hpp:31
Direction
This is a type safe type to denote a dimensional split direction.
Definition: Direction.hpp:30
boost::outcome_v2::result< T, E > Result
Definition: outcome.hpp:32
Definition: MultiBlockBoundary.hpp:54