-
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.
[2D manifold in 3D] Option to use global Cartesian coordinates to def…
…ine exact covariant basis vectors (#54) * new save_solution_file method for covariant form * save using conversion that depends on auxiliary variables * improve comment * move back spherical2cartesian * generalize metrics * covariant form using polynomial geometry, but it isn't conservative * a_node -> aux_node * remove duplicated code and HDF5 dependency * remove using HDF5... * add third contravariant component to have consistent number of variables * ability to choose between exact geometry in spherical coords or approx cartesian * preliminary implementation of exact cartesian global coordinates * now have option to switch between spherical/cartesian global coords * resolve merge * make integrate_via_indices use exact Jacobian * fix initial condition * update docstrings * remove HDF5 and Infiltrator * remove * add more docstrings * resolve conflicts * improve comments * more docstring/comments * put back in comment about bottom topography being zero for initial_condition_gaussian * add comment about calc_node_coordinates * remove unnecessary calc_node_coordinates_2d_shell * remove git add .! from end of docstring warning * improve docstring * remove obsolete comment * Added elixirs for spherical advection convergence tests * use same save_solution_file as Cartesian * remove v3 * fix tests * remove references to v3 in comments * fix typo in docstring * Apply suggestions from code review Co-authored-by: Andrés Rueda-Ramírez <[email protected]> * apply suggestions from code review --------- Co-authored-by: Andrés Rueda-Ramírez <[email protected]>
- Loading branch information
1 parent
8d2dc5a
commit fd639d6
Showing
18 changed files
with
497 additions
and
322 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
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.