Skip to content
Open
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
48 changes: 48 additions & 0 deletions src/core_atmosphere/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,54 @@ set(ATMOSPHERE_CORE_PHYSICS_NOAA_SOURCES

list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_NOAA_SOURCES PREPEND physics/physics_noaa/UGWP/)

set(ATMOSPHERE_CORE_PHYSICS_MYNN-EDMF_DIR ${CMAKE_CURRENT_SOURCE_DIR}/physics/physics_noaa/MYNN-EDMF)

if(NOT EXISTS ${ATMOSPHERE_CORE_PHYSICS_MYNN-EDMF_DIR})
set(PHYSICS_MYNN-EDMF_REPO_URL "https://github.com/NCAR/MYNN-EDMF.git")
execute_process(COMMAND git clone ${PHYSICS_MYNN-EDMF_REPO_URL} ${ATMOSPHERE_CORE_PHYSICS_MYNN-EDMF_DIR}
RESULT_VARIABLE GIT_CLONE_RESULT
OUTPUT_VARIABLE GIT_CLONE_OUTPUT
ERROR_VARIABLE GIT_CLONE_ERROR)
if(NOT GIT_CLONE_RESULT EQUAL 0)
message(FATAL_ERROR "Git clone failed with error: ${GIT_CLONE_ERROR}")
endif()

else()
message(STATUS "Directory ${DIR_TO_CHECK} already exists, skipping clone")
endif()

set(ATMOSPHERE_CORE_PHYSICS_MYNN-EDMF_SOURCES
module_bl_mynnedmf.F90
MPAS/module_bl_mynnedmf_common.F90
MPAS/module_bl_mynnedmf_driver.F90
)
list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_MYNN-EDMF_SOURCES PREPEND physics/physics_noaa/MYNN-EDMF/)

set(ATMOSPHERE_CORE_PHYSICS_MYNN-SFC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/physics/physics_noaa/MYNN-SFC)

if(NOT EXISTS ${ATMOSPHERE_CORE_PHYSICS_MYNN-SFC_DIR})
set(PHYSICS_MYNN-SFC_REPO_URL "https://github.com/NCAR/MYNN-SFC.git")
execute_process(COMMAND git clone ${PHYSICS_MYNN-SFC_REPO_URL} ${ATMOSPHERE_CORE_PHYSICS_MYNN-SFC_DIR}
RESULT_VARIABLE GIT_CLONE_RESULT
OUTPUT_VARIABLE GIT_CLONE_OUTPUT
ERROR_VARIABLE GIT_CLONE_ERROR)
if(NOT GIT_CLONE_RESULT EQUAL 0)
message(FATAL_ERROR "Git clone failed with error: ${GIT_CLONE_ERROR}")
endif()

else()
message(STATUS "Directory ${DIR_TO_CHECK} already exists, skipping clone")
endif()

set(ATMOSPHERE_CORE_PHYSICS_MYNN-SFC_SOURCES
module_sf_mynnsfc_land.F90
module_sf_mynnsfc_water.F90
module_sf_mynnsfc_ice.F90
MPAS/module_sf_mynnsfc_common.F90
MPAS/module_sf_mynnsfc_driver.F90
)
list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_MYNN-SFC_SOURCES PREPEND physics/physics_noaa/MYNN-SFC/)

set(ATMOSPHERE_CORE_PHYSICS_NOAMP_UTILITY_SOURCES
CheckNanMod.F90
Machine.F90
Expand Down
14 changes: 14 additions & 0 deletions src/core_atmosphere/Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,19 @@ repo_url = https://github.com/NOAA-GSL/UGWP.git
tag = MPAS_20241223
required = True

[MYNN-EDMF]
local_path = ./physics_noaa/MYNN-EDMF
protocol = git
repo_url = https://github.com/NCAR/MYNN-EDMF.git
tag = v6.0.2
required = True

[MYNN-SFC]
local_path = ./physics_noaa/MYNN-SFC
protocol = git
repo_url = https://github.com/NCAR/MYNN-SFC.git
tag = v6.0.0
required = True

[externals_description]
schema_version = 1.0.0
316 changes: 213 additions & 103 deletions src/core_atmosphere/Registry.xml

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions src/core_atmosphere/physics/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ endif

all:
./../tools/manage_externals/checkout_externals --externals ./../Externals.cfg
$(MAKE) lookup_tables core_physics_init core_physics_mmm core_UGWP core_physics_wrf core_physics_noahmp core_physics
$(MAKE) lookup_tables core_physics_init core_physics_mmm core_UGWP core_mynnedmf core_mynnsfc core_physics_wrf core_physics_noahmp core_physics

dummy:
echo "****** compiling physics ******"
Expand Down Expand Up @@ -63,7 +63,13 @@ core_physics_mmm: core_physics_init
core_UGWP: core_physics_init
(cd physics_noaa/UGWP; $(MAKE) all)

core_physics_wrf: core_physics_init core_physics_mmm core_UGWP
core_mynnedmf: core_physics_init
(cd physics_noaa/MYNN-EDMF; cp ./MPAS/Makefile .; cp ./MPAS/module_bl_mynnedmf_driver.F90 .; cp ./MPAS/module_bl_mynnedmf_common.F90 .; $(MAKE) all)

core_mynnsfc: core_physics_init
(cd physics_noaa/MYNN-SFC; cp ./MPAS/Makefile .; cp ./MPAS/module_sf_mynnsfc_driver.F90 .; cp ./MPAS/module_sf_mynnsfc_common.F90 .; $(MAKE) all)

core_physics_wrf: core_physics_init core_physics_mmm core_UGWP core_mynnedmf
(cd physics_wrf; $(MAKE) all COREDEF="$(COREDEF)")

core_physics_noahmp:
Expand All @@ -73,7 +79,7 @@ core_physics_noahmp:

core_physics_init: $(OBJS_init)

core_physics: core_physics_wrf core_physics_noahmp
core_physics: core_physics_wrf core_physics_noahmp core_mynnedmf core_mynnsfc
($(MAKE) phys_interface COREDEF="$(COREDEF)")
ar -ru libphys.a $(OBJS_init) $(OBJS)
($(MAKE) -C ./physics_mmm -f Makefile.mpas physics_mmm_lib)
Expand Down Expand Up @@ -254,6 +260,8 @@ clean:
( cd physics_noahmp/src; $(MAKE) clean )
( cd physics_noahmp/utility; $(MAKE) clean )
( if [ -d physics_noaa/UGWP ]; then cd physics_noaa/UGWP; $(MAKE) clean; fi )
( if [ -d physics_noaa/MYNN-EDMF ]; then cd physics_noaa/MYNN-EDMF; $(MAKE) clean; fi )
( if [ -d physics_noaa/MYNN-SFC ]; then cd physics_noaa/MYNN-SFC; $(MAKE) clean; fi )
@# Certain systems with intel compilers generate *.i files
@# This removes them during the clean process
$(RM) *.i
Expand All @@ -264,5 +272,5 @@ ifeq "$(GEN_F90)" "true"
$(CPP) $(CPPFLAGS) $(COREDEF) $(HYDROSTATIC) $(CPPINCLUDES) $< > $*.f90
$(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I./physics_mmm -I./physics_wrf -I./physics_noahmp -I./physics_noahmp/utility -I./physics_noahmp/drivers/mpas -I./physics_noahmp/src -I.. -I../../framework $(MPAS_ESMF_INC)
else
$(FC) $(CPPFLAGS) $(COREDEF) $(HYDROSATIC) $(FFLAGS) -c $*.F $(CPPINCLUDES) $(FCINCLUDES) -I./physics_mmm -I./physics_wrf -I./physics_noahmp -I./physics_noahmp/utility -I./physics_noahmp/drivers/mpas -I./physics_noahmp/src -I./physics_noaa/UGWP -I.. -I../../framework $(MPAS_ESMF_INC)
$(FC) $(CPPFLAGS) $(COREDEF) $(HYDROSATIC) $(FFLAGS) -c $*.F $(CPPINCLUDES) $(FCINCLUDES) -I./physics_mmm -I./physics_wrf -I./physics_noahmp -I./physics_noahmp/utility -I./physics_noahmp/drivers/mpas -I./physics_noahmp/src -I./physics_noaa/UGWP -I./physics_noaa/MYNN-EDMF -I./physics_noaa/MYNN-SFC -I.. -I../../framework $(MPAS_ESMF_INC)
endif
25 changes: 19 additions & 6 deletions src/core_atmosphere/physics/mpas_atmphys_control.F
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ subroutine physics_namelist_check(configs)
endif

!pbl scheme:
if(.not. (config_pbl_scheme .eq. 'off' .or. &
config_pbl_scheme .eq. 'bl_mynn' .or. &
if(.not. (config_pbl_scheme .eq. 'off' .or. &
config_pbl_scheme .eq. 'bl_mynn' .or. &
config_pbl_scheme .eq. 'bl_mynnedmf' .or. &
config_pbl_scheme .eq. 'bl_ysu')) then

write(mpas_err_message,'(A,A20)') 'illegal value for pbl_scheme: ', &
Expand Down Expand Up @@ -243,10 +244,11 @@ subroutine physics_namelist_check(configs)
endif

!cloud fraction for radiation schemes:
if(.not. (config_radt_cld_scheme .eq. 'off' .or. &
config_radt_cld_scheme .eq. 'cld_incidence' .or. &
config_radt_cld_scheme .eq. 'cld_fraction' .or. &
config_radt_cld_scheme .eq. 'cld_fraction_thompson')) then
if(.not. (config_radt_cld_scheme .eq. 'off' .or. &
config_radt_cld_scheme .eq. 'cld_incidence' .or. &
config_radt_cld_scheme .eq. 'cld_fraction' .or. &
config_radt_cld_scheme .eq. 'cld_fraction_thompson' .or. &
config_radt_cld_scheme .eq. 'cld_fraction_mynn')) then

write(mpas_err_message,'(A,A20)') 'illegal value for calculation of cloud fraction: ', &
trim(config_radt_cld_scheme)
Expand All @@ -266,10 +268,19 @@ subroutine physics_namelist_check(configs)
config_radt_cld_scheme = "cld_incidence"

endif
if(.not. (config_pbl_scheme .eq. 'bl_mynn' .or. &
config_pbl_scheme .eq. 'bl_mynnedmf') .and. &
(config_radt_cld_scheme .eq. 'cld_fraction_mynn')) then
write(mpas_err_message,'(A,A20)') 'illegal cloud fraction option for pbl_scheme: ', &
trim(config_pbl_scheme)
call physics_error_fatal(mpas_err_message)

endif

!surface-layer scheme:
if(.not. (config_sfclayer_scheme .eq. 'off' .or. &
config_sfclayer_scheme .eq. 'sf_mynn' .or. &
config_sfclayer_scheme .eq. 'sf_mynnsfclay' .or. &
config_sfclayer_scheme .eq. 'sf_monin_obukhov' .or. &
config_sfclayer_scheme .eq. 'sf_monin_obukhov_rev')) then

Expand All @@ -279,6 +290,8 @@ subroutine physics_namelist_check(configs)
else
if(config_pbl_scheme == 'bl_mynn') then
config_sfclayer_scheme = 'sf_mynn'
elseif(config_pbl_scheme == 'bl_mynnedmf') then
config_sfclayer_scheme = 'sf_mynnsfclay'
elseif(config_pbl_scheme == 'bl_ysu') then
if(config_sfclayer_scheme /= 'sf_monin_obukhov' .and. &
config_sfclayer_scheme /= 'sf_monin_obukhov_rev') then
Expand Down
8 changes: 4 additions & 4 deletions src/core_atmosphere/physics/mpas_atmphys_driver.F
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ subroutine physics_driver(domain,itimestep,xtime_s)

!call to cloud scheme:
if(l_radtlw .or. l_radtsw) then
call allocate_cloudiness
call allocate_cloudiness(block%configs)
!$OMP PARALLEL DO
do thread=1,nThreads
call driver_cloudiness(block%configs,mesh,diag_physics,sfc_input, &
call driver_cloudiness(itimestep,block%configs,mesh,diag_physics,sfc_input, &
cellSolveThreadStart(thread),cellSolveThreadEnd(thread))
end do
!$OMP END PARALLEL DO
Expand Down Expand Up @@ -260,7 +260,7 @@ subroutine physics_driver(domain,itimestep,xtime_s)

!deallocate all radiation arrays:
if(config_radt_sw_scheme.ne.'off' .or. config_radt_lw_scheme.ne.'off') &
call deallocate_cloudiness
call deallocate_cloudiness(block%configs)
if(config_radt_sw_scheme.ne.'off') call deallocate_radiation_sw(block%configs)
if(config_radt_lw_scheme.ne.'off') call deallocate_radiation_lw(block%configs)

Expand Down Expand Up @@ -321,7 +321,7 @@ subroutine physics_driver(domain,itimestep,xtime_s)
call allocate_pbl(block%configs)
!$OMP PARALLEL DO
do thread=1,nThreads
call driver_pbl(itimestep,block%configs,mesh,sfc_input,diag_physics,tend_physics, &
call driver_pbl(itimestep,block%configs,state,mesh,sfc_input,diag_physics,tend_physics, &
cellSolveThreadStart(thread),cellSolveThreadEnd(thread))
end do
!$OMP END PARALLEL DO
Expand Down
Loading