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

Refactor fv3atm history & restart to reduce redundant code. Add rrfs-sd and clm lake to quilt restart. #660

Merged
merged 31 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0b4db90
move utility routines, data structures, and name generation out of FV…
SamuelTrahanNOAA May 5, 2023
2a081b3
move RRFS SD state restart io to separate file and rename clm_lake_io…
SamuelTrahanNOAA May 5, 2023
d527301
sfc array indices are calculated in FV3GFS_sfc_io.F90
SamuelTrahanNOAA May 5, 2023
e597b95
move rrfs sd emissions input code to FV3GFS_rrfs_sd_io.F90
SamuelTrahanNOAA May 6, 2023
3c91b6a
allocate sfc arrays in FV3GFS_sfc_io.F90
SamuelTrahanNOAA May 6, 2023
a6971dc
define and write axes in FV3GFS_sfc_io.F90
SamuelTrahanNOAA May 6, 2023
507fb73
register sfc fields in FV3GFS_sfc_io.F90
SamuelTrahanNOAA May 8, 2023
200ef3c
move sfc read loop to FV3GFS_sfc_io.F90
SamuelTrahanNOAA May 8, 2023
ce0ba00
Put post-read safeguards in FV3GFS_sfc_io.F90
SamuelTrahanNOAA May 10, 2023
b656b73
copy to grid in FV3GFS_sfc_io.F90 and make things private
SamuelTrahanNOAA May 10, 2023
ca3344b
fix discrepancies in copying from grid
SamuelTrahanNOAA May 10, 2023
8ae34ee
combine sfc read & write into one routine
SamuelTrahanNOAA May 17, 2023
8be22c6
move oro reading to FV3GFS_oro_io.F90
SamuelTrahanNOAA May 17, 2023
3177218
gwd I/O in FV3GFS_oro_io.F90
SamuelTrahanNOAA May 20, 2023
1d9305f
store quilt restart data structures in FV3GFS_sfc_io types
SamuelTrahanNOAA May 21, 2023
2a548ec
remove copy_from_GFS_Data calls from FV3GFS_restart_io.F90
SamuelTrahanNOAA May 22, 2023
780100d
bundle vars in FV3GFS_sfc_io.F90
SamuelTrahanNOAA May 22, 2023
ed919fe
consistent naming and clm lake quilt restart
SamuelTrahanNOAA May 23, 2023
91b63c1
rrfs sd restart in quilt (still under testing)
SamuelTrahanNOAA May 23, 2023
45c9d0d
Merge remote-tracking branch 'upstream/develop' into refactor-restart
SamuelTrahanNOAA May 23, 2023
af5b39d
Merge remote-tracking branch 'origin/develop' into refactor-restart
SamuelTrahanNOAA May 24, 2023
f9ad174
Merge branch 'refactor-restart' of ssh://github.com/SamuelTrahanNOAA/…
SamuelTrahanNOAA May 24, 2023
63de192
explicitly write axis values (from DusanJovic-NOAA), and clean up code
SamuelTrahanNOAA May 24, 2023
b336138
rename FV3GFS to fv3atm in code, except output metadata
SamuelTrahanNOAA May 26, 2023
305e996
refactor a bit more, putting history into fv3atm_history_io.F90 and r…
SamuelTrahanNOAA May 29, 2023
9e7d86b
more cleanup
SamuelTrahanNOAA May 30, 2023
ca65a7f
delete trailing whitespace
SamuelTrahanNOAA May 30, 2023
c9f1c0e
remove unneeded "use...only"
SamuelTrahanNOAA May 30, 2023
b5ab9ae
comments, consistent indentation, remove trailing whitespace
SamuelTrahanNOAA May 31, 2023
0466c61
Even longer explanation of RUC LSM axes from @tanyasmirnova
SamuelTrahanNOAA May 31, 2023
0c64f47
Merge remote-tracking branch 'upstream/develop' into refactor-restart
SamuelTrahanNOAA Jun 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ add_library(fv3atm
cpl/module_block_data.F90
cpl/module_cplfields.F90
cpl/module_cap_cpl.F90
io/clm_lake_io.F90
io/FV3GFS_io.F90
io/FV3GFS_restart_io.F90
io/fv3atm_common_io.F90
io/fv3atm_clm_lake_io.F90
io/fv3atm_rrfs_sd_io.F90
io/fv3atm_sfc_io.F90
io/fv3atm_oro_io.F90
io/fv3atm_history_io.F90
io/fv3atm_restart_io.F90
io/module_write_netcdf.F90
io/module_write_restart_netcdf.F90
io/module_fv3_io_def.F90
Expand Down
29 changes: 15 additions & 14 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ module atmos_model_mod

use stochastic_physics_wrapper_mod, only: stochastic_physics_wrapper,stochastic_physics_wrapper_end

use FV3GFS_io_mod, only: FV3GFS_restart_read, FV3GFS_restart_write, &
FV3GFS_GFS_checksum, &
FV3GFS_diag_register, FV3GFS_diag_output, &
use fv3atm_history_io_mod, only: fv3atm_diag_register, fv3atm_diag_output, &
DIAG_SIZE
use FV3GFS_restart_io_mod, only: FV3GFS_restart_register, &
use fv3atm_restart_io_mod, only: fv3atm_restart_register, &
fv3atm_checksum, &
fv_phy_restart_output, &
fv_sfc_restart_output
fv_sfc_restart_output, &
fv3atm_restart_read, &
fv3atm_restart_write
use fv_ufs_restart_io_mod, only: fv_dyn_restart_register, &
fv_dyn_restart_output
use fv_iau_mod, only: iau_external_data_type,getiauforcing,iau_initialize
Expand Down Expand Up @@ -369,7 +370,7 @@ subroutine update_atmos_radiation_physics (Atmos)

if (chksum_debug) then
if (mpp_pe() == mpp_root_pe()) print *,'RADIATION STEP ', GFS_control%kdt, GFS_control%fhour
call FV3GFS_GFS_checksum(GFS_control, GFS_data, Atm_block)
call fv3atm_checksum(GFS_control, GFS_data, Atm_block)
endif

if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "physics driver"
Expand All @@ -383,7 +384,7 @@ subroutine update_atmos_radiation_physics (Atmos)

if (chksum_debug) then
if (mpp_pe() == mpp_root_pe()) print *,'PHYSICS STEP1 ', GFS_control%kdt, GFS_control%fhour
call FV3GFS_GFS_checksum(GFS_control, GFS_data, Atm_block)
call fv3atm_checksum(GFS_control, GFS_data, Atm_block)
endif

if (GFS_Control%do_sppt .or. GFS_Control%do_shum .or. GFS_Control%do_skeb .or. &
Expand All @@ -402,7 +403,7 @@ subroutine update_atmos_radiation_physics (Atmos)

if (chksum_debug) then
if (mpp_pe() == mpp_root_pe()) print *,'PHYSICS STEP2 ', GFS_control%kdt, GFS_control%fhour
call FV3GFS_GFS_checksum(GFS_control, GFS_data, Atm_block)
call fv3atm_checksum(GFS_control, GFS_data, Atm_block)
endif
call getiauforcing(GFS_control,IAU_data)
if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "end of radiation and physics step"
Expand Down Expand Up @@ -736,15 +737,15 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
!rab call atmosphere_tracer_postinit (GFS_data, Atm_block)

call atmosphere_nggps_diag (Time, init=.true.)
call FV3GFS_diag_register (GFS_Diag, Time, Atm_block, GFS_control, Atmos%lon, Atmos%lat, Atmos%axes)
call fv3atm_diag_register (GFS_Diag, Time, Atm_block, GFS_control, Atmos%lon, Atmos%lat, Atmos%axes)
call GFS_restart_populate (GFS_restart_var, GFS_control, GFS_data%Statein, GFS_data%Stateout, GFS_data%Sfcprop, &
GFS_data%Coupling, GFS_data%Grid, GFS_data%Tbd, GFS_data%Cldprop, GFS_data%Radtend, &
GFS_data%IntDiag, Init_parm, GFS_Diag)
if (quilting_restart) then
call fv_dyn_restart_register (Atm(mygrid))
call FV3GFS_restart_register (GFS_data%Sfcprop, GFS_restart_var, Atm_block, GFS_control)
call fv3atm_restart_register (GFS_data%Sfcprop, GFS_restart_var, Atm_block, GFS_control)
endif
call FV3GFS_restart_read (GFS_data, GFS_restart_var, Atm_block, GFS_control, Atmos%domain_for_read, &
call fv3atm_restart_read (GFS_data, GFS_restart_var, Atm_block, GFS_control, Atmos%domain_for_read, &
Atm(mygrid)%flagstruct%warm_start, ignore_rst_cksum)
if(GFS_control%do_ca .and. Atm(mygrid)%flagstruct%warm_start)then
call read_ca_restart (Atmos%domain,GFS_control%ncells,GFS_control%nca,GFS_control%ncells_g,GFS_control%nca_g)
Expand Down Expand Up @@ -966,7 +967,7 @@ subroutine update_atmos_model_state (Atmos, rc)
if (chksum_debug) then
if (mpp_pe() == mpp_root_pe()) print *,'UPDATE STATE ', GFS_control%kdt, GFS_control%fhour
if (mpp_pe() == mpp_root_pe()) print *,'in UPDATE STATE ', size(GFS_data(1)%SfcProp%tsfc),'nblks=',Atm_block%nblks
call FV3GFS_GFS_checksum(GFS_control, GFS_data, Atm_block)
call fv3atm_checksum(GFS_control, GFS_data, Atm_block)
endif

!--- advance time ---
Expand Down Expand Up @@ -995,7 +996,7 @@ subroutine update_atmos_model_state (Atmos, rc)
endif
if (mpp_pe() == mpp_root_pe()) write(6,*) ' gfs diags time since last bucket empty: ',time_int/3600.,'hrs'
call atmosphere_nggps_diag(Atmos%Time)
call FV3GFS_diag_output(Atmos%Time, GFS_Diag, Atm_block, GFS_control%nx, GFS_control%ny, &
call fv3atm_diag_output(Atmos%Time, GFS_Diag, Atm_block, GFS_control%nx, GFS_control%ny, &
GFS_control%levs, 1, 1, 1.0_GFS_kind_phys, time_int, time_intfull, &
GFS_control%fhswr, GFS_control%fhlwr)
endif
Expand Down Expand Up @@ -1109,7 +1110,7 @@ subroutine atmos_model_restart(Atmos, timestamp)
call fv_dyn_restart_output(Atm(mygrid), timestamp)
else
call atmosphere_restart(timestamp)
call FV3GFS_restart_write (GFS_data, GFS_restart_var, Atm_block, &
call fv3atm_restart_write (GFS_data, GFS_restart_var, Atm_block, &
GFS_control, Atmos%domain, timestamp)
endif
if(GFS_control%do_ca)then
Expand Down
18 changes: 9 additions & 9 deletions fv3_cap.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!--------------- FV3GFS solo model -----------------
!--------------- FV3 ATM solo model ----------------
!
!*** The FV3 atmosphere grid component nuopc cap
!
Expand All @@ -11,7 +11,7 @@
! 02 Nov 2017: J. Wang Use Gerhard's transferable RouteHandle
!

module fv3gfs_cap_mod
module fv3atm_cap_mod

use ESMF
use NUOPC
Expand Down Expand Up @@ -80,14 +80,14 @@ module fv3gfs_cap_mod
contains

!-----------------------------------------------------------------------
!------------------- Solo fv3gfs code starts here ----------------------
!------------------- Solo fv3atm code starts here ----------------------
!-----------------------------------------------------------------------

subroutine SetServices(gcomp, rc)

type(ESMF_GridComp) :: gcomp
integer, intent(out) :: rc
character(len=*),parameter :: subname='(fv3gfs_cap:SetServices)'
character(len=*),parameter :: subname='(fv3atm_cap:SetServices)'

rc = ESMF_SUCCESS

Expand Down Expand Up @@ -983,7 +983,7 @@ subroutine InitializeRealize(gcomp, rc)
integer, intent(out) :: rc

! local variables
character(len=*),parameter :: subname='(fv3gfs_cap:InitializeRealize)'
character(len=*),parameter :: subname='(fv3atm_cap:InitializeRealize)'
type(ESMF_Clock) :: clock
type(ESMF_State) :: importState, exportState
integer :: urc
Expand Down Expand Up @@ -1248,7 +1248,7 @@ subroutine fv3_checkimport(gcomp, rc)
integer, intent(out) :: rc

! local variables
character(len=*),parameter :: subname='(fv3gfs_cap:fv3_checkimport)'
character(len=*),parameter :: subname='(fv3atm_cap:fv3_checkimport)'
integer :: n, nf
type(ESMF_Clock) :: clock
type(ESMF_Time) :: currTime, invalidTime
Expand Down Expand Up @@ -1335,7 +1335,7 @@ subroutine TimestampExport_phase1(gcomp, rc)
integer, intent(out) :: rc

! local variables
character(len=*),parameter :: subname='(fv3gfs_cap:TimestampExport_phase1)'
character(len=*),parameter :: subname='(fv3atm_cap:TimestampExport_phase1)'
type(ESMF_Clock) :: driverClock, modelClock
type(ESMF_State) :: exportState

Expand Down Expand Up @@ -1365,7 +1365,7 @@ subroutine ModelFinalize(gcomp, rc)
integer, intent(out) :: rc

! local variables
character(len=*),parameter :: subname='(fv3gfs_cap:ModelFinalize)'
character(len=*),parameter :: subname='(fv3atm_cap:ModelFinalize)'
integer :: i, urc
type(ESMF_VM) :: vm
real(kind=8) :: MPI_Wtime, timeffs
Expand Down Expand Up @@ -1413,4 +1413,4 @@ end subroutine ModelFinalize
!
!-----------------------------------------------------------------------------

end module fv3gfs_cap_mod
end module fv3atm_cap_mod
Loading