Peano
Loading...
Searching...
No Matches
DynamicMeshRefinementWithGradients.py
Go to the documentation of this file.
1# This file is part of the ExaHyPE2 project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3from .DynamicMeshRefinement import DynamicMeshRefinement
4
5
7 """!
8
9 Evaluate the gradient-based refinement criterion and collect the outcome
10 as refine and erase requests
11
12 The action set is the counterpart of
13 exahype2.api.blockstructured.DynamicMeshRefinement for solvers with an
14 exahype2.api.GradientRefinement PDE term. It differs only in what it
15 evaluates per volume: For each coordinate axis, it computes the left and
16 the right difference quotient of the solution
17 (@ref exahype2::fv::computeOneSidedGradient()) and hands each of them to
18 the term, i.e. it calls the term 2*Dimensions times per volume. Each
19 call starts from Keep.
20
21 A volume asks for a refinement if any call says Refine, and it may be
22 erased only if all calls say Erase. As the action set combines the
23 volumes of a cell the same way, it simply treats each call like the
24 outcome of one further volume. Everything else, i.e. the mesh size
25 bounds and the bookkeeping within the refinement service, is inherited.
26
27 """
28
29
30 TemplateEvaluateVolume = """
31 for (int normal=0; normal<Dimensions; normal++) {
32 for (int side=0; side<2; side++) {
33 double gradient[{{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}}];
34 ::exahype2::fv::computeOneSidedGradient(
35 fineGridCell{{UNKNOWN_IDENTIFIER}}.value,
36 {{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}},
37 {{NUMBER_OF_VOLUMES_PER_AXIS}},
38 volume,
39 normal,
40 side==1,
41 ::exahype2::fv::getVolumeLength( marker.h(), {{NUMBER_OF_VOLUMES_PER_AXIS}} ),
42 gradient
43 );
44 ::exahype2::RefinementCommand command = ::exahype2::RefinementCommand::Keep;
45 repositories::{{SOLVER_INSTANCE}}.refineEraseWithGradient(
46 gradient,
47 normal,
48 &command
49 );
50 anyVolumeWantsToRefine = anyVolumeWantsToRefine or command == ::exahype2::RefinementCommand::Refine;
51 allVolumesWantToErase = allVolumesWantToErase and command == ::exahype2::RefinementCommand::Erase;
52 }
53 }
54"""
55
57 return __name__.replace(".py", "").replace(".", "_")
Evaluate the gradient-based refinement criterion and collect the outcome as refine and erase requests...
Evaluate the point-wise refinement criterion and collect the outcome as refine and erase requests.