3from .AbstractFVActionSet
import AbstractFVActionSet
12 Fill a Finite Volume patch's initial condition, one volume at a time, by
13 calling the solver's exahype2.api.InitPointWisely PDE term once per
14 volume with that volume's centre.
16 Ported from the legacy, cell-wise
17 python/exahype2/solvers/fv/actionsets/InitialCondition.py, which is
18 handed a whole mesh cell's centre and extent, gridIsConstructed, and
19 fills the whole patch itself via the legacy initialCondition() PDE term.
20 This variant instead loops over the patch's volumes itself and calls
21 InitPointWisely's initPointWisely() once per volume, exactly like Flux
22 and MaxEigenvalue are evaluated once per degree of freedom - @see
23 exahype2.api.InitPointWisely.
25 Checkpoint-restart support (restart_from_checkpoint/loading_scheme in
26 the legacy version) has deliberately not been ported: it relies on
27 Solver attributes (CheckpointTimeStamp, CheckpointFilesOf...) that do
28 not exist in the new exahype2.api yet.
35 solver: exahype2.api.Solver
36 Has to have an InitPointWisely PDE term registered - @see
37 exahype2.api.fv.SetupSimulationOverRegularGrid, which asserts
38 this before it attaches an instance of this action set.
41 C++ boolean expression, evaluated per cell, guarding whether the
42 initial condition is (re)written for that cell.
44 Unlike the legacy, cell-wise version, this action set takes no
45 grid_is_constructed argument: InitPointWisely fills in a degree of
46 freedom from its coordinate alone, so - unlike the legacy
47 cell-wise initialCondition(), which had to know whether it was
48 still filling in default values during AMR mesh construction or
49 the real initial condition once the grid was done - it produces a
50 well-defined value regardless of how far mesh construction has
54 AbstractFVActionSet.__init__(self, solver)
60 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
62 "NUMBER_OF_VOLUMES_PER_AXIS": self.
_solver.numerical_scheme.patch_size,
63 "NUMBER_OF_UNKNOWNS": self.
_solver.unknowns,
64 "NUMBER_OF_AUXILIARY_VARIABLES": self.
_solver.auxiliary_variables,
65 "UNKNOWN_IDENTIFIER": self.
_solver._unknown_identifier(),
66 "SOLVER_INSTANCE": self.
_solver.get_name_of_global_instance(),
73 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
78 return __name__.replace(
".py",
"").replace(
".",
"_")
80 TemplateInitialCondition =
"""
81 logTraceIn( "touchCellFirstTime(...)---InitialCondition" );
82 // @todo Tim does it make sense to retire these loops and replace them with your compiler?
83 // It is only a minor thing, but maybe we can get rid of all of these dfor macros?
84 parallelDfor( volume, {{NUMBER_OF_VOLUMES_PER_AXIS}} ) {
85 int index = peano4::utils::dLinearised(volume,{{NUMBER_OF_VOLUMES_PER_AXIS}}) * ({{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}});
86 repositories::{{SOLVER_INSTANCE}}.initPointWisely(
87 ::exahype2::fv::getVolumeCentre( marker.x(), marker.h(), {{NUMBER_OF_VOLUMES_PER_AXIS}}, volume),
88 fineGridCell{{UNKNOWN_IDENTIFIER}}.value + index
92 logTraceOut( "touchCellFirstTime(...)---InitialCondition" );
Fill a Finite Volume patch's initial condition, one volume at a time, by calling the solver's exahype...
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
__init__(self, solver, guard)
solver: exahype2.api.Solver Has to have an InitPointWisely PDE term registered -
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
get_guard_of_operation(self, operation_name)
Return the guard of an operation.
str TemplateInitialCondition