Finite Volume Solver  prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
Classes | Public Attributes | Private Attributes | List of all members
fub::amrex::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  LevelData
 This class holds auxiliary data on each refinement level. More...
 

Public Member Functions

Constructors, Assignment Operators and Desctructor
 IntegratorContext (std::shared_ptr< GriddingAlgorithm > gridding, HyperbolicMethod method)
 Constructs a context object from given a gridding algorithm and a numerical method. More...
 
 IntegratorContext (std::shared_ptr< GriddingAlgorithm > gridding, HyperbolicMethod method, int cell_gcw, int face_gcw)
 Constructs a context object from given a gridding algorithm and a numerical method. More...
 
 IntegratorContext (const IntegratorContext &)
 Deeply copies a context and all its distributed data for all MPI ranks. More...
 
IntegratorContextoperator= (const IntegratorContext &)
 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...
 
virtual ~IntegratorContext ()=default
 Constructs a context object from given a gridding algorithm and a numerical method. More...
 
Member Accessors
int Rank () const noexcept
 Returns a shared pointer to the underlying GriddingAlgorithm which owns the simulation. 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
::amrex::MultiFab & GetData (int level)
 Returns the MultiFab associated with level data on the specifed level number. More...
 
const ::amrex::MultiFab & GetData (int level) const
 Returns the MultiFab associated with level data on the specifed level number. More...
 
::amrex::MultiFab & GetScratch (int level)
 Returns the MultiFab associated with level data with ghost cells on the specifed level number and direction. More...
 
const ::amrex::MultiFab & GetScratch (int level) const
 Returns the MultiFab associated with level data on the specifed level number. More...
 
::amrex::MultiFab & GetFluxes (int level, Direction dir)
 Returns the MultiFab associated with flux data on the specifed level number and direction. More...
 
const ::amrex::MultiFab & GetFluxes (int level, Direction dir) 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 ::amrex::GeometryGetGeometry (int level) const
 Returns the geometry object for the specified refinement level. More...
 
const std::shared_ptr< CounterRegistry > & GetCounterRegistry () const noexcept
 Returns a shared pointer to the counter registry. 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...
 
::amrex::IntVect GetRatioToCoarserLevel (int level) const noexcept
 Returns the refinement ratio for all directions. More...
 
Modifiers
virtual void ResetHierarchyConfiguration (std::shared_ptr< GriddingAlgorithm > gridding)
 Replaces the underlying gridding algorithm with the specified one. More...
 
virtual 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.
void PostAdvanceHierarchy ()
 Updates time point and cycle counter for the patch hierarchy. More...
 
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 CopyDataToScratch (int level_num)
 Updates time point and cycle counter for the patch hierarchy. More...
 
void CopyScratchToData (int level_num)
 Updates time point and cycle counter for the patch hierarchy. More...
 
void ApplyBoundaryCondition (int level, Direction dir)
 Applies the boundary condition for the scratch space on level level in direcition dir. More...
 
void ApplyBoundaryCondition (int level, Direction dir, AnyBoundaryCondition &bc)
 Updates time point and cycle counter for the patch hierarchy. More...
 
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. More...
 
void FillGhostLayerTwoLevels (int level, int coarse)
 Updates time point and cycle counter for the patch hierarchy. More...
 
void FillGhostLayerSingleLevel (int level, AnyBoundaryCondition &bc)
 Fills the ghost layer of the scratch data and does nothing in the coarse fine layer. More...
 
void FillGhostLayerSingleLevel (int level)
 Updates time point and cycle counter for the patch hierarchy. 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...
 

Public Attributes

bool count_per_level
 

Private Attributes

int cell_ghost_cell_width_
 
int face_ghost_cell_width_
 
std::shared_ptr< GriddingAlgorithmgridding_
 
std::vector< LevelDatadata_
 
HyperbolicMethod method_
 

Detailed Description

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

Constructor & Destructor Documentation

◆ IntegratorContext() [1/4]

fub::amrex::IntegratorContext::IntegratorContext ( std::shared_ptr< GriddingAlgorithm gridding,
HyperbolicMethod  method 
)

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

◆ IntegratorContext() [2/4]

fub::amrex::IntegratorContext::IntegratorContext ( std::shared_ptr< GriddingAlgorithm gridding,
HyperbolicMethod  method,
int  cell_gcw,
int  face_gcw 
)

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

◆ IntegratorContext() [3/4]

fub::amrex::IntegratorContext::IntegratorContext ( const IntegratorContext )

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

◆ IntegratorContext() [4/4]

fub::amrex::IntegratorContext::IntegratorContext ( IntegratorContext &&  )
defaultnoexcept

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

◆ ~IntegratorContext()

virtual fub::amrex::IntegratorContext::~IntegratorContext ( )
virtualdefault

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

Member Function Documentation

◆ AccumulateCoarseFineFluxes()

void fub::amrex::IntegratorContext::AccumulateCoarseFineFluxes ( int  level,
double  time_scale,
Direction  dir 
)

Accumulate fluxes on the coarse fine interfaces for a specified fine level number.

◆ ApplyBoundaryCondition() [1/2]

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

Applies the boundary condition for the scratch space on level level in direcition dir.

Parameters
levelThe refinement level on which the boundary condition shall be used.

◆ ApplyBoundaryCondition() [2/2]

void fub::amrex::IntegratorContext::ApplyBoundaryCondition ( int  level,
Direction  dir,
AnyBoundaryCondition bc 
)

Updates time point and cycle counter for the patch hierarchy.

◆ ApplyFluxCorrection()

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

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

◆ CoarsenConservatively()

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

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

◆ CompleteFromCons()

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

Reconstruct complete state variables from conservative ones.

◆ ComputeNumericFluxes()

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

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

◆ ComputeStableDt()

Duration fub::amrex::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::amrex::IntegratorContext::CopyDataToScratch ( int  level_num)

Updates time point and cycle counter for the patch hierarchy.

◆ CopyScratchToData()

void fub::amrex::IntegratorContext::CopyScratchToData ( int  level_num)

Updates time point and cycle counter for the patch hierarchy.

◆ FillGhostLayerSingleLevel() [1/2]

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

Updates time point and cycle counter for the patch hierarchy.

◆ FillGhostLayerSingleLevel() [2/2]

void fub::amrex::IntegratorContext::FillGhostLayerSingleLevel ( int  level,
AnyBoundaryCondition bc 
)

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

◆ FillGhostLayerTwoLevels() [1/2]

void fub::amrex::IntegratorContext::FillGhostLayerTwoLevels ( int  level,
AnyBoundaryCondition fbc,
int  coarse,
AnyBoundaryCondition cbc 
)

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

◆ FillGhostLayerTwoLevels() [2/2]

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

Updates time point and cycle counter for the patch hierarchy.

◆ GetCounterRegistry()

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

Returns a shared pointer to the counter registry.

◆ GetCycles()

std::ptrdiff_t fub::amrex::IntegratorContext::GetCycles ( int  level = 0) const

Returns the current number of cycles for data at the specified refinement level and direction.

◆ GetData() [1/2]

::amrex::MultiFab& fub::amrex::IntegratorContext::GetData ( int  level)

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

◆ GetData() [2/2]

const ::amrex::MultiFab& fub::amrex::IntegratorContext::GetData ( int  level) const

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

◆ GetFluxes() [1/2]

::amrex::MultiFab& fub::amrex::IntegratorContext::GetFluxes ( int  level,
Direction  dir 
)

Returns the MultiFab associated with flux data on the specifed level number and direction.

◆ GetFluxes() [2/2]

const ::amrex::MultiFab& fub::amrex::IntegratorContext::GetFluxes ( int  level,
Direction  dir 
) const

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

◆ GetGeometry()

const ::amrex::Geometry& fub::amrex::IntegratorContext::GetGeometry ( int  level) const

Returns the geometry object for the specified refinement level.

◆ GetGriddingAlgorithm()

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

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

◆ GetMpiCommunicator()

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

Returns the MPI communicator which is associated with this context.

◆ GetPatchHierarchy() [1/2]

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

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

◆ GetPatchHierarchy() [2/2]

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

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

◆ GetRatioToCoarserLevel() [1/2]

::amrex::IntVect fub::amrex::IntegratorContext::GetRatioToCoarserLevel ( int  level) const
noexcept

Returns the refinement ratio for all directions.

◆ GetRatioToCoarserLevel() [2/2]

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

Returns the refinement ratio in the specified direction.

◆ GetScratch() [1/2]

::amrex::MultiFab& fub::amrex::IntegratorContext::GetScratch ( int  level)

Returns the MultiFab associated with level data with ghost cells on the specifed level number and direction.

◆ GetScratch() [2/2]

const ::amrex::MultiFab& fub::amrex::IntegratorContext::GetScratch ( int  level) const

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

◆ GetTimePoint()

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

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

◆ LevelExists()

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

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

◆ operator=() [1/2]

IntegratorContext& fub::amrex::IntegratorContext::operator= ( const IntegratorContext )

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

◆ operator=() [2/2]

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

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

◆ PostAdvanceHierarchy()

void fub::amrex::IntegratorContext::PostAdvanceHierarchy ( )

Updates time point and cycle counter for the patch hierarchy.

◆ PostAdvanceLevel()

Result<void, TimeStepTooLarge> fub::amrex::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::amrex::IntegratorContext::PreAdvanceLevel ( int  level_num,
Duration  dt,
std::pair< int, int >  subcycle 
)

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

Returns
Returns the coarsest level that changed. This function returns the maximum number of levels if no change happened.

◆ Rank()

int fub::amrex::IntegratorContext::Rank ( ) const
noexcept

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

◆ ResetCoarseFineFluxes()

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

Resets all accumulates fluxes to zero.

◆ ResetHierarchyConfiguration() [1/2]

virtual void fub::amrex::IntegratorContext::ResetHierarchyConfiguration ( int  level = 0)
virtual

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.

Reimplemented in fub::amrex::CompressibleAdvectionIntegratorContext.

◆ ResetHierarchyConfiguration() [2/2]

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

Replaces the underlying gridding algorithm with the specified one.

Reimplemented in fub::amrex::CompressibleAdvectionIntegratorContext.

◆ SetCycles()

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

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

◆ SetTimePoint()

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

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

◆ UpdateConservatively()

void fub::amrex::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

◆ cell_ghost_cell_width_

int fub::amrex::IntegratorContext::cell_ghost_cell_width_
private

◆ count_per_level

bool fub::amrex::IntegratorContext::count_per_level

◆ data_

std::vector<LevelData> fub::amrex::IntegratorContext::data_
private

◆ face_ghost_cell_width_

int fub::amrex::IntegratorContext::face_ghost_cell_width_
private

◆ gridding_

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

◆ method_

HyperbolicMethod fub::amrex::IntegratorContext::method_
private

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