Skip to content

Commit

Permalink
Register diagnostics from stochastic physics only if allocated, fix d…
Browse files Browse the repository at this point in the history
…uplicate symbols error on macOS; ccpp-physics: cleanup CCPP cmake flags part 1; contains "fix the number of 2d fields nsfcprop2d" (NCAR#419) (NCAR#417)

- Fixes a bug inGFS_diagnostics.F90 that registered several stochastic variables as diagnostic output even though th arrays are not allocated if the corresponding stochastic option is turned off
- Fixes a problem that led to a "duplicate symbols" error on macOS with Intel by removing files from ccpp/CMakeLists.txt that get added automatically by CCPP
- Updates the submodule pointer for ccpp-physics for the changes described in Cleanup CCPP cmake flags part 1, remove extra logic that reduces optimization for radiation_aerosols.f, update CODEOWNERS, update README.md NCAR#773
- Contains the changes in fix the number of 2d fields nsfcprop2d NCAR#419 from @HelinWei-NOAA
- Updates the submodule pointer for GFDL_atmos_cubed_sphere to include latest JEDI control changes (contributed by @mark-a-potts)
  • Loading branch information
climbfuji authored Nov 12, 2021
1 parent b5bdf4c commit 720d4a0
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 137 deletions.
2 changes: 1 addition & 1 deletion atmos_cubed_sphere
4 changes: 0 additions & 4 deletions ccpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ add_subdirectory(physics)
add_library(
fv3ccpp

data/CCPP_typedefs.F90
data/GFS_typedefs.F90
data/CCPP_data.F90

driver/GFS_diagnostics.F90
driver/GFS_restart.F90
driver/GFS_init.F90
Expand Down
2 changes: 1 addition & 1 deletion ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2929,7 +2929,7 @@ subroutine coupling_create (Coupling, IM, Model)
endif

!--- stochastic physics option
if (Model%do_sppt .or. Model%ca_global)then
if (Model%do_sppt .or. Model%ca_global) then
allocate (Coupling%sppt_wts (IM,Model%levs))
Coupling%sppt_wts = clear_val
endif
Expand Down
250 changes: 130 additions & 120 deletions ccpp/driver/GFS_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2031,27 +2031,29 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop
enddo
endif

idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'skebu_wts'
ExtDiag(idx)%desc = 'perturbation velocity'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%skebu_wts(:,:)
enddo
if (Model%do_skeb) then
idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'skebu_wts'
ExtDiag(idx)%desc = 'perturbation velocity'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%skebu_wts(:,:)
enddo

idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'skebv_wts'
ExtDiag(idx)%desc = 'perturbation velocity'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%skebv_wts(:,:)
enddo
idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'skebv_wts'
ExtDiag(idx)%desc = 'perturbation velocity'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%skebv_wts(:,:)
enddo
endif

idx = idx + 1
ExtDiag(idx)%axes = 2
Expand Down Expand Up @@ -2085,115 +2087,123 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%refdmax263k(:)
enddo

idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'sppt_wts'
ExtDiag(idx)%desc = 'perturbation velocity'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%sppt_wts(:,:)
enddo
if (Model%do_sppt .or. Model%ca_global) then
idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'sppt_wts'
ExtDiag(idx)%desc = 'perturbation velocity'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%sppt_wts(:,:)
enddo
endif

idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'shum_wts'
ExtDiag(idx)%desc = 'perturbation velocity'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%shum_wts(:,:)
enddo
if (Model%do_shum) then
idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'shum_wts'
ExtDiag(idx)%desc = 'perturbation velocity'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%shum_wts(:,:)
enddo
endif

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'sfc_wts1'
ExtDiag(idx)%desc = 'perturbation amplitude'
ExtDiag(idx)%unit = 'none'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%sfc_wts(:,1)
enddo
if (Model%lndp_type /= 0) then
idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'sfc_wts1'
ExtDiag(idx)%desc = 'perturbation amplitude'
ExtDiag(idx)%unit = 'none'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%sfc_wts(:,1)
enddo

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'sfc_wts2'
ExtDiag(idx)%desc = 'perturbation amplitude'
ExtDiag(idx)%unit = 'none'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%sfc_wts(:,2)
enddo
idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'sfc_wts2'
ExtDiag(idx)%desc = 'perturbation amplitude'
ExtDiag(idx)%unit = 'none'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%sfc_wts(:,2)
enddo
endif

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca1'
ExtDiag(idx)%desc = 'Cellular Automata'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca1(:)
enddo
if (Model%do_ca) then
idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca1'
ExtDiag(idx)%desc = 'Cellular Automata'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca1(:)
enddo

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca_deep'
ExtDiag(idx)%desc = 'CA deep conv'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca_deep(:)
enddo
idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca_deep'
ExtDiag(idx)%desc = 'CA deep conv'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca_deep(:)
enddo

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca_turb'
ExtDiag(idx)%desc = 'CA turbulence'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca_turb(:)
enddo
idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca_turb'
ExtDiag(idx)%desc = 'CA turbulence'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca_turb(:)
enddo

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca_shal'
ExtDiag(idx)%desc = 'CA shallow conv'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca_shal(:)
enddo
idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca_shal'
ExtDiag(idx)%desc = 'CA shallow conv'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca_shal(:)
enddo

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca_rad'
ExtDiag(idx)%desc = 'CA radiation'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca_rad(:)
enddo
idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca_rad'
ExtDiag(idx)%desc = 'CA radiation'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca_rad(:)
enddo

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca_micro'
ExtDiag(idx)%desc = 'CA microphys'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca_micro(:)
enddo
idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ca_micro'
ExtDiag(idx)%desc = 'CA microphys'
ExtDiag(idx)%unit = '%'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%ca_micro(:)
enddo
endif

if (Model%ldiag_ugwp) THEN
!
Expand Down
2 changes: 1 addition & 1 deletion ccpp/physics
Submodule physics updated 3 files
+1 −61 CMakeLists.txt
+1 −1 CODEOWNERS
+15 −7 README.md
30 changes: 20 additions & 10 deletions io/FV3GFS_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,25 @@ subroutine FV3GFS_GFS_checksum (Model, GFS_Data, Atm_block)

ntr = size(GFS_Data(1)%Statein%qgrs,3)

nsfcprop2d = 93
if (Model%lsm == Model%lsm_noahmp) then
nsfcprop2d = 156
nsfcprop2d = nsfcprop2d + 49
if (Model%use_cice_alb) then
nsfcprop2d = nsfcprop2d + 4
endif
elseif (Model%lsm == Model%lsm_ruc) then
nsfcprop2d = 125
nsfcprop2d = nsfcprop2d + 4 + 12
if (Model%rdlai) then
nsfcprop2d = nsfcprop2d + 1
endif
else
nsfcprop2d = 107
if (Model%use_cice_alb) then
nsfcprop2d = nsfcprop2d + 4
endif
endif

if (Model%nstf_name(1) > 0) then
nsfcprop2d = nsfcprop2d + 16
endif

allocate (temp2d(isc:iec,jsc:jec,nsfcprop2d+Model%ntot3d+Model%nctp))
Expand Down Expand Up @@ -316,14 +326,14 @@ subroutine FV3GFS_GFS_checksum (Model, GFS_Data, Atm_block)
temp2d(i,j,92) = GFS_Data(nb)%Sfcprop%emis_ice(ix)
temp2d(i,j,93) = GFS_Data(nb)%Sfcprop%sncovr_ice(ix)

idx_opt = 93
idx_opt = 94
if (Model%use_cice_alb .or. Model%lsm == Model%lsm_ruc) then
temp2d(i,j,idx_opt+1) = GFS_Data(nb)%Sfcprop%albdirvis_ice(ix)
temp2d(i,j,idx_opt+2) = GFS_Data(nb)%Sfcprop%albdirnir_ice(ix)
temp2d(i,j,idx_opt+3) = GFS_Data(nb)%Sfcprop%albdifvis_ice(ix)
temp2d(i,j,idx_opt+4) = GFS_Data(nb)%Sfcprop%albdifnir_ice(ix)
temp2d(i,j,idx_opt) = GFS_Data(nb)%Sfcprop%albdirvis_ice(ix)
temp2d(i,j,idx_opt+1) = GFS_Data(nb)%Sfcprop%albdirnir_ice(ix)
temp2d(i,j,idx_opt+2) = GFS_Data(nb)%Sfcprop%albdifvis_ice(ix)
temp2d(i,j,idx_opt+3) = GFS_Data(nb)%Sfcprop%albdifnir_ice(ix)
idx_opt = idx_opt + 4
endif
idx_opt = idx_opt + 5

if (Model%lsm == Model%lsm_noahmp) then
temp2d(i,j,idx_opt) = GFS_Data(nb)%Sfcprop%snowxy(ix)
Expand Down Expand Up @@ -390,7 +400,7 @@ subroutine FV3GFS_GFS_checksum (Model, GFS_Data, Atm_block)
temp2d(i,j,idx_opt+9) = GFS_Data(nb)%Sfcprop%sfalb_lnd(ix)
temp2d(i,j,idx_opt+10) = GFS_Data(nb)%Sfcprop%sfalb_lnd_bck(ix)
temp2d(i,j,idx_opt+11) = GFS_Data(nb)%Sfcprop%sfalb_ice(ix)
idx_opt = idx_opt + 11
idx_opt = idx_opt + 12
if (Model%rdlai) then
temp2d(i,j,idx_opt+1) = GFS_Data(nb)%Sfcprop%xlaixy(ix)
idx_opt = idx_opt + 1
Expand Down

0 comments on commit 720d4a0

Please sign in to comment.