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

Convert GFS DDTs from blocked data structures to contiguous arrays (aka update GFS_debug.F90) #183

Merged
merged 10 commits into from
Aug 8, 2024
Merged
154 changes: 83 additions & 71 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_debug.F90
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,16 @@ module GFS_diagtoscreen

use print_var_chksum, only: print_var

use machine, only: kind_phys

use GFS_typedefs, only: GFS_control_type, GFS_statein_type, &
GFS_stateout_type, GFS_sfcprop_type, &
GFS_coupling_type, GFS_grid_type, &
GFS_tbd_type, GFS_cldprop_type, &
GFS_radtend_type, GFS_diag_type

use CCPP_typedefs, only: GFS_interstitial_type

implicit none

private
Expand All @@ -314,66 +324,70 @@ module GFS_diagtoscreen
!> \section arg_table_GFS_diagtoscreen_init Argument Table
!! \htmlinclude GFS_diagtoscreen_init.html
!!
subroutine GFS_diagtoscreen_init (Model, Data, Interstitial, errmsg, errflg)

use GFS_typedefs, only: GFS_control_type, GFS_data_type
use CCPP_typedefs, only: GFS_interstitial_type
subroutine GFS_diagtoscreen_init (Model, Statein, Stateout, Sfcprop, Coupling, &
Grid, Tbd, Cldprop, Radtend, Diag, Interstitial, &
errmsg, errflg)

implicit none

!--- interface variables
type(GFS_control_type), intent(in) :: Model
type(GFS_data_type), intent(in) :: Data(:)
type(GFS_statein_type), intent(in) :: Statein
type(GFS_stateout_type), intent(in) :: Stateout
type(GFS_sfcprop_type), intent(in) :: Sfcprop
type(GFS_coupling_type), intent(in) :: Coupling
type(GFS_grid_type), intent(in) :: Grid
type(GFS_tbd_type), intent(in) :: Tbd
type(GFS_cldprop_type), intent(in) :: Cldprop
type(GFS_radtend_type), intent(in) :: Radtend
type(GFS_diag_type), intent(in) :: Diag
type(GFS_interstitial_type), intent(in) :: Interstitial(:)
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

!--- local variables
integer :: i

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

do i=1,size(Data)
call GFS_diagtoscreen_run (Model, Data(i)%Statein, Data(i)%Stateout, Data(i)%Sfcprop, &
Data(i)%Coupling, Data(i)%Grid, Data(i)%Tbd, Data(i)%Cldprop, &
Data(i)%Radtend, Data(i)%Intdiag, Interstitial(1), &
size(Interstitial), i, errmsg, errflg)
end do
call GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, &
Coupling, Grid, Tbd, Cldprop, &
Radtend, Diag, Interstitial(1), &
size(Interstitial), -999, errmsg, errflg)

end subroutine GFS_diagtoscreen_init

!> \section arg_table_GFS_diagtoscreen_timestep_init Argument Table
!! \htmlinclude GFS_diagtoscreen_timestep_init.html
!!
subroutine GFS_diagtoscreen_timestep_init (Model, Data, Interstitial, errmsg, errflg)

use GFS_typedefs, only: GFS_control_type, GFS_data_type
use CCPP_typedefs, only: GFS_interstitial_type
subroutine GFS_diagtoscreen_timestep_init (Model, Statein, Stateout, Sfcprop, Coupling, &
Grid, Tbd, Cldprop, Radtend, Diag, Interstitial, &
errmsg, errflg)

implicit none

!--- interface variables
type(GFS_control_type), intent(in) :: Model
type(GFS_data_type), intent(in) :: Data(:)
type(GFS_statein_type), intent(in) :: Statein
type(GFS_stateout_type), intent(in) :: Stateout
type(GFS_sfcprop_type), intent(in) :: Sfcprop
type(GFS_coupling_type), intent(in) :: Coupling
type(GFS_grid_type), intent(in) :: Grid
type(GFS_tbd_type), intent(in) :: Tbd
type(GFS_cldprop_type), intent(in) :: Cldprop
type(GFS_radtend_type), intent(in) :: Radtend
type(GFS_diag_type), intent(in) :: Diag
type(GFS_interstitial_type), intent(in) :: Interstitial(:)
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

!--- local variables
integer :: i

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

do i=1,size(Data)
call GFS_diagtoscreen_run (Model, Data(i)%Statein, Data(i)%Stateout, Data(i)%Sfcprop, &
Data(i)%Coupling, Data(i)%Grid, Data(i)%Tbd, Data(i)%Cldprop, &
Data(i)%Radtend, Data(i)%Intdiag, Interstitial(1), &
size(Interstitial), i, errmsg, errflg)
end do
call GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, &
Coupling, Grid, Tbd, Cldprop, &
Radtend, Diag, Interstitial(1), &
size(Interstitial), -999, errmsg, errflg)

end subroutine GFS_diagtoscreen_timestep_init

Expand All @@ -390,12 +404,6 @@ subroutine GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling,
#ifdef _OPENMP
use omp_lib
#endif
use GFS_typedefs, only: GFS_control_type, GFS_statein_type, &
GFS_stateout_type, GFS_sfcprop_type, &
GFS_coupling_type, GFS_grid_type, &
GFS_tbd_type, GFS_cldprop_type, &
GFS_radtend_type, GFS_diag_type
use CCPP_typedefs, only: GFS_interstitial_type

implicit none

Expand Down Expand Up @@ -619,7 +627,7 @@ subroutine GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling,
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Tbd%in_nm' , Tbd%in_nm)
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Tbd%ccn_nm' , Tbd%ccn_nm)
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Tbd%aer_nm' , Tbd%aer_nm)
if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_unified) then
if (Model%imfdeepcnv == Model%imfdeepcnv_gf) then
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Tbd%cactiv' , Tbd%cactiv)
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Tbd%cactiv_m' , Tbd%cactiv_m)
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Tbd%aod_gf' , Tbd%aod_gf)
Expand Down Expand Up @@ -877,13 +885,6 @@ subroutine GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling,
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Coupling%v10mi_cpl ', Coupling%v10mi_cpl )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Coupling%tsfci_cpl ', Coupling%tsfci_cpl )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Coupling%psurfi_cpl ', Coupling%psurfi_cpl )
if (Model%use_med_flux) then
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Coupling%dusfcino_cpl ', Coupling%dusfcino_cpl )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Coupling%dvsfcino_cpl ', Coupling%dvsfcino_cpl )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Coupling%dtsfcino_cpl ', Coupling%dtsfcino_cpl )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Coupling%dqsfcino_cpl ', Coupling%dqsfcino_cpl )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Coupling%ulwsfcino_cpl', Coupling%ulwsfcino_cpl )
end if
end if
if (Model%cplchm) then
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Coupling%rainc_cpl', Coupling%rainc_cpl)
Expand Down Expand Up @@ -971,6 +972,17 @@ module GFS_interstitialtoscreen

use print_var_chksum, only: print_var

use machine, only: kind_phys

use GFS_typedefs, only: GFS_control_type, GFS_statein_type, &
GFS_stateout_type, GFS_sfcprop_type, &
GFS_coupling_type, GFS_grid_type, &
GFS_tbd_type, GFS_cldprop_type, &
GFS_radtend_type, GFS_diag_type

use CCPP_typedefs, only: GFS_interstitial_type


implicit none

private
Expand All @@ -982,16 +994,23 @@ module GFS_interstitialtoscreen
!> \section arg_table_GFS_interstitialtoscreen_init Argument Table
!! \htmlinclude GFS_interstitialtoscreen_init.html
!!
subroutine GFS_interstitialtoscreen_init (Model, Data, Interstitial, errmsg, errflg)

use GFS_typedefs, only: GFS_control_type, GFS_data_type
use CCPP_typedefs, only: GFS_interstitial_type
subroutine GFS_interstitialtoscreen_init (Model, Statein, Stateout, Sfcprop, Coupling, &
Grid, Tbd, Cldprop, Radtend, Diag, Interstitial, &
errmsg, errflg)

implicit none

!--- interface variables
type(GFS_control_type), intent(in) :: Model
type(GFS_data_type), intent(in) :: Data(:)
type(GFS_statein_type), intent(in) :: Statein
type(GFS_stateout_type), intent(in) :: Stateout
type(GFS_sfcprop_type), intent(in) :: Sfcprop
type(GFS_coupling_type), intent(in) :: Coupling
type(GFS_grid_type), intent(in) :: Grid
type(GFS_tbd_type), intent(in) :: Tbd
type(GFS_cldprop_type), intent(in) :: Cldprop
type(GFS_radtend_type), intent(in) :: Radtend
type(GFS_diag_type), intent(in) :: Diag
type(GFS_interstitial_type), intent(in) :: Interstitial(:)
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
Expand All @@ -1003,11 +1022,9 @@ subroutine GFS_interstitialtoscreen_init (Model, Data, Interstitial, errmsg, err
errmsg = ''
errflg = 0


do i=1,size(Interstitial)
call GFS_interstitialtoscreen_run (Model, Data(1)%Statein, Data(1)%Stateout, Data(1)%Sfcprop, &
Data(1)%Coupling, Data(1)%Grid, Data(1)%Tbd, Data(1)%Cldprop, &
Data(1)%Radtend, Data(1)%Intdiag, Interstitial(i), &
call GFS_interstitialtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling, &
Grid, Tbd, Cldprop, Radtend, Diag, Interstitial(i), &
size(Interstitial), -999, errmsg, errflg)
end do

Expand All @@ -1016,16 +1033,23 @@ end subroutine GFS_interstitialtoscreen_init
!> \section arg_table_GFS_interstitialtoscreen_timestep_init Argument Table
!! \htmlinclude GFS_interstitialtoscreen_timestep_init.html
!!
subroutine GFS_interstitialtoscreen_timestep_init (Model, Data, Interstitial, errmsg, errflg)

use GFS_typedefs, only: GFS_control_type, GFS_data_type
use CCPP_typedefs, only: GFS_interstitial_type
subroutine GFS_interstitialtoscreen_timestep_init (Model, Statein, Stateout, Sfcprop, Coupling, &
Grid, Tbd, Cldprop, Radtend, Diag, Interstitial, &
errmsg, errflg)

implicit none

!--- interface variables
type(GFS_control_type), intent(in) :: Model
type(GFS_data_type), intent(in) :: Data(:)
type(GFS_statein_type), intent(in) :: Statein
type(GFS_stateout_type), intent(in) :: Stateout
type(GFS_sfcprop_type), intent(in) :: Sfcprop
type(GFS_coupling_type), intent(in) :: Coupling
type(GFS_grid_type), intent(in) :: Grid
type(GFS_tbd_type), intent(in) :: Tbd
type(GFS_cldprop_type), intent(in) :: Cldprop
type(GFS_radtend_type), intent(in) :: Radtend
type(GFS_diag_type), intent(in) :: Diag
type(GFS_interstitial_type), intent(in) :: Interstitial(:)
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
Expand All @@ -1039,9 +1063,8 @@ subroutine GFS_interstitialtoscreen_timestep_init (Model, Data, Interstitial, er


do i=1,size(Interstitial)
call GFS_interstitialtoscreen_run (Model, Data(1)%Statein, Data(1)%Stateout, Data(1)%Sfcprop, &
Data(1)%Coupling, Data(1)%Grid, Data(1)%Tbd, Data(1)%Cldprop, &
Data(1)%Radtend, Data(1)%Intdiag, Interstitial(i), &
call GFS_interstitialtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling, &
Grid, Tbd, Cldprop, Radtend, Diag, Interstitial(i), &
size(Interstitial), -999, errmsg, errflg)
end do

Expand All @@ -1060,14 +1083,6 @@ subroutine GFS_interstitialtoscreen_run (Model, Statein, Stateout, Sfcprop, Coup
#ifdef _OPENMP
use omp_lib
#endif
use machine, only: kind_phys
use GFS_typedefs, only: GFS_control_type, GFS_statein_type, &
GFS_stateout_type, GFS_sfcprop_type, &
GFS_coupling_type, GFS_grid_type, &
GFS_tbd_type, GFS_cldprop_type, &
GFS_radtend_type, GFS_diag_type
use CCPP_typedefs, only: GFS_interstitial_type

implicit none

!--- interface variables
Expand Down Expand Up @@ -1293,7 +1308,6 @@ subroutine GFS_interstitialtoscreen_run (Model, Statein, Stateout, Sfcprop, Coup
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%qss_ice ', Interstitial%qss_ice )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%qss_land ', Interstitial%qss_land )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%qss_water ', Interstitial%qss_water )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%radar_reset ', Interstitial%radar_reset )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%raddt ', Interstitial%raddt )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%raincd ', Interstitial%raincd )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%raincs ', Interstitial%raincs )
Expand Down Expand Up @@ -1322,8 +1336,6 @@ subroutine GFS_interstitialtoscreen_run (Model, Statein, Stateout, Sfcprop, Coup
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%sigmafrac ', Interstitial%sigmafrac )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%sigmatot ', Interstitial%sigmatot )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%snowc ', Interstitial%snowc )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%snowd_ice ', Interstitial%snowd_ice )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%snowd_land ', Interstitial%snowd_land )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%snohf ', Interstitial%snohf )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%snowmt ', Interstitial%snowmt )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%stress ', Interstitial%stress )
Expand Down Expand Up @@ -1535,7 +1547,7 @@ module GFS_checkland
!! \htmlinclude GFS_checkland_run.html
!!
subroutine GFS_checkland_run (me, master, blkno, im, kdt, iter, flag_iter, flag_guess, &
flag_init, flag_restart, frac_grid, isot, ivegsrc, stype,scolor, vtype, slope, &
flag_init, flag_restart, frac_grid, isot, ivegsrc, stype,scolor, vtype, slope, &
dry, icy, wet, lake, ocean, oceanfrac, landfrac, lakefrac, slmsk, islmsk, &
zorl, zorlw, zorll, zorli, fice, errmsg, errflg )

Expand Down
Loading
Loading