Finite Volume Solver  prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
fub::samrai::IntegratorContext Class Reference

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...
 
IntegratorContextoperator= (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...
 
IntegratorContextoperator= (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 AnyBoundaryConditionGetBoundaryCondition () const
 Returns the current boundary condition for the specified level. More...
 
AnyBoundaryConditionGetBoundaryCondition ()
 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 PatchHierarchyGetPatchHierarchy () const noexcept
 Returns a reference to const PatchHierarchy which is a member of the GriddingAlgorithm. More...
 
PatchHierarchyGetPatchHierarchy () 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, TimeStepTooLargePostAdvanceLevel (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< GriddingAlgorithmgridding_
 
HyperbolicMethod method_
 
AuxialiaryDataDescription aux_desc_
 
std::vector< Durationtime_points_
 
std::vector< Durationregrid_time_points_
 
std::vector< std::ptrdiff_t > cycles_
 
std::shared_ptr< RefineAlgorithmfill_scratch_
 
std::shared_ptr< CoarsenAlgorithmcoarsen_fluxes_
 
std::shared_ptr< CoarsenAlgorithmcoarsen_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_
 

Detailed Description

This class is used by the HypebrolicSplitLevelIntegrator and delegates AMR related tasks to the AMReX library.

Member Typedef Documentation

◆ CoarsenAlgorithm

using fub::samrai::IntegratorContext::CoarsenAlgorithm = SAMRAI::xfer::CoarsenAlgorithm
private

◆ CoarsenSchedule

using fub::samrai::IntegratorContext::CoarsenSchedule = SAMRAI::xfer::CoarsenSchedule
private

◆ RefineAlgorithm

using fub::samrai::IntegratorContext::RefineAlgorithm = SAMRAI::xfer::RefineAlgorithm
private

◆ RefineSchedule

using fub::samrai::IntegratorContext::RefineSchedule = SAMRAI::xfer::RefineSchedule
private

Constructor & Destructor Documentation

◆ IntegratorContext() [1/3]

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.

◆ IntegratorContext() [2/3]

fub::samrai::IntegratorContext::IntegratorContext ( const IntegratorContext )
default

Deeply copies a context and all its distributed data for all MPI ranks.

◆ IntegratorContext() [3/3]

fub::samrai::IntegratorContext::IntegratorContext ( IntegratorContext &&  )
defaultnoexcept

Constructs a context object from given a gridding algorithm and a numerical method.

◆ ~IntegratorContext()

fub::samrai::IntegratorContext::~IntegratorContext ( )
default

Constructs a context object from given a gridding algorithm and a numerical method.

Member Function Documentation

◆ AccumulateCoarseFineFluxes()

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.

◆ ApplyBoundaryCondition()

void fub::samrai::IntegratorContext::ApplyBoundaryCondition ( int  level,
Direction  dir 
)

On each first subcycle this will regrid the data if neccessary.

◆ ApplyFluxCorrection()

void fub::samrai::IntegratorContext::ApplyFluxCorrection ( int  fine,
int  coarse,
Duration  dt 
)

Replace the coarse fluxes by accumulated fine fluxes on the coarse fine interfaces.

◆ CoarsenConservatively()

void fub::samrai::IntegratorContext::CoarsenConservatively ( int  fine,
int  coarse 
)

Coarsen scratch data from a fine level number to a coarse level number.

◆ CompleteFromCons()

void fub::samrai::IntegratorContext::CompleteFromCons ( int  level,
Duration  dt 
)

Reconstruct complete state variables from conservative ones.

◆ ComputeNumericFluxes()

void fub::samrai::IntegratorContext::ComputeNumericFluxes ( int  level,
Duration  dt,
Direction  dir 
)

Fill the flux MultiFab with numeric fluxes based on current states in scratch.

◆ ComputeStableDt()

Duration fub::samrai::IntegratorContext::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.

◆ CopyDataToScratch()

void fub::samrai::IntegratorContext::CopyDataToScratch ( int  level)

◆ CopyScratchToData()

void fub::samrai::IntegratorContext::CopyScratchToData ( int  level)

◆ FillGhostLayerSingleLevel()

void fub::samrai::IntegratorContext::FillGhostLayerSingleLevel ( int  level)

Fills the ghost layer of the scratch data and does nothing in the coarse fine layer.

◆ FillGhostLayerTwoLevels()

void fub::samrai::IntegratorContext::FillGhostLayerTwoLevels ( int  level,
int  coarse 
)

Fills the ghost layer of the scratch data and interpolates in the coarse fine layer.

◆ GetBoundaryCondition() [1/2]

AnyBoundaryCondition& fub::samrai::IntegratorContext::GetBoundaryCondition ( )

Returns the current boundary condition for the specified level.

◆ GetBoundaryCondition() [2/2]

const AnyBoundaryCondition& fub::samrai::IntegratorContext::GetBoundaryCondition ( ) const

Returns the current boundary condition for the specified level.

◆ GetCounterRegistry()

const std::shared_ptr<CounterRegistry>& fub::samrai::IntegratorContext::GetCounterRegistry ( ) const
noexcept

◆ GetCycles()

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.

◆ GetDataIds()

span<const int> fub::samrai::IntegratorContext::GetDataIds ( ) const

Returns the MultiFab associated with level data on the specifed level number.

◆ GetFluxIds()

span<const int> fub::samrai::IntegratorContext::GetFluxIds ( ) const

Returns the MultiFab associated with level data on the specifed level number.

◆ GetGeometry()

const SAMRAI::geom::CartesianGridGeometry& fub::samrai::IntegratorContext::GetGeometry ( int  level) const

Returns the geometry object for the specified refinement level.

◆ GetGriddingAlgorithm()

const std::shared_ptr<GriddingAlgorithm>& fub::samrai::IntegratorContext::GetGriddingAlgorithm ( ) const
noexcept

Returns a shared pointer to the underlying GriddingAlgorithm which owns the simulation.

◆ GetMpiCommunicator()

MPI_Comm fub::samrai::IntegratorContext::GetMpiCommunicator ( ) const
noexcept

Returns the MPI communicator which is associated with this context.

◆ GetPatchHierarchy() [1/2]

const PatchHierarchy& fub::samrai::IntegratorContext::GetPatchHierarchy ( ) const
noexcept

Returns a reference to const PatchHierarchy which is a member of the GriddingAlgorithm.

◆ GetPatchHierarchy() [2/2]

PatchHierarchy& fub::samrai::IntegratorContext::GetPatchHierarchy ( )
noexcept

Returns a reference to PatchHierarchy which is a member of the GriddingAlgorithm.

◆ GetPatchLevel() [1/2]

SAMRAI::hier::PatchLevel& fub::samrai::IntegratorContext::GetPatchLevel ( int  level)

Returns the MultiFab associated with level data on the specifed level number.

◆ GetPatchLevel() [2/2]

const SAMRAI::hier::PatchLevel& fub::samrai::IntegratorContext::GetPatchLevel ( int  level) const

Returns the MultiFab associated with level data on the specifed level number.

◆ GetRatioToCoarserLevel() [1/2]

SAMRAI::hier::IntVector fub::samrai::IntegratorContext::GetRatioToCoarserLevel ( int  level) const
noexcept

Returns the refinement ratio for all directions.

◆ GetRatioToCoarserLevel() [2/2]

int fub::samrai::IntegratorContext::GetRatioToCoarserLevel ( int  level,
Direction  dir 
) const
noexcept

Returns the refinement ratio in the specified direction.

◆ GetScratchIds()

span<const int> fub::samrai::IntegratorContext::GetScratchIds ( ) const

Returns the MultiFab associated with level data on the specifed level number.

◆ GetTimePoint()

Duration fub::samrai::IntegratorContext::GetTimePoint ( int  level = 0) const

Returns the current time level for data at the specified refinement level and direction.

◆ LevelExists()

bool fub::samrai::IntegratorContext::LevelExists ( int  level) const
noexcept

Returns true if the data exists for the specified level number.

◆ operator=() [1/2]

IntegratorContext& fub::samrai::IntegratorContext::operator= ( const IntegratorContext )
default

Deeply copies a context and all its distributed data for all MPI ranks.

◆ operator=() [2/2]

IntegratorContext& fub::samrai::IntegratorContext::operator= ( IntegratorContext &&  )
defaultnoexcept

Constructs a context object from given a gridding algorithm and a numerical method.

◆ PostAdvanceLevel()

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.

◆ PreAdvanceLevel()

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.

◆ RegisterVariables() [1/2]

template<typename Method >
static AuxialiaryDataDescription fub::samrai::IntegratorContext::RegisterVariables ( const DataDescription desc,
const Method &  method 
)
inlinestatic

◆ RegisterVariables() [2/2]

static AuxialiaryDataDescription fub::samrai::IntegratorContext::RegisterVariables ( const DataDescription desc,
int  scratch_ghost_cell_width,
int  flux_ghost_cell_width 
)
static

◆ ResetCoarseFineFluxes()

void fub::samrai::IntegratorContext::ResetCoarseFineFluxes ( int  fine,
int  coarse 
)

Resets all accumulates fluxes to zero.

◆ ResetHierarchyConfiguration() [1/2]

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.

Parameters
[in]levelThe level number of the coarsest level which changed its shape. Regrid all levels finer than level.

◆ ResetHierarchyConfiguration() [2/2]

void fub::samrai::IntegratorContext::ResetHierarchyConfiguration ( std::shared_ptr< GriddingAlgorithm gridding)

Replaces the underlying gridding algorithm with the specified one.

◆ SetCycles()

void fub::samrai::IntegratorContext::SetCycles ( std::ptrdiff_t  cycle,
int  level 
)

Sets the cycle count for a specific level number and direction.

◆ SetTimePoint()

void fub::samrai::IntegratorContext::SetTimePoint ( Duration  t,
int  level 
)

Sets the time point for a specific level number and direction.

◆ UpdateConservatively()

void fub::samrai::IntegratorContext::UpdateConservatively ( int  level,
Duration  dt,
Direction  dir 
)

Apply a conservative time update for each conservative variable on the specified level number and direction.

Member Data Documentation

◆ aux_desc_

AuxialiaryDataDescription fub::samrai::IntegratorContext::aux_desc_
private

◆ boundaries_

std::vector<std::shared_ptr<SAMRAI::xfer::RefinePatchStrategy> > fub::samrai::IntegratorContext::boundaries_
private

◆ coarsen_fluxes_

std::shared_ptr<CoarsenAlgorithm> fub::samrai::IntegratorContext::coarsen_fluxes_
private

◆ coarsen_fluxes_schedule_

std::vector<std::shared_ptr<CoarsenSchedule> > fub::samrai::IntegratorContext::coarsen_fluxes_schedule_
private

◆ coarsen_scratch_

std::shared_ptr<CoarsenAlgorithm> fub::samrai::IntegratorContext::coarsen_scratch_
private

◆ coarsen_scratch_schedule_

std::vector<std::shared_ptr<CoarsenSchedule> > fub::samrai::IntegratorContext::coarsen_scratch_schedule_
private

◆ cycles_

std::vector<std::ptrdiff_t> fub::samrai::IntegratorContext::cycles_
private

◆ fill_scratch_

std::shared_ptr<RefineAlgorithm> fub::samrai::IntegratorContext::fill_scratch_
private

◆ fill_scratch_one_level_schedule_

std::vector<std::shared_ptr<RefineSchedule> > fub::samrai::IntegratorContext::fill_scratch_one_level_schedule_
private

◆ fill_scratch_two_level_schedule_

std::vector<std::shared_ptr<RefineSchedule> > fub::samrai::IntegratorContext::fill_scratch_two_level_schedule_
private

◆ ghost_cell_width_

int fub::samrai::IntegratorContext::ghost_cell_width_
private

◆ gridding_

std::shared_ptr<GriddingAlgorithm> fub::samrai::IntegratorContext::gridding_
private

◆ method_

HyperbolicMethod fub::samrai::IntegratorContext::method_
private

◆ regrid_time_points_

std::vector<Duration> fub::samrai::IntegratorContext::regrid_time_points_
private

◆ time_points_

std::vector<Duration> fub::samrai::IntegratorContext::time_points_
private

The documentation for this class was generated from the following file: