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

JCSDA changes #787

Closed
wants to merge 6 commits into from
Closed

JCSDA changes #787

wants to merge 6 commits into from

Conversation

danholdaway
Copy link
Contributor

@danholdaway danholdaway commented Jul 23, 2021

Description

This a series of changes implemented by the JCSDA to enable data assimilation applications.

The main changes are to allow for paths to the namelist files, field_table, and the INPUT directory. The solution used follows the one suggested provided to @aerorahul by @bensonr.

Other change include allowing more tracers for EMC's CMAQ assimilation and changes to MPP adjoint for data assimilation with MOM6

How Has This Been Tested?
We have run the the unit tests of the JEDI system

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included
  • make distcheck passes

@bensonr
Copy link
Contributor

bensonr commented Jul 23, 2021

@danholdaway - I noticed a good chunk of the standard FMS PR info is missing. Did the template not come up when you created the PR?

The adjoint work was contributed by NASA. Are they aware of the adjoint comm changes? If not, we will need their approvals as well.

@danholdaway
Copy link
Contributor Author

@bensonr sorry about that, I think I accidentally deleted, I've included the rest of your template in the description. NASA is not aware about the adjoint changes since they were contributed by Jong Kim at EMC. I can work with the folks at GMAO to make sure their FV3 linear model works with these changes once they are part of develop. We run GMAO's linear model within the JCSDA so would just need to ship them the changes we've made there.

Copy link
Member

@thomas-robinson thomas-robinson left a comment

Choose a reason for hiding this comment

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

The trailing whitespace needs to be removed

@@ -81,10 +80,11 @@
send = recv

if(debug_message_passing) then
nlist = size(domain%list(:))
allocate(msg1(0:nlist-1), msg2(0:nlist-1) )
nlist = size(domain%list(:))
Copy link
Member

Choose a reason for hiding this comment

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

remove trailing whitespace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -159,7 +159,7 @@ module tracer_manager_mod
!> @{

integer :: num_tracer_fields = 0
integer, parameter :: MAX_TRACER_FIELDS = 150
integer, parameter :: MAX_TRACER_FIELDS = 250
Copy link
Member

Choose a reason for hiding this comment

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

@GFDL-Eric can this be a namelist parameter?

Copy link
Contributor

Choose a reason for hiding this comment

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

@thomas-robinson I don't believe we currently ingest a namelist for either tracer_manager or field_manager, although there are a set of tools in fm_utils.F90 that can "set" a namelist (fm_util_start_namelist), but it seems very ocean specific (hardcoded) and I'm not entirely sure what it's doing and/or if it's still even used. I don't know that we will have hardcoded limits like this after the rewrite, but that depends on how we implement things.

@bensonr
Copy link
Contributor

bensonr commented Jul 30, 2021

@danholdaway - have you confirmed the adjoint changes with NASA?

@bensonr
Copy link
Contributor

bensonr commented Aug 3, 2021

@mathomp4 - Sorry to bother you. The developers at JCSDA have some updates to the adjoint code in FMS and I would appreciate you taking at look at this PR to ensure they changes has GMAO approval. Can you perform a review?

@danholdaway
Copy link
Contributor Author

Sorry for the lack of response to your earlier comment @bensonr. @mathomp4 and I discussed yesterday and I think we have a plan to make the changes necessary for the GEOS adjoint.

@mathomp4
Copy link
Contributor

mathomp4 commented Aug 24, 2021

@mathomp4 - Sorry to bother you. The developers at JCSDA have some updates to the adjoint code in FMS and I would appreciate you taking at look at this PR to ensure they changes has GMAO approval. Can you perform a review?

@bensonr It's hard for me to review as we are a bit behind on FMS. We are in 2019.01 land, so my thought is: yes this is fine. I mean, any adjoint change is probably something I'd ask @danholdaway about anyway so, good to me? 😄

(Note: I am looking at trying to move GEOS to latest FMS but I got caught in a...spiral of CMake. I thought I'd try to take your CMakeLists.txt, but it's assuming a different build system than GEOS' so then I tried to convert Baselibs to build HDF4, HDF5, netCDF, etc with CMake and I'm hitting bugs in their build systems. I currently am needing to use the development branches of HDF5 and netCDF-C to get close to building with CMake... We might have to make a "plug" around FMS and maybe override the CMake like we do with MOM6, etc.)

@mathomp4
Copy link
Contributor

Update: I'm going to try just pulling in these changes from @danholdaway into our FMS as a test to see if it builds and works with the GCM. My guess is it will since that won't trigger the adjoint. I might have to work with people on our end to figure out how to actually trigger that code in an ADAS run.

mathomp4 added a commit to GEOS-ESM/FMS that referenced this pull request Aug 24, 2021
These are updates based on:

NOAA-GFDL#787
@bensonr
Copy link
Contributor

bensonr commented Aug 30, 2021

@mathomp4 - thanks for the messages. I'll await hearing from you on your attempts to bring in the adjoint updates and whether they are acceptable for NASA.

The CMake system was contributed by @aerorahul and was purpose built for the NEMS/UFS build systems. It looks like NASA has gone forward with a CMake system and the autotools config/build system is not of interest. Is that correct?

@aerorahul
Copy link
Contributor

@bensonr
The cmake build system in FMS is generic and not specific to NEMS/UFS.
Furthermore, UFS can build FMS in-line (FMS as a gitmodule of UFS) or off-line (FMS is provided as a pre-installed package provided via FMS_ROOT) to the UFS application via find_package(FMS REQUIRED COMPONENTS R4 R8)

GEOS uses "cmake" within the context of cmake extensions from ecbuild and their own layer on top of ecbuild.
As a result, all components within GEOS need to be built with an ecbuild layer (Please correct me if I am wrong @mathomp4)

@mathomp4
If you set NetCDF_ROOT as pointing to a standard netCDF installation (we use the autotools config/build for netCDF) such that (shown below is for macOS), you should be able to use find_package(FMS) within GEOS framework, provided FMS is pre-built offline:

NetCDF_ROOT
└── 4.7.4
    ├── bin
    │   ├── nc-config
    │   ├── nccopy
    │   ├── ncdump
    │   ├── ncgen
    │   ├── ncgen3
    │   └── nf-config
    ├── include
    │   ├── netcdf.h
    │   ├── netcdf.inc
    │   ├── netcdf.mod
    │   ├── netcdf4_f03.mod
    │   ├── netcdf4_nc_interfaces.mod
    │   ├── netcdf4_nf_interfaces.mod
    │   ├── netcdf_aux.h
    │   ├── netcdf_dispatch.h
    │   ├── netcdf_f03.mod
    │   ├── netcdf_filter.h
    │   ├── netcdf_fortv2_c_interfaces.mod
    │   ├── netcdf_mem.h
    │   ├── netcdf_meta.h
    │   ├── netcdf_nc_data.mod
    │   ├── netcdf_nc_interfaces.mod
    │   ├── netcdf_nf_data.mod
    │   ├── netcdf_nf_interfaces.mod
    │   ├── netcdf_par.h
    │   └── typesizes.mod
    ├── lib
    │   ├── libh5bzip2.la
    │   ├── libh5bzip2.so
    │   ├── libnetcdf.18.dylib
    │   ├── libnetcdf.a
    │   ├── libnetcdf.dylib -> libnetcdf.18.dylib
    │   ├── libnetcdf.la
    │   ├── libnetcdf.settings
    │   ├── libnetcdff.7.dylib
    │   ├── libnetcdff.a
    │   ├── libnetcdff.dylib -> libnetcdff.7.dylib
    │   ├── libnetcdff.la
    │   ├── libnetcdff.settings
    │   └── pkgconfig
    └── share
        └── man

@danholdaway
Copy link
Contributor Author

Correct me if I'm wrong @mathomp4 but this PR does not need to wait on GMAO testing their adjoint with these changes. GMAO has two modes of building: GEOSgcm and GEOSadas. The GEOSadas build (which contains the adjoint) will likely never need to be updated to use a version of FMS that includes these changes. The adjoint in that system will be superseded by the adjoint coming from JEDI in the not too distant future and that will already be tested with these changes.

@mathomp4
Copy link
Contributor

@aerorahul Yeah. I figured out a way to do things with the Autotools build of FMS. The CMake build was a rabbit hole (I think I found a bug in netCDF's CMake build), so I switched to the old standby of autotools.

When I did that, I got farther. I even got our old FV3 to build but got stuck (surprisingly) on MOM6 which is essentially pretty close to dev/gfdl.

I'll be talking with @sanAkel on that issue. I'm sure it's just a "Matt doesn't know MOM6" sort of thing that can be fixed up (files need added our CMakeLists, etc.)

@aerorahul
Copy link
Contributor

@mathomp4
This is the UFS's MOM6 cmake build if it helps.
It depends on FMS (and ESMF in our case).
https://github.com/ufs-community/ufs-weather-model/tree/develop/MOM6-interface

@sanAkel
Copy link

sanAkel commented Aug 30, 2021

@aerorahul Yeah. I figured out a way to do things with the Autotools build of FMS. The CMake build was a rabbit hole (I think I found a bug in netCDF's CMake build), so I switched to the old standby of autotools.

When I did that, I got farther. I even got our old FV3 to build but got stuck (surprisingly) on MOM6 which is essentially pretty close to dev/gfdl.

I'll be talking with @sanAkel on that issue. I'm sure it's just a "Matt doesn't know MOM6" sort of thing that can be fixed up (files need added our CMakeLists, etc.)

@mathomp4 And all (interested), it has only recently (about a week ago) that I heard GMAO/GEOS folks are finally getting caught up with FMS. Due to that reason, we (at GMAO) use MOM6 interface to FMS1. I can work to switch to FMS2 which follows all the MOM6 infra changes already in place.

@bensonr
Copy link
Contributor

bensonr commented Aug 30, 2021 via email

@sanAkel
Copy link

sanAkel commented Sep 1, 2021

@bensonr thanks for that note (reg. older fms_io/mpp_io interfaces). @mathomp4 seems to have found what is needed at our end to make it build. He can summarize it better!

@mathomp4
Copy link
Contributor

mathomp4 commented Sep 1, 2021

@bensonr thanks for that note (reg. older fms_io/mpp_io interfaces). @mathomp4 seems to have found what is needed at our end to make it build. He can summarize it better!

Yes. I was able to build FMS with CMake (with a hack shown in #806 for PIC) and then I had to do some rather ugly hacking in our FindBaselibs code where I have to "make my own FMS::fms_r4 targets" and the like. But after that things seem to build.

Now of course, in truth I'll have to update our fork because of our constants (see #155, #796) and re-do all this with that (I'm using this repo for now), but we are closer!

@bensonr
Copy link
Contributor

bensonr commented Sep 2, 2021 via email

@sanAkel
Copy link

sanAkel commented Sep 2, 2021

@bensonr

Just to try and see what happens, I tried a stock coupled model run.

  • First it died looking for INPUT/atmos_mosaic.nc and INPUT/land_mosaic.nc We did not use them before in GEOS coupled (or even uncoupled: AGCM-only) models. In any case, since I have ocean-only set up from MOM6-examples and my own config, I gave it some xx_mosaic.nc; xx=atmos, land and it moved past that failure. In debug mode,
Image              PC                Routine            Line        Source
GEOSgcm.x          00000000102E0286  Unknown               Unknown  Unknown
GEOSgcm.x          000000000EC48805  mpp_mod_mp_mpp_er          71  mpp_util_mpi.inc
GEOSgcm.x          000000000EB3FFB2  fms_io_utils_mod_         201  fms_io_utils.F90
GEOSgcm.x          000000000EB8E166  netcdf_io_mod_mp_         367  netcdf_io.F90
GEOSgcm.x          000000000EBAB4B8  netcdf_io_mod_mp_         643  netcdf_io.F90
GEOSgcm.x          000000000EBAA9BD  netcdf_io_mod_mp_        1961  netcdf_io.F90
GEOSgcm.x          000000000EBE59E5  grid2_mod_mp_open         180  grid2.F90
GEOSgcm.x          000000000EBF2852  grid2_mod_mp_open         195  grid2.F90
GEOSgcm.x          000000000EBF3AD6  grid2_mod_mp_open         252  grid2.F90
GEOSgcm.x          000000000EBF3C8D  grid2_mod_mp_grid         144  grid2.F90
GEOSgcm.x          000000000EB2EED4  fms_mod_mp_fms_in         435  fms.F90
  • But then died with following: Unit 9 is already in use (etc_unit) in mpp_comm_mpi here is the trace:
Image              PC                Routine            Line        Source
GEOSgcm.x          00000000102E0286  Unknown               Unknown  Unknown
libMOM6_GEOSPlug.  00002AAE5CCA5025  mpp_mod_mp_mpp_er          71  mpp_util_mpi.inc
libMOM6_GEOSPlug.  00002AAE5CCA1FD5  mpp_mod_mp_mpp_in         140  mpp_comm_mpi.inc
libMOM6_GEOSPlug.  00002AAE5CB9C46C  fms_mod_mp_fms_in         343  fms.F90
libMOM6_GEOSPlug.  00002AAE5CA8D214  mom6_geosplugmod_         709  MOM6_GEOSPlug.F90
libesmf.so         00002AAABA568344  _ZN5ESMCI6FTable1     Unknown  Unknown
libesmf.so         00002AAABA56BE8F  ESMCI_FTableCallE     Unknown  Unknown

Any thoughts??

@GFDL-Eric
Copy link
Contributor

GFDL-Eric commented Sep 2, 2021 via email

@sanAkel
Copy link

sanAkel commented Sep 2, 2021

@GFDL-Eric 👋
Thanks for the suggestions and explanation.

Reg.

It's not super clear to me why we're reserving unit 9 for the etc_unit, but
I would think we'd be susceptible to running into that error depending on
how many files are opened before the mpp_init call. Thoughts on why we've
got this unit reserved, Rusty?

As you say, let's defer to @bensonr.

As for:

For the first error, grid2 checks the grid_spec.nc file for the existence
of the variables atm_mosaic_file, ocn_mosaic_file, lnd_mosaic_file... if
those variables exist within grid_spec.nc, grid2 will attempt to open those
files and will throw an error if it is unable to do so. So either
grid_spec.nc would need to be changed to not reference those files... or
you could do exactly as you did and make those files.

I get it, thank you!

Alright, with MOM6, since the grid_spec.nc does list mosaic files, we have them (and do generate them for each and every configuration), so they can be provided. Just so other GMAO folks are aware of it, I will copy on this bit: @yvikhlya, @sdrabenh, @wmputman.

@bensonr
Copy link
Contributor

bensonr commented Sep 2, 2021 via email

@GFDL-Eric
Copy link
Contributor

GFDL-Eric commented Sep 2, 2021 via email

@bensonr
Copy link
Contributor

bensonr commented Sep 2, 2021 via email

@mathomp4
Copy link
Contributor

mathomp4 commented Sep 2, 2021

Note: I got @sanAkel past the etc_unit issue by having him do:

 &mpp_nml
      etc_unit_is_stderr = .TRUE.
 /

in input.nml.

@sanAkel
Copy link

sanAkel commented Sep 2, 2021

Note: I got @sanAkel past the etc_unit issue by having him do:

 &mpp_nml
      etc_unit_is_stderr = .TRUE.
 /

in input.nml.

And to add to @mathomp4's comment, our coupled model runs.

@danholdaway
Copy link
Contributor Author

Superseded by #807 so closing.

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.

7 participants