Skip to content
Draft
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
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/AndersJensen-NOAA/TEMPO.git
tag = v3.0.0_i
required = True

[externals_description]
schema_version = 1.0.0
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
141 changes: 140 additions & 1 deletion 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,12 @@ subroutine allocate_microphysics(configs)

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

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

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

!sounding variables:
if(.not.allocated(rho_p) ) allocate(rho_p(ims:ime,kms:kme,jms:jme) )
Expand Down Expand Up @@ -149,13 +154,35 @@ 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))

!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))
if(.not.allocated(muc_p)) allocate(muc_p(ims:ime,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))

case("mp_tempo")
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))

microp3_select: select case(trim(microp_scheme))
case("mp_thompson_aerosols")
if(.not.allocated(nifa2d_p)) allocate(nifa2d_p(ims:ime,jms:jme))
Expand All @@ -164,6 +191,15 @@ subroutine allocate_microphysics(configs)
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))

case("mp_tempo")
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

case default
end select microp3_select

Expand All @@ -184,10 +220,12 @@ subroutine deallocate_microphysics(configs)

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

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

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

!sounding variables:
if(allocated(rho_p) ) deallocate(rho_p )
Expand Down Expand Up @@ -230,13 +268,35 @@ 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)

!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)
if(allocated(muc_p)) deallocate(muc_p)
if(allocated(ni_p) ) deallocate(ni_p )
if(allocated(nr_p) ) deallocate(nr_p )

case("mp_tempo")
if(allocated(ni_p) ) deallocate(ni_p )
if(allocated(nr_p) ) deallocate(nr_p )

microp3_select: select case(trim(microp_scheme))
case("mp_thompson_aerosols")
if(allocated(nifa2d_p)) deallocate(nifa2d_p)
Expand All @@ -245,6 +305,15 @@ subroutine deallocate_microphysics(configs)
if(allocated(nifa_p) ) deallocate(nifa_p )
if(allocated(nwfa_p) ) deallocate(nwfa_p )

case("mp_tempo")
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

case default
end select microp3_select

Expand Down Expand Up @@ -274,6 +343,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

!CCPP-compliant flags:
character(len=StrKIND):: errmsg
Expand All @@ -289,15 +359,24 @@ 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)

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, &
tempo_cfgs=tempo_cfgs)

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)
case("mp_tempo")
if(config_tempo_aerosolaware) then
call init_tempo_aerosols_forMPAS(do_restart,dminfo,mesh,state,time_lev,diag_physics)
endif

case default
end select microp2_select
Expand Down Expand Up @@ -339,11 +418,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 +466,63 @@ 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 , &
w = w_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)
!frainnc_p = frainnc_p + tempo_driver_diags%frz_rain_precip
!max_hail_diameter_sfc_p = tempo_driver_diags%max_hail_diameter_sfc
!max_hail_diameter_column_p = tempo_driver_diags%max_hail_diameter_column
do k = kts, kte
!refl10cm_p = tempo_driver_diags%refl10cm
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
Loading