Skip to content

Commit

Permalink
Semantic code order for Multi Equations Constructors (#2202)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring authored Dec 11, 2024
1 parent a151e74 commit f45455b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
5 changes: 2 additions & 3 deletions src/equations/compressible_euler_multicomponent_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/equations/compressible_euler_multicomponent_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/equations/ideal_glm_mhd_multicomponent_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 6 additions & 8 deletions src/equations/ideal_glm_mhd_multicomponent_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit f45455b

Please sign in to comment.