Peano
PDE Namespace Reference

Variables

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

Variable Documentation

◆ compute_primitive_variables

string 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 #else
8 #endif
9 
10 #if DIMENSIONS == 3
11  const auto uSq = u0 * u0 + u1 * u1 + u2 * u2;
12  const auto u_n = (normal == 0) ? u0 : (normal == 1) ? u1 : u2;
13 #else
14  const auto uSq = u0 * u0 + u1 * u1;
15  const auto u_n = (normal == 0) ? u0 : u1;
16 #endif
17 
18  const auto internalE = Q[Shortcuts::rhoE] - 0.5 * Q[Shortcuts::rho] * uSq;
19  const auto p = (GAMMA - 1.0) * internalE;
20 """

Definition at line 4 of file PDE.py.

◆ eigenvalue

string 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

string 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 35 of file PDE.py.

◆ max_eigenvalue

string 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 25 of file PDE.py.

◆ nonconservative_product

string 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

string 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 53 of file PDE.py.

◆ stiff_eigenvalue

string 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

string 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

string 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

string 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.