diff --git a/CMakeLists.txt b/CMakeLists.txt index 159b1dfe5..1a1b69fdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -263,11 +263,7 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI") set_property(SOURCE ${CAPS} PROPERTY COMPILE_FLAGS "-Mnobounds") endif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU") -if (PROJECT STREQUAL "CCPP-FV3") - if (NOT STATIC) - link_directories(${NCEPLIBS_DIR}/lib) - endif (NOT STATIC) -elseif (PROJECT STREQUAL "CCPP-SCM") +if (PROJECT STREQUAL "CCPP-SCM") SET(W3LIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../external/w3nco/v2.0.6/src) SET(BACIOLIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../external/bacio/v2.0.1/src) SET(SPLIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../external/sp/v2.0.2/src) @@ -282,7 +278,7 @@ elseif (PROJECT STREQUAL "CCPP-SCM") INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/bacio) INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/ccpp/framework/src) -endif (PROJECT STREQUAL "CCPP-FV3") +endif (PROJECT STREQUAL "CCPP-SCM") #------------------------------------------------------------------------------ @@ -299,8 +295,9 @@ else(STATIC) endif(STATIC) if (PROJECT STREQUAL "CCPP-FV3") + # Link required NCEPlibs for dynamic builds if (NOT STATIC) - target_link_libraries(ccppphys LINK_PUBLIC ${LIBS} sp_v2.0.2_d bacio_4 w3nco_d) + target_link_libraries(ccppphys LINK_PUBLIC ${LIBS} ${BACIO_LIB4} ${SP_LIBd} ${W3NCO_LIBd}) endif (NOT STATIC) elseif (PROJECT STREQUAL "CCPP-SCM") target_link_libraries(ccppphys LINK_PUBLIC ${LIBS} w3 sp bacio) diff --git a/physics/module_mp_thompson_hrrr.F90 b/physics/module_mp_thompson.F90 similarity index 99% rename from physics/module_mp_thompson_hrrr.F90 rename to physics/module_mp_thompson.F90 index 64ec5d731..d962b3c24 100644 --- a/physics/module_mp_thompson_hrrr.F90 +++ b/physics/module_mp_thompson.F90 @@ -44,7 +44,7 @@ !wrft:model_layer:physics !+---+-----------------------------------------------------------------+ ! -MODULE module_mp_thompson_hrrr +MODULE module_mp_thompson USE machine, only : kind_phys @@ -3596,12 +3596,6 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, & qv1d(k) = MAX(1.E-10, qv1d(k) + qvten(k)*DT) qc1d(k) = qc1d(k) + qcten(k)*DT nc1d(k) = MAX(2./rho(k), MIN(nc1d(k) + ncten(k)*DT, Nt_c_max)) - ! DH* this was for FIM - !nwfa1d(k) = MAX(11.1E6/rho(k), MIN(9999.E6/rho(k), & - ! (nwfa1d(k)+nwfaten(k)*DT))) - !nifa1d(k) = MAX(naIN1*0.01, MIN(9999.E6/rho(k), & - ! (nifa1d(k)+nifaten(k)*DT))) - ! *DH nwfa1d(k) = MAX(11.1E6, MIN(9999.E6, & (nwfa1d(k)+nwfaten(k)*DT))) nifa1d(k) = MAX(naIN1*0.01, MIN(9999.E6, & @@ -3734,6 +3728,9 @@ subroutine qr_acr_qg ENDIF IF (.NOT. good .EQ. 1 ) THEN +#ifndef SION + write_thompson_tables = .true. +#endif write(0,*) "ThompMP: computing qr_acr_qg" do n2 = 1, nbr ! vr(n2) = av_r*Dr(n2)**bv_r * DEXP(-fv_r*Dr(n2)) @@ -3911,6 +3908,9 @@ subroutine qr_acr_qs ENDIF IF (.NOT. good .EQ. 1 ) THEN +#ifndef SION + write_thompson_tables = .true. +#endif write(0,*) "ThompMP: computing qr_acr_qs" do n2 = 1, nbr ! vr(n2) = av_r*Dr(n2)**bv_r * DEXP(-fv_r*Dr(n2)) @@ -4162,6 +4162,9 @@ subroutine freezeH2O(threads) ENDIF IF (.NOT. good .EQ. 1 ) THEN +#ifndef SION + write_thompson_tables = .true. +#endif write(0,*) "ThompMP: computing freezeH2O" orho_w = 1./rho_w @@ -5785,5 +5788,5 @@ end subroutine readwrite_tables !+---+-----------------------------------------------------------------+ !+---+-----------------------------------------------------------------+ -END MODULE module_mp_thompson_hrrr +END MODULE module_mp_thompson !+---+-----------------------------------------------------------------+ diff --git a/physics/mp_thompson_hrrr.F90 b/physics/mp_thompson.F90 similarity index 97% rename from physics/mp_thompson_hrrr.F90 rename to physics/mp_thompson.F90 index d82e0c505..b7f7b5650 100644 --- a/physics/mp_thompson_hrrr.F90 +++ b/physics/mp_thompson.F90 @@ -1,13 +1,13 @@ ! CCPP license goes here, as well as further documentation -module mp_thompson_hrrr +module mp_thompson use machine, only : kind_phys - use module_mp_thompson_hrrr, only : thompson_init, mp_gt_driver, thompson_finalize + use module_mp_thompson, only : thompson_init, mp_gt_driver, thompson_finalize implicit none - public :: mp_thompson_hrrr_init, mp_thompson_hrrr_run, mp_thompson_hrrr_finalize + public :: mp_thompson_init, mp_thompson_run, mp_thompson_finalize private @@ -16,7 +16,7 @@ module mp_thompson_hrrr contains #if 0 -!! \section arg_table_mp_thompson_hrrr_init Argument Table +!! \section arg_table_mp_thompson_init Argument Table !! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | !! |----------------------|-------------------------------------------------------|----------------------------------------------------------|------------|------|-----------|-----------|--------|----------| !! | ncol | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F | @@ -36,7 +36,7 @@ module mp_thompson_hrrr !! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | !! #endif - subroutine mp_thompson_hrrr_init(ncol, nlev, is_aerosol_aware, & + subroutine mp_thompson_init(ncol, nlev, is_aerosol_aware, & nwfa2d, nifa2d, nwfa, nifa, & mpicomm, mpirank, mpiroot, & imp_physics, & @@ -121,7 +121,7 @@ subroutine mp_thompson_hrrr_init(ncol, nlev, is_aerosol_aware, & threads=threads) if (errflg /= 0) return else if (is_aerosol_aware) then - write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_hrrr_init:', & + write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_init:', & ' aerosol-aware microphysics require all of the following', & ' optional arguments: nifa2d, nwfa2d, nwfa, nifa' errflg = 1 @@ -137,10 +137,10 @@ subroutine mp_thompson_hrrr_init(ncol, nlev, is_aerosol_aware, & is_initialized = .true. - end subroutine mp_thompson_hrrr_init + end subroutine mp_thompson_init #if 0 -!! \section arg_table_mp_thompson_hrrr_run Argument Table +!! \section arg_table_mp_thompson_run Argument Table !! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | !! |-----------------|-----------------------------------------------------------------------|-----------------------------------------------------------------------|------------|------|-----------|-----------|--------|----------| !! | ncol | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F | @@ -184,7 +184,7 @@ end subroutine mp_thompson_hrrr_init !! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | !! #endif - subroutine mp_thompson_hrrr_run(ncol, nlev, con_g, con_rd, & + subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & spechum, qc, qr, qi, qs, qg, ni, nr, & is_aerosol_aware, nc, nwfa, nifa, & nwfa2d, nifa2d, & @@ -293,7 +293,7 @@ subroutine mp_thompson_hrrr_run(ncol, nlev, con_g, con_rd, & ! Check initialization state if (.not.is_initialized) then - write(errmsg, fmt='((a))') 'mp_thompson_hrrr_run called before mp_thompson_hrrr_init' + write(errmsg, fmt='((a))') 'mp_thompson_run called before mp_thompson_init' errflg = 1 return end if @@ -311,7 +311,7 @@ subroutine mp_thompson_hrrr_run(ncol, nlev, con_g, con_rd, & present(nifa) .and. & present(nwfa2d) .and. & present(nifa2d) )) then - write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_hrrr_run:', & + write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_run:', & ' aerosol-aware microphysics require all of the', & ' following optional arguments:', & ' nc, nwfa, nifa, nwfa2d, nifa2d' @@ -359,7 +359,7 @@ subroutine mp_thompson_hrrr_run(ncol, nlev, con_g, con_rd, & has_reqi = 0 has_reqs = 0 else - write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_hrrr_run:', & + write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_run:', & ' all or none of the following optional', & ' arguments are required: re_cloud, re_ice, re_snow' errflg = 1 @@ -451,17 +451,17 @@ subroutine mp_thompson_hrrr_run(ncol, nlev, con_g, con_rd, & re_snow = re_snow_mp*1.0E6_kind_phys end if - end subroutine mp_thompson_hrrr_run + end subroutine mp_thompson_run #if 0 -!! \section arg_table_mp_thompson_hrrr_finalize Argument Table +!! \section arg_table_mp_thompson_finalize Argument Table !! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | !! |-----------------|---------------------------------------------------------------|--------------------------------------------------------|------------|------|-----------|-----------|--------|----------| !! | 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 | !! #endif - subroutine mp_thompson_hrrr_finalize(errmsg, errflg) + subroutine mp_thompson_finalize(errmsg, errflg) implicit none @@ -478,6 +478,6 @@ subroutine mp_thompson_hrrr_finalize(errmsg, errflg) is_initialized = .false. - end subroutine mp_thompson_hrrr_finalize + end subroutine mp_thompson_finalize -end module mp_thompson_hrrr +end module mp_thompson diff --git a/physics/mp_thompson_hrrr_post.F90 b/physics/mp_thompson_post.F90 similarity index 89% rename from physics/mp_thompson_hrrr_post.F90 rename to physics/mp_thompson_post.F90 index 60876d8a3..bb91ce7cd 100644 --- a/physics/mp_thompson_hrrr_post.F90 +++ b/physics/mp_thompson_post.F90 @@ -1,10 +1,10 @@ -module mp_thompson_hrrr_post +module mp_thompson_post use machine, only : kind_phys implicit none - public :: mp_thompson_hrrr_post_init, mp_thompson_hrrr_post_run, mp_thompson_hrrr_post_finalize + public :: mp_thompson_post_init, mp_thompson_post_run, mp_thompson_post_finalize private @@ -17,7 +17,7 @@ module mp_thompson_hrrr_post contains #if 0 -!! \section arg_table_mp_thompson_hrrr_post_init Argument Table +!! \section arg_table_mp_thompson_post_init Argument Table !! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | !! |-----------------|-------------------------------------------------------|----------------------------------------------------------|------------|------|-----------|-----------|--------|----------| !! | ncol | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F | @@ -27,7 +27,7 @@ module mp_thompson_hrrr_post !! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | !! #endif - subroutine mp_thompson_hrrr_post_init(ncol, area, ttendlim, errmsg, errflg) + subroutine mp_thompson_post_init(ncol, area, ttendlim, errmsg, errflg) implicit none @@ -87,10 +87,10 @@ subroutine mp_thompson_hrrr_post_init(ncol, area, ttendlim, errmsg, errflg) is_initialized = .true. - end subroutine mp_thompson_hrrr_post_init + end subroutine mp_thompson_post_init #if 0 -!! \section arg_table_mp_thompson_hrrr_post_run Argument Table +!! \section arg_table_mp_thompson_post_run Argument Table !! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | !! |-----------------|-------------------------------------------------------|----------------------------------------------------------|------------|------|-----------|-----------|--------|----------| !! | ncol | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F | @@ -106,7 +106,7 @@ end subroutine mp_thompson_hrrr_post_init !! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | !! #endif - subroutine mp_thompson_hrrr_post_run(ncol, nlev, tgrs_save, tgrs, prslk, dtp, & + subroutine mp_thompson_post_run(ncol, nlev, tgrs_save, tgrs, prslk, dtp, & mpicomm, mpirank, mpiroot, errmsg, errflg) implicit none @@ -137,7 +137,7 @@ subroutine mp_thompson_hrrr_post_run(ncol, nlev, tgrs_save, tgrs, prslk, dtp, & ! Check initialization state if (.not.is_initialized) then - write(errmsg, fmt='((a))') 'mp_thompson_hrrr_post_run called before mp_thompson_hrrr_post_init' + write(errmsg, fmt='((a))') 'mp_thompson_post_run called before mp_thompson_post_init' errflg = 1 return end if @@ -155,7 +155,7 @@ subroutine mp_thompson_hrrr_post_run(ncol, nlev, tgrs_save, tgrs, prslk, dtp, & if (tgrs_save(i,k) + mp_tend(i,k)*prslk(i,k) .ne. tgrs(i,k)) then #ifdef DEBUG - write(0,*) "mp_thompson_hrrr_post_run mp_tend limiter: i, k, t_old, t_new, t_lim:", & + write(0,*) "mp_thompson_post_run mp_tend limiter: i, k, t_old, t_new, t_lim:", & & i, k, tgrs_save(i,k), tgrs(i,k), tgrs_save(i,k) + mp_tend(i,k)*prslk(i,k) #endif events = events + 1 @@ -165,20 +165,20 @@ subroutine mp_thompson_hrrr_post_run(ncol, nlev, tgrs_save, tgrs, prslk, dtp, & end do if (events > 0) then - write(0,'(a,i0,a,i0,a)') "mp_thompson_hrrr_post_run: mp_tend_lim applied ", events, "/", nlev*ncol, " times" + write(0,'(a,i0,a,i0,a)') "mp_thompson_post_run: mp_tend_lim applied ", events, "/", nlev*ncol, " times" end if - end subroutine mp_thompson_hrrr_post_run + end subroutine mp_thompson_post_run #if 0 -!! \section arg_table_mp_thompson_hrrr_post_finalize Argument Table +!! \section arg_table_mp_thompson_post_finalize Argument Table !! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | !! |-----------------|-------------------------------------------------------|----------------------------------------------------------|------------|------|-----------|-----------|--------|----------| !! | 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 | !! #endif - subroutine mp_thompson_hrrr_post_finalize(errmsg, errflg) + subroutine mp_thompson_post_finalize(errmsg, errflg) implicit none @@ -193,6 +193,6 @@ subroutine mp_thompson_hrrr_post_finalize(errmsg, errflg) is_initialized = .false. - end subroutine mp_thompson_hrrr_post_finalize + end subroutine mp_thompson_post_finalize -end module mp_thompson_hrrr_post +end module mp_thompson_post diff --git a/physics/mp_thompson_hrrr_pre.F90 b/physics/mp_thompson_pre.F90 similarity index 96% rename from physics/mp_thompson_hrrr_pre.F90 rename to physics/mp_thompson_pre.F90 index a96000e2d..643c7fbad 100644 --- a/physics/mp_thompson_hrrr_pre.F90 +++ b/physics/mp_thompson_pre.F90 @@ -1,25 +1,25 @@ ! CCPP license goes here, as well as further documentation -module mp_thompson_hrrr_pre +module mp_thompson_pre use machine, only : kind_phys - use module_mp_thompson_hrrr, only : naIN0, naIN1, naCCN0, naCCN1, eps + use module_mp_thompson, only : naIN0, naIN1, naCCN0, naCCN1, eps use module_mp_thompson_make_number_concentrations, only: make_IceNumber, make_DropletNumber, make_RainNumber implicit none - public :: mp_thompson_hrrr_pre_init, mp_thompson_hrrr_pre_run, mp_thompson_hrrr_pre_finalize + public :: mp_thompson_pre_init, mp_thompson_pre_run, mp_thompson_pre_finalize private contains - subroutine mp_thompson_hrrr_pre_init() - end subroutine mp_thompson_hrrr_pre_init + subroutine mp_thompson_pre_init() + end subroutine mp_thompson_pre_init #if 0 -!! \section arg_table_mp_thompson_hrrr_pre_run Argument Table +!! \section arg_table_mp_thompson_pre_run Argument Table !! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | !! |-----------------|-----------------------------------------------------------------------|----------------------------------------------------------|------------|------|-----------|-----------|--------|----------| !! | ncol | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F | @@ -54,7 +54,7 @@ end subroutine mp_thompson_hrrr_pre_init !! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | !! #endif - subroutine mp_thompson_hrrr_pre_run(ncol, nlev, kdt, con_g, con_rd, & + subroutine mp_thompson_pre_run(ncol, nlev, kdt, con_g, con_rd, & spechum, qc, qr, qi, qs, qg, ni, nr, & make_number_concentrations, & is_aerosol_aware, nc, nwfa, nifa, nwfa2d, & @@ -113,7 +113,7 @@ subroutine mp_thompson_hrrr_pre_run(ncol, nlev, kdt, con_g, con_rd, & errmsg = '' errflg = 0 - ! Save current air temperature for tendency limiters in mp_thompson_hrrr_post + ! Save current air temperature for tendency limiters in mp_thompson_post tgrs_save = tgrs ! Return if not first timestep @@ -126,7 +126,7 @@ subroutine mp_thompson_hrrr_pre_run(ncol, nlev, kdt, con_g, con_rd, & .not.present(nifa2d) .or. & .not.present(nwfa) .or. & .not.present(nifa) )) then - write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_hrrr_pre_run:', & + write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_pre_run:', & ' aerosol-aware microphysics require all of the following', & ' optional arguments: nc, nwfa2d, nifa2d, nwfa, nifa' errflg = 1 @@ -307,9 +307,9 @@ subroutine mp_thompson_hrrr_pre_run(ncol, nlev, kdt, con_g, con_rd, & ! If nc is in boundary conditions but qc is not, reset nc to zero if (maxval(nc)>0.0 .and. maxval(qc)==0.0) nc = 0.0 - end subroutine mp_thompson_hrrr_pre_run + end subroutine mp_thompson_pre_run - subroutine mp_thompson_hrrr_pre_finalize() - end subroutine mp_thompson_hrrr_pre_finalize + subroutine mp_thompson_pre_finalize() + end subroutine mp_thompson_pre_finalize -end module mp_thompson_hrrr_pre +end module mp_thompson_pre