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

Update/cleanup gsd/develop: rename Thompson MP, update NCEPlibs handling, add fallback option to read/write Thompson tables #241

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 4 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")

#------------------------------------------------------------------------------

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
!wrft:model_layer:physics
!+---+-----------------------------------------------------------------+
!
MODULE module_mp_thompson_hrrr
MODULE module_mp_thompson

USE machine, only : kind_phys

Expand Down Expand Up @@ -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, &
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -5785,5 +5788,5 @@ end subroutine readwrite_tables

!+---+-----------------------------------------------------------------+
!+---+-----------------------------------------------------------------+
END MODULE module_mp_thompson_hrrr
END MODULE module_mp_thompson
!+---+-----------------------------------------------------------------+
34 changes: 17 additions & 17 deletions physics/mp_thompson_hrrr.F90 → physics/mp_thompson.F90
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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 |
Expand All @@ -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, &
Expand Down Expand Up @@ -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
Expand All @@ -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 |
Expand Down Expand Up @@ -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, &
Expand Down Expand Up @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
30 changes: 15 additions & 15 deletions physics/mp_thompson_hrrr_post.F90 → physics/mp_thompson_post.F90
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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 |
Expand All @@ -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

Expand Down Expand Up @@ -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 |
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Loading