Skip to content

Commit

Permalink
Chsp physics update, global latlon grid, post changes and CCN-IN foll…
Browse files Browse the repository at this point in the history
…owup bugfix (NCAR#104)

* point to ccpp branch chsp_latlon_post

* add chsp code changes from Jongil

Co-authored-by: Jongil Han <jingil.han@noaa.gov>

* add landsfcmdl variable to model sfc history file meta data

* add global latlon grid on write grid component, code changes from Jeffrey Whitaker

Co-authored-by: Jeffrey Whitaker <Jeffrey.S.Whitaker@noaa.gov>

* add chsp code changes in ccpp-physics

Co-authored-by: Jongil Han <jongil.han@noaa.gov>

* remove support for legacy Intel compilers in CCPP gmake build

Co-authored-by: Dom Heinzeller <dom.heinzeller@noaa.gov>

* update ccpp physics, fix syntax error

* update sflx.f in ccpp physics

* CCN-IN followup bugfix

Co-authored-by: Grant Firl <grantf@ucar.edu>

* Bugfix for GNU compiler in io/module_wrt_grid_comp.F90; bugfix in gfsphysics/physics/sfc_diff.f; updates for CCPP

* merge fv3 dycore ccpp framework and physics to the latest repoes

* cmeps integration changes

Co-authored-by: Denise Worthen <Denise.Worthen@noaa.gov>

* update CCPP with tsfcl change

* fix timestr in module_cap_cpl.F90

* fix syntax error in ugwp_driver_v0.F

* point ccpp/physics back to NCAR master

Co-authored-by: Jun Wang <junwang-noaa@users.noreply.github.com>
Co-authored-by: Jeffrey Whitaker <Jeffrey.S.Whitaker@noaa.gov>
Co-authored-by: Jongil Han <jongil.han@noaa.gov>
Co-authored-by: Dom Heinzeller <dom.heinzeller@noaa.gov>
Co-authored-by: Grant Firl <grantf@ucar.edu>
Co-authored-by: Dom Heinzeller <climbfuji@ymail.com>
Co-authored-by: Denise Worthen <Denise.Worthen@noaa.gov>
  • Loading branch information
8 people committed Apr 28, 2020
1 parent aac9ff9 commit bc9aa3b
Show file tree
Hide file tree
Showing 20 changed files with 516 additions and 317 deletions.
4 changes: 2 additions & 2 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,7 @@ subroutine setup_exportdata (rc)

if (IPD_Control%cplflx) then
! MEAN Zonal compt of momentum flux (N/m**2)
idx = queryfieldlist(exportFieldsList,'mean_zonal_moment_flx')
idx = queryfieldlist(exportFieldsList,'mean_zonal_moment_flx_atm')
if (idx > 0 ) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
Expand All @@ -2057,7 +2057,7 @@ subroutine setup_exportdata (rc)
endif

! MEAN Merid compt of momentum flux (N/m**2)
idx = queryfieldlist(exportFieldsList,'mean_merid_moment_flx')
idx = queryfieldlist(exportFieldsList,'mean_merid_moment_flx_atm')
if (idx > 0 ) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
Expand Down
12 changes: 3 additions & 9 deletions ccpp/build_ccpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function usage {
echo " SUITES=ABC,XYZ (comma-separated list of CCPP suites; "
echo " corresponding filenames: suite_ABC.xml. ...)"
echo " MULTI_GASES=Y/N (default N)"
echo " INTEL16=Y/N (default N)"
echo " clean_before [optional] can be 'YES' (default) or 'NO'"
echo " clean_after [optional] can be 'YES' (default) or 'NO'"
exit 1
Expand Down Expand Up @@ -129,14 +128,9 @@ if [[ "${MAKE_OPT}" == *"MULTI_GASES=Y"* ]]; then
else
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DMULTI_GASES=OFF"
fi
if [[ "${MAKE_OPT}" == *"INTEL16=Y"* ]]; then
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DLEGACY_INTEL=ON"
elif [[ "${MACHINE_ID}" == "wcoss_cray" ]]; then
echo "In ccpp_build.sh: flag to cmake that wcoss_cray uses Intel 16"
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DLEGACY_INTEL=ON"
else
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DLEGACY_INTEL=OFF"
fi

# Flag to cmake that modern Intel compilers are used
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DLEGACY_INTEL=OFF"

# Generate additional CCPP cmake flags depending on machine / compiler
if [[ "${MACHINE_ID}" == "macosx.gnu" ]]; then
Expand Down
47 changes: 27 additions & 20 deletions cpl/module_cap_cpl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,15 @@ end subroutine realizeConnectedCplFields
!-----------------------------------------------------------------------------

subroutine Dump_cplFields(gcomp, importState, exportstate, clock_fv3, &
statewrite_flag, timeslice)
statewrite_flag, state_tag, timestr)

type(ESMF_GridComp), intent(in) :: gcomp
type(ESMF_State) :: importState, exportstate
type(ESMF_Clock),intent(in) :: clock_fv3
logical, intent(in) :: statewrite_flag
integer :: timeslice
character(len=*), intent(in) :: state_tag !< Import or export.
character(len=*), intent(in) :: timestr !< Import or export.
integer :: timeslice = 1
!
character(len=160) :: nuopcMsg
character(len=160) :: filename
Expand All @@ -229,34 +231,39 @@ subroutine Dump_cplFields(gcomp, importState, exportstate, clock_fv3, &
call ESMF_ClockPrint(clock_fv3, options="currTime", &
preString="leaving FV3_ADVANCE with clock_fv3 current: ", &
unit=nuopcMsg)
call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO)
! call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO)
call ESMF_ClockPrint(clock_fv3, options="startTime", &
preString="leaving FV3_ADVANCE with clock_fv3 start: ", &
unit=nuopcMsg)
call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO)
! call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO)
call ESMF_ClockPrint(clock_fv3, options="stopTime", &
preString="leaving FV3_ADVANCE with clock_fv3 stop: ", &
unit=nuopcMsg)
call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO)
! call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO)

! Dumping Fields out
if (statewrite_flag) then
timeslice = timeslice + 1
call ESMF_GridCompGet(gcomp, importState=importState, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
! replace with tiled field dumps
!call ESMFPP_RegridWriteState(importState, "fv3_cap_import_", timeslice, rc=rc)
write(filename,'(a,i6.6)') 'fv3_cap_import_',timeslice
call State_RWFields_tiles(importState,trim(filename), timeslice, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
call ESMF_GridCompGet(gcomp, exportState=exportState, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

! replace with tiled field dumps
!call ESMFPP_RegridWriteState(exportState, "fv3_cap_export_", timeslice, rc=rc)
write(filename,'(a,i6.6)') 'fv3_cap_export_',timeslice
call State_RWFields_tiles(exportState,trim(filename), timeslice, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
if(trim(state_tag) .eq. 'import')then
call ESMF_GridCompGet(gcomp, importState=importState, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
! replace with tiled field dumps
!call ESMFPP_RegridWriteState(importState, "fv3_cap_import_", timeslice, rc=rc)
write(filename,'(a,a,a)') 'fv3_cap_import_'//trim(timestr)//'_'
call State_RWFields_tiles(importState,trim(filename), timeslice, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
end if

if(trim(state_tag) .eq. 'export')then
call ESMF_GridCompGet(gcomp, exportState=exportState, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
! replace with tiled field dumps
!call ESMFPP_RegridWriteState(exportState, "fv3_cap_export_", timeslice, rc=rc)
write(filename,'(a,a,a)') 'fv3_cap_export_'//trim(timestr)//'_'
call State_RWFields_tiles(exportState,trim(filename), timeslice, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
end if

endif
!
end subroutine Dump_cplFields
Expand Down
4 changes: 2 additions & 2 deletions cpl/module_cplfields.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ module module_cplfields
"vegetation_type ", &
"inst_vegetation_area_frac ", &
"inst_surface_roughness ", &
"mean_zonal_moment_flx ", &
"mean_merid_moment_flx ", &
"mean_zonal_moment_flx_atm ", &
"mean_merid_moment_flx_atm ", &
"mean_sensi_heat_flx ", &
"mean_laten_heat_flx ", &
"mean_down_lw_flx ", &
Expand Down
17 changes: 14 additions & 3 deletions fv3_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
write_nemsioflip =.false.
write_fsyncflag =.false.

if(trim(output_grid) == 'gaussian_grid') then
if(trim(output_grid) == 'gaussian_grid' .or. trim(output_grid) == 'global_latlon') then
call ESMF_ConfigGetAttribute(config=CF, value=imo, label ='imo:',rc=rc)
call ESMF_ConfigGetAttribute(config=CF, value=jmo, label ='jmo:',rc=rc)
call ESMF_ConfigGetAttribute(config=CF, value=write_nemsioflip, label ='write_nemsioflip:',rc=rc)
Expand Down Expand Up @@ -703,7 +703,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
call ESMF_StateGet(wrtState(i), &
itemName="mirror_"//trim(fcstItemNameList(j)), &
fieldbundle=wrtFB(j,i), rc=rc)
if(mype == 0) print *,'af get wrtfb=',"mirror_"//trim(fcstItemNameList(j)),'rc=',rc
if(mype == 0) print *,'af get wrtfb=',"mirror_"//trim(fcstItemNameList(j)),' rc=',rc
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

! determine regridmethod
Expand Down Expand Up @@ -949,6 +949,7 @@ subroutine ModelAdvance(gcomp, rc)
logical :: isAlarmEnabled, isAlarmRinging, lalarm, reconcileFlag
character(len=*),parameter :: subname='(fv3_cap:ModelAdvance)'
character(240) :: msgString
character(240) :: import_timestr, export_timestr
!jw debug
character(ESMF_MAXSTR) :: name
integer :: mype,date(6), fieldcount, fcst_nfld
Expand Down Expand Up @@ -1026,6 +1027,10 @@ subroutine ModelAdvance(gcomp, rc)
m=date(5),s=date(6),rc=rc)
! if(mype==0) print *,'af clock,timestep date=',date
! if(mype==lead_wrttask(1)) print *,'on wrt lead,af clock,timestep date=',date
!
call ESMF_ClockGet(clock_fv3, currTime=currTime, timeStep=timeStep, rc=rc)
call ESMF_TimeGet(currTime, timestring=import_timestr, rc=rc)
call ESMF_TimeGet(currTime+timestep, timestring=export_timestr, rc=rc)
!
!-----------------------------------------------------------------------------
!*** integration loop
Expand All @@ -1048,6 +1053,12 @@ subroutine ModelAdvance(gcomp, rc)

if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__, rcToReturn=rc)) return

if ( cpl ) then
! assign import_data called during phase=1
call Dump_cplFields(gcomp, importState, exportstate, clock_fv3, &
cplprint_flag, 'import', import_timestr)
endif

call ESMF_GridCompRun(fcstComp, exportState=fcstState, clock=clock_fv3, &
phase=2, userRc=urc, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
Expand Down Expand Up @@ -1164,7 +1175,7 @@ subroutine ModelAdvance(gcomp, rc)
!jw for coupled, check clock and dump import and export state
if ( cpl ) then
call Dump_cplFields(gcomp, importState, exportstate, clock_fv3, &
cplprint_flag, timeslice)
cplprint_flag, 'export', export_timestr)
endif

if (mype==0) print *,'fv3_cap,end integrate,na=',na,' time=',mpi_wtime()- timeri
Expand Down
Loading

0 comments on commit bc9aa3b

Please sign in to comment.