21 #ifndef FUB_AMREX_CUTCELL_INTEGRATOR_CONTEXT_HPP
22 #define FUB_AMREX_CUTCELL_INTEGRATOR_CONTEXT_HPP
29 #include <AMReX_FluxRegister.H>
30 #include <AMReX_MultiFab.H>
38 class IntegratorContext;
86 [[nodiscard]] const std::shared_ptr<CounterRegistry>&
112 [[nodiscard]] const ::amrex::EBFArrayBoxFactory&
117 [[nodiscard]] ::amrex::MultiFab&
GetData(
int level);
161 [[nodiscard]] std::ptrdiff_t
GetCycles(
int level = 0)
const;
164 [[nodiscard]] const ::amrex::Geometry&
GetGeometry(
int level)
const;
184 const ::amrex::MFIter& mfi)
const
314 std::array<::amrex::MultiFab, AMREX_SPACEDIM>
fluxes{};
This is a polymorphic value type that wraps any BoundaryCondition object.
Definition: AnyBoundaryCondition.hpp:55
This class modifies and initializes a cutcell::PatchLevel in a cutcell::PatchHierarchy.
Definition: AMReX/cutcell/GriddingAlgorithm.hpp:56
This class manages data and the numerical method to perform cut cell simulations with the AMReX libra...
Definition: AMReX/cutcell/IntegratorContext.hpp:46
int scratch_ghost_cell_width_
Definition: AMReX/cutcell/IntegratorContext.hpp:334
MPI_Comm GetMpiCommunicator() const noexcept
Returns the MPI communicator which is associated with this context.
void CopyDataToScratch(int level)
Compute and store reference states for cut-cells over all split cycles.
void FillGhostLayerSingleLevel(int level)
Compute and store reference states for cut-cells over all split cycles.
::amrex::MultiFab & GetShieldedFromRightFluxes(int level, Direction dir)
Returns the MultiFab associated with flux data on the specifed level number and direction.
void ApplyBoundaryCondition(int level, Direction dir, AnyBoundaryCondition &bc)
Compute and store reference states for cut-cells over all split cycles.
void FillGhostLayerTwoLevels(int level, AnyBoundaryCondition &fbc, int coarse, AnyBoundaryCondition &cbc)
Fills the ghost layer of the scratch data and interpolates in the coarse fine layer.
int GetRatioToCoarserLevel(int level, Direction dir) const noexcept
Returns the refinement ratio in the specified direction.
void CopyScratchToData(int level)
Compute and store reference states for cut-cells over all split cycles.
void ResetHierarchyConfiguration(int level=0)
Whenever the gridding algorithm changes the data hierarchy this function will regrid all distributed ...
::amrex::MultiFab & GetScratch(int level)
Returns the MultiFab associated with level data with ghost cells on the specifed level number and dir...
IntegratorContext(std::shared_ptr< GriddingAlgorithm > gridding, HyperbolicMethod method, int cell_gcw, int face_gcw)
Deeply copies a context and all its distributed data for all MPI ranks.
int PreAdvanceLevel(int level_num, Duration dt, std::pair< int, int > subcycle)
On each first subcycle this will regrid the data if neccessary.
void ResetCoarseFineFluxes(int fine, int coarse)
Resets all accumulates fluxes to zero.
::amrex::MultiCutFab & GetBoundaryFluxes(int level)
Returns the MultiFab associated with flux data on the specifed level number and direction.
IntegratorContext(std::shared_ptr< GriddingAlgorithm > gridding, HyperbolicMethod method)
Deeply copies a context and all its distributed data for all MPI ranks.
::amrex::MultiFab & GetFluxes(int level, Direction dir)
Returns the MultiFab associated with flux data on the specifed level number and direction.
void CoarsenConservatively(int fine, int coarse)
Coarsen scratch data from a fine level number to a coarse level number.
void FillGhostLayerTwoLevels(int level, int coarse)
Compute and store reference states for cut-cells over all split cycles.
bool LevelExists(int level) const noexcept
Returns the refinement ratio in the specified direction.
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.
AnyBoundaryCondition & GetBoundaryCondition()
Returns the current boundary condition for the specified level.
void PreAdvanceHierarchy()
Compute and store reference states for cut-cells over all split cycles.
std::shared_ptr< CounterRegistry > registry_
Definition: AMReX/cutcell/IntegratorContext.hpp:282
const std::shared_ptr< CounterRegistry > & GetCounterRegistry() const noexcept
Returns a shared pointer to the counter registry.
void SetCycles(std::ptrdiff_t cycle, int level)
Sets the cycle count for a specific level number and direction.
std::function< void(IntegratorContext &, int, Duration, std::pair< int, int >)> FeedbackFn
Definition: AMReX/cutcell/IntegratorContext.hpp:48
void PostAdvanceHierarchy()
Compute and store reference states for cut-cells over all split cycles.
::amrex::MultiFab & GetData(int level)
Returns the MultiFab associated with level data on the specifed level number.
const PatchHierarchy & GetPatchHierarchy() const noexcept
Returns a reference to const PatchHierarchy which is a member of the GriddingAlgorithm.
Duration GetTimePoint(int level=0) const
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.
::amrex::MultiFab & GetShieldedFromLeftFluxes(int level, Direction dir)
Returns the MultiFab associated with flux data on the specifed level number and direction.
::amrex::MultiFab & GetDoublyShieldedFluxes(int level, Direction dir)
Returns the MultiFab associated with flux data on the specifed level number and direction.
bool count_per_level
Definition: AMReX/cutcell/IntegratorContext.hpp:283
::amrex::MultiFab & GetReferenceStates(int level)
Returns the MultiFab associated with flux data on the specifed level number and direction.
HyperbolicMethod method_
Definition: AMReX/cutcell/IntegratorContext.hpp:338
std::ptrdiff_t GetCycles(int level=0) const
Returns the current number of cycles for data at the specified refinement level and direction.
const AnyBoundaryCondition & GetBoundaryCondition() const
Returns the current boundary condition for the specified level.
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...
::amrex::FabType GetFabType(int level, const ::amrex::MFIter &mfi) const noexcept
Returns the refinement ratio in the specified direction.
double GetDx(int level, Direction dir) const noexcept
Returns the refinement ratio in the specified direction.
::amrex::EBFArrayBoxFactory & GetEmbeddedBoundary(int level)
Returns the current boundary condition for the specified level.
IntegratorContext & operator=(const IntegratorContext &)
Deeply copies a context and all its distributed data for all MPI ranks.
::amrex::MultiFab & GetStabilizedFluxes(int level, Direction dir)
Returns the MultiFab associated with flux data on the specifed level number and direction.
const std::shared_ptr< GriddingAlgorithm > & GetGriddingAlgorithm() const noexcept
Returns a shared pointer to the underlying GriddingAlgorithm which owns the simulation.
void ComputeNumericFluxes(int level, Duration dt, Direction dir)
Fill the flux MultiFab with numeric fluxes based on current states in scratch.
std::shared_ptr< GriddingAlgorithm > gridding_
Definition: AMReX/cutcell/IntegratorContext.hpp:336
const ::amrex::Geometry & GetGeometry(int level) const
Returns the geometry object for the specified refinement level.
FeedbackFn feedback_
Definition: AMReX/cutcell/IntegratorContext.hpp:339
const ::amrex::EBFArrayBoxFactory & GetEmbeddedBoundary(int level) const
Returns the current boundary condition for the specified level.
int flux_ghost_cell_width_
Definition: AMReX/cutcell/IntegratorContext.hpp:335
void ApplyFluxCorrection(int fine, int coarse, Duration dt)
Replace the coarse fluxes by accumulated fine fluxes on the coarse fine interfaces.
const HyperbolicMethod & GetHyperbolicMethod() const noexcept
Returns the hyperbolic method member object.
void CompleteFromCons(int level, Duration dt)
Reconstruct complete state variables from conservative ones.
::amrex::IntVect GetRatioToCoarserLevel(int level) const noexcept
Returns the refinement ratio for all directions.
void ResetHierarchyConfiguration(std::shared_ptr< GriddingAlgorithm > gridding)
Replaces the underlying gridding algorithm with the specified one.
IntegratorContext(IntegratorContext &&) noexcept=default
Deeply copies a context and all its distributed data for all MPI ranks.
std::vector< LevelData > data_
Definition: AMReX/cutcell/IntegratorContext.hpp:337
IntegratorContext(const IntegratorContext &)
Deeply copies a context and all its distributed data for all MPI ranks.
void AccumulateCoarseFineFluxes(int level, double time_scale, Direction dir)
Accumulate fluxes on the coarse fine interfaces for a specified fine level number.
void SetFeedbackFunction(FeedbackFn feedback)
Call this function upon every time integration.
Definition: AMReX/cutcell/IntegratorContext.hpp:98
void FillGhostLayerSingleLevel(int level, AnyBoundaryCondition &bc)
Fills the ghost layer of the scratch data and does nothing in the coarse fine layer.
void ApplyBoundaryCondition(int level, Direction dir)
Applies the boundary condition for the scratch space on level level in direcition dir.
Definition: AMReX/cutcell/PatchHierarchy.hpp:139
Definition: FillCutCellData.hpp:30
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: HyperbolicMethod.hpp:150
Definition: AMReX/cutcell/IntegratorContext.hpp:286
::amrex::MultiFab scratch
scratch space filled with data in ghost cells
Definition: AMReX/cutcell/IntegratorContext.hpp:304
std::ptrdiff_t cycles
Definition: AMReX/cutcell/IntegratorContext.hpp:331
std::optional<::amrex::MultiFab > reference_states
reference states which are used to compute embedded boundary fluxes
Definition: AMReX/cutcell/IntegratorContext.hpp:301
std::array<::amrex::MultiFab, AMREX_SPACEDIM > fluxes
Definition: AMReX/cutcell/IntegratorContext.hpp:314
LevelData(const LevelData &other)=delete
std::shared_ptr<::amrex::EBFArrayBoxFactory > eb_factory
This eb_factory is shared with the underlying patch hierarchy.
Definition: AMReX/cutcell/IntegratorContext.hpp:295
LevelData(LevelData &&) noexcept=default
std::array<::amrex::MultiFab, AMREX_SPACEDIM > doubly_shielded_fluxes
Definition: AMReX/cutcell/IntegratorContext.hpp:318
LevelData & operator=(const LevelData &other)=delete
std::array<::amrex::MultiFab, AMREX_SPACEDIM > stabilized_fluxes
Definition: AMReX/cutcell/IntegratorContext.hpp:315
Duration regrid_time_point
Definition: AMReX/cutcell/IntegratorContext.hpp:330
std::unique_ptr<::amrex::MultiCutFab > boundary_fluxes
fluxes for the embedded boundary
Definition: AMReX/cutcell/IntegratorContext.hpp:307
std::array<::amrex::MultiFab, AMREX_SPACEDIM > shielded_left_fluxes
Definition: AMReX/cutcell/IntegratorContext.hpp:316
Duration time_point
Definition: AMReX/cutcell/IntegratorContext.hpp:329
::amrex::FluxRegister coarse_fine
FluxRegister accumulate fluxes on coarse fine interfaces between refinement level.
Definition: AMReX/cutcell/IntegratorContext.hpp:327
std::array<::amrex::MultiFab, AMREX_SPACEDIM > shielded_right_fluxes
Definition: AMReX/cutcell/IntegratorContext.hpp:317