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 2D Potential Temperature Formulation for the Euler Eqs. #38

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e12a357
Potential Temperature Euler Eq.
MarcoArtiano Sep 19, 2024
4602b1c
delete backup files
MarcoArtiano Sep 19, 2024
680186e
formatting
MarcoArtiano Sep 19, 2024
dd5568a
formatting
MarcoArtiano Sep 19, 2024
96d60c1
merging
MarcoArtiano Sep 19, 2024
04c304d
renaming
MarcoArtiano Sep 23, 2024
12931b8
renaming source term
MarcoArtiano Sep 23, 2024
5124bc8
renaming
MarcoArtiano Sep 23, 2024
af1eb1f
renaming and test added
MarcoArtiano Sep 23, 2024
e382140
added ec test
MarcoArtiano Sep 23, 2024
374cb63
restyling and clean up
MarcoArtiano Sep 23, 2024
b75cfef
formatting
MarcoArtiano Sep 23, 2024
a229219
minor changes
MarcoArtiano Sep 23, 2024
bf65669
minor changes
MarcoArtiano Sep 23, 2024
6b3da0b
minor changes
MarcoArtiano Sep 23, 2024
e952915
renaming, enabling Float32
MarcoArtiano Sep 24, 2024
78d4bcc
formatting
MarcoArtiano Sep 24, 2024
a820c97
deleted useless parts
MarcoArtiano Sep 24, 2024
b2e1b90
Update examples/elixir_moist_euler_dry_bubble.jl
MarcoArtiano Sep 25, 2024
9021e28
Update examples/elixir_moist_euler_moist_bubble.jl
MarcoArtiano Sep 25, 2024
c53a3cd
Update examples/elixir_moist_euler_nonhydrostatic_gravity_waves.jl
MarcoArtiano Sep 25, 2024
3cf8db1
Update src/TrixiAtmo.jl
MarcoArtiano Sep 25, 2024
d2a23b1
Update examples/elixir_moist_euler_moist_bubble.jl
MarcoArtiano Sep 25, 2024
dbbd06a
Update elixir_euler_potential_temperature_dry_bubble.jl
MarcoArtiano Sep 25, 2024
41ec9bf
Update test_trixi_consistency.jl
MarcoArtiano Sep 25, 2024
de71e98
Update test_trixi_consistency.jl
MarcoArtiano Sep 25, 2024
14c3820
gravity wave test, testing ec fluxes
MarcoArtiano Sep 25, 2024
7116306
minor changes
MarcoArtiano Sep 25, 2024
6c91b29
minor changes
MarcoArtiano Sep 25, 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
114 changes: 114 additions & 0 deletions examples/elixir_potential_euler_dry_bubble.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
using OrdinaryDiffEq
using Trixi
using TrixiAtmo
using TrixiAtmo: flux_LMARS, source_terms_bubble, flux_theta
using Plots

function initial_condition_warm_bubble(x, t,
equations::CompressiblePotentialEulerEquations2D)
g = equations.g
c_p = equations.c_p
c_v = equations.c_v
# center of perturbation
center_x = 10000.0
center_z = 2000.0
# radius of perturbation
radius = 2000.0
# distance of current x to center of perturbation
r = sqrt((x[1] - center_x)^2 + (x[2] - center_z)^2)

# perturbation in potential temperature
potential_temperature_ref = 300.0
potential_temperature_perturbation = 0.0
if r <= radius
potential_temperature_perturbation = 2 * cospi(0.5 * r / radius)^2
end
potential_temperature = potential_temperature_ref + potential_temperature_perturbation

# Exner pressure, solves hydrostatic equation for x[2]
exner = 1 - g / (c_p * potential_temperature_ref) * x[2]

# pressure
p_0 = 100_000.0 # reference pressure
R = c_p - c_v # gas constant (dry air)
p = p_0 * exner^(c_p / R)
T = potential_temperature * exner

# density
rho = p / (R * T)
v1 = 20.0
v2 = 0.0

return SVector(rho, rho * v1, rho * v2, rho * potential_temperature)
end

###############################################################################
# semidiscretization of the compressible Euler equations

equations = CompressiblePotentialEulerEquations2D()

boundary_conditions = (x_neg = boundary_condition_periodic,
x_pos = boundary_condition_periodic,
y_neg = boundary_condition_slip_wall,
y_pos = boundary_condition_slip_wall)

polydeg = 3
basis = LobattoLegendreBasis(polydeg)

surface_flux = flux_LMARS

volume_flux = flux_theta
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)

solver = DGSEM(basis, surface_flux, volume_integral)

coordinates_min = (0.0, 0.0)
coordinates_max = (20_000.0, 10_000.0)

cells_per_dimension = (32, 16)
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max,
periodicity = (true, false))
initial_condition = initial_condition_warm_bubble

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
source_terms = source_terms_bubble,
boundary_conditions = boundary_conditions)

###############################################################################
# ODE solvers, callbacks etc.

tspan = (0.0, 1000.0) # 1000 seconds final time

ode = semidiscretize(semi, tspan)

summary_callback = SummaryCallback()

analysis_interval = 1000

analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
extra_analysis_errors = (:entropy_conservation_error,))

alive_callback = AliveCallback(analysis_interval = analysis_interval)

save_solution = SaveSolutionCallback(interval = analysis_interval,
save_initial_solution = true,
save_final_solution = true,
output_directory = "out",
solution_variables = cons2prim)

stepsize_callback = StepsizeCallback(cfl = 1.0)

callbacks = CallbackSet(summary_callback,
analysis_callback,
alive_callback,
save_solution,
stepsize_callback)

###############################################################################
# run the simulation
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);

summary_callback()
3 changes: 2 additions & 1 deletion src/TrixiAtmo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ include("solvers/solvers.jl")
include("semidiscretization/semidiscretization_hyperbolic_2d_manifold_in_3d.jl")

export CompressibleMoistEulerEquations2D
export CompressiblePotentialEulerEquations2D
ranocha marked this conversation as resolved.
Show resolved Hide resolved

export flux_chandrashekar, flux_LMARS
export flux_chandrashekar, flux_LMARS, flux_theta

export examples_dir

Expand Down
Loading