Peano
CCZ4Solver.AbstractCCZ4Solver Class Reference

Dictionary which specifies the unknown names plus their cardinality. More...

Inheritance diagram for CCZ4Solver.AbstractCCZ4Solver:
Collaboration diagram for CCZ4Solver.AbstractCCZ4Solver:

Public Member Functions

def __init__ (self)
 
def enable_second_order (self)
 
def add_all_solver_constants (self)
 
def add_makefile_parameters (self, peano4_project, path_of_ccz4_application)
 
def add_tracer (self, name, coordinates, project, number_of_entries_between_two_db_flushes, data_delta_between_two_snapsots, time_delta_between_two_snapsots, clear_database_after_flush, tracer_unknowns=None)
 

Data Fields

 integer_constants
 
 double_constants
 
 Default_Time_Step_Size_Relaxation
 

Static Public Attributes

float Default_Time_Step_Size_Relaxation = 0.1
 

Private Member Functions

def _add_standard_includes (self)
 

Static Private Attributes

dictionary _FO_formulation_unknowns
 
dictionary _SO_formulation_unknowns
 

Detailed Description

Dictionary which specifies the unknown names plus their cardinality.

Abstract base class for any CCZ4 solver

Each CCZ4 solver inherits from this abstract base class which really only
defines some generic stuff such as the unknowns and includes that every
single solver will use.

The solver should, more or less, work out of the box, but you have to do
three things if you use a subclass:

1. If you use a CCZ4 solver, you will still have to add all the libraries to
   your Peano project such that the Makefile picks them up. For this, the
   solver offers an add_makefile_parameters().

2. You have to set the initial conditions via
my_solver.set_implementation(initial_conditions = " " "
for (int i=0; i<NumberOfUnknowns+NumberOfAuxiliaryVariables; i++) Q[i] = 0.0;
::applications::exahype2::ccz4::gaugeWave(Q, volumeCentre, 0);
" " ")
void gaugeWave(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &x, double t)

At this point, different CCZ4 solver variants might require different syntax. The term volumeCentre for example above is only defined in a finite volume ontext.

  1. Finally, you have to add domain-specific constants to the project. For this, call add_all_solver_constants(). See the comment below.

Further to that, you might want to have to set boundary conditions. By default, we do not set any boundary conditions. This works fine if periodic boundary conditions are used. But once you switch off periodic boundary conditions, you have to tell the solver how to treat the boundary. This is typically done via set_implementation(), too.

More complex scenarios

Setting particular implementations via set_implementation() is not always convenient or possible. You might want to add new functions to your classes, do something in the solver constructor, and so forth. If so, feel free to modify the file MySolverName.cpp which the tool generates. In this context, you might want to pass in

my_solver.set_implementation(initial_conditions = exahype2.solvers.PDETerms.User_Defined_Implementation,
refinement_criterion = exahype2.solvers.PDETerms.User_Defined_Implementation,
boundary_conditions=exahype2.solvers.PDETerms.User_Defined_Implementation
)

which ensures that you get the right hook-in methods generated when you invoke the Python script for the first time. These methods will contain todo comments for you. Subsequent runs of the Python API should not overwrite the solver implementation.

Constants

Each CCZ4 solver requires a minimal set of constants. These are represented by integer_constants and double_constants. Please augment these dictionaries. Eventually, you have to submit all the constants via add_all_solver_constants().

Has to be class attribute, as we need it in the constructor, i.e. before the abstract object is created.

Definition at line 8 of file CCZ4Solver.py.

Constructor & Destructor Documentation

◆ __init__()

def CCZ4Solver.AbstractCCZ4Solver.__init__ (   self)
    Constructor

    Initialise the two dictionaries with default values (which work).

Definition at line 128 of file CCZ4Solver.py.

Member Function Documentation

◆ _add_standard_includes()

◆ add_all_solver_constants()

def CCZ4Solver.AbstractCCZ4Solver.add_all_solver_constants (   self)
    Add domain-specific constants

    I need a couple of constants. I could either replace them directly
    within the Python snippets below, but I prefer here to go a different
    way and to export them as proper C++ constants.

    There are two ways to inject solver constants into Peano: We can either
    add them to the Makefile as global const expressions, or we can add
    them to the ExaHyPE2 solver. The latter is the route we go down here,
    as these constants logically belong to the solver and not to the project.

    This operation uses the parent class' add_solver_constants(). You still
    can use this operation to add further parameters. Or you can, as a user,
    always add new entries to integer_constants or double_constants and then
    call this routine rather than adding individual constants one by one.

Definition at line 187 of file CCZ4Solver.py.

References CCZ4Solver.AbstractCCZ4Solver.double_constants, and CCZ4Solver.AbstractCCZ4Solver.integer_constants.

Referenced by SBH.FVSolver.__init__().

Here is the caller graph for this function:

◆ add_makefile_parameters()

def CCZ4Solver.AbstractCCZ4Solver.add_makefile_parameters (   self,
  peano4_project,
  path_of_ccz4_application 
)
    Add include path and minimal required cpp files to makefile

    If you have multiple CCZ4 solvers, i.e. different solvers of CCZ4 or multiple
    instances of the CCZ4 type, please call this operation only once on one of
    your solvers. At the moment, I add hte following cpp files to the setup:

    - InitialValues.cpp
    - CCZ4Kernels.cpp
    - SecondOrderAuxiliaryVariablesReconstruction.cpp

    You can always add further files via
peano4_project.output.makefile.add_cpp_file( "mypath/myfile.cpp" )

Definition at line 216 of file CCZ4Solver.py.

◆ add_tracer()

def CCZ4Solver.AbstractCCZ4Solver.add_tracer (   self,
  name,
  coordinates,
  project,
  number_of_entries_between_two_db_flushes,
  data_delta_between_two_snapsots,
  time_delta_between_two_snapsots,
  clear_database_after_flush,
  tracer_unknowns = None 
)
    Add tracer to project

    Consult exahype2.tracer.DumpTracerIntoDatabase for an explanation of
    some of the arguments. Most of them are simply piped through to this
    class.

    The tracer is given a name and initial coordinates (list of three-tuples).
    We need to know the underlying project as well, as we have to add the
    tracing to the time stepping and the database update to the plotting.
project.add_action_set_to_timestepping(my_interpolation)
project.add_action_set_to_timestepping(exahype2.tracer.DumpTracerIntoDatabase(
particle_set=tracer_particles,
solver=self,
filename=name + "-" + self._name,
number_of_entries_between_two_db_flushes=number_of_entries_between_two_db_flushes,
output_precision=10,
data_delta_between_two_snapsots = data_delta_between_two_snapsots,
time_delta_between_two_snapsots = time_delta_between_two_snapsots,
clear_database_after_flush = True,
))

Reimplemented in CCZ4Solver.CCZ4Solver_RKDG_GlobalAdaptiveTimeStep, CCZ4Solver.CCZ4Solver_RKDG_GlobalAdaptiveTimeStepWithEnclaveTasking, CCZ4Solver.CCZ4Solver_FD4_SecondOrderFormulation_GlobalAdaptiveTimeStepWithEnclaveTasking, CCZ4Solver.CCZ4Solver_FD4_GlobalAdaptiveTimeStep, CCZ4Solver.CCZ4Solver_FD4_GlobalAdaptiveTimeStepWithEnclaveTasking, CCZ4Solver.CCZ4Solver_FV_GlobalAdaptiveTimeStepWithEnclaveTasking, and CCZ4Solver.CCZ4Solver_FV_GlobalAdaptiveTimeStep.

Definition at line 250 of file CCZ4Solver.py.

◆ enable_second_order()

def CCZ4Solver.AbstractCCZ4Solver.enable_second_order (   self)

Definition at line 158 of file CCZ4Solver.py.

References CCZ4Solver.AbstractCCZ4Solver.integer_constants.

Field Documentation

◆ _FO_formulation_unknowns

dictionary CCZ4Solver.AbstractCCZ4Solver._FO_formulation_unknowns
staticprivate

◆ _SO_formulation_unknowns

dictionary CCZ4Solver.AbstractCCZ4Solver._SO_formulation_unknowns
staticprivate
Initial value:
= {
"G",
"K",
"theta",
"Z",
"lapse",
"shift",
"b",
"traceK",
"phi",
}

Definition at line 114 of file CCZ4Solver.py.

Referenced by CCZ4Solver.CCZ4Solver_FD4_SecondOrderFormulation_GlobalAdaptiveTimeStepWithEnclaveTasking.__init__().

◆ Default_Time_Step_Size_Relaxation [1/2]

float CCZ4Solver.AbstractCCZ4Solver.Default_Time_Step_Size_Relaxation = 0.1
static

◆ Default_Time_Step_Size_Relaxation [2/2]

CCZ4Solver.AbstractCCZ4Solver.Default_Time_Step_Size_Relaxation

◆ double_constants

CCZ4Solver.AbstractCCZ4Solver.double_constants

◆ integer_constants

CCZ4Solver.AbstractCCZ4Solver.integer_constants

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