Skip to content

Commit

Permalink
Merge pull request #4 from NCAR/dtc/develop
Browse files Browse the repository at this point in the history
update
  • Loading branch information
panll authored Jul 14, 2020
2 parents 15b048d + 5e82921 commit 34337e3
Show file tree
Hide file tree
Showing 65 changed files with 2,092 additions and 541 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ target_link_libraries(fv3core PRIVATE fms)
target_link_libraries(fv3core PRIVATE gfsphysics)
target_link_libraries(fv3core PRIVATE ipd)

target_include_directories(fv3core PRIVATE ${ESMF_MOD})
target_include_directories(fv3core PRIVATE atmos_cubed_sphere ${ESMF_MOD})

# end of fv3core

Expand Down
71 changes: 53 additions & 18 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module atmos_model_mod
use atmosphere_mod, only: atmosphere_scalar_field_halo
use atmosphere_mod, only: atmosphere_get_bottom_layer
use atmosphere_mod, only: set_atmosphere_pelist
use atmosphere_mod, only: Atm, mytile
use atmosphere_mod, only: Atm, mygrid
use block_control_mod, only: block_control_type, define_blocks_packed
use DYCORE_typedefs, only: DYCORE_data_type, DYCORE_diag_type
#ifdef CCPP
Expand Down Expand Up @@ -336,6 +336,28 @@ subroutine update_atmos_radiation_physics (Atmos)
! print *,'in atmos_model, after assign_importdata, rc=',rc
endif

! Calculate total non-physics tendencies by substracting old IPD Stateout
! variables from new/updated IPD Statein variables (gives the tendencies
! due to anything else than physics)
if (IPD_Control%ldiag3d) then
do nb = 1,Atm_block%nblks
IPD_Data(nb)%Intdiag%du3dt(:,:,8) = IPD_Data(nb)%Intdiag%du3dt(:,:,8) &
+ (IPD_Data(nb)%Statein%ugrs - IPD_Data(nb)%Stateout%gu0)
IPD_Data(nb)%Intdiag%dv3dt(:,:,8) = IPD_Data(nb)%Intdiag%dv3dt(:,:,8) &
+ (IPD_Data(nb)%Statein%vgrs - IPD_Data(nb)%Stateout%gv0)
IPD_Data(nb)%Intdiag%dt3dt(:,:,11) = IPD_Data(nb)%Intdiag%dt3dt(:,:,11) &
+ (IPD_Data(nb)%Statein%tgrs - IPD_Data(nb)%Stateout%gt0)
enddo
if (IPD_Control%qdiag3d) then
do nb = 1,Atm_block%nblks
IPD_Data(nb)%Intdiag%dq3dt(:,:,12) = IPD_Data(nb)%Intdiag%dq3dt(:,:,12) &
+ (IPD_Data(nb)%Statein%qgrs(:,:,IPD_Control%ntqv) - IPD_Data(nb)%Stateout%gq0(:,:,IPD_Control%ntqv))
IPD_Data(nb)%Intdiag%dq3dt(:,:,13) = IPD_Data(nb)%Intdiag%dq3dt(:,:,13) &
+ (IPD_Data(nb)%Statein%qgrs(:,:,IPD_Control%ntoz) - IPD_Data(nb)%Stateout%gq0(:,:,IPD_Control%ntoz))
enddo
endif
endif

call mpp_clock_end(setupClock)

if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "radiation driver"
Expand Down Expand Up @@ -466,7 +488,7 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
integer :: bdat(8), cdat(8)
integer :: ntracers, maxhf, maxh
character(len=32), allocatable, target :: tracer_names(:)
integer :: nthrds
integer :: nthrds, nb

!-----------------------------------------------------------------------

Expand Down Expand Up @@ -604,8 +626,8 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
Init_parm%area => Atmos%area
Init_parm%tracer_names => tracer_names
#ifdef CCPP
Init_parm%restart = Atm(mytile)%flagstruct%warm_start
Init_parm%hydrostatic = Atm(mytile)%flagstruct%hydrostatic
Init_parm%restart = Atm(mygrid)%flagstruct%warm_start
Init_parm%hydrostatic = Atm(mygrid)%flagstruct%hydrostatic
#endif

#ifdef INTERNAL_FILE_NML
Expand Down Expand Up @@ -633,17 +655,6 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
if(IPD_Control%me == IPD_Control%master) print *,'do_skeb=',IPD_Control%do_skeb
end if

#ifdef CCPP
! Initialize the CCPP framework
call CCPP_step (step="init", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP init step failed')
! Doing the init here requires logic in thompson aerosol init if no aerosol
! profiles are specified and internal profiles are calculated, because these
! require temperature/geopotential etc which are not yet set. Sim. for RUC LSM.
call CCPP_step (step="physics_init", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP physics_init step failed')
#endif

Atmos%Diag => IPD_Diag

if (IPD_Control%do_sfcperts) then
Expand Down Expand Up @@ -677,7 +688,7 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
endif
endif

Atm(mytile)%flagstruct%do_skeb = IPD_Control%do_skeb
Atm(mygrid)%flagstruct%do_skeb = IPD_Control%do_skeb

! initialize the IAU module
call iau_initialize (IPD_Control,IAU_data,Init_parm)
Expand All @@ -698,11 +709,35 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
call FV3GFS_diag_register (IPD_Diag, Time, Atm_block, IPD_Control, Atmos%lon, Atmos%lat, Atmos%axes)
call IPD_initialize_rst (IPD_Control, IPD_Data, IPD_Diag, IPD_Restart, Init_parm)
#ifdef CCPP
call FV3GFS_restart_read (IPD_Data, IPD_Restart, Atm_block, IPD_Control, Atmos%domain, Atm(mytile)%flagstruct%warm_start)
call FV3GFS_restart_read (IPD_Data, IPD_Restart, Atm_block, IPD_Control, Atmos%domain, Atm(mygrid)%flagstruct%warm_start)
#else
call FV3GFS_restart_read (IPD_Data, IPD_Restart, Atm_block, IPD_Control, Atmos%domain)
#endif

! Populate the IPD_Data%Statein container with the prognostic state
! in Atm_block, which contains the initial conditions/restart data.
call atmos_phys_driver_statein (IPD_data, Atm_block, flip_vc)

! When asked to calculate 3-dim. tendencies, set Stateout variables to
! Statein variables here in order to capture the first call to dycore
if (IPD_Control%ldiag3d) then
do nb = 1,Atm_block%nblks
IPD_Data(nb)%Stateout%gu0 = IPD_Data(nb)%Statein%ugrs
IPD_Data(nb)%Stateout%gv0 = IPD_Data(nb)%Statein%vgrs
IPD_Data(nb)%Stateout%gt0 = IPD_Data(nb)%Statein%tgrs
IPD_Data(nb)%Stateout%gq0 = IPD_Data(nb)%Statein%qgrs
enddo
endif

#ifdef CCPP
! Initialize the CCPP framework
call CCPP_step (step="init", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP init step failed')
! Initialize the CCPP physics
call CCPP_step (step="physics_init", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP physics_init step failed')
#endif

!--- set the initial diagnostic timestamp
diag_time = Time
if (output_1st_tstep_rst) then
Expand Down Expand Up @@ -1456,7 +1491,7 @@ subroutine update_atmos_chemistry(state, rc)
ib = i + Atm_block%isc - 1
nb = Atm_block%blkno(ib,jb)
ix = Atm_block%ixp(ib,jb)
hpbl(i,j) = IPD_Data(nb)%IntDiag%hpbl(ix)
hpbl(i,j) = IPD_Data(nb)%Tbd%hpbl(ix)
area(i,j) = IPD_Data(nb)%Grid%area(ix)
stype(i,j) = IPD_Data(nb)%Sfcprop%stype(ix)
rainc(i,j) = IPD_Data(nb)%Coupling%rainc_cpl(ix)
Expand Down
Loading

0 comments on commit 34337e3

Please sign in to comment.