Repository navigation
Fixes for finite difference stencils on nonuniform meshes (rotation) - #1144
Open
AstroBarker wants to merge 2 commits into
Open
AstroBarker wants to merge 2 commits into
AstroBarker wants to merge 2 commits into
Conversation
…on that are correct on a non-uniform mesh.
Collaborator
|
not as critical, but I think that |
Contributor
Author
Noted! I haven't poked around yet for where else this might be relevant. |
Member
|
Very nice! I will take a deeper look in 24hr when i'm not traveling. |
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This grew out of conversations with @Debraheem. There are a number of finite differences in$$\partial_r$$ derivatives for mixing coefficients. These used stencils that were inconsistent on a non-uniform mesh.
star/private/rotation_mix_info.f90for radialTL;DR
The centered finite difference
and friends, which are used in the rotation code for estimating mixing coefficients, are only correct on a uniform mesh. For MESA we can basically guarantee that we do not have such a mesh.
Details
puremodule proceduresddr_nonuniformandddr_one_sided.setup:dRho_dr,dP_dr(which feedsdRho_dr_ad),dj_dr(which feedsdr2omegaandHj) anddomega_dlnRnow useddr_nonuniform.omega_shearandset_STdlnomega_dlnrnow useddr_nonuniform.set_zone_scale_height(v, r, ktop, kbot, H)computesH = v/|dv/dr|over a contiguous unstable zone: the centered stencil inside, the one-sided stencil at both ends, and a two-point fallback for 2-face zones. SSI, ES and GSF all call it now in place of three copies of the same code.dRho,dPressure,domega,d_mu(unused) andd_j_rot.kbot == 1/ktop == nzbranches and thek == -1debug writes.dr(:)now only feeds the dP/dr sign guard and debug output.This PR updates these finite differences to use a form appropriate for non-uniform meshes.
Stencils
Define the signed spacings for each side of a face
The generic second order finite difference is
On a uniform mesh it reduces to the usual form. A one sided form is used at mixing boundaries.
These are implemented in elemental functions in
num/public/num_lib.f90and tested innum/test.Impact
The

20M_z2m2_high_rotationtest case seems to proceed with fewer retries compared to main. There is a large impact seen in the GSF diffusion coefficients, seen below (excuse the poor plot)where the panels show the log of the GSF diffusion coefficient with the fixed stencils (blue) and without (orange). The old mixing profile is noisy, with jumps corresponding to changes in mesh spacing (shown hastily in the lower panels).