Skip to content

Commit 48b1934

Browse files
committed
Merge branch 'NSF-MPAS/physics_fix_tend_scalars' into hotfix-v8.2.1 (PR #1215)
This merge fixes an issue that prevented the use of the MYNN PBL scheme (e.g., through the selection of the 'convection_permitting' suite) without the use of the aerosol-aware Thompson cloud microphysics scheme.
2 parents a11aef6 + bbcb89d commit 48b1934

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

src/core_atmosphere/Registry.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@
15781578

15791579
<var name="nc" array_group="number" units="nb kg^{-1}"
15801580
description="Cloud water number concentration"
1581-
packages="bl_mynn_in;mp_thompson_aers_in"/>
1581+
packages="mp_thompson_aers_in"/>
15821582

15831583
<var name="nifa" array_group="number" units="nb kg^{-1}"
15841584
description="Ice-friendly aerosol number concentration"
@@ -1920,7 +1920,7 @@
19201920

19211921
<var name="tend_nc" name_in_code="nc" array_group="number" units="nb m^{-3} s^{-1}"
19221922
description="Tendency of cloud water number concentration multiplied by dry air density divided by d(zeta)/dz"
1923-
packages="bl_mynn_in;mp_thompson_aers_in"/>
1923+
packages="mp_thompson_aers_in"/>
19241924

19251925
<var name="tend_nifa" name_in_code="nifa" array_group="number" units="nb m^{-3} s^{-1}"
19261926
description="Tendency of ice-friendly aerosol number concentration multiplied by dry air density divided by d(zeta)/dz"

src/core_atmosphere/physics/mpas_atmphys_interface.F

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ subroutine allocate_forall_physics(configs)
127127
case("bl_mynn")
128128
if(.not.allocated(nc_p)) allocate(nc_p(ims:ime,kms:kme,jms:jme))
129129
if(.not.allocated(ni_p)) allocate(ni_p(ims:ime,kms:kme,jms:jme))
130+
if(.not.allocated(nifa_p)) allocate(nifa_p(ims:ime,kms:kme,jms:jme))
131+
if(.not.allocated(nwfa_p)) allocate(nwfa_p(ims:ime,kms:kme,jms:jme))
130132

131133
case default
132134
end select pbl_select
@@ -200,6 +202,8 @@ subroutine deallocate_forall_physics(configs)
200202
case("bl_mynn")
201203
if(allocated(nc_p)) deallocate(nc_p)
202204
if(allocated(ni_p)) deallocate(ni_p)
205+
if(allocated(nifa_p)) deallocate(nifa_p)
206+
if(allocated(nwfa_p)) deallocate(nwfa_p)
203207

204208
case default
205209
end select pbl_select
@@ -364,6 +368,8 @@ subroutine MPAS_to_physics(configs,mesh,state,time_lev,diag,diag_physics,its,ite
364368
do i = its,ite
365369
nc_p(i,k,j) = 0._RKIND
366370
ni_p(i,k,j) = 0._RKIND
371+
nifa_p(i,k,j) = 0._RKIND
372+
nwfa_p(i,k,j) = 0._RKIND
367373
enddo
368374
enddo
369375
enddo
@@ -381,14 +387,22 @@ subroutine MPAS_to_physics(configs,mesh,state,time_lev,diag,diag_physics,its,ite
381387
enddo
382388
endif
383389
!initializes nc_p, nifa_p, and nwfa_p when running the option "mp_thompson_aerosols":
384-
if(f_nc) then
390+
if(f_nc .and. f_nifa .and. f_nwfa) then
385391
nullify(nc)
392+
nullify(nifa)
393+
nullify(nwfa)
386394
call mpas_pool_get_dimension(state,'index_nc',index_nc)
395+
call mpas_pool_get_dimension(state,'index_nifa',index_nifa)
396+
call mpas_pool_get_dimension(state,'index_nwfa',index_nwfa)
387397
nc => scalars(index_nc,:,:)
398+
nifa => scalars(index_nifa,:,:)
399+
nwfa => scalars(index_nwfa,:,:)
388400
do j = jts,jte
389401
do k = kts,kte
390402
do i = its,ite
391-
nc_p(i,k,j) = max(0.,nc(k,i) )
403+
nc_p(i,k,j) = max(0.,nc(k,i))
404+
nifa_p(i,k,j) = max(0.,nifa(k,i))
405+
nwfa_p(i,k,j) = max(0.,nwfa(k,i))
392406
enddo
393407
enddo
394408
enddo

src/core_atmosphere/physics/mpas_atmphys_todynamics.F

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,20 @@ subroutine physics_get_tend_work( &
352352
do i = 1, nCellsSolve
353353
do k = 1, nVertLevels
354354
tend_scalars(index_qs,k,i) = tend_scalars(index_qs,k,i) + rqsblten(k,i)*mass(k,i)
355-
tend_scalars(index_nc,k,i) = tend_scalars(index_nc,k,i) + rncblten(k,i)*mass(k,i)
356355
tend_scalars(index_ni,k,i) = tend_scalars(index_ni,k,i) + rniblten(k,i)*mass(k,i)
357-
tend_scalars(index_nifa,k,i) = tend_scalars(index_nifa,k,i) + rnifablten(k,i)*mass(k,i)
358-
tend_scalars(index_nwfa,k,i) = tend_scalars(index_nwfa,k,i) + rnwfablten(k,i)*mass(k,i)
359356
enddo
360357
enddo
361358

359+
if(trim(microp_scheme) == 'mp_thompson_aerosols') then
360+
do i = 1, nCellsSolve
361+
do k = 1, nVertLevels
362+
tend_scalars(index_nc,k,i) = tend_scalars(index_nc,k,i) + rncblten(k,i)*mass(k,i)
363+
tend_scalars(index_nifa,k,i) = tend_scalars(index_nifa,k,i) + rnifablten(k,i)*mass(k,i)
364+
tend_scalars(index_nwfa,k,i) = tend_scalars(index_nwfa,k,i) + rnwfablten(k,i)*mass(k,i)
365+
enddo
366+
enddo
367+
endif
368+
362369
case default
363370
end select pbl_select
364371
endif

0 commit comments

Comments
 (0)