Finite Volume Solver
prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
|
This class is used by the HypebrolicSplitLevelIntegrator and delegates AMR related tasks to the AMReX library. More...
#include <IntegratorContext.hpp>
Classes | |
struct | AuxialiaryDataDescription |
Public Member Functions | |
void | CopyDataToScratch (int level) |
void | CopyScratchToData (int level) |
const std::shared_ptr< CounterRegistry > & | GetCounterRegistry () const noexcept |
Constructors and Assignments | |
IntegratorContext (std::shared_ptr< GriddingAlgorithm > gridding, HyperbolicMethod method, AuxialiaryDataDescription aux_desc) | |
Constructs a context object from given a gridding algorithm and a numerical method. More... | |
IntegratorContext (const IntegratorContext &)=default | |
Deeply copies a context and all its distributed data for all MPI ranks. More... | |
IntegratorContext & | operator= (const IntegratorContext &)=default |
Deeply copies a context and all its distributed data for all MPI ranks. More... | |
IntegratorContext (IntegratorContext &&) noexcept=default | |
Constructs a context object from given a gridding algorithm and a numerical method. More... | |
IntegratorContext & | operator= (IntegratorContext &&) noexcept=default |
Constructs a context object from given a gridding algorithm and a numerical method. More... | |
~IntegratorContext ()=default | |
Constructs a context object from given a gridding algorithm and a numerical method. More... | |
Member Accessors | |
const AnyBoundaryCondition & | GetBoundaryCondition () const |
Returns the current boundary condition for the specified level. More... | |
AnyBoundaryCondition & | GetBoundaryCondition () |
Returns the current boundary condition for the specified level. More... | |
const std::shared_ptr< GriddingAlgorithm > & | GetGriddingAlgorithm () const noexcept |
Returns a shared pointer to the underlying GriddingAlgorithm which owns the simulation. More... | |
const PatchHierarchy & | GetPatchHierarchy () const noexcept |
Returns a reference to const PatchHierarchy which is a member of the GriddingAlgorithm. More... | |
PatchHierarchy & | GetPatchHierarchy () noexcept |
Returns a reference to PatchHierarchy which is a member of the GriddingAlgorithm. More... | |
MPI_Comm | GetMpiCommunicator () const noexcept |
Returns the MPI communicator which is associated with this context. More... | |
Access Level-specific data | |
SAMRAI::hier::PatchLevel & | GetPatchLevel (int level) |
Returns the MultiFab associated with level data on the specifed level number. More... | |
const SAMRAI::hier::PatchLevel & | GetPatchLevel (int level) const |
Returns the MultiFab associated with level data on the specifed level number. More... | |
span< const int > | GetDataIds () const |
Returns the MultiFab associated with level data on the specifed level number. More... | |
span< const int > | GetScratchIds () const |
Returns the MultiFab associated with level data on the specifed level number. More... | |
span< const int > | GetFluxIds () const |
Returns the MultiFab associated with level data on the specifed level number. More... | |
Duration | GetTimePoint (int level=0) const |
Returns the current time level for data at the specified refinement level and direction. More... | |
std::ptrdiff_t | GetCycles (int level=0) const |
Returns the current number of cycles for data at the specified refinement level and direction. More... | |
const SAMRAI::geom::CartesianGridGeometry & | GetGeometry (int level) const |
Returns the geometry object for the specified refinement level. More... | |
Observers | |
bool | LevelExists (int level) const noexcept |
Returns true if the data exists for the specified level number. More... | |
int | GetRatioToCoarserLevel (int level, Direction dir) const noexcept |
Returns the refinement ratio in the specified direction. More... | |
SAMRAI::hier::IntVector | GetRatioToCoarserLevel (int level) const noexcept |
Returns the refinement ratio for all directions. More... | |
Modifiers | |
void | ResetHierarchyConfiguration (std::shared_ptr< GriddingAlgorithm > gridding) |
Replaces the underlying gridding algorithm with the specified one. More... | |
void | ResetHierarchyConfiguration (int level=0) |
Whenever the gridding algorithm changes the data hierarchy this function will regrid all distributed helper variables managed by the context. More... | |
void | SetCycles (std::ptrdiff_t cycle, int level) |
Sets the cycle count for a specific level number and direction. More... | |
void | SetTimePoint (Duration t, int level) |
Sets the time point for a specific level number and direction. More... | |
Member functions relevant for the level integrator algorithm. | |
int | PreAdvanceLevel (int level_num, Duration dt, std::pair< int, int > subcycle) |
On each first subcycle this will regrid the data if neccessary. More... | |
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. More... | |
void | ApplyBoundaryCondition (int level, Direction dir) |
On each first subcycle this will regrid the data if neccessary. More... | |
void | FillGhostLayerTwoLevels (int level, int coarse) |
Fills the ghost layer of the scratch data and interpolates in the coarse fine layer. More... | |
void | FillGhostLayerSingleLevel (int level) |
Fills the ghost layer of the scratch data and does nothing in the coarse fine layer. More... | |
Duration | ComputeStableDt (int level, Direction dir) |
Returns a estimate for a stable time step size which can be taken for specified level number in direction dir. More... | |
void | ComputeNumericFluxes (int level, Duration dt, Direction dir) |
Fill the flux MultiFab with numeric fluxes based on current states in scratch. More... | |
void | UpdateConservatively (int level, Duration dt, Direction dir) |
Apply a conservative time update for each conservative variable on the specified level number and direction. More... | |
void | CompleteFromCons (int level, Duration dt) |
Reconstruct complete state variables from conservative ones. More... | |
void | AccumulateCoarseFineFluxes (int level, double time_scale, Direction dir) |
Accumulate fluxes on the coarse fine interfaces for a specified fine level number. More... | |
void | ApplyFluxCorrection (int fine, int coarse, Duration dt) |
Replace the coarse fluxes by accumulated fine fluxes on the coarse fine interfaces. More... | |
void | ResetCoarseFineFluxes (int fine, int coarse) |
Resets all accumulates fluxes to zero. More... | |
void | CoarsenConservatively (int fine, int coarse) |
Coarsen scratch data from a fine level number to a coarse level number. More... | |
Static Public Member Functions | |
static AuxialiaryDataDescription | RegisterVariables (const DataDescription &desc, int scratch_ghost_cell_width, int flux_ghost_cell_width) |
template<typename Method > | |
static AuxialiaryDataDescription | RegisterVariables (const DataDescription &desc, const Method &method) |
Private Types | |
using | RefineAlgorithm = SAMRAI::xfer::RefineAlgorithm |
using | RefineSchedule = SAMRAI::xfer::RefineSchedule |
using | CoarsenAlgorithm = SAMRAI::xfer::CoarsenAlgorithm |
using | CoarsenSchedule = SAMRAI::xfer::CoarsenSchedule |
Private Attributes | |
int | ghost_cell_width_ |
std::shared_ptr< GriddingAlgorithm > | gridding_ |
HyperbolicMethod | method_ |
AuxialiaryDataDescription | aux_desc_ |
std::vector< Duration > | time_points_ |
std::vector< Duration > | regrid_time_points_ |
std::vector< std::ptrdiff_t > | cycles_ |
std::shared_ptr< RefineAlgorithm > | fill_scratch_ |
std::shared_ptr< CoarsenAlgorithm > | coarsen_fluxes_ |
std::shared_ptr< CoarsenAlgorithm > | coarsen_scratch_ |
std::vector< std::shared_ptr< RefineSchedule > > | fill_scratch_two_level_schedule_ |
std::vector< std::shared_ptr< RefineSchedule > > | fill_scratch_one_level_schedule_ |
std::vector< std::shared_ptr< CoarsenSchedule > > | coarsen_scratch_schedule_ |
std::vector< std::shared_ptr< CoarsenSchedule > > | coarsen_fluxes_schedule_ |
std::vector< std::shared_ptr< SAMRAI::xfer::RefinePatchStrategy > > | boundaries_ |
This class is used by the HypebrolicSplitLevelIntegrator and delegates AMR related tasks to the AMReX library.
|
private |
|
private |
|
private |
|
private |
fub::samrai::IntegratorContext::IntegratorContext | ( | std::shared_ptr< GriddingAlgorithm > | gridding, |
HyperbolicMethod | method, | ||
AuxialiaryDataDescription | aux_desc | ||
) |
Constructs a context object from given a gridding algorithm and a numerical method.
|
default |
Deeply copies a context and all its distributed data for all MPI ranks.
|
defaultnoexcept |
Constructs a context object from given a gridding algorithm and a numerical method.
|
default |
Constructs a context object from given a gridding algorithm and a numerical method.
void fub::samrai::IntegratorContext::AccumulateCoarseFineFluxes | ( | int | level, |
double | time_scale, | ||
Direction | dir | ||
) |
Accumulate fluxes on the coarse fine interfaces for a specified fine level number.
void fub::samrai::IntegratorContext::ApplyBoundaryCondition | ( | int | level, |
Direction | dir | ||
) |
On each first subcycle this will regrid the data if neccessary.
void fub::samrai::IntegratorContext::ApplyFluxCorrection | ( | int | fine, |
int | coarse, | ||
Duration | dt | ||
) |
Replace the coarse fluxes by accumulated fine fluxes on the coarse fine interfaces.
void fub::samrai::IntegratorContext::CoarsenConservatively | ( | int | fine, |
int | coarse | ||
) |
Coarsen scratch data from a fine level number to a coarse level number.
void fub::samrai::IntegratorContext::CompleteFromCons | ( | int | level, |
Duration | dt | ||
) |
Reconstruct complete state variables from conservative ones.
Fill the flux MultiFab with numeric fluxes based on current states in scratch.
Returns a estimate for a stable time step size which can be taken for specified level number in direction dir.
void fub::samrai::IntegratorContext::CopyDataToScratch | ( | int | level | ) |
void fub::samrai::IntegratorContext::CopyScratchToData | ( | int | level | ) |
void fub::samrai::IntegratorContext::FillGhostLayerSingleLevel | ( | int | level | ) |
Fills the ghost layer of the scratch data and does nothing in the coarse fine layer.
void fub::samrai::IntegratorContext::FillGhostLayerTwoLevels | ( | int | level, |
int | coarse | ||
) |
Fills the ghost layer of the scratch data and interpolates in the coarse fine layer.
AnyBoundaryCondition& fub::samrai::IntegratorContext::GetBoundaryCondition | ( | ) |
Returns the current boundary condition for the specified level.
const AnyBoundaryCondition& fub::samrai::IntegratorContext::GetBoundaryCondition | ( | ) | const |
Returns the current boundary condition for the specified level.
|
noexcept |
std::ptrdiff_t fub::samrai::IntegratorContext::GetCycles | ( | int | level = 0 | ) | const |
Returns the current number of cycles for data at the specified refinement level and direction.
span<const int> fub::samrai::IntegratorContext::GetDataIds | ( | ) | const |
Returns the MultiFab associated with level data on the specifed level number.
span<const int> fub::samrai::IntegratorContext::GetFluxIds | ( | ) | const |
Returns the MultiFab associated with level data on the specifed level number.
const SAMRAI::geom::CartesianGridGeometry& fub::samrai::IntegratorContext::GetGeometry | ( | int | level | ) | const |
Returns the geometry object for the specified refinement level.
|
noexcept |
Returns a shared pointer to the underlying GriddingAlgorithm which owns the simulation.
|
noexcept |
Returns the MPI communicator which is associated with this context.
|
noexcept |
Returns a reference to const PatchHierarchy which is a member of the GriddingAlgorithm.
|
noexcept |
Returns a reference to PatchHierarchy which is a member of the GriddingAlgorithm.
SAMRAI::hier::PatchLevel& fub::samrai::IntegratorContext::GetPatchLevel | ( | int | level | ) |
Returns the MultiFab associated with level data on the specifed level number.
const SAMRAI::hier::PatchLevel& fub::samrai::IntegratorContext::GetPatchLevel | ( | int | level | ) | const |
Returns the MultiFab associated with level data on the specifed level number.
|
noexcept |
Returns the refinement ratio for all directions.
|
noexcept |
Returns the refinement ratio in the specified direction.
span<const int> fub::samrai::IntegratorContext::GetScratchIds | ( | ) | const |
Returns the MultiFab associated with level data on the specifed level number.
Duration fub::samrai::IntegratorContext::GetTimePoint | ( | int | level = 0 | ) | const |
Returns the current time level for data at the specified refinement level and direction.
|
noexcept |
Returns true if the data exists for the specified level number.
|
default |
Deeply copies a context and all its distributed data for all MPI ranks.
|
defaultnoexcept |
Constructs a context object from given a gridding algorithm and a numerical method.
Result<void, TimeStepTooLarge> fub::samrai::IntegratorContext::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.
int fub::samrai::IntegratorContext::PreAdvanceLevel | ( | int | level_num, |
Duration | dt, | ||
std::pair< int, int > | subcycle | ||
) |
On each first subcycle this will regrid the data if neccessary.
|
inlinestatic |
|
static |
void fub::samrai::IntegratorContext::ResetCoarseFineFluxes | ( | int | fine, |
int | coarse | ||
) |
Resets all accumulates fluxes to zero.
void fub::samrai::IntegratorContext::ResetHierarchyConfiguration | ( | int | level = 0 | ) |
Whenever the gridding algorithm changes the data hierarchy this function will regrid all distributed helper variables managed by the context.
[in] | level | The level number of the coarsest level which changed its shape. Regrid all levels finer than level. |
void fub::samrai::IntegratorContext::ResetHierarchyConfiguration | ( | std::shared_ptr< GriddingAlgorithm > | gridding | ) |
Replaces the underlying gridding algorithm with the specified one.
void fub::samrai::IntegratorContext::SetCycles | ( | std::ptrdiff_t | cycle, |
int | level | ||
) |
Sets the cycle count for a specific level number and direction.
void fub::samrai::IntegratorContext::SetTimePoint | ( | Duration | t, |
int | level | ||
) |
Sets the time point for a specific level number and direction.
Apply a conservative time update for each conservative variable on the specified level number and direction.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |