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

CAPS physics modifications and update to trunk #1

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
97972e4
Reduce debugging output from RUC and Thompson
climbfuji Nov 10, 2018
fe0f7d8
From Haiqin: update of physics/cu_gf_driver.F90, run shallow convecti…
climbfuji Nov 12, 2018
633520f
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into su…
climbfuji Nov 14, 2018
84d9b11
updating MYNN to top of trunk (RAP/HRRR repo) and adding mixing of qn…
joeolson42 Nov 14, 2018
4487a6c
Merge branch 'mynn' of https://github.com/joeolson42/ccpp-physics int…
climbfuji Nov 14, 2018
348b9f1
Merge branch 'ccpp-physics_ccpp_github_merge_in_latest_changes_of_mas…
climbfuji Nov 17, 2018
a92ae65
Merge branch 'dynamics-real4-dom' of https://github.com/climbfuji/ccp…
climbfuji Nov 17, 2018
8ab971d
Merge branch 'ccpp-physics_ccpp_github_merge_in_latest_changes_of_mas…
climbfuji Nov 17, 2018
57184b3
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into su…
climbfuji Nov 19, 2018
f756e97
physics/GFS_MP_generic.F90 and physics/mp_thompson_hrrr.F90: fix use …
climbfuji Nov 20, 2018
443c1bc
Update of RUC LSM from Tanya
climbfuji Nov 20, 2018
bec6a9c
physics/GFS_MP_generic.F90 and physics/sfc_drv_ruc.F90: changes to pr…
climbfuji Nov 20, 2018
bafc87e
physics/GFS_MP_generic.F90: save precipitation quantities from this t…
climbfuji Nov 20, 2018
4b2426a
physics/sfc_drv_ruc.F90: use precipitation quantities from previous t…
climbfuji Nov 20, 2018
48b1738
Fix feedback of cloud effective radii from Thompson MP to radiation, …
climbfuji Nov 21, 2018
fb4cb35
Reduce debug prints from RUC LSM and Thompson MP
climbfuji Nov 21, 2018
8d92c12
physics/mp_thompson_hrrr_pre.F90: add switch to use old (pre WRFv4) s…
climbfuji Nov 24, 2018
c82ef19
Updating physics/cu_gf_deep.F90 and physics/cu_gf_driver.F90 with lat…
climbfuji Nov 26, 2018
581a452
physics/GFS_MP_generic.F90: calculate srflag for Thompson MP in the s…
climbfuji Nov 26, 2018
3d9322d
Updating physics/module_MYNNPBL_wrapper.F90 and physics/module_bl_myn…
climbfuji Nov 26, 2018
d3a3d18
Updating physics/sfc_drv_ruc.F90 with latest changes from Tanya
climbfuji Nov 26, 2018
a32fa04
Updating physics/module_sf_mynn.F90 and physics/module_MYNNSFC_wrappe…
climbfuji Nov 26, 2018
0d6d65c
MYNN/RUC/GF: bugfixes, scale specific humdity and moist mixing ratios…
climbfuji Nov 27, 2018
9408757
physics/mp_thompson_hrrr_pre.F90: set nwfa surface emissions to zero
climbfuji Nov 27, 2018
2b5b261
physics/mp_thompson_hrrr_pre.F90: make WRFv3.8 CCN surface emission r…
climbfuji Nov 29, 2018
8b83982
physics/module_bl_mynn.F90: from Joe Olson, increase diffusion and ot…
climbfuji Nov 30, 2018
b68bf07
physics/cu_gf_driver.F90: bugfix, remove hard-coded switch to always …
climbfuji Dec 1, 2018
541fd8f
CMakeLists.txt: lowering flags for radiation_aerosols.f on jet
climbfuji Dec 20, 2018
cf2aa95
physics/module_MYNNPBL_wrapper.F90: correct/add intent information fo…
climbfuji Dec 20, 2018
74c0899
physics/module_MYNNrad_pre.F90: improved handling of subgrid clouds (…
climbfuji Dec 20, 2018
511a68c
physics/module_bl_mynn.F90: improvements from Joe Olson, bugfix for u…
climbfuji Dec 20, 2018
95aeb7c
physics/module_mp_thompson_hrrr.F90: add guard (temporary) for using …
climbfuji Dec 20, 2018
2936eeb
physics/mp_thompson_hrrr_post.F90: use namelist-provided global tempe…
climbfuji Dec 20, 2018
328e881
physics/radiation_clouds.f: bugfix, use correct effective radius for …
climbfuji Dec 20, 2018
bef3a02
physics/sfc_drv_ruc.F90: bugfixes for debug print statements, modific…
climbfuji Dec 20, 2018
52004f2
physics/GFS_debug.F90: do not use Adle checksum calculation on MacOSX…
climbfuji Dec 20, 2018
5452fed
physics/cu_gf_driver_pre.F90: handle initialization for coldstarts an…
climbfuji Dec 22, 2018
f6b48fd
physics/module_MYNNPBL_wrapper.F90: handle initialization for coldsta…
climbfuji Dec 22, 2018
f0d69e4
physics/module_MYNNSFC_wrapper.F90: handle initialization for coldsta…
climbfuji Dec 22, 2018
3730c7b
physics/module_sf_ruclsm.F90: handle initialization for coldstarts an…
climbfuji Dec 22, 2018
60c12f6
physics/sfc_drv_ruc.F90: handle initialization for coldstarts and war…
climbfuji Dec 22, 2018
3f5481f
physics/module_sf_ruclsm.F90: run internal init only for cold starts
climbfuji Dec 27, 2018
2aa6642
physics/sfc_drv_ruc.F90: correct intent for sfcdew in metadata table,…
climbfuji Dec 27, 2018
1d5ce7d
physics/GFS_debug.F90: add missing components to debug output
climbfuji Dec 27, 2018
8eca532
physics/GFS_debug.F90: add complete output of Diag DDT
climbfuji Dec 28, 2018
a076c60
physics/module_MYNNPBL_wrapper.F90: pass flag for restart runs to sub…
climbfuji Dec 28, 2018
50a6b34
physics/module_bl_mynn.F90: for restart runs, initialize only arrays …
climbfuji Dec 28, 2018
65bbc03
physics/GFS_phys_time_vary.fv3.F90, physics/GFS_phys_time_vary.scm.F9…
climbfuji Jan 23, 2019
a91ece2
physics/machine.F: add metadata table describing the kind types kind_…
climbfuji Jan 23, 2019
d716eff
physics/GFS_debug.F90: bugfix for gfortran compiler, cleanup of argum…
climbfuji Jan 23, 2019
b87ee01
Merge branch 'no-cdata-for-static-build' of https://github.com/climbf…
climbfuji Jan 23, 2019
ce9b175
physics/module_gfdl_cloud_microphys.F90: rename CPP directive for tra…
climbfuji Jan 25, 2019
90454ea
CMakeLists.txt: workaround for PGI compiler only required for dynamic…
climbfuji Jan 25, 2019
8adbe31
physics/GFS_DCNV_generic.F90: bugfix, use assumed-shape arrays for ar…
climbfuji Jan 25, 2019
d33aac2
physics/GFS_PBL_generic.F90: bugfix, use assumed-shape arrays for arg…
climbfuji Jan 25, 2019
79482cb
physics/samfshalcnv.f: bugfix, use assumed-shape arrays for arguments…
climbfuji Jan 25, 2019
b3ef924
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into no…
climbfuji Jan 25, 2019
8c4574c
physics/GFS_debug.F90: output individual components of Diag%fluxr
climbfuji Jan 25, 2019
86211a6
physics/mp_thompson_hrrr_pre.F90: change standard name block_number t…
climbfuji Jan 25, 2019
94fa507
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into su…
climbfuji Jan 25, 2019
675cac8
Merge branch 'no-cdata-for-static-build' of https://github.com/climbf…
climbfuji Jan 25, 2019
590be33
Merge pull request #198 from climbfuji/no-cdata-for-static-build
climbfuji Jan 28, 2019
b8c7e58
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into su…
climbfuji Jan 29, 2019
42126ae
physics/GFS_debug.F90: add blkno to GFS_abort argument list, fix meta…
climbfuji Jan 29, 2019
6c0115c
physics/sfc_drv_ruc.F90: fix invalid intents ('none'), adjust formatt…
climbfuji Jan 30, 2019
2c2c28e
CMakeLists.txt: for CCPP acceptance, reduce optimization for sflx.f (…
climbfuji Jan 30, 2019
911820f
physics/GFS_debug.F90: don't print RUC-specific variables when not us…
climbfuji Jan 30, 2019
34bc5c5
Merge pull request #200 from climbfuji/suite_fv3_gsd_test
climbfuji Jan 31, 2019
0d4d083
physics/sfc_nst.f: bugfix of wrong metadata table names and leading d…
climbfuji Feb 1, 2019
ba81da9
physics/GFS_phys_time_vary.fv3.F90: performance improvement for rando…
climbfuji Feb 1, 2019
8755e2f
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into fi…
climbfuji Feb 1, 2019
c1face9
physics/GFS_phys_time_vary.fv3.F90: bugfix, need to calculate imap an…
climbfuji Feb 1, 2019
27651ca
physics/GFS_rad_time_vary.fv3.F90: performance improvement for random…
climbfuji Feb 1, 2019
4ba1500
CMakeLists.txt: reduce optimization flags for satmedmfvdif.F as requi…
climbfuji Feb 3, 2019
ce87562
Add missing name to 'end subroutine' label
climbfuji Feb 3, 2019
16e23b7
Merge pull request #202 from climbfuji/fix_metadata_tables_and_thread…
climbfuji Feb 4, 2019
729f243
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into sa…
climbfuji Feb 4, 2019
ea61fa3
Merge pull request #203 from climbfuji/satmedmf_bitforbit_prod
climbfuji Feb 4, 2019
5e180cf
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into ca…
climbfuji Feb 5, 2019
5a6dfc1
physics/cu_ntiedtke.F90: add reminder to replace imported constants w…
climbfuji Feb 7, 2019
cd045f4
physics/m_micro_interstitial.F90: remove unused arguments imfdeepcnv …
climbfuji Feb 7, 2019
819d23b
Add physics/cu_ntiedtke_pre.F90 and physics/cu_ntiedtke_post.F90, sim…
climbfuji Feb 7, 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
63 changes: 51 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
string(REPLACE "-xCORE-AVX2" "-xCORE-AVX-I"
CMAKE_Fortran_FLAGS_LOPT
"${CMAKE_Fortran_FLAGS_LOPT}")
string(REPLACE "-axSSE4.2,AVX,CORE-AVX2" "-axSSE4.2,AVX,CORE-AVX-I"
CMAKE_Fortran_FLAGS_LOPT
"${CMAKE_Fortran_FLAGS_LOPT}")
SET_SOURCE_FILES_PROPERTIES(./physics/radiation_aerosols.f
PROPERTIES COMPILE_FLAGS "${CMAKE_Fortran_FLAGS_LOPT} -r8 -ftz")
# Force consistent results of math calculations for MG microphysics;
Expand All @@ -175,6 +178,39 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
SET_SOURCE_FILES_PROPERTIES(./physics/gfdl_fv_sat_adj.F90
PROPERTIES COMPILE_FLAGS "${CMAKE_Fortran_FLAGS_OPT32BIT}")
endif (DYN32)

# For CCPP acceptance: selective reduction of optimization flags, hopefully
# to be removed once established that this is not a reasonable approach.
if (TRANSITION)
# Replace "CORE-AVX2" with "CORE-AVX-I"
set(CMAKE_Fortran_FLAGS_LOPT ${CMAKE_Fortran_FLAGS})
string(REPLACE "-xCORE-AVX2" "-xCORE-AVX-I"
CMAKE_Fortran_FLAGS_LOPT
"${CMAKE_Fortran_FLAGS_LOPT}")
string(REPLACE "-axSSE4.2,AVX,CORE-AVX2" "-axSSE4.2,AVX,CORE-AVX-I"
CMAKE_Fortran_FLAGS_LOPT
"${CMAKE_Fortran_FLAGS_LOPT}")
SET_SOURCE_FILES_PROPERTIES(./physics/sflx.f
PROPERTIES COMPILE_FLAGS "${CMAKE_Fortran_FLAGS_LOPT}")
# Replace "-no-prec-div -no-prec-sqrt" with "-prec-div -prec-sqrt",
# replace "CORE-AVX2" with "CORE-AVX-I"
set(CMAKE_Fortran_FLAGS_LOPT2 ${CMAKE_Fortran_FLAGS})
string(REPLACE "-no-prec-div" "-prec-div"
CMAKE_Fortran_FLAGS_LOPT2
"${CMAKE_Fortran_FLAGS_LOPT2}")
string(REPLACE "-no-prec-sqrt" "-prec-sqrt"
CMAKE_Fortran_FLAGS_LOPT2
"${CMAKE_Fortran_FLAGS_LOPT2}")
string(REPLACE "-xCORE-AVX2" "-xCORE-AVX-I"
CMAKE_Fortran_FLAGS_LOPT2
"${CMAKE_Fortran_FLAGS_LOPT2}")
string(REPLACE "-axSSE4.2,AVX,CORE-AVX2" "-axSSE4.2,AVX,CORE-AVX-I"
CMAKE_Fortran_FLAGS_LOPT2
"${CMAKE_Fortran_FLAGS_LOPT2}")
SET_SOURCE_FILES_PROPERTIES(./physics/satmedmfvdif.F
PROPERTIES COMPILE_FLAGS "${CMAKE_Fortran_FLAGS_LOPT2}")
endif (TRANSITION)

else (PROJECT STREQUAL "CCPP-FV3")
SET_SOURCE_FILES_PROPERTIES(./physics/module_bfmicrophysics.f ./physics/rascnvv2.f ./physics/sflx.f ./physics/sfc_diff.f ./physics/sfc_diag.f PROPERTIES COMPILE_FLAGS -r8)
SET_SOURCE_FILES_PROPERTIES(./physics/module_nst_model.f90 ./physics/calpreciptype.f90 PROPERTIES COMPILE_FLAGS "-r8 -free")
Expand Down Expand Up @@ -263,19 +299,22 @@ set_target_properties(ccppphys PROPERTIES VERSION ${PROJECT_VERSION}
COMPILE_FLAGS "${CMAKE_Fortran_FLAGS}"
LINK_FLAGS "${CMAKE_Fortran_FLAGS}")

# DH* hack for PGI compiler: rename objects in scheme cap object files for ISO_C compliancy
# DH* Hack for PGI compiler: rename objects in scheme cap object files for ISO_C compliancy,
# this is only needed for dynamics builds - static build generates plain Fortran code.
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI")
set(CAPOBJS)
foreach(cap ${CAPS})
string(REPLACE "_cap.F90" "_cap.F90.o" capobj "./${CMAKE_FILES_DIRECTORY}/ccppphys.dir/${cap}")
list(APPEND CAPOBJS ${capobj})
endforeach(cap)

add_custom_command(TARGET ccppphys
PRE_LINK
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pgifix.py --cmake ${CAPOBJS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running pgifix_wrapper.py over all scheme caps")
if (NOT STATIC)
set(CAPOBJS)
foreach(cap ${CAPS})
string(REPLACE "_cap.F90" "_cap.F90.o" capobj "./${CMAKE_FILES_DIRECTORY}/ccppphys.dir/${cap}")
list(APPEND CAPOBJS ${capobj})
endforeach(cap)

add_custom_command(TARGET ccppphys
PRE_LINK
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pgifix.py --cmake ${CAPOBJS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running pgifix_wrapper.py over all scheme caps")
endif (NOT STATIC)
endif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI")
# *DH end hack for PGI compiler

Expand Down
8 changes: 7 additions & 1 deletion physics/GFS_DCNV_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,13 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cs
real(kind=kind_phys), dimension(:,:), intent(inout) :: upd_mf, dwn_mf, det_mf
! dqdti, cnvqci, upd_mfi, dwn_mfi, det_mfi only allocated if ldiag3d == .true. or lgocart == .true.
real(kind=kind_phys), dimension(:,:), intent(inout) :: dqdti, cnvqci, upd_mfi, dwn_mfi, det_mfi
real(kind=kind_phys), dimension(im,levs), intent(inout) :: cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d
real(kind=kind_phys), dimension(im,levs), intent(inout) :: cnvw, cnvc
! DH* The following arrays may not be allocated, depending on certain flags and microphysics schemes.
! Since Intel 15 crashes when passing unallocated arrays to arrays defined with explicit shape,
! use assumed-shape arrays. Note that Intel 18 and GNU 6.2.0-8.1.0 tolerate explicit-shape arrays
! as long as these do not get used when not allocated (it is still invalid Fortran code, though).
real(kind=kind_phys), dimension(:,:), intent(inout) :: cnvw_phy_f3d, cnvc_phy_f3d
! *DH

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
Expand Down
54 changes: 44 additions & 10 deletions physics/GFS_MP_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ end subroutine GFS_MP_generic_post_init
!! | ntrac | number_of_tracers | number of tracers | count | 0 | integer | | in | F |
!! | imp_physics | flag_for_microphysics_scheme | choice of microphysics scheme | flag | 0 | integer | | in | F |
!! | imp_physics_gfdl | flag_for_gfdl_microphysics_scheme | choice of GFDL microphysics scheme | flag | 0 | integer | | in | F |
!! | imp_physics_thompson | flag_for_thompson_microphysics_scheme | choice of Thompson microphysics scheme | flag | 0 | integer | | in | F |
!! | cal_pre | flag_for_precipitation_type_algorithm | flag controls precip type algorithm | flag | 0 | logical | | in | F |
!! | lssav | flag_diagnostics | logical flag for storing diagnostics | flag | 0 | logical | | in | F |
!! | ldiag3d | flag_diagnostics_3D | flag for 3d diagnostic fields | flag | 0 | logical | | in | F |
Expand Down Expand Up @@ -158,23 +159,31 @@ end subroutine GFS_MP_generic_post_init
!! | dtdtc | tendency_of_air_temperature_due_to_radiative_heating_assuming_clear_sky | clear sky radiative (shortwave + longwave) heating rate at current time | K s-1 | 2 | real | kind_phys | in | F |
!! | drain_cpl | tendency_of_lwe_thickness_of_precipitation_amount_for_coupling | change in rain_cpl (coupling_type) | m | 1 | real | kind_phys | inout | F |
!! | dsnow_cpl | tendency_of_lwe_thickness_of_snow_amount_for_coupling | change in show_cpl (coupling_type) | m | 1 | real | kind_phys | inout | F |
!! | lsm | flag_for_land_surface_scheme | flag for land surface model | flag | 0 | integer | | in | F |
!! | lsm_ruc | flag_for_ruc_land_surface_scheme | flag for RUC land surface model | flag | 0 | integer | | in | F |
!! | raincprv | lwe_thickness_of_explicit_rainfall_amount_from_previous_timestep | explicit rainfall from previous timestep | m | 1 | real | kind_phys | inout | F |
!! | rainncprv | lwe_thickness_of_convective_precipitation_amount_from_previous_timestep | convective_precipitation_amount from previous timestep | m | 1 | real | kind_phys | inout | F |
!! | iceprv | lwe_thickness_of_ice_amount_from_previous_timestep | ice amount from previous timestep | m | 1 | real | kind_phys | inout | F |
!! | snowprv | lwe_thickness_of_snow_amount_from_previous_timestep | snow amount from previous timestep | m | 1 | real | kind_phys | inout | F |
!! | graupelprv | lwe_thickness_of_graupel_amount_from_previous_timestep | graupel amount from previous timestep | m | 1 | real | kind_phys | inout | F |
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
!> \section gfs_mp_gen GFS MP Generic Post General Algorithm
!! @{
subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac, imp_physics, imp_physics_gfdl, &
cal_pre, lssav, ldiag3d, cplflx, cplchm, con_g, dtf, frain, rainc, rain1, rann, xlat, xlon, gt0, gq0, &
prsl, prsi, phii, tsfc, ice, snow, graupel, save_t, save_qv, ice0, snow0, graupel0, del, &
imp_physics_thompson, cal_pre, lssav, ldiag3d, cplflx, cplchm, con_g, dtf, frain, rainc, rain1, rann, xlat, xlon, &
gt0, gq0, prsl, prsi, phii, tsfc, ice, snow, graupel, save_t, save_qv, ice0, snow0, graupel0, del, &
rain, domr_diag, domzr_diag, domip_diag, doms_diag, tprcp, srflag, totprcp, totice, totsnw, &
totgrp, totprcpb, toticeb, totsnwb, totgrpb, dt3dt, dq3dt, rain_cpl, rainc_cpl, snow_cpl, pwat, &
do_sppt, dtdtr, dtdtc, drain_cpl, dsnow_cpl, errmsg, errflg)
do_sppt, dtdtr, dtdtc, drain_cpl, dsnow_cpl, lsm, lsm_ruc, raincprv, rainncprv, iceprv, snowprv, graupelprv, &
errmsg, errflg)
!
use machine, only: kind_phys
use machine, only: kind_phys

implicit none

integer, intent(in) :: im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac, imp_physics, imp_physics_gfdl
integer, intent(in) :: im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac, imp_physics, imp_physics_gfdl, imp_physics_thompson
logical, intent(in) :: cal_pre, lssav, ldiag3d, cplflx, cplchm

real(kind=kind_phys), intent(in) :: dtf, frain, con_g
Expand All @@ -197,6 +206,14 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
real(kind=kind_phys), dimension(im), intent(inout) :: drain_cpl
real(kind=kind_phys), dimension(im), intent(inout) :: dsnow_cpl

! Rainfall variables previous time step (update for RUC LSM)
integer, intent(in) :: lsm, lsm_ruc
real(kind=kind_phys), dimension(im), intent(inout) :: raincprv
real(kind=kind_phys), dimension(im), intent(inout) :: rainncprv
real(kind=kind_phys), dimension(im), intent(inout) :: iceprv
real(kind=kind_phys), dimension(im), intent(inout) :: snowprv
real(kind=kind_phys), dimension(im), intent(inout) :: graupelprv

! CCPP error handling
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
Expand All @@ -214,7 +231,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
onebg = 1.0d0/con_g

do i = 1, im
rain(i) = rainc(i) + frain * rain1(i)
rain(i) = rainc(i) + frain * rain1(i) ! time-step convective plus explicit
enddo

!> - If requested (e.g. Zhao-Carr MP scheme), call calpreciptype() to calculate dominant
Expand All @@ -226,12 +243,29 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
! physics timestep, while Diag%{rain,rainc} and all totprecip etc
! are on the dynamics timestep. Totally confusing and wrong. *DH
if (imp_physics == imp_physics_gfdl) then
tprcp = max(0., rain) ! clu: rain -> tprcp
!graupel = frain*graupel0
!ice = frain*ice0
!snow = frain*snow0
graupel = graupel0
ice = ice0
snow = snow0
! Do it right from the beginning for Thompson
else if (imp_physics == imp_physics_thompson) then
tprcp = max (0.,rainc + frain * rain1) ! time-step convective and explicit precip
graupel = frain*graupel0 ! time-step graupel
ice = frain*ice0 ! time-step ice
snow = frain*snow0 ! time-step snow
end if

if (lsm==lsm_ruc) then
if (imp_physics == imp_physics_gfdl .or. imp_physics == imp_physics_thompson) then
raincprv(:) = rainc(:)
rainncprv(:) = frain * rain1(:)
iceprv(:) = ice(:)
snowprv(:) = snow(:)
graupelprv(:) = graupel(:)
end if
end if

if (cal_pre) then ! hchuang: add dominant precipitation type algorithm
Expand All @@ -252,7 +286,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
! end do
! HCHUANG: use new precipitation type to decide snow flag for LSM snow accumulation

if (imp_physics /= imp_physics_gfdl) then
if (imp_physics /= imp_physics_gfdl .and. imp_physics /= imp_physics_thompson) then
do i=1,im
tprcp(i) = max(0.0, rain(i) )
if(doms(i) > 0.0 .or. domip(i) > 0.0) then
Expand Down Expand Up @@ -309,15 +343,15 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
enddo
enddo

!> - For GFDL cloud MP scheme, determine convective snow by surface temperature;
!> - For GFDL and Thompson MP scheme, determine convective snow by surface temperature;
!! and determine explicit rain/snow by snow/ice/graupel coming out directly from MP
!! and convective rainfall from the cumulus scheme if the surface temperature is below
!! \f$0^oC\f$.
if (imp_physics == imp_physics_gfdl) then
if (imp_physics == imp_physics_gfdl .or. imp_physics == imp_physics_thompson) then
! determine convective rain/snow by surface temperature
! determine large-scale rain/snow by rain/snow coming out directly from MP
do i = 1, im
tprcp(i) = max(0.0, rain(i) )! clu: rain -> tprcp
!tprcp(i) = max(0.0, rain(i) )! clu: rain -> tprcp ! DH now lines 245-250
srflag(i) = 0. ! clu: default srflag as 'rain' (i.e. 0)
if (tsfc(i) >= 273.15) then
crain = rainc(i)
Expand Down
Loading