Skip to content

Commit

Permalink
Merge pull request #1 from climbfuji/MP_generic_pre_20180816_based_on…
Browse files Browse the repository at this point in the history
…_vlab_master_merge_20180815_follow_up_scm

Update of MP generic pwat/calpreciptype changes to include latest VLAB master merge
  • Loading branch information
climbfuji authored Aug 17, 2018
2 parents a88ec61 + 97bfd3b commit 779463f
Show file tree
Hide file tree
Showing 22 changed files with 836 additions and 411 deletions.
24 changes: 17 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,23 @@ else (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
message (FATAL_ERROR "This program has only been compiled with gfortran, pgf90 and ifort. If another compiler is needed, the appropriate flags must be added in ${GFS_PHYS_SRC}/CMakeLists.txt")
endif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")

#apply general fortran tags to all fortran source files
if(${CMAKE_VERSION} LESS 3.3)
string (REPLACE ";" " " f_flags_str "${f_flags}")
SET_PROPERTY(SOURCE ${SCHEMES} ${CAPS} APPEND_STRING PROPERTY COMPILE_FLAGS " ${f_flags_str}")
else(${CMAKE_VERSION} LESS 3.3)
add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:${f_flags}>")
endif (${CMAKE_VERSION} LESS 3.3)
# The auto-generated caps can contain calls to physics schemes in
# which some of the arguments (pointers) are not associated. This is
# on purpose to avoid allocating fields that are not used inside the
# scheme if, for example, certain conditions are not met. To avoid
# Fortran runtime errors, it is necessary to remove checks for pointers
# that are not associated from the caps ONLY. For the physics schemes,
# these checks can and should remain enabled. Overwriting the check flags
# explicitly works for Intel and GNU, but not for PGI.
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
set_property(SOURCE ${CAPS} PROPERTY COMPILE_FLAGS "-fcheck=no-pointer")
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
set_property(SOURCE ${CAPS} PROPERTY COMPILE_FLAGS "-check nopointers")
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI")
if (CMAKE_Fortran_FLAGS MATCHES ".*chkptr.*")
message (FATAL_ERROR "PGI compiler option chkptr cannot be used for CCPP physics")
endif (CMAKE_Fortran_FLAGS MATCHES ".*chkptr.*")
endif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")

if (PROJECT STREQUAL "CCPP-FV3")
link_directories(${NCEPLIBS_DIR}/lib)
Expand Down
218 changes: 0 additions & 218 deletions input.nml

This file was deleted.

19 changes: 15 additions & 4 deletions physics/GFS_calpreciptype.f90
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ end subroutine GFS_calpreciptype_finalize
!! | snow0 | lwe_thickness_of_snow_amount_per_day | snow fall over 24h period | mm | 1 | real | kind_phys | in | F |
!! | graupel0 | lwe_thickness_of_graupel_amount_per_day | graupel fall over 24h period | mm | 1 | real | kind_phys | in | F |
!! | cplflx | flag_for_flux_coupling | flag controlling cplflx collection (default off) | flag | 0 | logical | | in | F |
!! | cplchm | flag_for_chemistry_coupling | flag controlling cplchm collection (default off) | flag | 0 | logical | | in | F |
!! | rain_cpl | lwe_thickness_of_precipitation_amount_for_coupling | total rain precipitation for model coupling | m | 1 | real | kind_phys | inout | F |
!! | rainc_cpl | lwe_thickness_of_convective_precipitation_amount_for_coupling | total convective precipitation | m | 1 | real | kind_phys | inout | F |
!! | snow_cpl | lwe_thickness_of_snow_amount_for_coupling | total snow precipitation for model coupling | 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 |
Expand All @@ -91,7 +93,8 @@ subroutine GFS_calpreciptype_run(kdt,nrcm,im,ix,lm,lp1,randomno, &
totprcpb,toticeb,totsnwb,totgrpb, &
hrate,mrate,save_t,save_qv, &
rain0,ice0,snow0,graupel0, &
cplflx,rain_cpl,snow_cpl,errmsg,errflg)
cplflx,cplchm,rain_cpl,rainc_cpl, &
snow_cpl,errmsg,errflg)

!$$$ subprogram documentation block
! . . .
Expand Down Expand Up @@ -134,9 +137,9 @@ subroutine GFS_calpreciptype_run(kdt,nrcm,im,ix,lm,lp1,randomno, &
real(kind=kind_phys), dimension(ix,lm), intent(in) :: save_t,save_qv
! rain0, ice0, snow0, graupel0 only allocated if GFDL MP is selected (imp_physics == imp_physics_gfdl)
real(kind=kind_phys), dimension(:), intent(in) :: rain0,ice0,snow0,graupel0
logical, intent(in) :: cplflx
logical, intent(in) :: cplflx,cplchm
! rain_cpl, snow_cpl only allocated if cplflx == .true.
real(kind=kind_phys), dimension(:), intent(inout) :: rain_cpl,snow_cpl
real(kind=kind_phys), dimension(:), intent(inout) :: rain_cpl,rainc_cpl,snow_cpl
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

Expand Down Expand Up @@ -399,7 +402,8 @@ subroutine GFS_calpreciptype_run(kdt,nrcm,im,ix,lm,lp1,randomno, &
crain = 0.0
csnow = rainc(i)
endif
if ((snow0(i)+ice0(i)+graupel0(i)+csnow) > (rain0(i)+crain)) then
! if ((snow0(i)+ice0(i)+graupel0(i)+csnow) > (rain0(i)+crain)) then
if ((snow0(i)+ice0(i)+graupel0(i)+csnow) > 0.0) then
srflag(i) = 1. ! clu: set srflag to 'snow' (i.e. 1)
endif
enddo
Expand All @@ -425,6 +429,13 @@ subroutine GFS_calpreciptype_run(kdt,nrcm,im,ix,lm,lp1,randomno, &
enddo
endif

if ((cplchm).and.(.not.cplflx)) then
do i = 1, im
rain_cpl(i) = rain_cpl(i) + rain(i)
rainc_cpl(i) = rainc_cpl(i) + rainc(i)
enddo
endif

return
end subroutine GFS_calpreciptype_run
!
Expand Down
7 changes: 7 additions & 0 deletions physics/GFS_gfdlmp_pre.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
!! before calling microphysics scheme:

module GFS_gfdlmp_pre

implicit none

private

public GFS_gfdlmp_pre_init, GFS_gfdlmp_pre_run, GFS_gfdlmp_pre_finalize

contains

!> \defgroup GFS_gfdlmp_pre GFS gfdlmp pre Scheme
Expand Down
13 changes: 10 additions & 3 deletions physics/GFS_gfdlmp_pwat.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
!! - pwat: column integrated precipitable water

module GFS_gfdlmp_pwat

implicit none

private

public GFS_gfdlmp_pwat_init, GFS_gfdlmp_pwat_run, GFS_gfdlmp_pwat_finalize

contains

!> \defgroup GFS_gfdlmp_pwat GFS Zhao-Carr PWAT Calculation
Expand Down Expand Up @@ -35,9 +42,9 @@ end subroutine GFS_gfdlmp_pwat_init
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
subroutine GFS_gfdlmp_pwat_run(im,ix,levs,del, &
ntcw,ncld,nncl,gq0_ntcw, gq0_ntrw, &
gq0_ntiw, gq0_ntsw, gq0_ntgl,q, & ! input
pwat,errmsg,errflg) ! output
ntcw,ncld,nncl,gq0_ntcw,gq0_ntrw, &
gq0_ntiw,gq0_ntsw,gq0_ntgl,q, & ! input
pwat,errmsg,errflg) ! output

use machine, only: kind_phys
use physcons, only: con_g
Expand Down
Loading

0 comments on commit 779463f

Please sign in to comment.