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

Physgrid: Introduce new topography file format. #3267

Merged

Conversation

ambrad
Copy link
Member

@ambrad ambrad commented Oct 29, 2019

Improve treatment of topography for physgrid configurations. Better GLL/PG consistency and error checking when reading netcdf files.

[BFB]

ambrad and others added 3 commits October 29, 2019 15:59
I. Background. Topography data include phi_s, SGH, SGH30, and landm_coslat. SGH
and SGH30
    area(Omega)^-1 sqrt( integral_Omega (h1(x) - h2(x))^2 dx ),
where h1 and h2 are two topography references.

SGH captures the smoothing between an ~5-km length scale and the actual
grid. SGH30 captures the smoothing between the ~5-km length scale and the true
(30") topography.

1. We want phi_s on the dynamics grid and the FV grid to be consistent in the
sense that an integral over an FV subcell of either representation gives the
same value.

2. We also what topography to be as rough as the simulation can tolerate.

1 is currently true because we read FV PHIS, remap to GLL, then remap back to FV
to make 1 true. But this procedure does not satisfy 2 because it introduces new
smoothing.

II. New topo file format, the mixed GLL-FV format. Thus, a new topography file
format will have the fields
   PHIS_d, phi_s on the GLL grid
   PHIS, phis_s on the FV grid
   SGH, SGH30, LANDM_COSLAT, LANDFRAC on the FV grid
The old file format, which does not contain PHIS_d, is still supported.

III. Final tool chain. PHIS_d will have exactly the smoothness the dycore
requires. Then PHIS_d is remapped to PHIS. The other fields can be computed from
PHIS. This requires cube_to_target and other tools.

IV. Converter. This PR provides a tool in standalone Homme to convert an old GLL
file to a new mixed GLL-FV file. The remapped SGH is augmented with additional
variance due to the remap. The results are good, but the final tool chain should
be used for new grid development work.
@ambrad
Copy link
Member Author

ambrad commented Oct 29, 2019

e3sm_developer testing in progress.

See Topography section on the physgrid results page for details.

@@ -451,30 +452,45 @@ subroutine read_inidat( ncid_ini, ncid_topo, dyn_in)
end do
end do

read_pg_grid = .false.
Copy link
Contributor

Choose a reason for hiding this comment

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

There's very likely going to be a conflict between this and PR #3204. It might be a good idea to merge those commits in to this branch.

Copy link
Member Author

Choose a reason for hiding this comment

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

This PR will go in after that one, so I'll merge master at the end when this PR is ready.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, that works. The conflicts shouldn't be too hard to fix since the block isn't that big.

call fv_phys_to_dyn_topo(elem,phys_tmp)
call fv_phys_to_dyn_topo(elem,phys_tmp)
else
! Attempt to read a mixed GLL-FV topo file, which contains PHIS_d in
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need a better description of what happens when the topo is on the GLL grid. Maybe I'm behind on this discussion, but last time we talked about it I thought we were sure that the topo used by the dynamics needs to be defined on the FV grid for the purpose of the the parameterizations that handle the "sub-grid" topography that live in physics world.
Is this change just a convenience so we don't have to create the topo on the FV grid? In other words, it allows us to use the conventional smoothing of topo on the GLL grid rather than defining a new smoothing operator on the FV grid?

Copy link
Member Author

Choose a reason for hiding this comment

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

First, let me quote a commit message so we have this information available in the conversation:

I. Background. Topography data include phi_s, SGH, SGH30, and landm_coslat. SGH
and SGH30
area(Omega)^-1 sqrt( integral_Omega (h1(x) - h2(x))^2 dx ),
where h1 and h2 are two topography references.

SGH captures the smoothing between an ~5-km length scale and the actual
grid. SGH30 captures the smoothing between the ~5-km length scale and the true
(30") topography.

  1. We want phi_s on the dynamics grid and the FV grid to be consistent in the
    sense that an integral over an FV subcell of either representation gives the
    same value.

  2. We also what topography to be as rough as the simulation can tolerate.

1 is currently true because we read FV PHIS, remap to GLL, then remap back to FV
to make 1 true. But this procedure does not satisfy 2 because it introduces new
smoothing.

II. New topo file format, the mixed GLL-FV format. Thus, a new topography file
format will have the fields
PHIS_d, phi_s on the GLL grid
PHIS, phis_s on the FV grid
SGH, SGH30, LANDM_COSLAT, LANDFRAC on the FV grid
The old file format, which does not contain PHIS_d, is still supported.

III. Final tool chain. PHIS_d will have exactly the smoothness the dycore
requires. Then PHIS_d is remapped to PHIS. The other fields can be computed from
PHIS. This requires cube_to_target and other tools.

IV. Converter. This PR provides a tool in standalone Homme to convert an old GLL
file to a new mixed GLL-FV file. The remapped SGH is augmented with additional
variance due to the remap. The results are good, but the final tool chain should
be used for new grid development work.

Copy link
Member Author

Choose a reason for hiding this comment

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

the topo used by the dynamics needs to be defined on the FV grid

Yes.

Is this change just a convenience so we don't have to create the topo on the FV grid?

No; see below.

In other words, it allows us to use the conventional smoothing of topo on the GLL grid rather than defining a new smoothing operator on the FV grid?

Yes, but that is not a matter of convenience, IMO. Rather, the dycore needs a specific type of smoothing, smoothing specific to the GLL grid. So this new file format provides exactly these GLL PHIS_d data. PHIS is then PHIS_d mapped to the FV grid, which gives the least amount of smoothing possible on both grids while keeping GLL and FV phis_s consistent. Then cube_to_target can run using PHIS (not PHIS_d), giving the FV SGH, SGH30, and landm_coslat.

This PR does have a convenience feature, however. The converter produces a file in this new format from an old pure-GLL topo file. A future PR will fill in the tool chain for doing each calculation on the right grid.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, this is fantastic. I like the new approach.

Copy link
Member

Choose a reason for hiding this comment

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

Does this mean the dual grid is no longer needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe adoption of (1) physgrid and (2) tri-grid will make the GLL dual grid unnecessary in v2. This PR does not change the status of the dual grid; it was already unnecessary for physgrid topo. This PR focuses on maximizing the quality of topo on each grid while keeping the two topo representations consistent, which does not require the GLL dual grid.

SCREAM may not use tri-grid, in which case the GLL dual grid will still be needed for that project. But I believe the status of that point is uncertain.

@@ -101,6 +101,7 @@ OPTION(BUILD_HOMME_PREQX_ACC "Primitive equations FEM with OpenACC" ON)
OPTION(BUILD_HOMME_PREQX_KOKKOS "Primitive equations FEM with Kokkos" OFF)
OPTION(BUILD_HOMME_SWIM "Shallow water equations implicit" OFF)
OPTION(BUILD_HOMME_PRIM "Primitive equations implicit" OFF)
OPTION(BUILD_HOMME_TOOL "Offline tool" OFF)
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason not to make this default ON?

Copy link
Member Author

Choose a reason for hiding this comment

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

No reason. Will do.

@mt5555
Copy link
Contributor

mt5555 commented Oct 31, 2019

nice PR. I'm looking forward to moving the interpolate, template and toposmoothing tools into the new tool framework.

@ambrad
Copy link
Member Author

ambrad commented Oct 31, 2019

This PR should go in only after #3204 and #3251. Once those go in, I'll merge master and resolve the expected conflicts in inidat.F90.

@mt5555
Copy link
Contributor

mt5555 commented Oct 31, 2019

@whannah1 : what's the status of #3204 - i seem to remember it was delayed because of some CIME issue. should we really delay this PR until afer #3204?

@whannah1
Copy link
Contributor

@mt5555 I was just waiting for that extra review from @AaronDonahue for #3204.
For #3251, we should talk about whether to also include removing the low-order mapping, since it would make the original intention of #3251 moot.

SET(UTILS_SHARE_DIR ${HOMME_SOURCE_DIR}/utils/csm_share)
SET(SRC_DIR ${HOMME_SOURCE_DIR}/src)
SET(SRC_SHARE_DIR ${HOMME_SOURCE_DIR}/src/share)
SET(TEST_SRC_DIR ${HOMME_SOURCE_DIR}/src/test_src)
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably tools won't need test_src?

Copy link
Member Author

Choose a reason for hiding this comment

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

Test modules get used in various spots in the code, so it's needed to build.

Copy link
Contributor

Choose a reason for hiding this comment

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

this is very minor: I am only asking because there is a code in tests_src that needs commenting if one wants to run intel with checks, for example. I thought tools won't need tests, so, it would make debugging easier. or maybe build tools with CAM=true directive.

Copy link
Member Author

Choose a reason for hiding this comment

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

You might open an issue about "code in tests_src that needs commenting if one wants to run intel with checks," as that implies something is broken.

What I meant above is that there is core code that uses test_mod, which in turn uses modules in test_src. So new cpp code would be needed to isolate test_src sufficiently. I consider that orthogonal to this PR. I believe setting CAM to true would create unresolved uses of modules from CAM.

IF (NOT PREQX_PLEV)
SET (PREQX_PLEV 20)
ENDIF ()
IF (NOT PREQX_USE_PIO)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would assume most of tools would need PIO=TRUE here (native input/output)...

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point.

@ambrad
Copy link
Member Author

ambrad commented Oct 31, 2019

I'm running e3sm_developer again b/c I had not sync'ed my repo's master and my branch after the recent IMEX PR. In my e3sm_dev run that just finished, all tests except HOMME's standalone theta-l tests pass.

Edit: Now all tests pass.

@ambrad
Copy link
Member Author

ambrad commented Nov 11, 2019

Now that PR #3204 in in master, I'll merge master into this branch, resolve the inidat conflict, and rerun tests.

…id-new-topo-file-format

Conflicts:
	components/cam/src/dynamics/se/inidat.F90

Merge master to get PR E3SM-Project#3204; resolve the conflict in inidat concerning reading
PHIS(_d) from the topo file.
@ambrad
Copy link
Member Author

ambrad commented Nov 11, 2019

All e3sm_developer tests pass.

mt5555 added a commit that referenced this pull request Dec 4, 2019
Improve treatment of topography for physgrid configurations. Better GLL/PG consistency and error checking when reading netcdf files.

[BFB]
mt5555 added a commit that referenced this pull request Dec 5, 2019
Improve treatment of topography for physgrid configurations. Better GLL/PG consistency and error checking when reading netcdf files.

[BFB
@mt5555 mt5555 merged commit deeb24c into E3SM-Project:master Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Atmosphere BFB PR leaves answers BFB enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants