From 207668b130ae73f38a69c239673b58e9fa38bef4 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 11 Dec 2024 14:35:41 +0100 Subject: [PATCH] Semantic code order for Multi Equations Constructors --- .../compressible_euler_multicomponent_1d.jl | 5 ++--- .../compressible_euler_multicomponent_2d.jl | 5 ++--- src/equations/ideal_glm_mhd_multicomponent_1d.jl | 6 +++--- src/equations/ideal_glm_mhd_multicomponent_2d.jl | 14 ++++++-------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/equations/compressible_euler_multicomponent_1d.jl b/src/equations/compressible_euler_multicomponent_1d.jl index 8594b0f5fa8..3cf7a60de34 100644 --- a/src/equations/compressible_euler_multicomponent_1d.jl +++ b/src/equations/compressible_euler_multicomponent_1d.jl @@ -78,13 +78,12 @@ function CompressibleEulerMulticomponentEquations1D(; gammas, gas_constants) _gas_constants = promote(gas_constants...) RealT = promote_type(eltype(_gammas), eltype(_gas_constants), typeof(gas_constants[1] / (gammas[1] - 1))) + __gammas = SVector(map(RealT, _gammas)) + __gas_constants = SVector(map(RealT, _gas_constants)) NVARS = length(_gammas) + 2 NCOMP = length(_gammas) - __gammas = SVector(map(RealT, _gammas)) - __gas_constants = SVector(map(RealT, _gas_constants)) - return CompressibleEulerMulticomponentEquations1D{NVARS, NCOMP, RealT}(__gammas, __gas_constants) end diff --git a/src/equations/compressible_euler_multicomponent_2d.jl b/src/equations/compressible_euler_multicomponent_2d.jl index 2c6bbdc4a23..f1a28cd1b92 100644 --- a/src/equations/compressible_euler_multicomponent_2d.jl +++ b/src/equations/compressible_euler_multicomponent_2d.jl @@ -82,13 +82,12 @@ function CompressibleEulerMulticomponentEquations2D(; gammas, gas_constants) _gas_constants = promote(gas_constants...) RealT = promote_type(eltype(_gammas), eltype(_gas_constants), typeof(gas_constants[1] / (gammas[1] - 1))) + __gammas = SVector(map(RealT, _gammas)) + __gas_constants = SVector(map(RealT, _gas_constants)) NVARS = length(_gammas) + 3 NCOMP = length(_gammas) - __gammas = SVector(map(RealT, _gammas)) - __gas_constants = SVector(map(RealT, _gas_constants)) - return CompressibleEulerMulticomponentEquations2D{NVARS, NCOMP, RealT}(__gammas, __gas_constants) end diff --git a/src/equations/ideal_glm_mhd_multicomponent_1d.jl b/src/equations/ideal_glm_mhd_multicomponent_1d.jl index a5f16bd78d8..c652c3416a2 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_1d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_1d.jl @@ -41,12 +41,12 @@ function IdealGlmMhdMulticomponentEquations1D(; gammas, gas_constants) _gas_constants = promote(gas_constants...) RealT = promote_type(eltype(_gammas), eltype(_gas_constants)) - NVARS = length(_gammas) + 7 - NCOMP = length(_gammas) - __gammas = SVector(map(RealT, _gammas)) __gas_constants = SVector(map(RealT, _gas_constants)) + NVARS = length(_gammas) + 7 + NCOMP = length(_gammas) + return IdealGlmMhdMulticomponentEquations1D{NVARS, NCOMP, RealT}(__gammas, __gas_constants) end diff --git a/src/equations/ideal_glm_mhd_multicomponent_2d.jl b/src/equations/ideal_glm_mhd_multicomponent_2d.jl index 509a2507cd9..3c09280533f 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_2d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_2d.jl @@ -42,15 +42,14 @@ function IdealGlmMhdMulticomponentEquations2D(; gammas, gas_constants) _gammas = promote(gammas...) _gas_constants = promote(gas_constants...) RealT = promote_type(eltype(_gammas), eltype(_gas_constants)) - - NVARS = length(_gammas) + 8 - NCOMP = length(_gammas) - __gammas = SVector(map(RealT, _gammas)) __gas_constants = SVector(map(RealT, _gas_constants)) c_h = convert(RealT, NaN) + NVARS = length(_gammas) + 8 + NCOMP = length(_gammas) + return IdealGlmMhdMulticomponentEquations2D{NVARS, NCOMP, RealT}(__gammas, __gas_constants, c_h) @@ -61,15 +60,14 @@ function IdealGlmMhdMulticomponentEquations2D(gammas, gas_constants, cv, cp, c_h _gammas = promote(gammas...) _gas_constants = promote(gas_constants...) RealT = promote_type(eltype(_gammas), eltype(_gas_constants)) - - NVARS = length(_gammas) + 8 - NCOMP = length(_gammas) - __gammas = SVector(map(RealT, _gammas)) __gas_constants = SVector(map(RealT, _gas_constants)) c_h = convert(RealT, c_h) + NVARS = length(_gammas) + 8 + NCOMP = length(_gammas) + return IdealGlmMhdMulticomponentEquations2D{NVARS, NCOMP, RealT}(__gammas, __gas_constants, c_h)