-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af1eb1f
commit e382140
Showing
5 changed files
with
121 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using OrdinaryDiffEq | ||
using Trixi | ||
using TrixiAtmo | ||
using TrixiAtmo: flux_theta, prim2cons | ||
############################################################################### | ||
# semidiscretization of the compressible Euler equations | ||
equations = CompressibleEulerPotentialTemperatureEquations2D() | ||
|
||
function initial_condition_weak_blast_wave(x, t, | ||
equations::CompressibleEulerPotentialTemperatureEquations2D) | ||
# From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) | ||
# Set up polar coordinates | ||
inicenter = SVector(0, 0) | ||
x_norm = x[1] - inicenter[1] | ||
y_norm = x[2] - inicenter[2] | ||
r = sqrt(x_norm^2 + y_norm^2) | ||
phi = atan(y_norm, x_norm) | ||
sin_phi, cos_phi = sincos(phi) | ||
|
||
# Calculate primitive variables | ||
RealT = eltype(x) | ||
rho = r > 0.5f0 ? one(RealT) : convert(RealT, 1.1691) | ||
v1 = r > 0.5f0 ? zero(RealT) : convert(RealT, 0.1882) * cos_phi | ||
v2 = r > 0.5f0 ? zero(RealT) : convert(RealT, 0.1882) * sin_phi | ||
p = r > 0.5f0 ? one(RealT) : convert(RealT, 1.245) | ||
|
||
return prim2cons(SVector(rho, v1, v2, p), equations) | ||
end | ||
|
||
initial_condition = initial_condition_weak_blast_wave | ||
|
||
volume_flux = flux_theta | ||
solver = DGSEM(polydeg = 3, surface_flux = flux_theta, | ||
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) | ||
|
||
coordinates_min = (-2.0, -2.0) | ||
coordinates_max = (2.0, 2.0) | ||
|
||
cells_per_dimension = (32, 32) | ||
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, | ||
periodicity = (true, true)) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
boundary_conditions = boundary_condition_periodic) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0, 0.4) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 100 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
save_solution = SaveSolutionCallback(interval = 100, | ||
save_initial_solution = true, | ||
save_final_solution = true, | ||
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), | ||
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback | ||
save_everystep = false, callback = callbacks); | ||
summary_callback() # print the timer summary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters