Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add numerical support of other real types (Float32) #1909

Merged
merged 34 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
cee9c6f
start with src/equations
huiyuxie Apr 19, 2024
1c95bb6
Merge branch 'trixi-framework:main' into main
huiyuxie Apr 28, 2024
195da8d
revise after the first review
huiyuxie Apr 28, 2024
2801e53
format src/equations
huiyuxie Apr 28, 2024
e2e413a
another version
huiyuxie Apr 30, 2024
ccc4a06
revise after the second review
huiyuxie May 2, 2024
12128a8
Merge branch 'main' into main
huiyuxie May 2, 2024
388917b
apply suggestions from code review - comments
huiyuxie May 3, 2024
77e32d0
remove TODO
huiyuxie May 3, 2024
b9e30fa
Merge branch 'trixi-framework:main' into main
huiyuxie May 6, 2024
4e6745f
Merge branch 'trixi-framework:main' into main
huiyuxie May 6, 2024
8fce44d
fix small errors
huiyuxie May 8, 2024
fa90a8b
complete compressible_euler
huiyuxie May 8, 2024
77521a5
Merge branch 'main' into main
huiyuxie May 8, 2024
832ad16
fix error and format
huiyuxie May 8, 2024
46081d5
Merge branch 'main' of https://github.com/huiyuxie/Trixi.jl
huiyuxie May 8, 2024
08272e0
revise min max
huiyuxie May 8, 2024
59f7a96
Merge branch 'main' into main
huiyuxie May 8, 2024
467d2f3
Merge branch 'trixi-framework:main' into main
huiyuxie May 10, 2024
5dc5aee
Merge branch 'main' into main
huiyuxie May 14, 2024
7b54890
revise based on new docs
huiyuxie May 14, 2024
c0ce534
revise based on new comments
huiyuxie May 15, 2024
013d902
Merge branch 'main' into main
huiyuxie May 15, 2024
9393f0a
Merge branch 'main' into main
huiyuxie May 17, 2024
523dac0
start sample test
huiyuxie May 21, 2024
4c8fa0e
add more tests
huiyuxie May 21, 2024
b355951
fix typos and comments
huiyuxie May 21, 2024
a5b462d
change code review
huiyuxie May 25, 2024
f43d8d4
add to CI
huiyuxie May 25, 2024
4c499fc
apply inferred macro
huiyuxie May 27, 2024
5dcbe2c
Merge branch 'main' into main
huiyuxie May 27, 2024
77704a8
complete
huiyuxie May 28, 2024
60d2873
Merge branch 'main' into main
huiyuxie Jun 1, 2024
60836bb
add Trixi
huiyuxie Jun 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Trixi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export flux, flux_central, flux_lax_friedrichs, flux_hll, flux_hllc, flux_hlle,
flux_chan_etal, flux_nonconservative_chan_etal, flux_winters_etal,
hydrostatic_reconstruction_audusse_etal, flux_nonconservative_audusse_etal,
FluxPlusDissipation, DissipationGlobalLaxFriedrichs, DissipationLocalLaxFriedrichs,
FluxLaxFriedrichs, max_abs_speed_naive,
FluxLaxFriedrichs, max_abs_speed_naive, max_abs_speeds,
huiyuxie marked this conversation as resolved.
Show resolved Hide resolved
FluxHLL, min_max_speed_naive, min_max_speed_davis, min_max_speed_einfeldt,
FluxLMARS,
FluxRotated,
Expand Down
56 changes: 30 additions & 26 deletions src/equations/acoustic_perturbation_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ A constant initial condition where the state variables are zero and the mean flo
Uses the global mean values from `equations`.
"""
function initial_condition_constant(x, t, equations::AcousticPerturbationEquations2D)
v1_prime = 0.0
v2_prime = 0.0
p_prime_scaled = 0.0
v1_prime = 0
v2_prime = 0
p_prime_scaled = 0
huiyuxie marked this conversation as resolved.
Show resolved Hide resolved

return SVector(v1_prime, v2_prime, p_prime_scaled, global_mean_vars(equations)...)
end
Expand All @@ -127,12 +127,13 @@ A smooth initial condition used for convergence tests in combination with
"""
function initial_condition_convergence_test(x, t,
equations::AcousticPerturbationEquations2D)
c = 2.0
A = 0.2
L = 2.0
f = 2.0 / L
a = 1.0
omega = 2 * pi * f
RealT = eltype(x)
a = 1
c = 2
L = 2
f = 2.0f0 / L
A = convert(RealT, 0.2)
omega = 2 * convert(RealT, pi) * f
init = c + A * sin(omega * (x[1] + x[2] - a * t))

v1_prime = init
Expand All @@ -154,12 +155,13 @@ function source_terms_convergence_test(u, x, t,
equations::AcousticPerturbationEquations2D)
v1_mean, v2_mean, c_mean, rho_mean = cons2mean(u, equations)

c = 2.0
A = 0.2
L = 2.0
f = 2.0 / L
a = 1.0
omega = 2 * pi * f
RealT = eltype(u)
a = 1
c = 2
L = 2
huiyuxie marked this conversation as resolved.
Show resolved Hide resolved
f = 2.0f0 / L
A = convert(RealT, 0.2)
omega = 2 * convert(RealT, pi) * f

si, co = sincos(omega * (x[1] + x[2] - a * t))
tmp = v1_mean + v2_mean - a
Expand All @@ -168,7 +170,7 @@ function source_terms_convergence_test(u, x, t,
du3 = A * omega * co * (2 * c_mean^2 * rho_mean + 2 * c * tmp + 2 * A * tmp * si) /
c_mean^2

du4 = du5 = du6 = du7 = 0.0
du4 = du5 = du6 = du7 = 0

return SVector(du1, du2, du3, du4, du5, du6, du7)
end
Expand All @@ -179,8 +181,8 @@ end
A Gaussian pulse in a constant mean flow. Uses the global mean values from `equations`.
"""
function initial_condition_gauss(x, t, equations::AcousticPerturbationEquations2D)
v1_prime = 0.0
v2_prime = 0.0
v1_prime = 0
v2_prime = 0
p_prime = exp(-4 * (x[1]^2 + x[2]^2))

prim = SVector(v1_prime, v2_prime, p_prime, global_mean_vars(equations)...)
Expand Down Expand Up @@ -240,8 +242,8 @@ function boundary_condition_slip_wall(u_inner, normal_direction::AbstractVector,
u_normal = normal[1] * u_inner[1] + normal[2] * u_inner[2]

# create the "external" boundary solution state
u_boundary = SVector(u_inner[1] - 2.0 * u_normal * normal[1],
u_inner[2] - 2.0 * u_normal * normal[2],
u_boundary = SVector(u_inner[1] - 2 * u_normal * normal[1],
u_inner[2] - 2 * u_normal * normal[2],
u_inner[3], cons2mean(u_inner, equations)...)

# calculate the boundary flux
Expand All @@ -257,13 +259,14 @@ end
v1_mean, v2_mean, c_mean, rho_mean = cons2mean(u, equations)

# Calculate flux for conservative state variables
RealT = eltype(u)
if orientation == 1
f1 = v1_mean * v1_prime + v2_mean * v2_prime +
c_mean^2 * p_prime_scaled / rho_mean
f2 = zero(eltype(u))
f2 = zero(RealT)
f3 = rho_mean * v1_prime + v1_mean * p_prime_scaled
else
f1 = zero(eltype(u))
f1 = zero(RealT)
f2 = v1_mean * v1_prime + v2_mean * v2_prime +
c_mean^2 * p_prime_scaled / rho_mean
f3 = rho_mean * v2_prime + v2_mean * p_prime_scaled
Expand All @@ -272,7 +275,7 @@ end
# The rest of the state variables are actually variable coefficients, hence the flux should be
# zero. See https://github.com/trixi-framework/Trixi.jl/issues/358#issuecomment-784828762
# for details.
f4 = f5 = f6 = f7 = zero(eltype(u))
f4 = f5 = f6 = f7 = 0

return SVector(f1, f2, f3, f4, f5, f6, f7)
end
Expand Down Expand Up @@ -313,7 +316,7 @@ end
# The rest of the state variables are actually variable coefficients, hence the flux should be
# zero. See https://github.com/trixi-framework/Trixi.jl/issues/358#issuecomment-784828762
# for details.
f4 = f5 = f6 = f7 = zero(eltype(u))
f4 = f5 = f6 = f7 = 0

return SVector(f1, f2, f3, f4, f5, f6, f7)
end
Expand Down Expand Up @@ -344,8 +347,9 @@ end
equations::AcousticPerturbationEquations2D)
λ = dissipation.max_abs_speed(u_ll, u_rr, orientation_or_normal_direction,
equations)
diss = -0.5 * λ * (u_rr - u_ll)
z = zero(eltype(u_ll))
diss = -0.5f0 * λ * (u_rr - u_ll)
z = 0
huiyuxie marked this conversation as resolved.
Show resolved Hide resolved

return SVector(diss[1], diss[2], diss[3], z, z, z, z)
end

Expand Down
Loading
Loading