3def initial(pointwise_initial_conditions):
5 std::fill_n(Q, (NumberOfAuxiliaryVariables + NumberOfUnknowns) * (Order + 1) * (Order + 1) * (Order + 1), 0);
7 context->initUnknownsPatch(Q, x, h, 0.0, 0.0,
9 const {{SOLUTION_STORAGE_PRECISION}}* const x,
10 const tarch::la::Vector<DIMENSIONS,double>& center,
13 {{SOLUTION_STORAGE_PRECISION}}* Q
14 ) -> void { """ + pointwise_initial_conditions +
"""
18 // Initialisation of PML parameters
19 auto dmp_pml_width_x = pml_cell_width * h[0];
20 auto dmp_pml_width_y = pml_cell_width * h[1];
21 auto dmp_pml_width_z = pml_cell_width * h[2];
23 auto dmp_pml_right_x = DomainOffset[0] + DomainSize[0] - dmp_pml_width_x;
24 auto dmp_pml_right_y = DomainOffset[1] + DomainSize[1] - dmp_pml_width_y;
25 auto dmp_pml_right_z = DomainOffset[2] + DomainSize[2] - dmp_pml_width_z;
27 auto dmp_pml_left_x = DomainOffset[0] + dmp_pml_width_x;
28 auto dmp_pml_left_y = DomainOffset[1] + dmp_pml_width_y;
29 auto dmp_pml_left_z = DomainOffset[2] + dmp_pml_width_z;
31 constexpr double amplitude_nominator = 6.0;
33 auto dmp_amplitude_x = (pml_power + 1) * amplitude_nominator / (2 * dmp_pml_width_x) * log(1.0 / pml_rel_error);
34 auto dmp_amplitude_y = (pml_power + 1) * amplitude_nominator / (2 * dmp_pml_width_y) * log(1.0 / pml_rel_error);
35 auto dmp_amplitude_z = (pml_power + 1) * amplitude_nominator / (2 * dmp_pml_width_z) * log(1.0 / pml_rel_error);
37 double offset_x = x[0] - h[0] * 0.5;
38 double offset_y = x[1] - h[1] * 0.5;
39 double offset_z = x[2] - h[2] * 0.5;
41 toolbox::curvi::idx4 idx(Order + 1, Order + 1, Order + 1, NumberOfUnknowns + NumberOfAuxiliaryVariables);
43 for (int k = 0; k < Order + 1; k++) {
44 double computational_z = (offset_z + h[2] * kernels::{{SOLVER_NAME}}::Quadrature<{{SOLUTION_STORAGE_PRECISION}}>::nodes[k]);
45 for (int j = 0; j < Order + 1; j++) {
46 double computational_y = (offset_y + h[1] * kernels::{{SOLVER_NAME}}::Quadrature<{{SOLUTION_STORAGE_PRECISION}}>::nodes[j]);
47 for (int i = 0; i < Order + 1; i++) {
48 double computational_x = (offset_x + h[0] * kernels::{{SOLVER_NAME}}::Quadrature<{{SOLUTION_STORAGE_PRECISION}}>::nodes[i]);
50 if (_TOP != 0) { // No PML on surface
51 if (computational_x < dmp_pml_left_x) {
53 k, j, i, Shortcuts::dmp_pml + 0
54 )] = dmp_amplitude_x * pow((dmp_pml_left_x - computational_x) / dmp_pml_width_x, pml_power);
57 if (_TOP != 1) { // No PML on surface
58 if (computational_y <= dmp_pml_left_y) {
60 k, j, i, Shortcuts::dmp_pml + 1
61 )] = dmp_amplitude_y * pow((dmp_pml_left_y - computational_y) / dmp_pml_width_y, pml_power);
64 if (_TOP != 2) { // No PML on surface
65 if (computational_z <= dmp_pml_left_z) {
67 k, j, i, Shortcuts::dmp_pml + 2
68 )] = dmp_amplitude_z * pow((dmp_pml_left_z - computational_z) / dmp_pml_width_z, pml_power);
71 if (computational_x >= dmp_pml_right_x) {
73 k, j, i, Shortcuts::dmp_pml + 0
74 )] = dmp_amplitude_x * pow((computational_x - dmp_pml_right_x) / dmp_pml_width_x, pml_power);
76 if (computational_y >= dmp_pml_right_y) {
78 k, j, i, Shortcuts::dmp_pml + 1
79 )] = dmp_amplitude_y * pow((computational_y - dmp_pml_right_y) / dmp_pml_width_y, pml_power);
81 if (computational_z >= dmp_pml_right_z) {
83 k, j, i, Shortcuts::dmp_pml + 2
84 )] = dmp_amplitude_z * pow((computational_z - dmp_pml_right_z) / dmp_pml_width_z, pml_power);
94 for (int i = 0; i < NumberOfUnknowns; i++) {
95 Qoutside[i] = Qinside[i];
101 // Check for NaN in any of the velocities
102 assert(("Check for Nans in velocity", !(std::isnan(Q[Shortcuts::v + 0]) || std::isnan(Q[Shortcuts::v + 1]) || std::isnan(Q[Shortcuts::v + 2]))));
104 auto cp = Q[Shortcuts::cp];
105 auto cs = Q[Shortcuts::cs];
106 auto q_x = Q[Shortcuts::metric_derivative + 0];
107 auto q_y = Q[Shortcuts::metric_derivative + 1];
108 auto q_z = Q[Shortcuts::metric_derivative + 2];
109 auto r_x = Q[Shortcuts::metric_derivative + 3];
110 auto r_y = Q[Shortcuts::metric_derivative + 4];
111 auto r_z = Q[Shortcuts::metric_derivative + 5];
112 auto s_x = Q[Shortcuts::metric_derivative + 6];
113 auto s_y = Q[Shortcuts::metric_derivative + 7];
114 auto s_z = Q[Shortcuts::metric_derivative + 8];
116 double lambda[10]{1.0};
118 lambda[0] = std::sqrt(q_x * q_x + q_y * q_y + q_z * q_z) * cp;
119 lambda[1] = std::sqrt(q_x * q_x + q_y * q_y + q_z * q_z) * cs;
120 lambda[2] = std::sqrt(q_x * q_x + q_y * q_y + q_z * q_z) * cs;
122 lambda[3] = std::sqrt(r_x * r_x + r_y * r_y + r_z * r_z) * cp;
123 lambda[4] = std::sqrt(r_x * r_x + r_y * r_y + r_z * r_z) * cs;
124 lambda[5] = std::sqrt(r_x * r_x + r_y * r_y + r_z * r_z) * cs;
126 lambda[6] = std::sqrt(s_x * s_x + s_y * s_y + s_z * s_z) * cp;
127 lambda[7] = std::sqrt(s_x * s_x + s_y * s_y + s_z * s_z) * cs;
128 lambda[8] = std::sqrt(s_x * s_x + s_y * s_y + s_z * s_z) * cs;
131 return *std::max_element(lambda, lambda + 10);
136 auto sigma_xx = Q[Shortcuts::sigma + 0];
137 auto sigma_yy = Q[Shortcuts::sigma + 1];
138 auto sigma_zz = Q[Shortcuts::sigma + 2];
139 auto sigma_xy = Q[Shortcuts::sigma + 3];
140 auto sigma_xz = Q[Shortcuts::sigma + 4];
141 auto sigma_yz = Q[Shortcuts::sigma + 5];
143 auto jacobian = Q[Shortcuts::jacobian];
145 std::fill_n(F, NumberOfUnknowns, 0.0);
147 toolbox::curvi::idx2 idx_pml(DIMENSIONS, 9);
151 auto q_x = Q[Shortcuts::metric_derivative + 0];
152 auto q_y = Q[Shortcuts::metric_derivative + 1];
153 auto q_z = Q[Shortcuts::metric_derivative + 2];
154 F[Shortcuts::v + 0] = -jacobian * (q_x * sigma_xx + q_y * sigma_xy + q_z * sigma_xz);
155 F[Shortcuts::v + 1] = -jacobian * (q_x * sigma_xy + q_y * sigma_yy + q_z * sigma_yz);
156 F[Shortcuts::v + 2] = -jacobian * (q_x * sigma_xz + q_y * sigma_yz + q_z * sigma_zz);
157 F[Shortcuts::pml + idx_pml(0, Shortcuts::v + 0)] = F[Shortcuts::v + 0];
158 F[Shortcuts::pml + idx_pml(0, Shortcuts::v + 1)] = F[Shortcuts::v + 1];
159 F[Shortcuts::pml + idx_pml(0, Shortcuts::v + 2)] = F[Shortcuts::v + 2];
162 auto r_x = Q[Shortcuts::metric_derivative + 3];
163 auto r_y = Q[Shortcuts::metric_derivative + 4];
164 auto r_z = Q[Shortcuts::metric_derivative + 5];
165 F[Shortcuts::v + 0] = -jacobian * (r_x * sigma_xx + r_y * sigma_xy + r_z * sigma_xz);
166 F[Shortcuts::v + 1] = -jacobian * (r_x * sigma_xy + r_y * sigma_yy + r_z * sigma_yz);
167 F[Shortcuts::v + 2] = -jacobian * (r_x * sigma_xz + r_y * sigma_yz + r_z * sigma_zz);
168 F[Shortcuts::pml + idx_pml(1, Shortcuts::v + 0)] = F[Shortcuts::v + 0];
169 F[Shortcuts::pml + idx_pml(1, Shortcuts::v + 1)] = F[Shortcuts::v + 1];
170 F[Shortcuts::pml + idx_pml(1, Shortcuts::v + 2)] = F[Shortcuts::v + 2];
173 auto s_x = Q[Shortcuts::metric_derivative + 6];
174 auto s_y = Q[Shortcuts::metric_derivative + 7];
175 auto s_z = Q[Shortcuts::metric_derivative + 8];
176 F[Shortcuts::v + 0] = -jacobian * (s_x * sigma_xx + s_y * sigma_xy + s_z * sigma_xz);
177 F[Shortcuts::v + 1] = -jacobian * (s_x * sigma_xy + s_y * sigma_yy + s_z * sigma_yz);
178 F[Shortcuts::v + 2] = -jacobian * (s_x * sigma_xz + s_y * sigma_yz + s_z * sigma_zz);
179 F[Shortcuts::pml + idx_pml(2, Shortcuts::v + 0)] = F[Shortcuts::v + 0];
180 F[Shortcuts::pml + idx_pml(2, Shortcuts::v + 1)] = F[Shortcuts::v + 1];
181 F[Shortcuts::pml + idx_pml(2, Shortcuts::v + 2)] = F[Shortcuts::v + 2];
188 toolbox::curvi::idx2 idx_pml(DIMENSIONS, 9);
189 auto rho = Q[Shortcuts::rho];
190 auto cp = Q[Shortcuts::cp];
191 auto cs = Q[Shortcuts::cs];
192 auto jacobian = Q[Shortcuts::jacobian];
193 auto dmp_pml_x = Q[Shortcuts::dmp_pml + 0];
194 auto dmp_pml_y = Q[Shortcuts::dmp_pml + 1];
195 auto dmp_pml_z = Q[Shortcuts::dmp_pml + 2];
196 auto mu = rho * cs * cs;
197 auto lambda = rho * cp * cp - 2 * mu;
199 std::fill_n(BTimesDeltaQ, NumberOfUnknowns, 0.0);
203 auto u_q = deltaQ[Shortcuts::v + 0];
204 auto v_q = deltaQ[Shortcuts::v + 1];
205 auto w_q = deltaQ[Shortcuts::v + 2];
206 auto q_x = Q[Shortcuts::metric_derivative + 0];
207 auto q_y = Q[Shortcuts::metric_derivative + 1];
208 auto q_z = Q[Shortcuts::metric_derivative + 2];
209 auto lam_temp = lambda * (-q_x * u_q - q_y * v_q - q_z * w_q);
210 BTimesDeltaQ[Shortcuts::sigma + 0] = -2 * mu * q_x * u_q + lam_temp;
211 BTimesDeltaQ[Shortcuts::sigma + 1] = -2 * mu * q_y * v_q + lam_temp;
212 BTimesDeltaQ[Shortcuts::sigma + 2] = -2 * mu * q_z * w_q + lam_temp;
213 BTimesDeltaQ[Shortcuts::sigma + 3] = -mu * (q_y * u_q + q_x * v_q); // sigma_xy
214 BTimesDeltaQ[Shortcuts::sigma + 4] = -mu * (q_z * u_q + q_x * w_q); // sigma_xz
215 BTimesDeltaQ[Shortcuts::sigma + 5] = -mu * (q_z * v_q + q_y * w_q); // sigma_yz
216 BTimesDeltaQ[Shortcuts::pml + idx_pml(0, Shortcuts::sigma + 0)] = -dmp_pml_x * q_x * u_q;
217 BTimesDeltaQ[Shortcuts::pml + idx_pml(0, Shortcuts::sigma + 1)] = -dmp_pml_x * q_y * v_q;
218 BTimesDeltaQ[Shortcuts::pml + idx_pml(0, Shortcuts::sigma + 2)] = -dmp_pml_x * q_z * w_q;
219 BTimesDeltaQ[Shortcuts::pml + idx_pml(0, Shortcuts::sigma + 3)] = -dmp_pml_x * (q_y * u_q + q_x * v_q);
220 BTimesDeltaQ[Shortcuts::pml + idx_pml(0, Shortcuts::sigma + 4)] = -dmp_pml_x * (q_z * u_q + q_x * w_q);
221 BTimesDeltaQ[Shortcuts::pml + idx_pml(0, Shortcuts::sigma + 5)] = -dmp_pml_x * (q_z * v_q + q_y * w_q);
224 auto u_r = deltaQ[Shortcuts::v + 0];
225 auto v_r = deltaQ[Shortcuts::v + 1];
226 auto w_r = deltaQ[Shortcuts::v + 2];
227 auto r_x = Q[Shortcuts::metric_derivative + 3];
228 auto r_y = Q[Shortcuts::metric_derivative + 4];
229 auto r_z = Q[Shortcuts::metric_derivative + 5];
230 auto lam_temp = lambda * (-r_x * u_r - r_y * v_r - r_z * w_r);
231 BTimesDeltaQ[Shortcuts::sigma + 0] = -2 * mu * r_x * u_r + lam_temp;
232 BTimesDeltaQ[Shortcuts::sigma + 1] = -2 * mu * r_y * v_r + lam_temp;
233 BTimesDeltaQ[Shortcuts::sigma + 2] = -2 * mu * r_z * w_r + lam_temp;
234 BTimesDeltaQ[Shortcuts::sigma + 3] = -mu * (r_y * u_r + r_x * v_r); // sigma_xy
235 BTimesDeltaQ[Shortcuts::sigma + 4] = -mu * (r_z * u_r + r_x * w_r); // sigma_xz
236 BTimesDeltaQ[Shortcuts::sigma + 5] = -mu * (r_z * v_r + r_y * w_r); // sigma_yz
237 BTimesDeltaQ[Shortcuts::pml + idx_pml(1, Shortcuts::sigma + 0)] = -dmp_pml_y * r_x * u_r;
238 BTimesDeltaQ[Shortcuts::pml + idx_pml(1, Shortcuts::sigma + 1)] = -dmp_pml_y * r_y * v_r;
239 BTimesDeltaQ[Shortcuts::pml + idx_pml(1, Shortcuts::sigma + 2)] = -dmp_pml_y * r_z * w_r;
240 BTimesDeltaQ[Shortcuts::pml + idx_pml(1, Shortcuts::sigma + 3)] = -dmp_pml_y * (r_y * u_r + r_x * v_r);
241 BTimesDeltaQ[Shortcuts::pml + idx_pml(1, Shortcuts::sigma + 4)] = -dmp_pml_y * (r_z * u_r + r_x * w_r);
242 BTimesDeltaQ[Shortcuts::pml + idx_pml(1, Shortcuts::sigma + 5)] = -dmp_pml_y * (r_z * v_r + r_y * w_r);
245 auto u_s = deltaQ[Shortcuts::v + 0];
246 auto v_s = deltaQ[Shortcuts::v + 1];
247 auto w_s = deltaQ[Shortcuts::v + 2];
248 auto s_x = Q[Shortcuts::metric_derivative + 6];
249 auto s_y = Q[Shortcuts::metric_derivative + 7];
250 auto s_z = Q[Shortcuts::metric_derivative + 8];
251 auto lam_temp = lambda * (-s_x * u_s - s_y * v_s - s_z * w_s);
252 BTimesDeltaQ[Shortcuts::sigma + 0] = -2 * mu * s_x * u_s + lam_temp;
253 BTimesDeltaQ[Shortcuts::sigma + 1] = -2 * mu * s_y * v_s + lam_temp;
254 BTimesDeltaQ[Shortcuts::sigma + 2] = -2 * mu * s_z * w_s + lam_temp;
255 BTimesDeltaQ[Shortcuts::sigma + 3] = -mu * (s_y * u_s + s_x * v_s); // sigma_xy
256 BTimesDeltaQ[Shortcuts::sigma + 4] = -mu * (s_z * u_s + s_x * w_s); // sigma_xz
257 BTimesDeltaQ[Shortcuts::sigma + 5] = -mu * (s_z * v_s + s_y * w_s); // sigma_yz
258 BTimesDeltaQ[Shortcuts::pml + idx_pml(2, Shortcuts::sigma + 0)] = -dmp_pml_z * s_x * u_s;
259 BTimesDeltaQ[Shortcuts::pml + idx_pml(2, Shortcuts::sigma + 1)] = -dmp_pml_z * s_y * v_s;
260 BTimesDeltaQ[Shortcuts::pml + idx_pml(2, Shortcuts::sigma + 2)] = -dmp_pml_z * s_z * w_s;
261 BTimesDeltaQ[Shortcuts::pml + idx_pml(2, Shortcuts::sigma + 3)] = -dmp_pml_z * (s_y * u_s + s_x * v_s);
262 BTimesDeltaQ[Shortcuts::pml + idx_pml(2, Shortcuts::sigma + 4)] = -dmp_pml_z * (s_z * u_s + s_x * w_s);
263 BTimesDeltaQ[Shortcuts::pml + idx_pml(2, Shortcuts::sigma + 5)] = -dmp_pml_z * (s_z * v_s + s_y * w_s);
270 auto rho = Q[Shortcuts::rho];
271 auto cp = Q[Shortcuts::cp];
272 auto cs = Q[Shortcuts::cs];
274 auto dmp_pml_x = Q[Shortcuts::dmp_pml + 0];
275 auto dmp_pml_y = Q[Shortcuts::dmp_pml + 1];
276 auto dmp_pml_z = Q[Shortcuts::dmp_pml + 2];
278 auto mu = rho * cs * cs;
279 auto lambda = rho * cp * cp - 2 * mu;
280 auto rho_inv = 1.0 / rho;
282 auto alpha_x = (pml_alpha_const + pml_alpha_scalar * dmp_pml_x);
283 auto alpha_y = (pml_alpha_const + pml_alpha_scalar * dmp_pml_y);
284 auto alpha_z = (pml_alpha_const + pml_alpha_scalar * dmp_pml_z);
286 toolbox::curvi::idx2 idx_pml(DIMENSIONS, 9);
288 const auto* Q_pml = Q + Shortcuts::pml;
289 auto* S_pml = S + Shortcuts::pml;
291 S[0] = rho_inv * (Q_pml[idx_pml(0, 0)] + Q_pml[idx_pml(1, 0)] + Q_pml[idx_pml(2, 0)]);
292 S[1] = rho_inv * (Q_pml[idx_pml(0, 1)] + Q_pml[idx_pml(1, 1)] + Q_pml[idx_pml(2, 1)]);
293 S[2] = rho_inv * (Q_pml[idx_pml(0, 2)] + Q_pml[idx_pml(1, 2)] + Q_pml[idx_pml(2, 2)]);
295 S[3] = (2 * mu + lambda) * Q_pml[idx_pml(0, 3)] + lambda * (Q_pml[idx_pml(0, 4)] + Q_pml[idx_pml(0, 5)])
296 + (2 * mu + lambda) * Q_pml[idx_pml(1, 3)] + lambda * (Q_pml[idx_pml(1, 4)] + Q_pml[idx_pml(1, 5)])
297 + (2 * mu + lambda) * Q_pml[idx_pml(2, 3)] + lambda * (Q_pml[idx_pml(2, 4)] + Q_pml[idx_pml(2, 5)]);
299 S[4] = (2 * mu + lambda) * Q_pml[idx_pml(0, 4)] + lambda * (Q_pml[idx_pml(0, 3)] + Q_pml[idx_pml(0, 5)])
300 + (2 * mu + lambda) * Q_pml[idx_pml(1, 4)] + lambda * (Q_pml[idx_pml(1, 3)] + Q_pml[idx_pml(1, 5)])
301 + (2 * mu + lambda) * Q_pml[idx_pml(2, 4)] + lambda * (Q_pml[idx_pml(2, 3)] + Q_pml[idx_pml(2, 5)]);
303 S[5] = (2 * mu + lambda) * Q_pml[idx_pml(0, 5)] + lambda * (Q_pml[idx_pml(0, 3)] + Q_pml[idx_pml(0, 4)])
304 + (2 * mu + lambda) * Q_pml[idx_pml(1, 5)] + lambda * (Q_pml[idx_pml(1, 3)] + Q_pml[idx_pml(1, 4)])
305 + (2 * mu + lambda) * Q_pml[idx_pml(2, 5)] + lambda * (Q_pml[idx_pml(2, 3)] + Q_pml[idx_pml(2, 4)]);
307 S[6] = mu * (Q_pml[idx_pml(0, 6)] + Q_pml[idx_pml(1, 6)] + Q_pml[idx_pml(2, 6)]);
308 S[7] = mu * (Q_pml[idx_pml(0, 7)] + Q_pml[idx_pml(1, 7)] + Q_pml[idx_pml(2, 7)]);
309 S[8] = mu * (Q_pml[idx_pml(0, 8)] + Q_pml[idx_pml(1, 8)] + Q_pml[idx_pml(2, 8)]);
311 for (int j = 0; j < 9; j++) {
312 S_pml[idx_pml(0, j)] = (dmp_pml_x + alpha_x) * Q_pml[idx_pml(0, j)];
313 S_pml[idx_pml(1, j)] = (dmp_pml_y + alpha_y) * Q_pml[idx_pml(1, j)];
314 S_pml[idx_pml(2, j)] = (dmp_pml_z + alpha_z) * Q_pml[idx_pml(2, j)];
320 auto rho = Q[Shortcuts::rho];
321 auto jacobian = Q[Shortcuts::jacobian];
323 auto rho_inv = 1.0 / (rho * jacobian);
325 auto dmp_pml_x = Q[Shortcuts::dmp_pml + 0];
326 auto dmp_pml_y = Q[Shortcuts::dmp_pml + 1];
327 auto dmp_pml_z = Q[Shortcuts::dmp_pml + 2];
329 toolbox::curvi::idx2 idx_pml(DIMENSIONS, 9);
331 // Rhs uses the same formula regardless of dimension, hence no switch necessary
333 rhs[Shortcuts::v + 0] = rho_inv * rhs[Shortcuts::v + 0];
334 rhs[Shortcuts::v + 1] = rho_inv * rhs[Shortcuts::v + 1];
335 rhs[Shortcuts::v + 2] = rho_inv * rhs[Shortcuts::v + 2];
337 for (int j = 0; j < 3; j++) {
338 rhs[Shortcuts::pml + idx_pml(0, j)] = dmp_pml_x / jacobian * rhs[Shortcuts::pml + idx_pml(0, j)];
339 rhs[Shortcuts::pml + idx_pml(1, j)] = dmp_pml_y / jacobian * rhs[Shortcuts::pml + idx_pml(1, j)];
340 rhs[Shortcuts::pml + idx_pml(2, j)] = dmp_pml_z / jacobian * rhs[Shortcuts::pml + idx_pml(2, j)];
346 auto result = ::exahype2::RefinementCommand::Keep;
352 Numerics::riemannSolver<VariableShortcuts{{SOLVER_NAME}}, {{CORRECTOR_COMPUTATION_PRECISION}}, Order, NumberOfUnknowns, NumberOfAuxiliaryVariables, 1>(
353 FL, FR, QL, QR, dt, direction, isBoundaryFace, faceIndex
359#define _CUSTOM_COORDINATES
363#include "../ExaSeis_core/Curvilinear/ContextCurvilinear.h"
364#include "../ExaSeis_core/Numerics/riemannsolverPML.h"
366#include "peano4/datamanagement/CellMarker.h"
371ContextCurvilinear<{{NAMESPACE | join("::")}}::VariableShortcuts{{SOLVER_NAME}},
372 {{NAMESPACE | join("::")}}::{{CLASSNAME}}::Order + 1,
373 ({{NAMESPACE | join("::")}}::{{CLASSNAME}}::NumberOfUnknowns + {{NAMESPACE | join("::")}}::{{CLASSNAME}}::NumberOfAuxiliaryVariables),
374 {{SOLUTION_STORAGE_PRECISION}}>* {{NAMESPACE | join("::")}}::{{CLASSNAME}}::context;
376tarch::la::Vector<DIMENSIONS,double> {{NAMESPACE | join("::")}}::{{CLASSNAME}}::invertProjection(const tarch::la::Vector<DIMENSIONS,double> coordinates){
378 if(peano4::datamanagement::CellMarker::isContained(
379 coordinates, DomainOffset+0.5*DomainSize, DomainSize, 0.
381 double fixedCoords[3];
382 fixedCoords[toolbox::curvi::Coordinate::X] = coordinates[0];
383 fixedCoords[toolbox::curvi::Coordinate::Y] = coordinates[1];
384 fixedCoords[toolbox::curvi::Coordinate::Z] = coordinates[2];
386 tarch::la::Vector<DIMENSIONS,double> result;
387 toolbox::curvi::Interface* curviInterface = context->getInterface();
388 result[0] = curviInterface->invertProjection(toolbox::curvi::Coordinate::X, fixedCoords);
389 result[1] = curviInterface->invertProjection(toolbox::curvi::Coordinate::Y, fixedCoords);
390 result[2] = curviInterface->invertProjection(toolbox::curvi::Coordinate::Z, fixedCoords);
401 double QuadraturePoints1d[Order+1];
403 tarch::la::Vector<DIMENSIONS,double> invertProjection(const tarch::la::Vector<DIMENSIONS,double> coordinates);
406 static ContextCurvilinear<VariableShortcuts{{SOLVER_NAME}}, Order + 1, (NumberOfAuxiliaryVariables + NumberOfUnknowns), {{SOLUTION_STORAGE_PRECISION}}>* context;
408 static constexpr int pml_cell_width = 1;
409 static constexpr double pml_alpha_const = 1.5;
410 static constexpr double pml_alpha_scalar = 0.0;
411 static constexpr double pml_rel_error = 0.001;
412 static constexpr int pml_power = 1;
418 kernels::{{SOLVER_NAME}}::Quadrature<{{SOLUTION_STORAGE_PRECISION}}>::nodes,
423 std::string topography_string = \"""" + scenario_string +
""".yaml";
425 //setting coarsestMeshLevel and maxAdaptiveMeshLevel
426 double maxDSize = std::numeric_limits<double>::min();
427 double minDSize = std::numeric_limits<double>::max();
428 tarch::la::Vector<DIMENSIONS, double> sizes = DomainSize;
430 for(int i=0; i<DIMENSIONS; i++){
431 if(sizes[i]>maxDSize){
434 if(sizes[i]<minDSize){
441 //finding coarsest possible Mesh level
442 while(maxDSize>MaxAdmissibleCellH){
447 double realCoarsestMeshSize = maxDSize;
448 double coarsestMeshLevel = depth;
451 while(minDSize>MinAdmissibleCellH){
456 context = new ContextCurvilinear<VariableShortcuts{{SOLVER_NAME}}, Order + 1, (NumberOfAuxiliaryVariables + NumberOfUnknowns), {{SOLUTION_STORAGE_PRECISION}}>(
459 realCoarsestMeshSize,
461 DomainOffset, DomainSize,
462 kernels::{{SOLVER_NAME}}::Quadrature<{{SOLUTION_STORAGE_PRECISION}}>::nodes,
463 kernels::{{SOLVER_NAME}}::DGMatrices<{{SOLUTION_STORAGE_PRECISION}}>::dudx
466 logInfo("startGridInitialisationStep()", "Freesurface set at " << std::to_string(_TOP * 2));
467 logInfo("startGridInitialisationStep()", "PML is using " << pml_cell_width << " elements");
multiplyMaterialParameterMatrix()
init_grid_step_implementation(scenario_string)
initial(pointwise_initial_conditions)
abstractUserDefinitions()