-
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.
Merge branch 'main' into arr/shallow_water_cartesian_topography
- Loading branch information
Showing
21 changed files
with
520 additions
and
340 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
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
66 changes: 66 additions & 0 deletions
66
examples/elixir_spherical_advection_covariant_quad_icosahedron.jl
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,66 @@ | ||
############################################################################### | ||
# DGSEM for the linear advection equation on the cubed sphere | ||
############################################################################### | ||
# To run a convergence test, use | ||
# convergence_test("../examples/elixir_spherical_advection_covariant_quad_icosahedron.jl", 4, cells_per_dimension = (1,1)) | ||
|
||
using OrdinaryDiffEq, Trixi, TrixiAtmo | ||
|
||
############################################################################### | ||
# Spatial discretization | ||
|
||
cells_per_dimension = (2, 2) | ||
initial_condition = initial_condition_gaussian | ||
|
||
equations = CovariantLinearAdvectionEquation2D(global_coordinate_system = GlobalCartesianCoordinates()) | ||
|
||
# Create DG solver with polynomial degree = p and a local Lax-Friedrichs flux | ||
solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs, | ||
volume_integral = VolumeIntegralWeakForm()) | ||
|
||
# Create a 2D cubed sphere mesh the size of the Earth. For the covariant form to work | ||
# properly, we currently need polydeg to equal that of the solver, and | ||
# initial_refinement_level = 0 (default) | ||
mesh = P4estMeshQuadIcosahedron2D(cells_per_dimension[1], EARTH_RADIUS, | ||
polydeg = Trixi.polydeg(solver)) | ||
|
||
initial_condition_transformed = transform_initial_condition(initial_condition, equations) | ||
|
||
# A semidiscretization collects data structures and functions for the spatial discretization | ||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_transformed, solver) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
# Create ODE problem with time span from 0 to T | ||
ode = semidiscretize(semi, (0.0, 12 * SECONDS_PER_DAY)) | ||
|
||
# At the beginning of the main loop, the SummaryCallback prints a summary of the simulation setup | ||
# and resets the timers | ||
summary_callback = SummaryCallback() | ||
|
||
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results | ||
analysis_callback = AnalysisCallback(semi, interval = 10, | ||
save_analysis = true, | ||
extra_analysis_errors = (:conservation_error,)) | ||
|
||
# The SaveSolutionCallback allows to save the solution to a file in regular intervals | ||
save_solution = SaveSolutionCallback(interval = 10, | ||
solution_variables = contravariant2global) | ||
|
||
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step | ||
stepsize_callback = StepsizeCallback(cfl = 0.7) | ||
|
||
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver | ||
callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, | ||
stepsize_callback) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks | ||
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), | ||
dt = 1.0, save_everystep = false, callback = callbacks); | ||
|
||
# Print the timer summary | ||
summary_callback() |
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
Oops, something went wrong.