Skip to content

Updates to Thompson-Eidhammer microphysics and MPAS to support future microphysics features #2

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

Merged
merged 19 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
496767a
Add microphysics submodule and updated graupel lookup table support (#1)
AndersJensen-NOAA Mar 15, 2024
aa543bb
Add aerosol aware microphysics capability (#2)
AndersJensen-NOAA Mar 15, 2024
fd985fb
Update submodule
AndersJensen-NOAA Mar 15, 2024
7b49ec7
Fix link to microphysics aerosol tables
AndersJensen-NOAA Mar 15, 2024
3402d6c
Add water- and ice-friendly aerosols to model for transport (#3)
AndersJensen-NOAA Mar 15, 2024
a775614
Update pointer for microphysics
AndersJensen-NOAA Mar 15, 2024
dfe8cad
Update pointer to microphysics submodule
AndersJensen-NOAA Mar 15, 2024
0629b0d
Add microphysics aerosol information to LBCs
AndersJensen-NOAA Mar 15, 2024
9e5e66b
Add aerosol-aware microphysics to LBCs (#4)
AndersJensen-NOAA Mar 15, 2024
a4bb22d
Time interpolation for microphysics aerosols ICs
AndersJensen-NOAA Mar 22, 2024
5780425
Merge with develop
AndersJensen-NOAA Mar 22, 2024
c6d1e73
Add time interpolation for microphysics aerosols to LBCs
AndersJensen-NOAA Mar 22, 2024
7453933
Aerosol time interpolation (#5)
AndersJensen-NOAA Mar 23, 2024
439f477
Merge remote-tracking branch 'origin/aerosol_time_interp' into gsl/de…
AndersJensen-NOAA Mar 25, 2024
8057815
Nc microphysics (#6)
AndersJensen-NOAA Mar 27, 2024
f7b6339
point to develop branch of Thompson submodule
AndersJensen-NOAA Mar 27, 2024
58b6372
Import nwfa and nifa into microphysics (#7)
AndersJensen-NOAA Mar 28, 2024
d89a93b
Add microphysics submodule makefile (#8)
AndersJensen-NOAA Mar 29, 2024
a5fe535
Bug fix in Makefile to deal with old version of microphysics
AndersJensen-NOAA Mar 29, 2024
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
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "src/core_atmosphere/physics/GSL_cloud_physics"]
path = src/core_atmosphere/physics/GSL_cloud_physics
url = https://github.com/AndersJensen-NOAA/GSL_cloud_physics.git
branch = develop
33 changes: 33 additions & 0 deletions src/core_atmosphere/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1480,9 +1480,21 @@
description="Cloud ice number concentration"
packages="bl_mynn_in;mp_thompson_in"/>

<var name="nc" array_group="number" units="nb kg^{-1}"
description="Cloud number concentration"
packages="mp_thompson_in"/>

<var name="nr" array_group="number" units="nb kg^{-1}"
description="Rain number concentration"
packages="mp_thompson_in"/>

<var name="nwfa" array_group="passive" units="nb kg^{-1}"
description="Number of water-friendly aerosols for microphysics"
packages="mp_thompson_in"/>

<var name="nifa" array_group="passive" units="nb kg^{-1}"
description="Number of ice-friendly aerosols for microphysics"
packages="mp_thompson_in"/>
</var_array>
#endif

Expand Down Expand Up @@ -1802,9 +1814,21 @@
description="Tendency of cloud ice number concentration multiplied by dry air density divided by d(zeta)/dz"
packages="bl_mynn_in;mp_thompson_in"/>

<var name="tend_nc" name_in_code="nc" array_group="number" units="nb m^{-3} s^{-1}"
description="Tendency of cloud number concentration multiplied by dry air density divided by d(zeta)/dz"
packages="mp_thompson_in"/>

<var name="tend_nr" name_in_code="nr" array_group="number" units="nb m^{-3} s^{-1}"
description="Tendency of rain number concentration multiplied by dry air density divided by d(zeta)/dz"
packages="mp_thompson_in"/>

<var name="tend_nwfa" name_in_code="nwfa" array_group="passive" units="nb m^{-3} s^{-1}"
description="Tendency of water-friendly aerosols multiplied by dry air density divided by d(zeta)/dz"
packages="mp_thompson_in"/>

<var name="tend_nifa" name_in_code="nifa" array_group="passive" units="nb m^{-3} s^{-1}"
description="Tendency of ice-friendly aerosols multiplied by dry air density divided by d(zeta)/dz"
packages="mp_thompson_in"/>
</var_array>
#endif
</var_struct>
Expand Down Expand Up @@ -1858,11 +1882,20 @@
<var name="lbc_qg" name_in_code="qg" array_group="moist" packages="mp_thompson_in;mp_wsm6_in" units="kg kg^{-1} s^{-1}"
description="Lateral boundary tendency of graupel mixing ratio"/>

<var name="lbc_nc" name_in_code="nc" array_group="number" packages="mp_thompson_in" units="m^{-3} s^{-1}"
description="Lateral boundary tendency of cloud number concentration"/>

<var name="lbc_nr" name_in_code="nr" array_group="number" packages="mp_thompson_in" units="m^{-3} s^{-1}"
description="Lateral boundary tendency of rain number concentration"/>

<var name="lbc_ni" name_in_code="ni" array_group="number" packages="bl_mynn_in;mp_thompson_in" units="m^{-3} s^{-1}"
description="Lateral boundary tendency of ice number concentration"/>

<var name="lbc_nwfa" name_in_code="nwfa" array_group="passive" packages="mp_thompson_in" units="m^{-3} s^{-1}"
description="Lateral boundary tendency of wfa"/>

<var name="lbc_nifa" name_in_code="nifa" array_group="passive" packages="mp_thompson_in" units="m^{-3} s^{-1}"
description="Lateral boundary tendency of ifa"/>
</var_array>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndersJensen-NOAA add "bl_mynn_in" as well in the packages. From what I gather, I think it matters for making sure these arrays are used in the pbl driver, i.e., see the "ni" portions.

</var_struct>

Expand Down
34 changes: 32 additions & 2 deletions src/core_atmosphere/dynamics/mpas_atm_time_integration.F
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ subroutine atm_srk3(domain, dt, itimestep, exchange_halo_group)
character (len=StrKIND), pointer :: config_convection_scheme

integer, pointer :: num_scalars, index_qv, nCells, nCellsSolve, nEdges, nEdgesSolve, nVertices, nVerticesSolve, nVertLevels
integer, pointer :: index_qc, index_qr, index_qi, index_qs, index_qg, index_nr, index_ni
integer, pointer :: index_qc, index_qr, index_qi, index_qs, index_qg, index_nc, index_nr, index_ni, index_nwfa, index_nifa

character(len=StrKIND), pointer :: config_IAU_option

Expand Down Expand Up @@ -468,9 +468,12 @@ subroutine atm_srk3(domain, dt, itimestep, exchange_halo_group)
call mpas_pool_get_dimension(state, 'index_qr', index_qr)
call mpas_pool_get_dimension(state, 'index_qi', index_qi)
call mpas_pool_get_dimension(state, 'index_qs', index_qs)
call mpas_pool_get_dimension(state, 'index_qg', index_qg)
call mpas_pool_get_dimension(state, 'index_qg', index_qg)
call mpas_pool_get_dimension(state, 'index_nc', index_nc)
call mpas_pool_get_dimension(state, 'index_nr', index_nr)
call mpas_pool_get_dimension(state, 'index_ni', index_ni)
call mpas_pool_get_dimension(state, 'index_nwfa', index_nwfa)
call mpas_pool_get_dimension(state, 'index_nifa', index_nifa)
endif

!
Expand Down Expand Up @@ -921,12 +924,21 @@ subroutine atm_srk3(domain, dt, itimestep, exchange_halo_group)
if (index_qg > 0) then
scalars_driving(index_qg,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'qg', rk_timestep(rk_step) )
end if
if (index_nc > 0) then
scalars_driving(index_nc,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nc', rk_timestep(rk_step) )
end if
if (index_nr > 0) then
scalars_driving(index_nr,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nr', rk_timestep(rk_step) )
end if
if (index_ni > 0) then
scalars_driving(index_ni,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'ni', rk_timestep(rk_step) )
end if
if (index_nwfa > 0) then
scalars_driving(index_nwfa,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nwfa', rk_timestep(rk_step) )
end if
if (index_nifa > 0) then
scalars_driving(index_nifa,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nifa', rk_timestep(rk_step) )
end if

!$OMP PARALLEL DO
do thread=1,nThreads
Expand Down Expand Up @@ -1088,12 +1100,21 @@ subroutine atm_srk3(domain, dt, itimestep, exchange_halo_group)
if (index_qg > 0) then
scalars_driving(index_qg,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'qg', rk_timestep(rk_step) )
end if
if (index_nc > 0) then
scalars_driving(index_nc,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nc', rk_timestep(rk_step) )
end if
if (index_nr > 0) then
scalars_driving(index_nr,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nr', rk_timestep(rk_step) )
end if
if (index_ni > 0) then
scalars_driving(index_ni,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'ni', rk_timestep(rk_step) )
end if
if (index_nwfa > 0) then
scalars_driving(index_nwfa,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nwfa', rk_timestep(rk_step) )
end if
if (index_nifa > 0) then
scalars_driving(index_nifa,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nifa', rk_timestep(rk_step) )
end if

!$OMP PARALLEL DO
do thread=1,nThreads
Expand Down Expand Up @@ -1248,12 +1269,21 @@ subroutine atm_srk3(domain, dt, itimestep, exchange_halo_group)
if (index_qg > 0) then
scalars_driving(index_qg,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'qg', dt )
end if
if (index_nc > 0) then
scalars_driving(index_nc,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nc', dt )
end if
if (index_nr > 0) then
scalars_driving(index_nr,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nr', dt )
end if
if (index_ni > 0) then
scalars_driving(index_ni,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'ni', dt )
end if
if (index_nwfa > 0) then
scalars_driving(index_nwfa,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nwfa', dt )
end if
if (index_nifa > 0) then
scalars_driving(index_nifa,1:nVertLevels,1:nCells+1) = mpas_atm_get_bdy_state( clock, block, nVertLevels, nCells, 'nifa', dt )
end if

!$OMP PARALLEL DO
do thread=1,nThreads
Expand Down
1 change: 1 addition & 0 deletions src/core_atmosphere/physics/GSL_cloud_physics
Submodule GSL_cloud_physics added at dfbbe2
24 changes: 19 additions & 5 deletions src/core_atmosphere/physics/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.SUFFIXES: .F .o
.SUFFIXES: .F .o .F90

ifeq ($(CORE),atmosphere)
COREDEF = -Dmpas
endif

all: lookup_tables core_physics_init core_physics_mmm core_physics_wrf core_physics
all: lookup_tables core_physics_init core_physics_mmm core_microphysics core_physics_wrf core_physics

dummy:
echo "****** compiling physics ******"
Expand Down Expand Up @@ -52,13 +52,17 @@ lookup_tables:
core_physics_mmm: core_physics_init
(cd physics_mmm; $(MAKE) all)

core_microphysics: core_physics_init core_physics_mmm
(if [ -f physics_wrf/module_mp_thompson.F ]; then rm physics_wrf/module_mp_thompson.F; else echo "No old module_mp_thompson.F file found"; fi)
(cd GSL_cloud_physics; cp ./drivers/mpas/module_mp_thompson.F90 .; $(MAKE) all COREDEF="$(COREDEF)")

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

core_physics_init: $(OBJS_init)
ar -ru libphys.a $(OBJS_init)

core_physics: core_physics_wrf
core_physics: core_microphysics core_physics_wrf
($(MAKE) phys_interface COREDEF="$(COREDEF)")
ar -ru libphys.a $(OBJS)

Expand Down Expand Up @@ -199,6 +203,7 @@ clean:
$(RM) *.o *.mod *.f90 libphys.a
( cd physics_wrf; $(MAKE) clean )
( cd physics_mmm; $(MAKE) clean )
( cd GSL_cloud_physics; $(MAKE) clean )
@# Certain systems with intel compilers generate *.i files
@# This removes them during the clean process
$(RM) *.i
Expand All @@ -207,7 +212,16 @@ 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.. -I../../framework -I../../external/esmf_time_f90
$(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I./physics_mmm -I./physics_wrf -I./GSL_cloud_physics -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./GSL_cloud_physics -I.. -I../../framework -I../../external/esmf_time_f90
endif

.F90.o:
$(RM) $@ $*.mod
ifeq "$(GEN_F90)" "true"
$(CPP) $(CPPFLAGS) $(COREDEF) $(HYDROSTATIC) $(CPPINCLUDES) $< > $*.f90
$(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I./physics_mmm -I./physics_wrf -I./GSL_cloud_physics -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.. -I../../framework -I../../external/esmf_time_f90
$(FC) $(CPPFLAGS) $(COREDEF) $(HYDROSATIC) $(FFLAGS) -c $*.F90 $(CPPINCLUDES) $(FCINCLUDES) -I./physics_mmm -I./physics_wrf -I./GSL_cloud_physics -I.. -I../../framework -I../../external/esmf_time_f90
endif
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module mpas_atmphys_driver_microphysics
!wrf physics:
use module_mp_kessler
use module_mp_thompson
use module_mp_thompson_utils
use module_mp_wsm6,only: wsm6
use mp_wsm6,only: mp_wsm6_init,refl10cm_wsm6

Expand Down Expand Up @@ -153,7 +154,10 @@ subroutine allocate_microphysics(configs)
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(nc_p) ) allocate(nc_p(ims:ime,kms:kme,jms:jme))
if(.not.allocated(nr_p) ) allocate(nr_p(ims:ime,kms:kme,jms:jme))
if(.not.allocated(nwfa_p) ) allocate(nwfa_p(ims:ime,kms:kme,jms:jme))
if(.not.allocated(nifa_p) ) allocate(nifa_p(ims:ime,kms:kme,jms:jme))

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))
Expand Down Expand Up @@ -227,7 +231,10 @@ subroutine deallocate_microphysics(configs)
if(allocated(ntc_p)) deallocate(ntc_p)
if(allocated(muc_p)) deallocate(muc_p)
if(allocated(ni_p) ) deallocate(ni_p )
if(allocated(nc_p) ) deallocate(nc_p )
if(allocated(nr_p) ) deallocate(nr_p )
if(allocated(nwfa_p) ) deallocate(nwfa_p )
if(allocated(nifa_p) ) deallocate(nifa_p )

if(allocated(rainprod_p)) deallocate(rainprod_p)
if(allocated(evapprod_p)) deallocate(evapprod_p)
Expand Down Expand Up @@ -365,6 +372,7 @@ subroutine driver_microphysics(configs,mesh,state,time_lev,diag,diag_physics,ten
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 , &
nc = nc_p , nwfa = nwfa_p , nifa = nifa_p , &
pii = pi_p , p = pres_p , dz = dz_p , &
w = w_p , dt_in = dt_microp , itimestep = itimestep , &
rainnc = rainnc_p , rainncv = rainncv_p , snownc = snownc_p , &
Expand Down
2 changes: 1 addition & 1 deletion src/core_atmosphere/physics/mpas_atmphys_finalize.F
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ subroutine mp_thompson_deallocate
if(allocated(tcg_racg) ) deallocate(tcg_racg )
if(allocated(tmr_racg) ) deallocate(tmr_racg )
if(allocated(tcr_gacr) ) deallocate(tcr_gacr )
if(allocated(tmg_gacr) ) deallocate(tmg_gacr )
! if(allocated(tmg_gacr) ) deallocate(tmg_gacr )
if(allocated(tnr_racg) ) deallocate(tnr_racg )
if(allocated(tnr_gacr) ) deallocate(tnr_gacr )
if(allocated(tcs_racs1)) deallocate(tcs_racs1)
Expand Down
Loading