13 Initialise the overlap data on hanging faces from the coarser mesh
15 A hanging face is a face of a fine cell which sits on the face of a
16 coarser, unrefined cell. Peano does not store hanging faces. It creates
17 them whenever a mesh sweep enters an adjacent fine cell and destroys them
18 once the sweep leaves this cell again. The action set plugs into
19 createHangingFace(): It takes the overlap data of the coarse face which
20 the hanging face is part of and interpolates them onto the hanging face
21 (::toolbox::blockstructured::interpolateHaloLayer_AoS_...). Afterwards,
22 the half of the hanging face which belongs to the coarse cell holds
23 interpolated coarse data, so the fine cell can reconstruct its halo as
24 if its neighbour were a fine cell, too.
26 The face overlap has to be a 2MxNxN patch: M is the overlap, N the
27 number of volumes per patch axis.
36 The value of each entry is the suffix of the C++ routine
37 ::toolbox::blockstructured::interpolateHaloLayer_AoS_<suffix>().
39 - PiecewiseConstant copies the coarse value into all fine volumes
41 - Linear interpolates linearly along the face. As the coarse face
42 does not hold the coarse volumes beyond its two ends, the scheme
43 extrapolates constantly there. Linear extrapolation would be more
44 accurate, but it can produce unphysical values such as negative
45 densities next to steep gradients
46 (@ref toolbox::blockstructured::internal::createLinearInterpolationMatrix()).
50 PiecewiseConstant =
"piecewise_constant"
51 Linear =
"linear_with_constant_extrapolation"
53 TemplateCreateHangingFace = jinja2.Template(
55 logTraceInWith1Argument( "createHangingFace(...)---InterpolateHangingFaces", marker.toString() );
56 ::toolbox::blockstructured::interpolateHaloLayer_AoS_{{SCHEME}}(
61 coarseGridFaces{{FACE_NAME}}(marker.getSelectedFaceNumber()).value,
62 fineGridFace{{FACE_NAME}}.value
64 logTraceOut( "createHangingFace(...)---InterpolateHangingFaces" );
71 scheme:
"InterpolateHangingFaces.Scheme" =
None,
73 additional_includes: str =
"",
77 @param patch_overlap: peano4.api.datamodel.Patch
78 The face data which the action set interpolates. The data of the
79 coarse face are read, the data of the hanging face are written.
81 @param scheme: InterpolateHangingFaces.Scheme
82 Interpolation scheme. Defaults to Scheme.Linear.
85 C++ boolean expression over the hanging face's
86 peano4::datamanagement::FaceMarker marker.
88 @param additional_includes: str
89 Further include statements, e.g. required by the guard.
92 super().
__init__(descend_invocation_order=1, parallel=
False)
93 assert patch_overlap.dim[0] % 2 == 0, (
94 "Patch associated to face has to have even number of volumes along "
95 "the normal. Otherwise, it is not a symmetric overlap."
98 InterpolateHangingFaces.Scheme.Linear
if scheme
is None else scheme
102 "UNKNOWNS": patch_overlap.no_of_unknowns,
103 "DOFS_PER_AXIS": patch_overlap.dim[1],
104 "OVERLAP": patch_overlap.dim[0] // 2,
105 "FACE_NAME": patch_overlap.name,
106 "SCHEME": self.
scheme.value,
118 return " return std::vector< peano4::grid::GridControlEvent >();\n"
127 if operation_name == ActionSet.OPERATION_CREATE_HANGING_FACE:
132 if operation_name == ActionSet.OPERATION_CREATE_HANGING_FACE:
137 return __name__.replace(
".py",
"").replace(
".",
"_")
148#include "toolbox/blockstructured/Interpolation.h"
Initialise the overlap data on hanging faces from the coarser mesh.
get_action_set_name(self)
Return unique action set name.
get_body_of_prepareTraversal(self)
get_includes(self)
Return include statements that you need.
__init__(self, patch_overlap, "InterpolateHangingFaces.Scheme" scheme=None, str guard="true", str additional_includes="")
user_should_modify_template(self)
Is the user allowed to modify the output.
get_destructor_body(self)
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
get_attributes(self)
Return attributes as copied and pasted into the generated class.
get_constructor_body(self)
Define a tailored constructor body.
get_guard_of_operation(self, operation_name)
Return the guard of an operation.
get_body_of_unprepareTraversal(self)
TemplateCreateHangingFace
get_body_of_createGridControlEventsForNextTraversal(self)
Return the grid control events that this action set wants to trigger.
Action set (reactions to events)