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

Updates for terrain / grid stretching #1361

Merged
merged 18 commits into from
Jan 9, 2024

Conversation

ewquon
Copy link
Contributor

@ewquon ewquon commented Jan 4, 2024

  • Fix bug w/ higher-order advection + terrain (ed6ae8c)
  • Clean up problem-specific terrain code
  • Warn if mismatched prob_hi[2] and zlevels_stag[nz] -- the latter is the stretched grid levels that are used to populate z_phys_nd and may differ from the input geometry if "grid_stretching_ratio" or "terrain_z_levels" is specified
  • Use zlevels_stag[nz] in init_terrain_grid() instead of ProbHiArray[2] -- only has an effect if surface elevation z_arr(ii,jj,k0) != 0
  • Enable terrain for idealized case with input sounding

…oblem domain

It may make sense to update the problem domain if possible
init_terrain_grid() used to use ztop = geom.ProbHiArray()[2], which
comes from the input file. For a stretched grid or user-specified
"terrain_z_levels", there could have been a mismatch between ztop and
the actual requested top of the domain.
Note: The regression tests DynamicRefinement, IsentropicVortex, and
ScalarAdvDiff all explicitly initialized z_phys_nd to be k*dz and then
called FillBoundary(). However, if use_terrain==true (and
init_custom_terrain() was called), then the default behavior should be
equivalent: init_zlevels() called without grid stretching, then
init_terrain_grid() called to populate z_phys_nd and then FillBoundary()
@ewquon ewquon marked this pull request as draft January 4, 2024 16:59
@ewquon
Copy link
Contributor Author

ewquon commented Jan 4, 2024

Draft for now, need to verify that the new default init_custom_terrain() doesn't break any reg tests...

@ewquon
Copy link
Contributor Author

ewquon commented Jan 5, 2024

Note: regtests fail for DensityCurrent_detJ2 and DensityCurrent_detJ2_nosub (both with terrain, default 3rd order) fail starting from ed6ae8c, i.e., after the bug fix.

Notes:
- Nominal z levels (e.g., from input terrain_z_levels) that are used for
  terrain smoothing should range from 0 (on the surface) to ztop
- The same levels are used to calculate the base state by integrating
  the hydrostatic equation through a column of air
- In the case of terrain or grid stretching, the base state profiles
  may have non-uniform vertical grid spacing
- These 1-D profiles are then interpolated to the 3-D terrain grid; the
  state and hse fab arrays are interpolated at z_phys_cc whereas the
  velocity fab arrays are interpolated at face centers calculated from
  z_phys_nd
@ewquon
Copy link
Contributor Author

ewquon commented Jan 9, 2024

302d57e enables ideal input soundings to be used with terrain, resulting in comparable pressure and density base states with and without grid stretching. The commit message describes the implementation. Some additional comments:

  • The nominal grid levels, either supplied by the user through terrain_z_levels -- or grid_stretching_ratio and initial_dz -- are the "coordinate surface heights" ($\zeta$) from Klemp 2011
  • $\zeta$ is expected to range from 0 (at the surface )to $z_{top}$
  • With BTF and Sullivan TF terrain grids, the physical height of the highest grid nodes is exactly equal to $z_{top}$ at k=geom[0].bigEnd(2)+1, (where $\zeta=z_{top}$).
  • With STF terrain grids (smoothing following Klemp 2011), the grid should be deformed near the surface only (see Implementation of terrain grid with STF smoothing #1368). The current implementation assumes the domain top is far enough away from the surface to be outside of the deformed grid region, in which case, the physical height of the highest grid nodes is also equal to $z_{top}$.

@ewquon ewquon marked this pull request as ready for review January 9, 2024 16:14
@ewquon
Copy link
Contributor Author

ewquon commented Jan 9, 2024

This PR looks bigger than it actually is. I consolidated all the duplicated terrain initialization code (that set the surface z_phys_nd = 0) and cleaned up most of the prob source files.

@asalmgren a heads up that the gold data were updated!

@ewquon ewquon requested a review from AMLattanzi January 9, 2024 16:15
@asalmgren asalmgren merged commit d8f1aca into erf-model:development Jan 9, 2024
10 checks passed
@ewquon ewquon deleted the grid_stretching_updates branch January 9, 2024 23:10
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