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

Add NOAA UFS UGWP suite of physics parameterizations #1276

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions src/core_atmosphere/Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ local_path = ./physics_mmm
protocol = git
repo_url = https://github.com/NCAR/MMM-physics.git
tag = 20240626-MPASv8.2
required = True

[GSL_UGWP]
local_path = ./UGWP
protocol = git
repo_url = https://github.com/mdtoyNOAA/UGWP.git
branch = main_knob_ugwp_tauamp_namelist
required = True

[externals_description]
Expand Down
4 changes: 2 additions & 2 deletions src/core_atmosphere/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ clean:
$(RM) $@ $*.mod
ifeq "$(GEN_F90)" "true"
$(CPP) $(CPPFLAGS) $(PHYSICS) $(CPPINCLUDES) -I./inc $< > $*.f90
$(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_wrf -I./physics/physics_mmm -I../external/esmf_time_f90
$(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_wrf -I./physics/physics_mmm -I./physics/UGWP -I../external/esmf_time_f90
else
$(FC) $(CPPFLAGS) $(PHYSICS) $(FFLAGS) -c $*.F $(CPPINCLUDES) $(FCINCLUDES) -I./inc -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_wrf -I./physics/physics_mmm -I../external/esmf_time_f90
$(FC) $(CPPFLAGS) $(PHYSICS) $(FFLAGS) -c $*.F $(CPPINCLUDES) $(FCINCLUDES) -I./inc -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_wrf -I./physics/physics_mmm -I./physics/UGWP -I../external/esmf_time_f90
endif
303 changes: 301 additions & 2 deletions src/core_atmosphere/Registry.xml

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/core_atmosphere/mpas_atm_core.F
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ subroutine atm_mpas_init_block(dminfo, stream_manager, block, mesh, dt)
type (mpas_pool_type), pointer :: sfc_input
type (mpas_pool_type), pointer :: diag_physics
type (mpas_pool_type), pointer :: diag_physics_noahmp
type (mpas_pool_type), pointer :: ngw_input
type (mpas_pool_type), pointer :: atm_input
type (mpas_pool_type), pointer :: output_noahmp

Expand Down Expand Up @@ -554,15 +555,16 @@ subroutine atm_mpas_init_block(dminfo, stream_manager, block, mesh, dt)
call mpas_pool_get_subpool(block % structs, 'tend', tend)
call mpas_pool_get_subpool(block % structs, 'diag_physics', diag_physics)
call mpas_pool_get_subpool(block % structs, 'diag_physics_noahmp', diag_physics_noahmp)
call mpas_pool_get_subpool(block % structs, 'ngw_input', ngw_input)
call mpas_pool_get_subpool(block % structs, 'atm_input', atm_input)
call mpas_pool_get_subpool(block % structs, 'output_noahmp', output_noahmp)
call physics_tables_init(dminfo, block % configs)
call physics_registry_init(mesh, block % configs, sfc_input)
call physics_run_init(block % configs, mesh, state, clock, stream_manager)

!initialization of all physics:
call physics_init(dminfo, clock, block % configs, mesh, diag, tend, state, 1, diag_physics, &
diag_physics_noahmp, atm_input, sfc_input, output_noahmp)
call physics_init(dminfo, stream_manager, clock, block % configs, mesh, diag, tend, state, 1, &
diag_physics, diag_physics_noahmp, ngw_input, atm_input, sfc_input, output_noahmp)
endif
#endif

Expand Down
47 changes: 47 additions & 0 deletions src/core_atmosphere/mpas_atm_core_interface.F
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ function atm_setup_packages(configs, streamInfo, packages, iocontext) result(ier
logical, pointer :: config_apply_lbcs
logical, pointer :: config_jedi_da, jedi_daActive
logical, pointer :: no_invariant_streamActive
logical, pointer :: ugwp_orog_streamActive
logical, pointer :: ugwp_ngw_streamActive
logical, pointer :: ugwp_diags_streamActive
character(len=StrKIND), pointer :: config_gwdo_scheme
logical, pointer :: config_ngw_scheme
logical, pointer :: config_ugwp_diags
character(len=StrKIND) :: attvalue
integer :: local_ierr

Expand Down Expand Up @@ -206,6 +212,47 @@ function atm_setup_packages(configs, streamInfo, packages, iocontext) result(ier
ierr = ierr + 1
call mpas_log_write('Package setup failed for atmphys in core_atmosphere', messageType=MPAS_LOG_ERR)
end if

!
! Optional gravity wave drag parameterization streams
!
call mpas_pool_get_config(configs, 'config_gwdo_scheme', config_gwdo_scheme)
nullify(ugwp_orog_streamActive)
call mpas_pool_get_package(packages, 'ugwp_orog_streamActive', ugwp_orog_streamActive)
if ( associated(config_gwdo_scheme) .and. associated(ugwp_orog_streamActive) ) then
if (trim(config_gwdo_scheme) == "bl_ugwp_gwdo") then
ugwp_orog_streamActive = .true.
else
ugwp_orog_streamActive = .false.
endif
else
ierr = ierr + 1
call mpas_log_write("Package setup failed for 'ugwp_orog_stream'. 'ugwp_orog_stream' is not a package.", &
messageType=MPAS_LOG_ERR)
end if

call mpas_pool_get_config(configs, 'config_ngw_scheme', config_ngw_scheme)
nullify(ugwp_ngw_streamActive)
call mpas_pool_get_package(packages, 'ugwp_ngw_streamActive', ugwp_ngw_streamActive)
if ( associated(config_ngw_scheme) .and. associated(ugwp_ngw_streamActive) ) then
ugwp_ngw_streamActive = config_ngw_scheme
else
ierr = ierr + 1
call mpas_log_write("Package setup failed for 'ugwp_ngw_stream'. 'ugwp_ngw_stream' is not a package.", &
messageType=MPAS_LOG_ERR)
end if

call mpas_pool_get_config(configs, 'config_ugwp_diags', config_ugwp_diags)
nullify(ugwp_diags_streamActive)
call mpas_pool_get_package(packages, 'ugwp_diags_streamActive', ugwp_diags_streamActive)
if ( associated(config_ugwp_diags) .and. associated(ugwp_diags_streamActive) ) then
ugwp_diags_streamActive = config_ugwp_diags
else
ierr = ierr + 1
call mpas_log_write("Package setup failed for 'ugwp_diags_stream'. 'ugwp_diags_stream' is not a package.", &
messageType=MPAS_LOG_ERR)
end if

#endif

end function atm_setup_packages
Expand Down
1 change: 1 addition & 0 deletions src/core_atmosphere/physics/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
physics_wrf/*.f90
physics_wrf/files/
physics_mmm
UGWP
13 changes: 9 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_physics_wrf core_physics_noahmp core_physics
$(MAKE) lookup_tables core_physics_init core_physics_mmm core_UGWP core_physics_wrf core_physics_noahmp core_physics

dummy:
echo "****** compiling physics ******"
Expand Down Expand Up @@ -59,7 +59,10 @@ lookup_tables:
core_physics_mmm: core_physics_init
(cd physics_mmm; $(MAKE) -f Makefile.mpas all)

core_physics_wrf: core_physics_init core_physics_mmm
core_UGWP: core_physics_init
(cd UGWP; $(MAKE) all)

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

core_physics_noahmp:
Expand Down Expand Up @@ -116,7 +119,8 @@ mpas_atmphys_driver_convection.o: \
mpas_atmphys_vars.o

mpas_atmphys_driver_gwdo.o: \
mpas_atmphys_vars.o
mpas_atmphys_vars.o \
mpas_atmphys_manager.o

mpas_atmphys_driver_lsm.o: \
mpas_atmphys_constants.o \
Expand Down Expand Up @@ -243,6 +247,7 @@ clean:
( cd physics_noahmp/drivers/mpas; $(MAKE) clean )
( cd physics_noahmp/src; $(MAKE) clean )
( cd physics_noahmp/utility; $(MAKE) clean )
( if [ -d UGWP ]; then cd UGWP; $(MAKE) clean; fi )
@# Certain systems with intel compilers generate *.i files
@# This removes them during the clean process
$(RM) *.i
Expand All @@ -253,5 +258,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 -I../../external/esmf_time_f90
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.. -I../../framework -I../../external/esmf_time_f90
$(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./UGWP -I.. -I../../framework -I../../external/esmf_time_f90
endif
3 changes: 2 additions & 1 deletion src/core_atmosphere/physics/mpas_atmphys_control.F
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ subroutine physics_namelist_check(configs)

!gravity wave drag over orography scheme:
if(.not. (config_gwdo_scheme .eq. 'off' .or. &
config_gwdo_scheme .eq. 'bl_ysu_gwdo')) then
config_gwdo_scheme .eq. 'bl_ysu_gwdo' .or. &
config_gwdo_scheme .eq. 'bl_ugwp_gwdo')) then

write(mpas_err_message,'(A,A20)') 'illegal value for gwdo_scheme: ', &
trim(config_gwdo_scheme)
Expand Down
10 changes: 6 additions & 4 deletions src/core_atmosphere/physics/mpas_atmphys_driver.F
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ subroutine physics_driver(domain,itimestep,xtime_s)
output_noahmp, &
tend_physics, &
atm_input, &
ngw_input, &
sfc_input

logical,pointer:: config_frac_seaice
Expand Down Expand Up @@ -188,6 +189,7 @@ subroutine physics_driver(domain,itimestep,xtime_s)
call mpas_pool_get_subpool(block%structs,'output_noahmp' ,output_noahmp )
call mpas_pool_get_subpool(block%structs,'atm_input' ,atm_input )
call mpas_pool_get_subpool(block%structs,'sfc_input' ,sfc_input )
call mpas_pool_get_subpool(block%structs,'ngw_input' ,ngw_input )
call mpas_pool_get_subpool(block%structs,'tend_physics' ,tend_physics )

call mpas_pool_get_dimension(block%dimensions,'nThreads',nThreads)
Expand Down Expand Up @@ -321,14 +323,14 @@ subroutine physics_driver(domain,itimestep,xtime_s)

!call to gravity wave drag over orography scheme:
if(config_gwdo_scheme .ne. 'off') then
call allocate_gwdo
call allocate_gwdo(block%configs)
!$OMP PARALLEL DO
do thread=1,nThreads
call driver_gwdo(itimestep,block%configs,mesh,sfc_input,diag_physics,tend_physics, &
cellSolveThreadStart(thread),cellSolveThreadEnd(thread))
call driver_gwdo(itimestep,block%configs,mesh,sfc_input,ngw_input,diag_physics, &
tend_physics,cellSolveThreadStart(thread),cellSolveThreadEnd(thread))
end do
!$OMP END PARALLEL DO
call deallocate_gwdo
call deallocate_gwdo(block%configs)
endif

!call to convection scheme:
Expand Down
Loading