Write DZDXF/DZDYF derived from ZSF - #6
Open
masih-e wants to merge 1 commit into
Open
Conversation
CFBM reads the terrain gradients from the input file. Both gradients are derived form the reprojected ZSF. Sencil follows geogrid's calc_dfdz/calc_dfdy with centred difference in the interior, one-sided at the edges. Behavior unchanged for NFUEL_CAT and ZSF. Portions drafted with Claude Opus 5. Closes #5
Collaborator
|
Thank you @masih-e! Can you confirm that you tested the new code and checked the output? |
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.
Closes #5
Derives
DZDXF/DZDYFfrom the reprojectedZSFand writes them alongsideNFUEL_CAT/ZSF.Boundary handling. The issue specifies "equivalent to extending terrain at
the edge." I used a one-sided difference instead. Replicating the edge into a
ghost cell leaves the numerator
z1-z0over a denominator of2h, whichreports half the true gradient, an O(1) error.
Map factor sense. Applied map factors, but multiplying where
calc_dfdx(WPS) divides. WRFmeasures grid spacing in projection space and treats the true inter-point
distance as
dx/MAPFAC—dyn_em/module_diffusion_em.F:1894builds itsphysical mixing length as
sqrt(dx/msftx * dy/msfty). So a physical gradientmultiplies by the map factor, and dividing doubles the error rather than
removing it. This reads like a WPS bug rather than a convention to match, but
flagging it since anyone diffing against a geogrid-produced file will see the
difference. Negligible at fire scale (5e-6 across the 40 km CT2 nest), 1.3%
across 2000 km, 8% across a continental domain.