Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
7 changes: 7 additions & 0 deletions src/core_atmosphere/Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,12 @@ repo_url = https://github.com/NOAA-GSL/UGWP.git
tag = MPAS_20241223
required = True

[TEMPO_MP]
local_path = ./physics_noaa/TEMPO
protocol = git
repo_url = https://github.com/NCAR/TEMPO.git
tag = tempo_v3.0.3
required = True

[externals_description]
schema_version = 1.0.0
162 changes: 95 additions & 67 deletions src/core_atmosphere/Registry.xml

Large diffs are not rendered by default.

10 changes: 7 additions & 3 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_TEMPO core_physics_wrf core_physics_noahmp core_physics

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

core_TEMPO: core_physics_init
(cd physics_noaa/TEMPO; $(MAKE) -f Makefile.mpas)

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

Expand Down Expand Up @@ -254,6 +257,7 @@ 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/TEMPO ]; then cd physics_noaa/TEMPO; $(MAKE) -f Makefile.mpas clean; fi )
@# Certain systems with intel compilers generate *.i files
@# This removes them during the clean process
$(RM) *.i
Expand All @@ -262,7 +266,7 @@ clean:
$(RM) $@ $*.mod
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
$(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I./physics_mmm -I./physics_wrf -I./physics_noaa/TEMPO -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./physics_noaa/UGWP -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_noaa/TEMPO -I./physics_noahmp -I./physics_noahmp/utility -I./physics_noahmp/drivers/mpas -I./physics_noahmp/src -I./physics_noaa/UGWP -I.. -I../../framework -I../../external/esmf_time_f90
endif
17 changes: 17 additions & 0 deletions src/core_atmosphere/physics/Registry_tempo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- ========================================================================================================= -->
<!-- CONFIGURATION OPTIONS AND ARRAYS SPECIFIC TO TEMPO: -->
<!-- ========================================================================================================= -->

<nml_record name="physics_mp_tempo" in_defaults="true">
<nml_option name="config_tempo_aerosolaware" type="logical" default_value="true" in_defaults="false"
units="-"
description="Logical flag to turn on/off prognostic cloud droplet and aerosol number concentrations"
possible_values=".true. or .false."/>

<nml_option name="config_tempo_hailaware" type="logical" default_value="true" in_defaults="false"
units="-"
description="Logical flag to turn on/off prognostic graupel number concentration and rime density"
possible_values=".true. or .false."/>
</nml_record>

<!-- ========================================================================================================= -->
1 change: 1 addition & 0 deletions src/core_atmosphere/physics/mpas_atmphys_control.F
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ subroutine physics_namelist_check(configs)
config_microp_scheme .eq. 'mp_kessler' .or. &
config_microp_scheme .eq. 'mp_thompson' .or. &
config_microp_scheme .eq. 'mp_thompson_aerosols' .or. &
config_microp_scheme .eq. 'mp_tempo' .or. &
config_microp_scheme .eq. 'mp_wsm6')) then

write(mpas_err_message,'(A,A20)') 'illegal value for config_microp_scheme:', &
Expand Down
153 changes: 149 additions & 4 deletions src/core_atmosphere/physics/mpas_atmphys_driver_microphysics.F
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ module mpas_atmphys_driver_microphysics
use module_mp_wsm6,only: wsm6
use mp_wsm6,only: mp_wsm6_init,refl10cm_wsm6

use module_mp_tempo_cfgs,only: ty_tempo_cfgs
use module_mp_tempo_driver,only: tempo_init, tempo_run, &
ty_tempo_driver_diags, tempo_aerosol_surface_emissions

implicit none
private
Expand Down Expand Up @@ -89,7 +92,7 @@ module mpas_atmphys_driver_microphysics

!--- initialization option for WSM6 from WRF version 3.8.1. this option could also be set as a namelist parameter.
integer,parameter:: hail_opt = 0

type(ty_tempo_cfgs) tempo_cfgs

contains

Expand All @@ -103,10 +106,13 @@ subroutine allocate_microphysics(configs)

!local pointers:
character(len=StrKIND),pointer:: microp_scheme
logical,pointer:: config_tempo_aerosolaware, config_tempo_hailaware

!-----------------------------------------------------------------------------------------------------------------

call mpas_pool_get_config(configs,'config_microp_scheme',microp_scheme)
call mpas_pool_get_config(configs,'config_tempo_aerosolaware',config_tempo_aerosolaware)
call mpas_pool_get_config(configs,'config_tempo_hailaware',config_tempo_hailaware)

!sounding variables:
if(.not.allocated(rho_p) ) allocate(rho_p(ims:ime,kms:kme,jms:jme) )
Expand Down Expand Up @@ -149,6 +155,41 @@ subroutine allocate_microphysics(configs)
if(.not.allocated(rainprod_p)) allocate(rainprod_p(ims:ime,kms:kme,jms:jme))
if(.not.allocated(evapprod_p)) allocate(evapprod_p(ims:ime,kms:kme,jms:jme))

case ("mp_tempo")
!mass mixing ratios:
if(.not.allocated(qi_p)) allocate(qi_p(ims:ime,kms:kme,jms:jme))
if(.not.allocated(qs_p)) allocate(qs_p(ims:ime,kms:kme,jms:jme))
if(.not.allocated(qg_p)) allocate(qg_p(ims:ime,kms:kme,jms:jme))

if(.not.allocated(ni_p) ) allocate(ni_p(ims:ime,kms:kme,jms:jme))
if(.not.allocated(nr_p) ) allocate(nr_p(ims:ime,kms:kme,jms:jme))
if(.not.allocated(refl10cm_p) ) allocate(refl10cm_p(ims:ime,kms:kme,jms:jme))

if(config_tempo_aerosolaware) then
if(.not.allocated(nifa2d_p)) allocate(nifa2d_p(ims:ime,jms:jme))
if(.not.allocated(nwfa2d_p)) allocate(nwfa2d_p(ims:ime,jms:jme))
if(.not.allocated(nc_p) ) allocate(nc_p(ims:ime,kms:kme,jms:jme) )
if(.not.allocated(nifa_p) ) allocate(nifa_p(ims:ime,kms:kme,jms:jme))
if(.not.allocated(nwfa_p) ) allocate(nwfa_p(ims:ime,kms:kme,jms:jme))
endif

if(config_tempo_hailaware) then
if(.not.allocated(ng_p) ) allocate(ng_p(ims:ime,kms:kme,jms:jme) )
if(.not.allocated(volg_p) ) allocate(volg_p(ims:ime,kms:kme,jms:jme))
endif

!surface precipitation:
if(.not.allocated(sr_p) ) allocate(sr_p(ims:ime,jms:jme) )
if(.not.allocated(snownc_p) ) allocate(snownc_p(ims:ime,jms:jme) )
if(.not.allocated(snowncv_p) ) allocate(snowncv_p(ims:ime,jms:jme) )
if(.not.allocated(graupelnc_p) ) allocate(graupelnc_p(ims:ime,jms:jme) )
if(.not.allocated(graupelncv_p)) allocate(graupelncv_p(ims:ime,jms:jme))

!cloud water,cloud ice,and snow effective radii:
if(.not.allocated(recloud_p)) allocate(recloud_p(ims:ime,kms:kme,jms:jme))
if(.not.allocated(reice_p) ) allocate(reice_p(ims:ime,kms:kme,jms:jme) )
if(.not.allocated(resnow_p) ) allocate(resnow_p(ims:ime,kms:kme,jms:jme) )

microp2_select: select case(trim(microp_scheme))
case("mp_thompson","mp_thompson_aerosols")
if(.not.allocated(ntc_p)) allocate(ntc_p(ims:ime,jms:jme))
Expand Down Expand Up @@ -184,11 +225,14 @@ subroutine deallocate_microphysics(configs)

!local pointers:
character(len=StrKIND),pointer:: microp_scheme
logical,pointer:: config_tempo_aerosolaware, config_tempo_hailaware

!-----------------------------------------------------------------------------------------------------------------

call mpas_pool_get_config(configs,'config_microp_scheme',microp_scheme)

call mpas_pool_get_config(configs,'config_tempo_aerosolaware',config_tempo_aerosolaware)
call mpas_pool_get_config(configs,'config_tempo_hailaware',config_tempo_hailaware)

!sounding variables:
if(allocated(rho_p) ) deallocate(rho_p )
if(allocated(th_p) ) deallocate(th_p )
Expand Down Expand Up @@ -230,6 +274,41 @@ subroutine deallocate_microphysics(configs)
if(allocated(rainprod_p)) deallocate(rainprod_p)
if(allocated(evapprod_p)) deallocate(evapprod_p)

case ("mp_tempo")
!mass mixing ratios:
if(allocated(qi_p)) deallocate(qi_p)
if(allocated(qs_p)) deallocate(qs_p)
if(allocated(qg_p)) deallocate(qg_p)

if(allocated(ni_p) ) deallocate(ni_p )
if(allocated(nr_p) ) deallocate(nr_p )
if(allocated(refl10cm_p) ) deallocate(refl10cm_p)

if(config_tempo_aerosolaware) then
if(allocated(nifa2d_p)) deallocate(nifa2d_p)
if(allocated(nwfa2d_p)) deallocate(nwfa2d_p)
if(allocated(nc_p) ) deallocate(nc_p )
if(allocated(nifa_p) ) deallocate(nifa_p )
if(allocated(nwfa_p) ) deallocate(nwfa_p )
endif

if(config_tempo_hailaware) then
if(allocated(ng_p) ) deallocate(ng_p )
if(allocated(volg_p) ) deallocate(volg_p )
endif

!surface precipitation:
if(allocated(sr_p) ) deallocate(sr_p )
if(allocated(snownc_p) ) deallocate(snownc_p )
if(allocated(snowncv_p) ) deallocate(snowncv_p )
if(allocated(graupelnc_p) ) deallocate(graupelnc_p )
if(allocated(graupelncv_p)) deallocate(graupelncv_p)

!cloud water,cloud ice,and snow effective radii:
if(allocated(recloud_p)) deallocate(recloud_p)
if(allocated(reice_p) ) deallocate(reice_p )
if(allocated(resnow_p) ) deallocate(resnow_p )

microp2_select: select case(trim(microp_scheme))
case("mp_thompson","mp_thompson_aerosols")
if(allocated(ntc_p)) deallocate(ntc_p)
Expand Down Expand Up @@ -274,6 +353,7 @@ subroutine init_microphysics(dminfo,configs,mesh,state,time_lev,sfc_input,diag_p
!local pointer:
logical,pointer:: do_restart
character(len=StrKIND),pointer:: microp_scheme
logical,pointer:: config_tempo_aerosolaware,config_tempo_hailaware

!CCPP-compliant flags:
character(len=StrKIND):: errmsg
Expand All @@ -289,12 +369,22 @@ subroutine init_microphysics(dminfo,configs,mesh,state,time_lev,sfc_input,diag_p

call mpas_pool_get_config(configs,'config_microp_scheme',microp_scheme)
call mpas_pool_get_config(configs,'config_do_restart' ,do_restart )
call mpas_pool_get_config(configs,'config_tempo_aerosolaware',config_tempo_aerosolaware)
call mpas_pool_get_config(configs,'config_tempo_hailaware',config_tempo_hailaware)

microp_select: select case(trim(microp_scheme))
case("mp_thompson","mp_thompson_aerosols")
call thompson_init(l_mp_tables)
call init_thompson_clouddroplets_forMPAS(mesh,sfc_input,diag_physics)

case("mp_tempo")
call tempo_init(aerosolaware_flag=config_tempo_aerosolaware, &
hailaware_flag=config_tempo_hailaware, tempo_cfgs=tempo_cfgs)

if(config_tempo_aerosolaware) then
call init_tempo_aerosols_forMPAS(do_restart,dminfo,mesh,state,time_lev,diag_physics)
endif

microp2_select: select case(trim(microp_scheme))
case("mp_thompson_aerosols")
call init_thompson_aerosols_forMPAS(do_restart,dminfo,mesh,state,time_lev,diag_physics)
Expand Down Expand Up @@ -339,11 +429,14 @@ subroutine driver_microphysics(configs,mesh,state,time_lev,diag,diag_physics,ten

!local variables and arrays:
integer:: istep
integer:: i,j,k

!CCPP-compliant flags:
character(len=StrKIND):: errmsg
integer:: errflg

type(ty_tempo_driver_diags) :: tempo_driver_diags

!-----------------------------------------------------------------------------------------------------------------
!call mpas_log_write('')
!call mpas_log_write('---enter subroutine driver_microphysics:')
Expand Down Expand Up @@ -384,6 +477,58 @@ subroutine driver_microphysics(configs,mesh,state,time_lev,diag,diag_physics,ten
)
call mpas_timer_stop('mp_kessler')

case ("mp_tempo")
if (allocated(nwfa_p) .and. allocated(nwfa2d_p)) then
call tempo_aerosol_surface_emissions(dt=dt_microp, nwfa=nwfa_p, nwfa2d=nwfa2d_p, &
ims=ims, ime=ime, jms=jms, jme=jme, kms=kms, kme=kme, kts=kts)
endif

call mpas_timer_start('mp_tempo')

istep = 1
do while (istep .le. n_microp)
call tempo_run( tempo_cfgs=tempo_cfgs, &
dt = dt_microp , itimestep = itimestep , &
th = th_p , qv = qv_p , qc = qc_p , &
qr = qr_p , qi = qi_p , qs = qs_p , &
qg = qg_p , ni = ni_p , nr = nr_p , &
ng = ng_p , qb = volg_p , w = w_p , &
nc = nc_p , nwfa = nwfa_p , nifa = nifa_p , &
pii = pi_p , p = pres_p , dz = dz_p , &
ids = ids , ide = ide , jds = jds , jde = jde , kds = kds , kde = kde , &
ims = ims , ime = ime , jms = jms , jme = jme , kms = kms , kme = kme , &
its = its , ite = ite , jts = jts , jte = jte , kts = kts , kte = kte , &
tempo_diags = tempo_driver_diags)
do j = jts, jte
do i = its, ite
! precipitation variables are summed in case of multiple calls when n_microp > 1
snowncv_p(i,j) = snowncv_p(i,j) + tempo_driver_diags%ice_liquid_equiv_precip(i,j) + &
tempo_driver_diags%snow_liquid_equiv_precip(i,j)
snownc_p(i,j) = snownc_p(i,j) + tempo_driver_diags%ice_liquid_equiv_precip(i,j) + &
tempo_driver_diags%snow_liquid_equiv_precip(i,j)
graupelncv_p(i,j) = graupelncv_p(i,j) + tempo_driver_diags%graupel_liquid_equiv_precip(i,j)
graupelnc_p(i,j) = graupelnc_p(i,j) + tempo_driver_diags%graupel_liquid_equiv_precip(i,j)
rainncv_p(i,j) = rainncv_p(i,j) + tempo_driver_diags%rain_precip(i,j) + &
tempo_driver_diags%ice_liquid_equiv_precip(i,j) + &
tempo_driver_diags%snow_liquid_equiv_precip(i,j) + &
tempo_driver_diags%graupel_liquid_equiv_precip(i,j)
rainnc_p(i,j) = rainnc_p(i,j) + tempo_driver_diags%rain_precip(i,j) + &
tempo_driver_diags%ice_liquid_equiv_precip(i,j) + &
tempo_driver_diags%snow_liquid_equiv_precip(i,j) + &
tempo_driver_diags%graupel_liquid_equiv_precip(i,j)
sr_p(i,j) = tempo_driver_diags%frozen_fraction(i,j)
do k = kts, kte
refl10cm_p(i,k,j) = tempo_driver_diags%refl10cm(i,k,j)
recloud_p(i,k,j) = tempo_driver_diags%re_cloud(i,k,j)
reice_p(i,k,j) = tempo_driver_diags%re_ice(i,k,j)
resnow_p(i,k,j) = tempo_driver_diags%re_snow(i,k,j)
enddo
enddo
enddo
istep = istep + 1
enddo
call mpas_timer_stop('mp_tempo')

case ("mp_thompson")
call mpas_timer_start('mp_thompson')
istep = 1
Expand Down Expand Up @@ -541,7 +686,7 @@ subroutine precip_from_MPAS(configs,diag_physics,its,ite)

!variables specific to different cloud microphysics schemes:
microp_select: select case(trim(microp_scheme))
case ("mp_thompson","mp_thompson_aerosols","mp_wsm6")
case ("mp_thompson","mp_thompson_aerosols","mp_wsm6","mp_tempo")
do j = jts, jte
do i = its, ite
snowncv_p(i,j) = 0._RKIND
Expand Down Expand Up @@ -633,7 +778,7 @@ subroutine precip_to_MPAS(configs,diag_physics,its,ite)

!variables specific to different cloud microphysics schemes:
microp_select: select case(trim(microp_scheme))
case ("mp_thompson","mp_thompson_aerosols","mp_wsm6")
case ("mp_thompson","mp_thompson_aerosols","mp_wsm6","mp_tempo")
do j = jts,jte
do i = its,ite
!time-step precipitation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ subroutine radiation_lw_from_MPAS(xtime_s,configs,mesh,state,time_lev,diag_physi
radiation_lw_select: select case (trim(radt_lw_scheme))
case("rrtmg_lw")
microp_select: select case(microp_scheme)
case("mp_thompson","mp_thompson_aerosols","mp_wsm6")
case("mp_thompson","mp_thompson_aerosols","mp_wsm6","mp_tempo")
if(config_microp_re) then
call mpas_pool_get_array(diag_physics,'re_cloud',re_cloud)
call mpas_pool_get_array(diag_physics,'re_ice' ,re_ice )
Expand Down Expand Up @@ -684,7 +684,7 @@ subroutine radiation_lw_to_MPAS(configs,diag_physics,tend_physics,its,ite)
case("rrtmg_lw")

microp_select: select case(microp_scheme)
case("mp_thompson","mp_thompson_aerosols","mp_wsm6")
case("mp_thompson","mp_thompson_aerosols","mp_wsm6","mp_tempo")
call mpas_pool_get_array(diag_physics,'rre_cloud',rre_cloud)
call mpas_pool_get_array(diag_physics,'rre_ice' ,rre_ice )
call mpas_pool_get_array(diag_physics,'rre_snow' ,rre_snow )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ subroutine radiation_sw_from_MPAS(configs,mesh,state,time_lev,diag_physics,atm_i

case("rrtmg_sw")
microp_select: select case(microp_scheme)
case("mp_thompson","mp_thompson_aerosols","mp_wsm6")
case("mp_thompson","mp_thompson_aerosols","mp_wsm6","mp_tempo")
if(config_microp_re) then
call mpas_pool_get_array(diag_physics,'re_cloud',re_cloud)
call mpas_pool_get_array(diag_physics,'re_ice' ,re_ice )
Expand Down
Loading