euler_physics_2d Module

Conserved state Q = (rho, rhou, rhov, E). p = (gam-1)(E - 0.5rho(u^2 + v^2)) F = (rho u, rho u^2 + p, rho u v, u(E+p)) G = (rho v, rho u v, rho v^2+p, v(E+p))



Functions

public function compute_max_wave_speed_2d(state) result(s_max)

Global maximum signal speed max_{i,j}( max(|u|,|v|) + c ) over interior cells.

Read more…

Arguments

Type IntentOptional Attributes Name
type(solver_state_2d_t), intent(in) :: state

Return Value real(kind=wp)


Subroutines

public pure subroutine primitives_2d(q, gam, rho, u, v, p)

Extract primitives (rho, u, v, p) from a 2D conserved state.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: q(:)
real(kind=wp), intent(in) :: gam
real(kind=wp), intent(out) :: rho
real(kind=wp), intent(out) :: u
real(kind=wp), intent(out) :: v
real(kind=wp), intent(out) :: p

public pure subroutine compute_euler_flux_2d(q, fx, gy, gam)

Compute both directional flux vectors F (x) and G (y) for state Q.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: q(:)
real(kind=wp), intent(out) :: fx(:)
real(kind=wp), intent(out) :: gy(:)
real(kind=wp), intent(in) :: gam

public subroutine compute_eigensystem_2d(q, dir, r_mat, r_inv, gam)

Right-eigenvector matrix K and its inverse for the flux Jacobian in direction dir (1 = x: eigenvalues u-c,u,u,u+c; 2 = y: v-c,v,v,v+c). Columns of K, conserved variables Q=(rho,rho u,rho v,E): x: [1, u-c, v, H-u c] [1, u, v, q2] [0, 0, 1, v] [1, u+c, v, H+u c] y: [1, u, v-c, H-v c] [1, u, v, q2] [0, 1, 0, u] [1, u, v+c, H+v c] where H=(E+p)/rho, q2=0.5*(u^2+v^2). K^{-1} via LAPACK getrf/getri.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: q(neq2d)
integer, intent(in) :: dir
real(kind=wp), intent(out) :: r_mat(neq2d,neq2d)
real(kind=wp), intent(out) :: r_inv(neq2d,neq2d)
real(kind=wp), intent(in) :: gam

private subroutine invert_4x4(a, ainv)

Inverse of a 4x4 matrix via LAPACK LU (dgetrf) + inversion (dgetri).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: a(4,4)
real(kind=wp), intent(out) :: ainv(4,4)

private pure subroutine directional_flux(q, dir, gam, f)

Return the directional Euler flux: fx for dir==1, gy for dir==2.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: q(neq2d)
integer, intent(in) :: dir
real(kind=wp), intent(in) :: gam
real(kind=wp), intent(out) :: f(neq2d)

private pure subroutine lax_friedrichs_split_2d(q, dir, gam, fp, fm)

Lax-Friedrichs directional splitting: F± = ½(F ± α Q), α = |vel_dir| + c. Guarantees fp + fm == F exactly (same α applied to both halves).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: q(neq2d)
integer, intent(in) :: dir
real(kind=wp), intent(in) :: gam
real(kind=wp), intent(out) :: fp(neq2d)
real(kind=wp), intent(out) :: fm(neq2d)

private subroutine steger_warming_split_2d(q, dir, gam, fp, fm)

Steger-Warming splitting: F± = R·diag(λ±)·R⁻¹·Q. Exact for the homogeneous Euler flux (F = A·Q); fp+fm == F to machine precision. Eigenvalue order: x → (u-c, u, u, u+c); y → (v-c, v, v, v+c). NOT pure: calls compute_eigensystem_2d which uses LAPACK.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: q(neq2d)
integer, intent(in) :: dir
real(kind=wp), intent(in) :: gam
real(kind=wp), intent(out) :: fp(neq2d)
real(kind=wp), intent(out) :: fm(neq2d)

private pure subroutine van_leer_split_2d(q, dir, gam, fp, fm)

van Leer splitting: Mach-split mass flux carrying transverse momentum. Pressure split: p± = p(M±1)²(2∓M)/4 (subsonic); supersonic branches are fully upwind (fp==F, fm==0 for M≥1; fp==0, fm==F for M≤-1). Uses in (normal) and it (transverse) momentum indices to handle both directions uniformly.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: q(neq2d)
integer, intent(in) :: dir
real(kind=wp), intent(in) :: gam
real(kind=wp), intent(out) :: fp(neq2d)
real(kind=wp), intent(out) :: fm(neq2d)

public subroutine split_contravariant_2d(q, smetric, scheme, gam, fp, fm)

Contravariant flux-vector splitting along a general metric/area vector smetric = S_xi or S_eta (size 2). Splits the CONTRAVARIANT flux Fhat = smetric(1)F + smetric(2)G (F,G physical Euler fluxes) into fp/fm with eigenvalues U, U, U +- c|S| where the contravariant velocity is U = smetric(1)u + smetric(2)v and |S| = norm2(smetric).

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: q(neq2d)
real(kind=wp), intent(in) :: smetric(2)
character(len=*), intent(in) :: scheme
real(kind=wp), intent(in) :: gam
real(kind=wp), intent(out) :: fp(neq2d)
real(kind=wp), intent(out) :: fm(neq2d)

public subroutine split_flux_2d(q, dir, scheme, gam, fp, fm)

Dispatch to one of the three FVS routines by scheme name. dir=1 → x-splitting (uses F, eigenvalues u±c); dir=2 → y-splitting (uses G, v±c). scheme: 'lax_friedrichs' | 'steger_warming' | 'van_leer'. NOT pure: may call steger_warming_split_2d (which calls LAPACK).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: q(neq2d)
integer, intent(in) :: dir
character(len=*), intent(in) :: scheme
real(kind=wp), intent(in) :: gam
real(kind=wp), intent(out) :: fp(neq2d)
real(kind=wp), intent(out) :: fm(neq2d)