Peano
Loading...
Searching...
No Matches
exahype2 Namespace Reference

For the generic kernels that I use here most of the time. More...

Namespaces

namespace  dg
 
namespace  elastic
 
namespace  enumerator
 
namespace  ExaHyPEMain
 
namespace  fd
 
namespace  fv
 
namespace  grid
 
namespace  internal
 
namespace  postprocessing
 
namespace  Project
 
namespace  solvers
 
namespace  symhype
 
namespace  tracer
 

Data Structures

class  CellAccess
 Cell access class. More...
 
struct  CellData
 Representation of a number of cells which contains all information that's required to process the stored patches or polynomial shape functions (given you know the semantics of the data). More...
 
class  EnclaveBookkeeping
 Enclave bookkeeping. More...
 
class  EnclaveTask
 Base class for all enclave tasks. More...
 
class  LoadBalancingConfiguration
 ExaHyPE 2-specific load balancing configuration. More...
 
class  PlotFilter
 
class  RefinementControl
 Manage refine/erase requests within ExaHyPE 2. More...
 
class  RefinementControlService
 
class  Solver
 
struct  VolumeIndex
 A lot of the loop routines expect a voxel (or face) index which is a vector over integers. More...
 
struct  VolumeIndex< 0, Args... >
 

Enumerations

enum class  PrecisionCommand {
  Long_double = sizeof(long double) , Double = sizeof(double) , Single = sizeof(float) , Float = Single ,
  Half = sizeof(float) / 2 , Float16_t = Half , FP16 = Half , Bfloat = -1 ,
  Bfloat16_t = Bfloat , BF16 = Bfloat , Custom
}
 
enum class  RefinementCommand { Keep , Refine , Erase }
 

Functions

PrecisionCommand getDefaultPrecisionCommand ()
 The default is double as this is the highest precision available per default.
 
RefinementCommand getDefaultRefinementCommand ()
 The default is coarsen as this is the lowest priority command.
 
template<typename CellLabel , typename FaceLabel >
double getMinTimeStampOfNeighboursAhead (const CellLabel &cellLabel, const peano4::datamanagement::FaceEnumerator< FaceLabel > &faceLabelEnumerator)
 Similar to getMinTimeStampOfNeighbours(), but we minimise only over those neighbours that are actually ahead.
 
template<typename CellLabel , typename FaceLabel >
bool runTimeStepOnCell (const CellLabel &cellLabel, const peano4::datamanagement::FaceEnumerator< FaceLabel > &faceLabelEnumerator, double globalMinTimeStamp)
 Determine whether to run a time step on a cell by analysing the neighbouring cells' timestamp.
 
template<typename CellLabel , typename FaceLabel >
double removeTimeStepAccumulationErrorsFromCell (const CellLabel &cellLabel, const peano4::datamanagement::FaceEnumerator< FaceLabel > &faceLabelEnumerator, double timeStepSize)
 Remove accumulation errors from cell time stamps.
 
std::pair< double, doublegetInterpolationWeights (double oldTimeStampOnFace, double newTimeStampOnFace, double cellTimeStamp)
 
double discretiseAndTruncateTimeStepSizes (double cellTimeStepSize, double maxGlobalTimeStepSize, int discretisationStepsSize)
 Discretise (bucket) time step sizes and truncate it.
 
tarch::tests::TestCasegetUnitTests ()
 Please destroy after usage.
 
void setDefaultLogStatements ()
 
template<class... Args>
auto volumeIndex (Args... args)
 

Variables

bool havenumpy = False
 
bool havempmath = False
 
bool havesympy = False
 
bool havematplotlib = False
 

Detailed Description

For the generic kernels that I use here most of the time.

Enumeration Type Documentation

◆ PrecisionCommand

enum class exahype2::PrecisionCommand
strong
Enumerator
Long_double 
Double 
Single 
Float 
Half 
Float16_t 
FP16 
Bfloat 
Bfloat16_t 
BF16 
Custom 

Definition at line 6 of file PrecisionControl.h.

◆ RefinementCommand

enum class exahype2::RefinementCommand
strong
Enumerator
Keep 
Refine 
Erase 

Definition at line 13 of file RefinementControl.h.

Function Documentation

◆ discretiseAndTruncateTimeStepSizes()

double exahype2::discretiseAndTruncateTimeStepSizes ( double cellTimeStepSize,
double maxGlobalTimeStepSize,
int discretisationStepsSize )

Discretise (bucket) time step sizes and truncate it.

This routine is used by any local time stepping. The idea is that we first mimick subcycling: Let there be a global max time step size. We assume this one arises on the coarsest mesh level. So patches either do this time step or they do a time step that is \( 3^{-k} \) that size.

Pitfalls

We expect a min time step size that we use globally. We find the biggest \( discretisationSteps^k \cdot minGlobalTimeStepSize < cellTimeStepSize \) value through k which still meets the stability of cellTimeStepSize. We then return this value.

Truncation

If the eigenvalues become very small within a cell, we end up with huge time step sizes. This should not happen. So I expect the global time step size (largest value) and truncate the time step size in any case by this one.

Decreasing time step sizes

I use the global minimal time step size to kick off the analysis. This fails if the admissible global time step size shrinks over time. Therefore, the cell's time step size can be smaller than the globally admissible time step size. It simply means that the global time step size is shrinking and that the argument we get is lagging behind as we haven't finished the current time step yet.

Parameters
discretisationStepsPass in zero to allow a totally anarchic time stepping. Use one to construct subcycling without a re-adoption of the time step sizes or something negative to switch the bucketing off.
maxGlobalTimeStepSizeMaximum global time step size (of previous time step). I use this one to truncate too big time step sizes. Overall, I expect the time step size not to grow by more than 10 percent.
cellTimeStepSizeTime step size the patch would like to pick.

Definition at line 30 of file TimeStepping.cpp.

References _log, tarch::la::greater(), and logDebug.

Here is the call graph for this function:

◆ getDefaultPrecisionCommand()

exahype2::PrecisionCommand exahype2::getDefaultPrecisionCommand ( )

The default is double as this is the highest precision available per default.

Definition at line 3 of file PrecisionControl.cpp.

References Double.

◆ getDefaultRefinementCommand()

exahype2::RefinementCommand exahype2::getDefaultRefinementCommand ( )

The default is coarsen as this is the lowest priority command.

Definition at line 8 of file RefinementControl.cpp.

References Erase.

◆ getInterpolationWeights()

std::pair< double, double > exahype2::getInterpolationWeights ( double oldTimeStampOnFace,
double newTimeStampOnFace,
double cellTimeStamp )

A posteriori fixes of time stamps

I'm afraid of accumulation errors in the time stamps for the small cells which might end up lacking behind or running ahead. I can recognise such situations by very small weights for the old time snapshot. However, I don't fix it here. For fixing such a divergence, I rely on an explicit cleanup later on.

Parameters
cellTimeStampThis is an in-out parameter, as we can adopt the stamp size to avoid the accummulation of rounding errors.
Returns
Weight of (old,new) data.

Definition at line 8 of file TimeStepping.cpp.

References _log, assertion4, assertion5, tarch::la::equals(), tarch::la::greaterEquals(), logDebug, and tarch::la::smallerEquals().

Here is the call graph for this function:

◆ getMinTimeStampOfNeighboursAhead()

template<typename CellLabel , typename FaceLabel >
double exahype2::getMinTimeStampOfNeighboursAhead ( const CellLabel & cellLabel,
const peano4::datamanagement::FaceEnumerator< FaceLabel > & faceLabelEnumerator )

Similar to getMinTimeStampOfNeighbours(), but we minimise only over those neighbours that are actually ahead.

If no neighbour is ahead or one lags behind, we return the time stamp of cellLabel.

Using code/algorithms

Local timestepping codes can run into situations where the eigenvalue per cell is zero. This means that nothing happens in such cell. Therefore, the cell cannot advance in time. We don't know how far we can/should march. In this case, ExaHyPE offers two strategies: We can use the global admissible time step size, i.e. the global maximum eigenvalue, to determine a time step size; or we can see whether one of the neighbours is ahead and catch up.

The former method leads to a staircase pattern, as some cells where nothing happens race forward in time. A description of this behaviour is found in the Python routine referenced below.

Deadlocks

I've seen multiple cases where

See also
exahype2.solvers.fv.kernels.create_compute_new_time_step_size_kernel_for_local_time_stepping

Definition at line 61 of file TimeStepping.h.

References assertion, tarch::la::greater(), and tarch::la::smaller().

Here is the call graph for this function:

◆ getUnitTests()

tarch::tests::TestCase * exahype2::getUnitTests ( )

Please destroy after usage.

Definition at line 18 of file UnitTests.cpp.

References tarch::tests::TreeTestCaseCollection::addTestCase().

Referenced by main(), and runTests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeTimeStepAccumulationErrorsFromCell()

template<typename CellLabel , typename FaceLabel >
double exahype2::removeTimeStepAccumulationErrorsFromCell ( const CellLabel & cellLabel,
const peano4::datamanagement::FaceEnumerator< FaceLabel > & faceLabelEnumerator,
double timeStepSize )

Remove accumulation errors from cell time stamps.

If we add time step sizes to the time stamp over and over again, it is very likely that the time stamps at resolution boundaries do not match at one point. If we use subcycling, 3xdt/3 usually does not equal the dt of a big cell. So it makes sense to amend the time step sizes slightly to help us to synchronise time stamps between cells, i.e. to avoid that they are off by a tiny bit and hence mess up the time stepping.

So what I do first of all is to check if the current (update) cell time stamp does equal a neighbour. If there are multiple of matching neighbours, I pick the one with the biggest time stamp. This check for equality is a double precision check which should use relative quantities, as time stamps can be arbitrarily large. So once I find a matching time stamp, I return this time stamp rather than the current time step size and, hence, sync the current time step size with the neighbours. This can mean that I reduce or increase the time step size slightly, i.e. I assume that enough slack is built into the chosen time step size such that a tiny increase does not blow up the result.

Relative accuracy

If two time stamps are equal depends on the magnutide of the time step size. It does not matter what the time stamps are, as any "rounding" decision should be time translation invariant. However, if I have a large time step size, then I'd be happy to alter it more rigorously than for a stiff problem with tiny time step sizes. Overall, I accept around one percent of the time step sizes as acceptable alteration of the outcome.

Usage of routine within local time stepping

If we have subcycling, then we know that timeStepSize is never zero, as we use the largest (original) eigenvalue within the system and derive the levels' time step sizes from there. Things are different with local time stepping, where each cell can have its own time step size. If a cell has a size of zero, then we always should derive the admissible dt from the neighbours.

See also
getMinTimeStampOfNeighboursAhead() for a discussion how to make zero eigenvalue patches catch up over time.
Parameters
timeStepSizeTime step size the code would wish to use
Returns
Time step size the code should use eventually

Definition at line 200 of file TimeStepping.h.

References _log, assertion2, tarch::la::equals(), tarch::la::greaterEquals(), logDebug, and tarch::la::NUMERICAL_ZERO_DIFFERENCE.

Here is the call graph for this function:

◆ runTimeStepOnCell()

template<typename CellLabel , typename FaceLabel >
bool exahype2::runTimeStepOnCell ( const CellLabel & cellLabel,
const peano4::datamanagement::FaceEnumerator< FaceLabel > & faceLabelEnumerator,
double globalMinTimeStamp )

Determine whether to run a time step on a cell by analysing the neighbouring cells' timestamp.

These timestamps are stored within the face labels. We update a cell if all the neighbours are at the same time stamp or ahead.

See also
removeTimeStepAccumulationErrorsFromCell() for a discussion of precisions we use for the checks above

For some reason that I haven't understood completely yet, the above decision pattern can still lead to a deadlock where no cell in the global domain does advance in time. Which is really weird, as there always should be a global minimum. My guess is that something along the AMR boundaries does not work properly.

Parameters
cellLabel

Definition at line 132 of file TimeStepping.h.

References tarch::la::equals(), exahype2::internal::getMinTimeStampOfNeighbours(), and tarch::la::greaterEquals().

Here is the call graph for this function:

◆ setDefaultLogStatements()

◆ volumeIndex()

Variable Documentation

◆ havematplotlib

bool exahype2.havematplotlib = False

Definition at line 42 of file __init__.py.

◆ havempmath

bool exahype2.havempmath = False

Definition at line 19 of file __init__.py.

◆ havenumpy

bool exahype2.havenumpy = False

Definition at line 10 of file __init__.py.

◆ havesympy

bool exahype2.havesympy = False

Definition at line 32 of file __init__.py.