Skip to content

Conversation

Iddingsite
Copy link
Collaborator

@Iddingsite Iddingsite commented Jul 6, 2025

The current implementation of the WENO-5 advection algorithm is using the non-conservative form of the advection equation (V∂T∂x). We can implement the conservative form (∂(VT)∂x) using directly the velocities on the staggered grid (see for instance here).

Three good reasons to do that:

  • No need to interpolate the velocities from the sides to the center anymore
  • Makes no assumption on the divergence of V, so will be fully compatible with compressible flow
  • Would be fully conservative for the quantity advected

The implementation is a simple addition: using directly the velocities of the staggered grid for the value of the fluxes after using WENO-5 to approximate the advected quantity on the sides .

I have added a boolean kwarg to WENO_advection!() to be able to use both the non-conservative and the conservative form, but I believe that the conservative form should be the default. That would be a breaking change, because the input velocities required would be by default the velocities on the sides as opposed to currently velocities on vertices.

I have currently a problem with the boundary conditions, but I think I am mostly there. @albert-de-montserrat, is there a helper function to get only the interior points of for instance stokes.V.Vx? Because of the ghost points, I have to add +1 to my indexes currently and it would be nice if it could work by default with velocity fields without ghost points.

Needs #339 to be merged before.

@Iddingsite Iddingsite marked this pull request as draft July 6, 2025 15:37
@Iddingsite
Copy link
Collaborator Author

Iddingsite commented Jul 8, 2025

Alright, I understand my problem. I forgot that T was defined on the vertices in geodynamics, so this approach will not work for temperature (without interpolating of course). It will only work for quantities at the center of the stencil (η, ρ, Compo..). So I don't think there is a big interest for JustRelax.

@Iddingsite
Copy link
Collaborator Author

Closing that one for now.

@Iddingsite Iddingsite closed this Jul 8, 2025
@Iddingsite Iddingsite reopened this Jul 16, 2025
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.

1 participant