Skip to content

Commit

Permalink
Add 2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpit-Babbar committed Jul 17, 2024
1 parent 0716b9c commit ca6eb52
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions examples/elixir_moist_euler_EC_bubble.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ using NLsolve: nlsolve

equations = CompressibleMoistEulerEquations2D()

# TODO - Should the IC functions and struct be in the equation file?
function moist_state(y, dz, y0, r_t0, theta_e0, equations::CompressibleMoistEulerEquations2D)
@unpack p_0, g, c_pd, c_pv, c_vd, c_vv, R_d, R_v, c_pl, L_00 = equations
(p, rho, T, r_t, r_v, rho_qv, theta_e) = y
Expand Down
12 changes: 6 additions & 6 deletions examples/elixir_moist_euler_dry_bubble.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using OrdinaryDiffEq
using Trixi
using Trixi # TODO - Decide. This structure requires Trixi.jl to be in Project.toml of `Test`
using TrixiAtmo
using TrixiAtmo: flux_LMARS, source_terms_geopotential, cons2drypot

Expand Down Expand Up @@ -29,10 +29,10 @@ function initial_condition_warm_bubble(x, t, equations::CompressibleMoistEulerEq
θ = θ_ref + Δθ # potential temperature
# π_exner = 1 - g / (c_pd * θ) * x[2] # exner pressure
# rho = p_0 / (R_d * θ) * (π_exner)^(c_vd / R_d) # density

# calculate background pressure with assumption hydrostatic and neutral
p = p_0 * (1-kappa * g * x[2] / (R_d * θ_ref))^(c_pd / R_d)

#calculate rho and T with p and theta (now perturbed) rho = p / R_d T, T = θ / π
rho = p / ((p / p_0)^kappa*R_d*θ)
T = p / (R_d * rho)
Expand All @@ -42,7 +42,7 @@ function initial_condition_warm_bubble(x, t, equations::CompressibleMoistEulerEq
v2 = 0.0
rho_v1 = rho * v1
rho_v2 = rho * v2
rho_E = rho * c_vd * T + 1/2 * rho * (v1^2 + v2^2)
rho_E = rho * c_vd * T + 1/2 * rho * (v1^2 + v2^2)
return SVector(rho, rho_v1, rho_v2, rho_E, zero(eltype(g)) ,zero(eltype(g)))
end

Expand All @@ -67,7 +67,7 @@ volume_flux = flux_chandrashekar
volume_integral=VolumeIntegralFluxDifferencing(volume_flux)


# Create DG solver with polynomial degree = 4 and LMARS flux as surface flux
# Create DG solver with polynomial degree = 4 and LMARS flux as surface flux
# and the EC flux (chandrashekar) as volume flux
solver = DGSEM(basis, surface_flux, volume_integral)

Expand Down Expand Up @@ -120,7 +120,7 @@ callbacks = CallbackSet(summary_callback,

###############################################################################
# run the simulation
sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
maxiters=1.0e7,
dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
save_everystep=false, callback=callbacks);
Expand Down
5 changes: 4 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[deps]
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Trixi = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"

[compat]
Test = "1"
Test = "1"
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ const TRIXI_NTHREADS = clamp(Sys.CPU_THREADS, 2, 3)
@test TrixiAtmo.baz() isa String
end
end

@time if TRIXI_TEST == "all" || TRIXI_TEST == "moist_euler"
include("test_2d_moist_euler.jl")
end
end

0 comments on commit ca6eb52

Please sign in to comment.