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

gmtb/develop: update from master, MYJ PBL/SFC, Noah MP #320

Merged
merged 38 commits into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e48c99c
initial addition of CCPP metadata for NoahMP
grantfirl Aug 20, 2019
366378c
Merge branch 'fix_LSM_units' into noahmp
grantfirl Aug 20, 2019
6236796
put sfc_noahmp_drv.f in module; add init/finalize + meta file html br…
grantfirl Aug 20, 2019
747c5a4
fix soil_moisture_content unit error
grantfirl Aug 21, 2019
aa5aec7
add CCPP error variables to sfc_noahmp_drv.f and fix local name error…
grantfirl Aug 21, 2019
e5e6b78
add NoahMP interstitial code (only pre routine needed for GFS suite f…
grantfirl Aug 22, 2019
6c2cab8
send physical constants through the argument list
grantfirl Aug 23, 2019
24b8942
remove WRF error handling in favor of CCPP error handling
grantfirl Aug 24, 2019
1098500
pass errmsg and errflg down call chain
grantfirl Aug 24, 2019
dab6e6d
move NoahMP calculation of julian day and year length to GFS_time_var…
grantfirl Aug 26, 2019
869e874
add MYJ surface layer scheme and MYJ PBL scheme to CCPP
Qingfu-Liu Aug 27, 2019
2dc18d2
add MYJ surface layer scheme and PBL scheme to CCPP
Qingfu-Liu Aug 28, 2019
bb81114
add Julie as codeowner
grantfirl Aug 29, 2019
c7bc295
Merge pull request #312 from grantfirl/master
climbfuji Aug 29, 2019
d0af67a
add set_soilveg to noahmpdrv_init
grantfirl Aug 30, 2019
3e2f892
add calculation of sncovr to GFS_surface_generic_pre_run (not to init…
grantfirl Aug 30, 2019
78523cf
add calculation of sncovr to GFS_phys_time_vary_run (not to init beca…
grantfirl Sep 3, 2019
64f70df
Merge branch 'fix_sncovr' into noahmp
grantfirl Sep 3, 2019
6d04c51
Merge branch 'gmtb/develop' into noahmp
grantfirl Sep 3, 2019
af34508
fix GFS_time_vary_pre.fv3.F90 compilation error
grantfirl Sep 3, 2019
619afe0
add calculation of precipitation variables for NoahMP in GFS_MP_gener…
grantfirl Sep 4, 2019
de728a8
add resetting of sfcprop%t2m and q2m to values from noahmp if noahmp …
grantfirl Sep 5, 2019
775f4ff
(temporarily?) move calculation of precip rates for NoahMP to scheme-…
grantfirl Sep 6, 2019
856b6f1
Merge branch 'gmtb/develop' of https://github.com/NCAR/ccpp-physics i…
climbfuji Sep 9, 2019
a311364
Merge branch 'gmtb/develop' into noahmp
grantfirl Sep 10, 2019
e7bb31a
revert whitespace changes to GFS_MP_generic.F90
grantfirl Sep 10, 2019
69c215f
fix bug in metadata table for GFS_phys_time_vary_run for FV3
grantfirl Sep 12, 2019
48d27a6
Merge branch 'myj_from_qingfu' into HEAD
climbfuji Sep 13, 2019
822c647
Revert changes to physics/module_BL_MYJPBL.F90 physics/module_SF_JSFC…
climbfuji Sep 13, 2019
12c416a
Merge pull request #317 from climbfuji/master_update_from_gmtb_develo…
climbfuji Sep 13, 2019
248af59
Convert physics/module_MYJPBL_wrapper.F90 and physics/module_MYJSFC_w…
climbfuji Sep 13, 2019
e8bbc76
Merge branch 'noahmp' of https://github.com/grantfirl/ccpp-physics in…
climbfuji Sep 13, 2019
268f9a5
physics/GFS_time_vary_pre.fv3.F90: trim trailing whitespaces
climbfuji Sep 13, 2019
aadbcfd
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into my…
climbfuji Sep 13, 2019
26ed038
physics/GFS_phys_time_vary.fv3.F90: disable calculation of snocvr in …
climbfuji Sep 16, 2019
d98248a
CMakeLists.txt: compile ./physics/module_SF_JSFC.F90 ./physics/module…
climbfuji Sep 18, 2019
806de33
physics/module_BL_MYJPBL.F90, physics/module_SF_JSFC.F90, physics/mo…
climbfuji Sep 18, 2019
dceac20
physics/module_MYJPBL_wrapper.F90: use double precision floats, remov…
climbfuji Sep 18, 2019
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
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
SET_SOURCE_FILES_PROPERTIES(./physics/module_nst_water_prop.f90 PROPERTIES COMPILE_FLAGS "-ffree-line-length-none -fdefault-real-8 -ffree-form")
SET_SOURCE_FILES_PROPERTIES(./physics/aer_cloud.F ./physics/wv_saturation.F ./physics/cldwat2m_micro.F ./physics/surface_perturbation.F90 PROPERTIES COMPILE_FLAGS "-fdefault-real-8 -fdefault-double-8")
SET_SOURCE_FILES_PROPERTIES(./physics/module_mp_thompson_make_number_concentrations.F90 PROPERTIES COMPILE_FLAGS "-fdefault-real-8 -fdefault-double-8")

SET_SOURCE_FILES_PROPERTIES(./physics/module_SF_JSFC.F90 ./physics/module_BL_MYJPBL.F90 PROPERTIES COMPILE_FLAGS "-fdefault-real-8 -fdefault-double-8")
if (PROJECT STREQUAL "CCPP-FV3")
# Set 32-bit floating point precision flags for certain files
# that are executed in the dynamics (fast physics part)
Expand Down Expand Up @@ -167,6 +167,8 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
./physics/module_MYNNrad_pre.F90
./physics/module_MYNNrad_post.F90
./physics/module_mp_thompson_make_number_concentrations.F90
./physics/module_SF_JSFC.F90
./physics/module_BL_MYJPBL.F90
PROPERTIES COMPILE_FLAGS "-r8 -ftz")

# Replace -xHost or -xCORE-AVX2 with -xCORE-AVX-I for certain files
Expand Down Expand Up @@ -265,6 +267,8 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
SET_SOURCE_FILES_PROPERTIES(./physics/mersenne_twister.f PROPERTIES COMPILE_FLAGS "-r8 -ftz")
SET_SOURCE_FILES_PROPERTIES(./physics/module_nst_water_prop.f90 PROPERTIES COMPILE_FLAGS "-extend-source 132 -r8 -free")
SET_SOURCE_FILES_PROPERTIES(./physics/aer_cloud.F ./physics/wv_saturation.F ./physics/cldwat2m_micro.F ./physics/surface_perturbation.F90 PROPERTIES COMPILE_FLAGS "-r8")
SET_SOURCE_FILES_PROPERTIES(./physics/module_mp_thompson_make_number_concentrations.F90 PROPERTIES COMPILE_FLAGS "-r8")
SET_SOURCE_FILES_PROPERTIES(./physics/module_SF_JSFC.F90 ./physics/module_BL_MYJPBL.F90 PROPERTIES COMPILE_FLAGS "-r8")
endif (PROJECT STREQUAL "CCPP-FV3")
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI")
SET_SOURCE_FILES_PROPERTIES(./physics/module_bfmicrophysics.f ./physics/sflx.f ./physics/sfc_diff.f ./physics/sfc_diag.f PROPERTIES COMPILE_FLAGS -r8)
Expand All @@ -273,6 +277,7 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI")
SET_SOURCE_FILES_PROPERTIES(./physics/module_nst_water_prop.f90 PROPERTIES COMPILE_FLAGS "-r8 -Mfree")
SET_SOURCE_FILES_PROPERTIES(./physics/aer_cloud.F ./physics/wv_saturation.F ./physics/cldwat2m_micro.F ./physics/surface_perturbation.F90 PROPERTIES COMPILE_FLAGS "-r8")
SET_SOURCE_FILES_PROPERTIES(./physics/module_mp_thompson_make_number_concentrations.F90 PROPERTIES COMPILE_FLAGS "-r8")
SET_SOURCE_FILES_PROPERTIES(./physics/module_SF_JSFC.F90 ./physics/module_BL_MYJPBL.F90 PROPERTIES COMPILE_FLAGS "-r8")
if (PROJECT STREQUAL "CCPP-FV3")
# Set 32-bit floating point precision flags for certain files
# that are executed in the dynamics (fast physics part)
Expand Down
39 changes: 35 additions & 4 deletions physics/GFS_phys_time_vary.fv3.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ module GFS_phys_time_vary
use iccn_def, only : ciplin, ccnin, ci_pres
use iccninterp, only : read_cidata, setindxci, ciinterpol

#if 0
!--- variables needed for calculating 'sncovr'
use namelist_soilveg, only: salp_data, snupx
#endif

implicit none

private
Expand Down Expand Up @@ -318,7 +323,7 @@ end subroutine GFS_phys_time_vary_finalize
!!
!>\section gen_GFS_phys_time_vary_run GFS_phys_time_vary_run General Algorithm
!> @{
subroutine GFS_phys_time_vary_run (Data, Model, nthrds, errmsg, errflg)
subroutine GFS_phys_time_vary_run (Data, Model, nthrds, first_time_step, errmsg, errflg)

use mersenne_twister, only: random_setseed, random_number
use machine, only: kind_phys
Expand All @@ -327,9 +332,10 @@ subroutine GFS_phys_time_vary_run (Data, Model, nthrds, errmsg, errflg)
implicit none

! Interface variables
type(GFS_data_type), intent(in) :: Data(:)
type(GFS_data_type), intent(inout) :: Data(:)
type(GFS_control_type), intent(inout) :: Model
integer, intent(in) :: nthrds
logical, intent(in) :: first_time_step
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

Expand All @@ -338,8 +344,8 @@ subroutine GFS_phys_time_vary_run (Data, Model, nthrds, errmsg, errflg)
real(kind=kind_phys), parameter :: con_99 = 99.0_kind_phys
real(kind=kind_phys), parameter :: con_100 = 100.0_kind_phys

integer :: i, j, k, iseed, iskip, ix, nb, nblks, kdt_rad
real(kind=kind_phys) :: sec_zero
integer :: i, j, k, iseed, iskip, ix, nb, nblks, kdt_rad, vegtyp
real(kind=kind_phys) :: sec_zero, rsnow
real(kind=kind_phys) :: wrk(1)
real(kind=kind_phys) :: rannie(Model%cny)
real(kind=kind_phys) :: rndval(Model%cnx*Model%cny*Model%nrcm)
Expand Down Expand Up @@ -493,6 +499,31 @@ subroutine GFS_phys_time_vary_run (Data, Model, nthrds, errmsg, errflg)
endif
endif

#if 0
!Calculate sncovr if it was read in but empty (from FV3/io/FV3GFS_io.F90/sfc_prop_restart_read)
if (first_time_step) then
if (nint(Data(1)%Sfcprop%sncovr(1)) == -9999) then
!--- compute sncovr from existing variables
!--- code taken directly from read_fix.f
do nb = 1, nblks
do ix = 1, Model%blksz(nb)
Data(nb)%Sfcprop%sncovr(ix) = 0.0
if (Data(nb)%Sfcprop%slmsk(ix) > 0.001) then
vegtyp = Data(nb)%Sfcprop%vtype(ix)
if (vegtyp == 0) vegtyp = 7
rsnow = 0.001*Data(nb)%Sfcprop%weasd(ix)/snupx(vegtyp)
if (0.001*Data(nb)%Sfcprop%weasd(ix) < snupx(vegtyp)) then
Data(nb)%Sfcprop%sncovr(ix) = 1.0 - (exp(-salp_data*rsnow) - rsnow*exp(-salp_data))
else
Data(nb)%Sfcprop%sncovr(ix) = 1.0
endif
endif
enddo
enddo
endif
endif
#endif

end subroutine GFS_phys_time_vary_run
!> @}

Expand Down
8 changes: 8 additions & 0 deletions physics/GFS_phys_time_vary.fv3.meta
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@
type = integer
intent = in
optional = F
[first_time_step]
standard_name = flag_for_first_time_step
long_name = flag for first time step for time integration loop (cold/warmstart)
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down
121 changes: 89 additions & 32 deletions physics/GFS_time_vary_pre.fv3.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ subroutine GFS_time_vary_pre_init (errmsg, errflg)
errflg = 0

if (is_initialized) return

!--- Call gfuncphys (funcphys.f) to compute all physics function tables.
call gfuncphys ()

Expand Down Expand Up @@ -65,68 +65,125 @@ end subroutine GFS_time_vary_pre_finalize
!> \section arg_table_GFS_time_vary_pre_run Argument Table
!! \htmlinclude GFS_time_vary_pre_run.html
!!
subroutine GFS_time_vary_pre_run (Model, errmsg, errflg)
subroutine GFS_time_vary_pre_run (jdat, idat, dtp, lsm, lsm_noahmp, nsswr, &
nslwr, idate, debug, me, master, nscyc, sec, phour, zhour, fhour, kdt, &
julian, yearlen, ipt, lprnt, lssav, lsswr, lslwr, solhr, errmsg, errflg)

use machine, only: kind_phys
use GFS_typedefs, only: GFS_control_type

implicit none

type(GFS_control_type), intent(inout) :: Model
integer, intent(in) :: idate(4)
integer, intent(in) :: jdat(1:8), idat(1:8)
integer, intent(in) :: lsm, lsm_noahmp, &
nsswr, nslwr, me, &
master, nscyc
logical, intent(in) :: debug
real(kind=kind_phys), intent(in) :: dtp

integer, intent(out) :: kdt, yearlen, ipt
logical, intent(out) :: lprnt, lssav, lsswr, &
lslwr
real(kind=kind_phys), intent(out) :: sec, phour, zhour, &
fhour, julian, solhr

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

real(kind=kind_phys), parameter :: con_24 = 24.0_kind_phys
real(kind=kind_phys), parameter :: con_hr = 3600.0_kind_phys
real(kind=kind_phys) :: rinc(5)

integer :: iw3jdn
integer :: jd0, jd1
real :: fjd

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

! Check initialization status
if (.not.is_initialized) then
write(errmsg,'(*(a))') "Logic error: GFS_time_vary_pre_run called before GFS_time_vary_pre_init"
write(errmsg,'(*(a))') "Logic error: GFS_time_vary_pre_run called &
&before GFS_time_vary_pre_init"
errflg = 1
return
end if

!--- Model%jdat is being updated directly inside of FV3GFS_cap.F90
!--- jdat is being updated directly inside of FV3GFS_cap.F90
!--- update calendars and triggers
rinc(1:5) = 0
call w3difdat(Model%jdat,Model%idat,4,rinc)
Model%sec = rinc(4)
Model%phour = Model%sec/con_hr
call w3difdat(jdat,idat,4,rinc)
sec = rinc(4)
phour = sec/con_hr
!--- set current bucket hour
Model%zhour = Model%phour
Model%fhour = (Model%sec + Model%dtp)/con_hr
Model%kdt = nint((Model%sec + Model%dtp)/Model%dtp)
zhour = phour
fhour = (sec + dtp)/con_hr
kdt = nint((sec + dtp)/dtp)

if(lsm == lsm_noahmp) then
!GJF* These calculations were originally in GFS_physics_driver.F90 for
! NoahMP. They were moved to this routine since they only depend
! on time (not space). Note that this code is included as-is from
! GFS_physics_driver.F90, but it may be simplified by using more
! NCEP W3 library calls (e.g., see W3DOXDAT, W3FS13 for Julian day
! of year and W3DIFDAT to determine the integer number of days in
! a given year). *GJF
! Julian day calculation (fcst day of the year)
! we need yearln and julian to
! pass to noah mp sflx, idate is init, jdat is fcst;idate = jdat when kdt=1
! jdat is changing
!

jd1 = iw3jdn(jdat(1),jdat(2),jdat(3))
jd0 = iw3jdn(jdat(1),1,1)
fjd = float(jdat(5))/24.0 + float(jdat(6))/1440.0

julian = float(jd1-jd0) + fjd

!
! Year length
!
! what if the integration goes from one year to another?
! iyr or jyr ? from 365 to 366 or from 366 to 365
!
! is this against model's noleap yr assumption?
if (mod(jdat(1),4) == 0) then
yearlen = 366
if (mod(jdat(1),100) == 0) then
yearlen = 365
if (mod(jdat(1),400) == 0) then
yearlen = 366
endif
endif
endif
endif

Model%ipt = 1
Model%lprnt = .false.
Model%lssav = .true.
ipt = 1
lprnt = .false.
lssav = .true.

!--- radiation triggers
Model%lsswr = (mod(Model%kdt, Model%nsswr) == 1)
Model%lslwr = (mod(Model%kdt, Model%nslwr) == 1)
lsswr = (mod(kdt, nsswr) == 1)
lslwr = (mod(kdt, nslwr) == 1)
!--- allow for radiation to be called on every physics time step, if needed
if (Model%nsswr == 1) Model%lsswr = .true.
if (Model%nslwr == 1) Model%lslwr = .true.
if (nsswr == 1) lsswr = .true.
if (nslwr == 1) lslwr = .true.

!--- set the solar hour based on a combination of phour and time initial hour
Model%solhr = mod(Model%phour+Model%idate(1),con_24)

if ((Model%debug) .and. (Model%me == Model%master)) then
print *,' sec ', Model%sec
print *,' kdt ', Model%kdt
print *,' nsswr ', Model%nsswr
print *,' nslwr ', Model%nslwr
print *,' nscyc ', Model%nscyc
print *,' lsswr ', Model%lsswr
print *,' lslwr ', Model%lslwr
print *,' fhour ', Model%fhour
print *,' phour ', Model%phour
print *,' solhr ', Model%solhr
solhr = mod(phour+idate(1),con_24)

if ((debug) .and. (me == master)) then
print *,' sec ', sec
print *,' kdt ', kdt
print *,' nsswr ', nsswr
print *,' nslwr ', nslwr
print *,' nscyc ', nscyc
print *,' lsswr ', lsswr
print *,' lslwr ', lslwr
print *,' fhour ', fhour
print *,' phour ', phour
print *,' solhr ', solhr
endif

end subroutine GFS_time_vary_pre_run
Expand Down
Loading