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 covariant form using P4estMesh #31

Closed
wants to merge 89 commits into from
Closed

Conversation

tristanmontoya
Copy link
Member

@tristanmontoya tristanmontoya commented Aug 17, 2024

This PR contains a preliminary implementation of a two-dimensional DG solver for PDEs on surfaces in covariant form, starting here with the variable-coefficient linear advection equation on the sphere.

I defined a new P4estElementContainerCovariant type to carry the specific geometric information needed for the covariant form. Since only the scalar advection equation is supported so far, I didn't add Christoffel symbols as part of this PR.

Trixi.jl's rhs!, weak_form_kernel!, flux_differencing_kernel!, compute_coefficients!, calc_interface_flux!, max_dt, and calc_error_norms functions are specialized in dg_2d_manifold_in_3d_covariant.jl so as to dispatch on the new type AbstractCovariantEquations{NDIMS, NVARS}. The physical and numerical fluxes called by those functions take in the cache as well as the node and element indices, so that all the geometric information can be accessed by these fluxes. This way, we do not need to store the spatially varying geometric quantities that the contravariant fluxes depend upon as auxiliary solution variables as I did in an earlier implementation of my spherical shallow water solver.

The initial condition is prescribed with zonal and meridional velocity or momentum components, which then get transformed in compute_coefficients! to get the local contravariant components. An additional elixir elixir_spherical_advection_covariant.jl has been added as an example of this, using a smooth Gaussian bell test case adapted from the standard Cosine bell case (Case 1 from the Williamson et al. test suite). Standard values of geophysical parameters are provided as constants in src/equations/reference_data.jl.

This PR also includes tests for the new weak-form and flux-differencing solvers, which give the same results when the arithmetic mean is used for the two-point volume flux. As discussed in #43, Trixi.jl versions below 0.9 are no longer supported.

tristanmontoya and others added 28 commits July 18, 2024 21:57
…tion in Trixi.jl (cherry-picked from f45378e)

Co-authored-by: Tristan Montoya <[email protected]>
…ltype() and ndims() functions for new struct
@tristanmontoya tristanmontoya marked this pull request as draft August 17, 2024 22:48
Copy link

codecov bot commented Aug 17, 2024

Codecov Report

Attention: Patch coverage is 99.34853% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.88%. Comparing base (49ec206) to head (b7a7f5a).

Files with missing lines Patch % Lines
src/equations/shallow_water_3d.jl 90.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #31      +/-   ##
==========================================
+ Coverage   84.71%   87.88%   +3.17%     
==========================================
  Files          11       17       +6     
  Lines        1125     1420     +295     
==========================================
+ Hits          953     1248     +295     
  Misses        172      172              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Collaborator

@amrueda amrueda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an initial "superficial" review. I still have to look at the following files in detail:

  • src/solvers/dgsem_p4est/containers_2d_manifold_in_3d_covariant.jl
  • src/solvers/dgsem_p4est/dg_2d_manifold_in_3d_covariant.jl

src/meshes/p4est_cubed_sphere.jl Outdated Show resolved Hide resolved
src/equations/equations.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_p4est/dg_2d_manifold_in_3d_covariant.jl Outdated Show resolved Hide resolved
test/test_spherical_advection.jl Show resolved Hide resolved
src/equations/covariant_advection.jl Show resolved Hide resolved
@tristanmontoya
Copy link
Member Author

After the discussion in #46, I wonder if this should be modified to not pass the cache around, or if it's best to merge it first and then look into cleaner alternatives.

@tristanmontoya
Copy link
Member Author

Superseded by #47.

@tristanmontoya tristanmontoya deleted the tm/covariant_form branch November 25, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants