Skip to content

Output of auxiliary 2d/3d arrays from CCPP (and other parts of the model)#21

Merged
DomHeinzeller merged 3 commits into
NOAA-GSL:gsd/developfrom
climbfuji:add_aux_output
Apr 29, 2020
Merged

Output of auxiliary 2d/3d arrays from CCPP (and other parts of the model)#21
DomHeinzeller merged 3 commits into
NOAA-GSL:gsd/developfrom
climbfuji:add_aux_output

Conversation

@climbfuji
Copy link
Copy Markdown

@climbfuji climbfuji commented Apr 24, 2020

This PR adds the capability to output auxiliary 2d/3d data from CCPP (and other parts of the model).

For the description of the problem and the proposed solution, see
https://docs.google.com/document/d/1VVHMR89vw6m3ADvAkipvDRiga6GffsVKpYYEZBVnkFU/edit?usp=sharing

In brief, this PR adds the required host model variables and metadata to GFS_typedefs.* and registers the output fields in GFS_diagnostics.F90. Developers who want to use these arrays will need to add the metadata and variables to their physics scheme and populate the arrays inside their scheme (as in the example below).

Associated PRs:
#21
NOAA-GSL/ufs-weather-model#17

For regression testing, see NOAA-GSL/ufs-weather-model#17.

@climbfuji
Copy link
Copy Markdown
Author

climbfuji commented Apr 24, 2020

Since changes to the CCPP physics for debugging purposes are not to be committed to the repository, I am giving an example for how to use these capabilities and show results here.

I modified the GF scheme as follows:

diff --git a/physics/cu_gf_driver.F90 b/physics/cu_gf_driver.F90
index 927b452..aed7348 100644
--- a/physics/cu_gf_driver.F90
+++ b/physics/cu_gf_driver.F90
@@ -76,7 +76,8 @@ contains
                flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend,           &
                du3dt_SCNV,dv3dt_SCNV,dt3dt_SCNV,dq3dt_SCNV,                     &
                du3dt_DCNV,dv3dt_DCNV,dt3dt_DCNV,dq3dt_DCNV,                     &
-               ldiag3d,qdiag3d,qci_conv,errmsg,errflg)
+               ldiag3d,qdiag3d,qci_conv,errmsg,errflg,                          &
+               naux2d,naux3d,aux2d,aux3d)
 !-------------------------------------------------------------
       implicit none
       integer, parameter :: maxiens=1
@@ -137,6 +138,11 @@ contains
    integer, intent(in   ) :: imfshalcnv
    character(len=*), intent(out) :: errmsg
    integer,          intent(out) :: errflg
+
+   integer, intent(in) :: naux2d,naux3d
+   real(kind_phys), intent(inout) :: aux2d(:,:)
+   real(kind_phys), intent(inout) :: aux3d(:,:,:)
+
 !  define locally for now.
    integer, dimension(im),intent(inout) :: cactiv
    integer, dimension(im) :: k22_shallow,kbcon_shallow,ktop_shallow
@@ -199,6 +205,11 @@ contains
   ! initialize ccpp error handling variables
      errmsg = ''
      errflg = 0
+
+     aux2d(:,1) = aux2d(:,1) + 1
+     aux2d(:,2) = aux2d(:,2) + 2
+     aux3d(:,:,1) = aux3d(:,:,1) + 3
+
 !
 ! Scale specific humidity to dry mixing ratio
 !

and

diff --git a/physics/cu_gf_driver.meta b/physics/cu_gf_driver.meta
index 99e6ca6..a738721 100644
--- a/physics/cu_gf_driver.meta
+++ b/physics/cu_gf_driver.meta
@@ -476,3 +476,29 @@
   type = integer
   intent = out
   optional = F
+[naux2d]
+  standard_name = number_of_2d_auxiliary_arrays
+  long_name = number of 2d auxiliary arrays to output (for debugging)
+  units = count
+  dimensions = ()
+  type = integer
+[naux3d]
+  standard_name = number_of_3d_auxiliary_arrays
+  long_name = number of 3d auxiliary arrays to output (for debugging)
+  units = count
+  dimensions = ()
+  type = integer
+[aux2d]
+  standard_name = auxiliary_2d_arrays
+  long_name = auxiliary 2d arrays to output (for debugging)
+  units = none
+  dimensions = (horizontal_dimension,number_of_3d_auxiliary_arrays)
+  type = real
+  kind = kind_phys
+[aux3d]
+  standard_name = auxiliary_3d_arrays
+  long_name = auxiliary 3d arrays to output (for debugging)
+  units = none
+  dimensions = (horizontal_dimension,vertical_dimension,number_of_3d_auxiliary_arrays)
+  type = real
+  kind = kind_phys

I then added the following lines to input.nml in the &gfs_physics_nml section and ran a 6h forecast (with fhzero=1., fdiag = 0,1,2,3,4,5,6):

       naux2d         = 2
       naux3d         = 1
       aux2d_time_avg = .true., .false.

Lastly, I added the following three lines to diag_table:

# Auxiliary output
"gfs_phys",    "aux2d_01",     "aux2d_01",      "fv3_history2d",  "all",  .false.,  "none",  2
"gfs_phys",    "aux2d_02",     "aux2d_02",      "fv3_history2d",  "all",  .false.,  "none",  2
"gfs_phys",    "aux3d_01",     "aux3d_01",      "fv3_history",    "all",  .false.,  "none",  2

The output was as expected (keeping in mind that the output at 0h is written after the first timestep, i.e. after one pass through the physics) for the three auxiliary output arrays, see screenshots.

Screen Shot 2020-04-24 at 4 59 15 PM
Screen Shot 2020-04-24 at 4 59 57 PM
Screen Shot 2020-04-24 at 5 00 29 PM

@climbfuji climbfuji marked this pull request as ready for review April 24, 2020 21:47
@climbfuji
Copy link
Copy Markdown
Author

@DomHeinzeller DomHeinzeller added the merge with other PR merge as part of other PR label Apr 29, 2020
DomHeinzeller added a commit that referenced this pull request Apr 29, 2020
…aux_output_dom

Combine "Update to MYNN-EDMF part II #20" and "Output of auxiliary 2d/3d arrays from CCPP #21"
@DomHeinzeller DomHeinzeller merged commit 662333a into NOAA-GSL:gsd/develop Apr 29, 2020
zhanglikate referenced this pull request in zhanglikate/ufsatm Oct 7, 2025
* Remove unused and unsupported code (See NOAA-EMC#21)
* Remove APPBUILD step from rt.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge with other PR merge as part of other PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants