From 18ba5da17f3a0e9329ddda4021b78cf4544037fb Mon Sep 17 00:00:00 2001 From: DavidNew-NOAA <134300700+DavidNew-NOAA@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:36:13 -0400 Subject: [PATCH] JEDI increment write to cubed sphere history (#983) This PR, a companion to Global Workflow PR [#2420](https://github.com/NOAA-EMC/global-workflow/pull/2420) changes the variational YAML for JEDI to write to cubed sphere history rather than the Gaussian grid. With the new changes to Global Workflow, the new gdas_fv3jedi_jediinc2fv3.x OOPS app will read the JEDI increment from the cubed sphere history, compute the FV3 increment, and interpolate/write it the the Gaussian grid. The only meaningful difference is that the internal calculations, namely computation of the hydrostatic layer thickness increment, will be computed on the native grid rather than on the Gaussian grid, before interpolation rather than after. This makes more sense physically. Eventually the FV3 increment will be written and read to/from cubed sphere history anyway. --- ...inc2fv3.yaml.j2 => fv3jedi_fv3inc.yaml.j2} | 30 +++++++++---------- parm/atm/variational/3dvar_drpcg.yaml.j2 | 9 +++--- test/fv3jedi/CMakeLists.txt | 8 ++--- ...c2fv3.yaml => gdasapp_fv3jedi_fv3inc.yaml} | 4 +-- ...inc2fv3.ref => gdasapp_fv3jedi_fv3inc.ref} | 0 utils/fv3jedi/CMakeLists.txt | 8 ++--- utils/fv3jedi/fv3jedi_fv3inc.cc | 8 +++++ ...fv3jedi_jediinc2fv3.h => fv3jedi_fv3inc.h} | 8 ++--- utils/fv3jedi/gdas_fv3jedi_jediinc2fv3.cc | 8 ----- 9 files changed, 42 insertions(+), 41 deletions(-) rename parm/atm/utils/{gdas_jediinc2fv3.yaml.j2 => fv3jedi_fv3inc.yaml.j2} (83%) rename test/fv3jedi/testinput/{gdasapp_fv3jedi_jediinc2fv3.yaml => gdasapp_fv3jedi_fv3inc.yaml} (92%) rename test/fv3jedi/testoutput/{gdasapp_fv3jedi_jediinc2fv3.ref => gdasapp_fv3jedi_fv3inc.ref} (100%) create mode 100644 utils/fv3jedi/fv3jedi_fv3inc.cc rename utils/fv3jedi/{gdas_fv3jedi_jediinc2fv3.h => fv3jedi_fv3inc.h} (93%) delete mode 100644 utils/fv3jedi/gdas_fv3jedi_jediinc2fv3.cc diff --git a/parm/atm/utils/gdas_jediinc2fv3.yaml.j2 b/parm/atm/utils/fv3jedi_fv3inc.yaml.j2 similarity index 83% rename from parm/atm/utils/gdas_jediinc2fv3.yaml.j2 rename to parm/atm/utils/fv3jedi_fv3inc.yaml.j2 index e94d2a061..ae1922805 100644 --- a/parm/atm/utils/gdas_jediinc2fv3.yaml.j2 +++ b/parm/atm/utils/fv3jedi_fv3inc.yaml.j2 @@ -9,11 +9,11 @@ background: field table filename: ./fv3jedi/field_table akbk: ./fv3jedi/akbk.nc4 layout: - - ${{ layout_x }} - - ${{ layout_y }} - npx: ${{ npx_ges }} - npy: ${{ npy_ges }} - npz: ${{ npz_ges }} + - {{ layout_x }} + - {{ layout_y }} + npx: {{ npx_ges }} + npy: {{ npy_ges }} + npz: {{ npz_ges }} field metadata override: ./fv3jedi/fv3jedi_fieldmetadata_restart.yaml input: datapath: ./bkg @@ -33,11 +33,11 @@ jedi increment: field table filename: ./fv3jedi/field_table akbk: ./fv3jedi/akbk.nc4 layout: - - ${{ layout_x }} - - ${{ layout_y }} - npx: ${{ npx_ges }} - npy: ${{ npy_ges }} - npz: ${{ npz_ges }} + - {{ layout_x }} + - {{ layout_y }} + npx: {{ npx_ges }} + npy: {{ npy_ges }} + npz: {{ npz_ges }} field metadata override: ./fv3jedi/fv3jedi_fieldmetadata_history.yaml input: filetype: cube sphere history @@ -50,11 +50,11 @@ fv3 increment: field table filename: ./fv3jedi/field_table akbk: ./fv3jedi/akbk.nc4 layout: - - ${{ layout_x }} - - ${{ layout_y }} - npx: ${{ npx_ges }} - npy: ${{ npy_ges }} - npz: ${{ npz_ges }} + - {{ layout_x }} + - {{ layout_y }} + npx: {{ npx_ges }} + npy: {{ npy_ges }} + npz: {{ npz_ges }} field metadata override: ./fv3jedi/fv3jedi_fieldmetadata_fv3inc.yaml output: filetype: auxgrid diff --git a/parm/atm/variational/3dvar_drpcg.yaml.j2 b/parm/atm/variational/3dvar_drpcg.yaml.j2 index c0f684413..79eaa83d2 100644 --- a/parm/atm/variational/3dvar_drpcg.yaml.j2 +++ b/parm/atm/variational/3dvar_drpcg.yaml.j2 @@ -84,9 +84,10 @@ final: increment: output: state component: - filetype: auxgrid - gridtype: gaussian - filename: ./anl/atminc. + filetype: cube sphere history + filename: ./anl/atminc.{{ current_cycle | to_fv3time }}.nc4 + provider: ufs + fields to write: [ugrd,vgrd,tmp,pressfc,spfh,icmr,clwmr,o3mr] geometry: fms initialization: namelist filename: ./fv3jedi/fmsmpp.nml @@ -98,4 +99,4 @@ final: npx: {{ npx_anl }} npy: {{ npy_anl }} npz: {{ npz_anl }} - field metadata override: ./fv3jedi/fv3jedi_fieldmetadata_restart.yaml + field metadata override: ./fv3jedi/fv3jedi_fieldmetadata_history.yaml diff --git a/test/fv3jedi/CMakeLists.txt b/test/fv3jedi/CMakeLists.txt index c0238e6a1..8e4266c3e 100644 --- a/test/fv3jedi/CMakeLists.txt +++ b/test/fv3jedi/CMakeLists.txt @@ -4,10 +4,10 @@ file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test/fv3jedi/testoutput) file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test/fv3jedi/fv3jedi) # Test YAMLs -file(CREATE_LINK ${PROJECT_SOURCE_DIR}/test/fv3jedi/testinput/gdasapp_fv3jedi_jediinc2fv3.yaml ${PROJECT_BINARY_DIR}/test/fv3jedi/testinput/gdasapp_fv3jedi_jediinc2fv3.yaml SYMBOLIC) +file(CREATE_LINK ${PROJECT_SOURCE_DIR}/test/fv3jedi/testinput/gdasapp_fv3jedi_fv3inc.yaml ${PROJECT_BINARY_DIR}/test/fv3jedi/testinput/gdasapp_fv3jedi_fv3inc.yaml SYMBOLIC) # Test reference files -file(CREATE_LINK ${PROJECT_SOURCE_DIR}/test/fv3jedi/testoutput/gdasapp_fv3jedi_jediinc2fv3.ref ${PROJECT_BINARY_DIR}/test/fv3jedi/testoutput/gdasapp_fv3jedi_jediinc2fv3.ref SYMBOLIC) +file(CREATE_LINK ${PROJECT_SOURCE_DIR}/test/fv3jedi/testoutput/gdasapp_fv3jedi_fv3inc.ref ${PROJECT_BINARY_DIR}/test/fv3jedi/testoutput/gdasapp_fv3jedi_fv3inc.ref SYMBOLIC) # FV3 files file(CREATE_LINK ${PROJECT_SOURCE_DIR}/parm/io/fv3jedi_fieldmetadata_fv3inc.yaml ${PROJECT_BINARY_DIR}/test/fv3jedi/fv3jedi/fv3jedi_fieldmetadata_fv3inc.yaml SYMBOLIC) @@ -17,7 +17,7 @@ file(CREATE_LINK ${PROJECT_SOURCE_DIR}/sorc/fv3-jedi/test/Data/fv3files/fmsmpp.n file(CREATE_LINK ${PROJECT_SOURCE_DIR}/sorc/fv3-jedi/test/Data/fv3files/field_table_gfdl ${PROJECT_BINARY_DIR}/test/fv3jedi/fv3jedi/field_table_gfdl SYMBOLIC) # Tests -add_test(NAME test_gdasapp_fv3jedi_jediinc2fv3 - COMMAND srun -n6 ${CMAKE_BINARY_DIR}/bin/gdas_fv3jedi_jediinc2fv3.x ${PROJECT_BINARY_DIR}/test/fv3jedi/testinput/gdasapp_fv3jedi_jediinc2fv3.yaml +add_test(NAME test_gdasapp_fv3jedi_fv3inc + COMMAND srun -n6 ${CMAKE_BINARY_DIR}/bin/gdas_fv3jedi_fv3inc.x ${PROJECT_BINARY_DIR}/test/fv3jedi/testinput/gdasapp_fv3jedi_fv3inc.yaml WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/fv3jedi) diff --git a/test/fv3jedi/testinput/gdasapp_fv3jedi_jediinc2fv3.yaml b/test/fv3jedi/testinput/gdasapp_fv3jedi_fv3inc.yaml similarity index 92% rename from test/fv3jedi/testinput/gdasapp_fv3jedi_jediinc2fv3.yaml rename to test/fv3jedi/testinput/gdasapp_fv3jedi_fv3inc.yaml index e7d235202..b0c08350c 100644 --- a/test/fv3jedi/testinput/gdasapp_fv3jedi_jediinc2fv3.yaml +++ b/test/fv3jedi/testinput/gdasapp_fv3jedi_fv3inc.yaml @@ -60,7 +60,7 @@ fv3 increment: provider: ufs test: - reference filename: testoutput/gdasapp_fv3jedi_jediinc2fv3.ref - test output filename: testoutput/gdasapp_fv3jedi_jediinc2fv3.test.out + reference filename: testoutput/gdasapp_fv3jedi_fv3inc.ref + test output filename: testoutput/gdasapp_fv3jedi_fv3inc.test.out float relative tolerance: 1.0e-3 diff --git a/test/fv3jedi/testoutput/gdasapp_fv3jedi_jediinc2fv3.ref b/test/fv3jedi/testoutput/gdasapp_fv3jedi_fv3inc.ref similarity index 100% rename from test/fv3jedi/testoutput/gdasapp_fv3jedi_jediinc2fv3.ref rename to test/fv3jedi/testoutput/gdasapp_fv3jedi_fv3inc.ref diff --git a/utils/fv3jedi/CMakeLists.txt b/utils/fv3jedi/CMakeLists.txt index 4c29dd11d..474b4478d 100644 --- a/utils/fv3jedi/CMakeLists.txt +++ b/utils/fv3jedi/CMakeLists.txt @@ -1,5 +1,5 @@ # Increment post processing -ecbuild_add_executable( TARGET gdas_fv3jedi_jediinc2fv3.x - SOURCES gdas_fv3jedi_jediinc2fv3.cc gdas_fv3jedi_jediinc2fv3.h) -target_compile_features( gdas_fv3jedi_jediinc2fv3.x PUBLIC cxx_std_17) -target_link_libraries( gdas_fv3jedi_jediinc2fv3.x PUBLIC NetCDF::NetCDF_CXX oops fv3jedi) +ecbuild_add_executable( TARGET fv3jedi_fv3inc.x + SOURCES fv3jedi_fv3inc.cc fv3jedi_fv3inc.h) +target_compile_features( fv3jedi_fv3inc.x PUBLIC cxx_std_17) +target_link_libraries( fv3jedi_fv3inc.x PUBLIC NetCDF::NetCDF_CXX oops fv3jedi) diff --git a/utils/fv3jedi/fv3jedi_fv3inc.cc b/utils/fv3jedi/fv3jedi_fv3inc.cc new file mode 100644 index 000000000..cf7f8b284 --- /dev/null +++ b/utils/fv3jedi/fv3jedi_fv3inc.cc @@ -0,0 +1,8 @@ +#include "fv3jedi_fv3inc.h" +#include "oops/runs/Run.h" + +int main(int argc, char ** argv) { + oops::Run run(argc, argv); + gdasapp::fv3inc fv3inc; + return run.execute(fv3inc); +} diff --git a/utils/fv3jedi/gdas_fv3jedi_jediinc2fv3.h b/utils/fv3jedi/fv3jedi_fv3inc.h similarity index 93% rename from utils/fv3jedi/gdas_fv3jedi_jediinc2fv3.h rename to utils/fv3jedi/fv3jedi_fv3inc.h index 212148e10..77be91bea 100644 --- a/utils/fv3jedi/gdas_fv3jedi_jediinc2fv3.h +++ b/utils/fv3jedi/fv3jedi_fv3inc.h @@ -20,11 +20,11 @@ namespace gdasapp { // Main application class - class jediinc2fv3 : public oops::Application { + class fv3inc : public oops::Application { public: - explicit jediinc2fv3(const eckit::mpi::Comm & comm = oops::mpi::world()) + explicit fv3inc(const eckit::mpi::Comm & comm = oops::mpi::world()) : Application(comm) {} - static const std::string classname() {return "gdasapp::jediinc2fv3";} + static const std::string classname() {return "gdasapp::fv3inc";} int execute(const eckit::Configuration & fullConfig, bool validate) const { // Setup variable change @@ -83,7 +83,7 @@ namespace gdasapp { private: std::string appname() const { - return "gdasapp::jediinc2fv3"; + return "gdasapp::fv3inc"; } }; } // namespace gdasapp diff --git a/utils/fv3jedi/gdas_fv3jedi_jediinc2fv3.cc b/utils/fv3jedi/gdas_fv3jedi_jediinc2fv3.cc deleted file mode 100644 index 9744aa6e8..000000000 --- a/utils/fv3jedi/gdas_fv3jedi_jediinc2fv3.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "gdas_fv3jedi_jediinc2fv3.h" -#include "oops/runs/Run.h" - -int main(int argc, char ** argv) { - oops::Run run(argc, argv); - gdasapp::jediinc2fv3 jediinc2fv3; - return run.execute(jediinc2fv3); -}