Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
8 changes: 7 additions & 1 deletion AdvCore_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ subroutine Run(GC, IMPORT, EXPORT, CLOCK, RC)
logical :: exclude
character(len=ESMF_MAXSTR) :: tmpstring
character(len=ESMF_MAXSTR) :: adjustTracerMode
character(len=ESMF_MAXSTR) :: eta_rc_file
character(len=ESMF_MAXSTR), allocatable :: xlist(:)
character(len=ESMF_MAXSTR), allocatable :: biggerlist(:)
integer, parameter :: XLIST_MAX = 60
Expand Down Expand Up @@ -539,7 +540,12 @@ subroutine Run(GC, IMPORT, EXPORT, CLOCK, RC)
VERIFY_(STATUS)
AllOCATE( BK_r8(LM+1) ,stat=STATUS )
VERIFY_(STATUS)
call set_eta(LM,LS,ptop_r8,pint_r8,ak_r8,bk_r8)
call MAPL_GetResource(MAPL, eta_rc_file, label='ETA_RC_FILE:', default = 'None', rc = status)
if( trim(eta_rc_file) == 'None' ) then
call set_eta(LM,LS,ptop_r8,pint_r8,ak_r8,bk_r8)
else
call get_eta(trim(eta_rc_file), ptop_r8,pint_r8,ak_r8,bk_r8)
endif
ptop=ptop_r8
pint=pint_r8
ak=ak_r8
Expand Down
12 changes: 10 additions & 2 deletions DynCore_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Module FVdycoreCubed_GridComp
HYDROSTATIC => FV_HYDROSTATIC, &
fv_getUpdraftHelicity, &
ADIABATIC, SW_DYNAMICS, AdvCore_Advection
use m_topo_remap, only: dyn_topo_remap
use shared_topo_remap, only: dyn_topo_remap
use CubeGridPrototype, only: register_grid_and_regridders

! !PUBLIC MEMBER FUNCTIONS:
Expand Down Expand Up @@ -7455,6 +7455,7 @@ subroutine Coldstart(gc, import, export, clock, rc)
type (ESMF_FieldBundle) :: TRADV_BUNDLE
character(len=ESMF_MAXSTR) :: FIELDNAME
character(len=ESMF_MAXSTR) :: STRING
character(len=ESMF_MAXSTR) :: eta_rc_file
real(REAL8), parameter :: r0_6=0.6
real(REAL8), parameter :: r1_0=1.0

Expand Down Expand Up @@ -7578,7 +7579,14 @@ subroutine Coldstart(gc, import, export, clock, rc)
bk_is_missing = .true.
endif

if (ak_is_missing .or. bk_is_missing) call set_eta(km, ls, ptop, pint, AK, BK)
if (ak_is_missing .or. bk_is_missing) then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicates logic above. It should be moved into an internal procedure and then just called from the two locations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interfaces are different. I am not sure how to avoid the logic. Since it is already moved to init(), it is not a big issue.

call MAPL_GetResource(MAPL, eta_rc_file, label='ETA_RC_FILE:', default = 'None', rc = status)
if( trim(eta_rc_file) == 'None' ) then
call set_eta(km, ls, ptop, pint, AK, BK)
else
call get_eta(trim(eta_rc_file), ptop, pint, AK, BK)
endif
endif

_ASSERT(ANY(AK /= 0.0) .or. ANY(BK /= 0.0),'needs informative message')
do L=lbound(PE,3),ubound(PE,3)
Expand Down
10 changes: 9 additions & 1 deletion interp_restarts.F90
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ program interp_restarts
integer :: p_split, npx, npy, npz, ivar, lcnt_var, iq0
integer :: n_args,n_files,nlevs,nedges,ifile,nlev,n_output,nfv_vars
character(len=ESMF_MAXPATHLEN), allocatable :: extra_files(:),extra_output(:)
character(len=ESMF_MAXPATHLEN) :: eta_rc_file
type(fv_rst), pointer :: rst_files(:) => null()
type(ArrDescr) :: ArrDes
integer :: info
Expand Down Expand Up @@ -114,6 +115,7 @@ program interp_restarts
n_readers=1
ihydro = 1
scale_rst = .true.
eta_rc_file = 'None'
do i=1,n_args
call get_command_argument(i,str)
select case(trim(str))
Expand Down Expand Up @@ -177,6 +179,8 @@ program interp_restarts
read(astr,*)schmidt_parameters(2)
call get_command_argument(i+3,astr)
read(astr,*)schmidt_parameters(3)
case('-eta_file')
call get_command_argument(i+1,eta_rc_file)
end select
end do

Expand Down Expand Up @@ -326,7 +330,11 @@ program interp_restarts

allocate ( r8_ak(npz+1) )
allocate ( r8_bk(npz+1) )
call set_eta(npz,ks,ptop,pint,r8_ak,r8_bk)
if (trim(eta_rc_file) == 'None') then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and duplicated again here ...

call set_eta(npz,ks,ptop,pint,r8_ak,r8_bk)
else
call get_eta(trim(eta_rc_file), ptop,pint,r8_ak,r8_bk)
endif
FV_Atm(1)%ak = r8_ak
FV_Atm(1)%bk = r8_bk
deallocate ( r8_ak,r8_bk )
Expand Down