Peano
Loading...
Searching...
No Matches
PDE Namespace Reference

Variables

str compute_primitive_variables
str max_eigenvalue
str flux
str source_term
str eigenvalue
str stiff_eigenvalue
str nonconservative_product
str stiff_nonconservative_product
str stiff_source_term_aderdg
str stiff_source_term_fv

Variable Documentation

◆ compute_primitive_variables

str PDE.compute_primitive_variables
Initial value:
1= r"""
2 const auto irho = 1.0 / Q[Shortcuts::rho];
3 const auto u0 = Q[Shortcuts::rhoU + 0] * irho;
4 const auto u1 = Q[Shortcuts::rhoU + 1] * irho;
5#if DIMENSIONS == 3
6 const auto u2 = Q[Shortcuts::rhoU + 2] * irho;
7#endif
8
9#if DIMENSIONS == 3
10 const auto uSq = u0 * u0 + u1 * u1 + u2 * u2;
11 const auto u_n = (normal == 0) ? u0 : (normal == 1) ? u1 : u2;
12#else
13 const auto uSq = u0 * u0 + u1 * u1;
14 const auto u_n = (normal == 0) ? u0 : u1;
15#endif
16
17 const auto internalE = Q[Shortcuts::rhoE] - 0.5 * Q[Shortcuts::rho] * uSq;
18 const auto p = (GAMMA - 1.0) * internalE;
19"""

Definition at line 4 of file PDE.py.

◆ eigenvalue

str PDE.eigenvalue
Initial value:
1= r"""
2 if (Q[Shortcuts::h] <= hThreshold) {
3 return 0.0;
4 }
5
6 // Wave speed estimation based on the flux Jacobian
7 const auto Vn{Q[Shortcuts::hu + normal] / Q[Shortcuts::h]};
8 const auto c{std::sqrt(g * Q[Shortcuts::h])};
9 const auto sFlux{std::fmax(std::fabs(Vn + c), std::fabs(Vn - c))};
10"""

Definition at line 4 of file PDE.py.

◆ flux

str PDE.flux
Initial value:
1= r"""
2 {compute_primitive_variables}
3
4 F[Shortcuts::rho] = Q[Shortcuts::rhoU + normal];
5
6 F[Shortcuts::rhoU + 0] = Q[Shortcuts::rhoU + 0] * u_n;
7 F[Shortcuts::rhoU + 1] = Q[Shortcuts::rhoU + 1] * u_n;
8#if DIMENSIONS == 3
9 F[Shortcuts::rhoU + 2] = Q[Shortcuts::rhoU + 2] * u_n;
10#endif
11
12 F[Shortcuts::rhoU + normal] += p;
13
14 F[Shortcuts::rhoE] = (Q[Shortcuts::rhoE] + p) * u_n;
15""".format(
16 compute_primitive_variables=compute_primitive_variables
17)

Definition at line 34 of file PDE.py.

◆ max_eigenvalue

str PDE.max_eigenvalue
Initial value:
1= r"""
2 {compute_primitive_variables}
3 const auto speedOfSound = std::sqrt(GAMMA * p * irho);
4 auto result = std::fmax(0.0, std::fabs(u_n - speedOfSound));
5 result = std::fmax(result, std::fabs(u_n + speedOfSound));
6 return result;
7""".format(
8 compute_primitive_variables=compute_primitive_variables
9)

Definition at line 24 of file PDE.py.

◆ nonconservative_product

str PDE.nonconservative_product
Initial value:
1= r"""
2 for (int n = 0; n < NumberOfUnknowns; n++) {
3 BTimesDeltaQ[n] = 0.0;
4 }
5
6 if (Q[Shortcuts::h] <= hThreshold) {
7 return;
8 }
9
10 // Bathymetry/topography-related effects
11 BTimesDeltaQ[Shortcuts::hu + normal] = g * Q[Shortcuts::h] * (deltaQ[Shortcuts::h] + deltaQ[Shortcuts::z]);
12"""

Definition at line 37 of file PDE.py.

◆ source_term

str PDE.source_term
Initial value:
1= r"""
2 S[Shortcuts::rho] = 0.0;
3 S[Shortcuts::rhoU + 0] = 0.0;
4 S[Shortcuts::rhoU + 1] = -Q[Shortcuts::rho] * GRAVITY;
5#if DIMENSIONS == 3
6 S[Shortcuts::rhoU + 2] = 0.0;
7#endif
8 S[Shortcuts::rhoE] = -Q[Shortcuts::rhoU + 1] * GRAVITY;
9"""

Definition at line 52 of file PDE.py.

◆ stiff_eigenvalue

str PDE.stiff_eigenvalue
Initial value:
1= r"""
2 // Wave speed estimation based on the stiff source
3 const auto momentum{std::sqrt(Q[Shortcuts::hu] * Q[Shortcuts::hu] + Q[Shortcuts::hv] * Q[Shortcuts::hv])};
4 const auto sSource{2.0 * g * momentum * invXi / (Q[Shortcuts::h] * Q[Shortcuts::h])};
5"""

Definition at line 15 of file PDE.py.

◆ stiff_nonconservative_product

str PDE.stiff_nonconservative_product
Initial value:
1= r"""
2 // Compute stiff turbulent drag on the interface
3 const auto momentumSQR{Q[Shortcuts::hu] * Q[Shortcuts::hu] + Q[Shortcuts::hv] * Q[Shortcuts::hv]};
4 const auto momentum{std::sqrt(momentumSQR)};
5 if (tarch::la::greater(momentum / Q[Shortcuts::h], 0.0)) {
6 const auto turbulentDrag{g * momentumSQR * invXi / (Q[Shortcuts::h] * Q[Shortcuts::h])};
7 const auto directionVect{Q[Shortcuts::hu + normal] / momentum};
8 BTimesDeltaQ[Shortcuts::hu + normal] += h[normal] * turbulentDrag * directionVect;
9 }
10"""

Definition at line 50 of file PDE.py.

◆ stiff_source_term_aderdg

str PDE.stiff_source_term_aderdg
Initial value:
1= r"""
2 for (int n = 0; n < NumberOfUnknowns; n++) {
3 S[n] = 0.0;
4 }
5
6 if (Q[Shortcuts::h] <= hThreshold) {
7 return;
8 }
9
10 // Compute local slope cF
11 const auto dzx{deltaQ[Shortcuts::z]};
12 const auto dzy{deltaQ[Shortcuts::z + NumberOfUnknowns + NumberOfAuxiliaryVariables]};
13 const auto cF{1.0 / std::sqrt(1.0 + dzx * dzx + dzy * dzy)};
14
15 // Apply friction only if there is some movement
16 const auto momentumSQR{Q[Shortcuts::hu] * Q[Shortcuts::hu] + Q[Shortcuts::hv] * Q[Shortcuts::hv]};
17 const auto momentum{std::sqrt(momentumSQR)};
18 if (tarch::la::greater(momentum / Q[Shortcuts::h], 0.0)) {
19 const auto coulombFriction{mu * cF * Q[Shortcuts::h]};
20 const auto turbulentDrag{momentumSQR * invXi / (Q[Shortcuts::h] * Q[Shortcuts::h])};
21 const auto frictionTerm{-g * (coulombFriction + turbulentDrag) / momentum};
22 S[Shortcuts::hu] = Q[Shortcuts::hu] * frictionTerm;
23 S[Shortcuts::hv] = Q[Shortcuts::hv] * frictionTerm;
24 }
25"""

Definition at line 61 of file PDE.py.

◆ stiff_source_term_fv

str PDE.stiff_source_term_fv
Initial value:
1= r"""
2 for (int n = 0; n < NumberOfUnknowns; n++) {
3 S[n] = 0.0;
4 }
5
6 if (Q[Shortcuts::h] <= hThreshold) {
7 return;
8 }
9
10 // Compute local slope cF
11 const auto dzx{deltaQ[Shortcuts::z]};
12 const auto dzy{deltaQ[Shortcuts::z + NumberOfUnknowns + NumberOfAuxiliaryVariables]};
13 const auto cF{1.0 / std::sqrt(1.0 + dzx * dzx + dzy * dzy)};
14
15 // Apply friction only if there is some movement
16 const auto momentumSQR{Q[Shortcuts::hu] * Q[Shortcuts::hu] + Q[Shortcuts::hv] * Q[Shortcuts::hv]};
17 const auto momentum{std::sqrt(momentumSQR)};
18 if (tarch::la::greater(momentum / Q[Shortcuts::h], 0.0)) {
19 const auto coulombFriction{mu * cF * Q[Shortcuts::h]};
20 const auto frictionTerm{-g * coulombFriction / momentum};
21 S[Shortcuts::hu] = Q[Shortcuts::hu] * frictionTerm;
22 S[Shortcuts::hv] = Q[Shortcuts::hv] * frictionTerm;
23 }
24"""

Definition at line 87 of file PDE.py.