Peano
PMLDynamicRuptureElastic.py
Go to the documentation of this file.
2  return """
3 //This term is not present in the Zenodo repository at https://zenodo.org/records/6386282
4 //however it is present in Leo's "phd" tag at https://gitlab.lrz.de/ExaHyPE-Seismic/ExaSeis/-/blob/leo/phd/Applications/DynamicRupture/PMLSlipWeakening/PMLSlipWeakening.cpp?ref_type=tags#L468
5 // We are working on the assumption that it should be in there.
6 
7  S[9] = -Q[0];
8  S[10] = -Q[1];
9  S[11] = -Q[2];
10 """
11 
12 
14  return """
15  context->riemannSolver(
16  FL, FR,
17  QL, QR,
18  t, dt,
19  h,
20  direction,
21  isBoundaryFace,
22  faceIndex,
23  1 //surface
24  );
25 """
26 
28  return """
29 #define _CUSTOM_COORDINATES
30 #define ASAGI_NOMPI
31 #define _TOP 1
32 
33 #include "../ExaSeis_core/Curvilinear/ContextDynamicRupture.h"
34 #include "../ExaSeis_core/Numerics/riemannsolverPMLDynamicRupture.h"
35 """
36 
38  return """
39 ContextDynamicRupture<{{NAMESPACE | join("::")}}::VariableShortcuts{{SOLVER_NAME}},
40  {{NAMESPACE | join("::")}}::{{CLASSNAME}}::Order + 1,
41  {{NAMESPACE | join("::")}}::{{CLASSNAME}}::NumberOfUnknowns,
42  {{NAMESPACE | join("::")}}::{{CLASSNAME}}::NumberOfAuxiliaryVariables,
43  {{SOLUTION_STORAGE_PRECISION}}>* {{NAMESPACE | join("::")}}::{{CLASSNAME}}::context;
44 """
45 
47  return """
48 public:
49  double QuadraturePoints1d[Order+1];
50 
51 protected:
52  static ContextDynamicRupture<VariableShortcutsElasticSolver, Order + 1, NumberOfUnknowns, NumberOfAuxiliaryVariables, {{SOLUTION_STORAGE_PRECISION}}>* context;
53 
54  static constexpr int pml_cell_width = 1;
55  static constexpr double pml_alpha_const = 1.5;
56  static constexpr double pml_alpha_scalar = 0.0;
57  static constexpr double pml_rel_error = 0.001;
58  static constexpr int pml_power = 1;
59 """
60 
61 def init_grid_step_implementation(scenario_string):
62  return """
63  std::copy_n(
64  kernels::{{SOLVER_NAME}}::Quadrature<{{SOLUTION_STORAGE_PRECISION}}>::nodes,
65  (Order+1),
66  QuadraturePoints1d
67  );
68 
69  std::string topography_string = \"""" + scenario_string + """.yaml";
70 
71  //setting coarsestMeshLevel and maxAdaptiveMeshLevel
72  double maxDSize = std::numeric_limits<double>::min();
73  double minDSize = std::numeric_limits<double>::max();
74  tarch::la::Vector<DIMENSIONS, double> sizes = DomainSize;
75 
76  for(int i=0; i<DIMENSIONS; i++){
77  if(sizes[i]>maxDSize){
78  maxDSize = sizes[i];
79  }
80  if(sizes[i]<minDSize){
81  minDSize = sizes[i];
82  }
83  }
84 
85  int depth = 0;
86 
87  //finding coarsest possible Mesh level
88  while(maxDSize>MaxAdmissibleCellH){
89  depth += 1;
90  maxDSize /= 3.0;
91  }
92 
93  double realCoarsestMeshSize = maxDSize;
94  double coarsestMeshLevel = depth;
95 
96  depth = 0;
97  while(minDSize>MinAdmissibleCellH){
98  depth += 1;
99  minDSize /= 3.0;
100  }
101 
102  logTraceOutWith1Argument("Freesurface set at ", std::to_string(_TOP * 2));
103 
104  context = new ContextDynamicRupture<VariableShortcutsElasticSolver, Order + 1, NumberOfUnknowns, NumberOfAuxiliaryVariables, {{SOLUTION_STORAGE_PRECISION}}>(
105  topography_string,
106  coarsestMeshLevel,
107  realCoarsestMeshSize,
108  depth,
109  DomainOffset, DomainSize,
110  kernels::ElasticSolver::Quadrature<{{SOLUTION_STORAGE_PRECISION}}>::nodes,
111  kernels::ElasticSolver::DGMatrices<{{SOLUTION_STORAGE_PRECISION}}>::dudx
112  );
113 
114  std::cout << "PML is using " << pml_cell_width << " elements" << std::endl;
115  std::cout << "Freesurface set at " << _TOP * 2 << std::endl;
116 """
117 
118 def finish_time_step_implementation(scenario_string):
119  return """
120  if (_solverState==SolverState::GridInitialisation) {
121  std::string filename_rupture_model = \"""" + scenario_string + """_fault.yaml";
122  context->initRuptureModel(filename_rupture_model);
123  }
124 """
def init_grid_step_implementation(scenario_string)
def finish_time_step_implementation(scenario_string)