Skip to content

Commit 9227e5c

Browse files
author
Courtney Peverley
committed
update submodule; fix interfaces
1 parent 04be369 commit 9227e5c

5 files changed

Lines changed: 54 additions & 78 deletions

File tree

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
[submodule "atmos_phys"]
3737
path = src/atmos_phys
3838
url = https://github.com/peverwhee/atmospheric_physics
39-
fxtag = 403130ec1bb3e245255182a3c3167aba3a84d4f3
39+
fxtag = 86fc6f9542b949af4e667c1be6d364a08102485b
4040
fxrequired = AlwaysRequired
4141
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
4242

src/physics/cam/cloud_rad_props.F90

Lines changed: 47 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ module cloud_rad_props
2121

2222
use cam_logfile, only: iulog
2323
use cam_abortutils, only: endrun
24+
use rrtmgp_cloud_optics_setup, only: g_mu_ccpp => g_mu, g_lambda_ccpp => g_lambda, g_d_eff_ccpp => g_d_eff
25+
use rrtmgp_cloud_optics_setup, only: abs_lw_liq_ccpp => abs_lw_liq, abs_lw_ice_ccpp => abs_lw_ice
26+
use rrtmgp_cloud_optics_setup, only: ext_sw_liq_ccpp => ext_sw_liq, ext_sw_ice_ccpp => ext_sw_ice
27+
use rrtmgp_cloud_optics_setup, only: ssa_sw_liq_ccpp => ssa_sw_liq, ssa_sw_ice_ccpp => ssa_sw_ice
28+
use rrtmgp_cloud_optics_setup, only: asm_sw_liq_ccpp => asm_sw_liq, asm_sw_ice_ccpp => asm_sw_ice
2429

2530

2631
implicit none
@@ -78,9 +83,7 @@ module cloud_rad_props
7883
contains
7984
!==============================================================================
8085

81-
subroutine cloud_rad_props_init(abs_lw_liq_out, abs_lw_ice_out, ext_sw_liq_out, &
82-
ssa_sw_liq_out, asm_sw_liq_out, ext_sw_ice_out, ssa_sw_ice_out, &
83-
asm_sw_ice_out, g_mu_out, g_lambda_out, g_d_eff_out, tiny_out)
86+
subroutine cloud_rad_props_init(tiny_out)
8487
use netcdf
8588
use spmd_utils, only: masterproc
8689
use ioFileMod, only: getfil
@@ -90,18 +93,7 @@ subroutine cloud_rad_props_init(abs_lw_liq_out, abs_lw_ice_out, ext_sw_liq_out,
9093
#if ( defined SPMD )
9194
use mpishorthand
9295
#endif
93-
real(r8), allocatable, intent(out) :: abs_lw_liq_out(:,:,:)
94-
real(r8), allocatable, intent(out) :: ext_sw_liq_out(:,:,:)
95-
real(r8), allocatable, intent(out) :: asm_sw_liq_out(:,:,:)
96-
real(r8), allocatable, intent(out) :: ssa_sw_liq_out(:,:,:)
97-
real(r8), allocatable, intent(out) :: abs_lw_ice_out(:,:)
98-
real(r8), allocatable, intent(out) :: ext_sw_ice_out(:,:)
99-
real(r8), allocatable, intent(out) :: asm_sw_ice_out(:,:)
100-
real(r8), allocatable, intent(out) :: ssa_sw_ice_out(:,:)
101-
real(r8), allocatable, intent(out) :: g_mu_out(:)
102-
real(r8), allocatable, intent(out) :: g_lambda_out(:,:)
103-
real(r8), allocatable, intent(out) :: g_d_eff_out(:)
104-
real(r8), intent(out) :: tiny_out
96+
real(r8), intent(out) :: tiny_out
10597

10698
character(len=256) :: liquidfile
10799
character(len=256) :: icefile
@@ -142,51 +134,52 @@ subroutine cloud_rad_props_init(abs_lw_liq_out, abs_lw_ice_out, ext_sw_liq_out,
142134
call cnst_get_ind('CLDICE', ixcldice)
143135
call cnst_get_ind('CLDLIQ', ixcldliq)
144136

145-
call rrtmgp_cloud_optics_setup_init(liqopticsfile, iceopticsfile, abs_lw_liq, &
146-
abs_lw_ice, ext_sw_liq, ext_sw_ice, ssa_sw_liq, ssa_sw_ice, asm_sw_liq, &
147-
asm_sw_ice, g_lambda, g_mu, g_d_eff, errmsg, err)
137+
call rrtmgp_cloud_optics_setup_init(liqopticsfile, iceopticsfile, errmsg, err)
148138
if (err /= 0) then
149139
call endrun(sub//': '//errmsg)
150140
end if
151141

142+
! Set module-level variables
143+
! Set output variables
144+
nmu = size(g_mu_ccpp)
145+
nlambda = size(g_lambda_ccpp, 2)
146+
n_g_d = size(g_d_eff_ccpp)
147+
allocate(abs_lw_liq(nmu,nlambda,nlwbands), stat=ierr)
148+
call handle_allocate_error(ierr, sub, 'abs_lw_liq')
149+
abs_lw_liq = abs_lw_liq_ccpp
150+
allocate(ext_sw_liq(nmu,nlambda,nswbands), stat=ierr)
151+
call handle_allocate_error(ierr, sub, 'ext_sw_liq')
152+
ext_sw_liq = ext_sw_liq_ccpp
153+
allocate(ssa_sw_liq(nmu,nlambda,nswbands), stat=ierr)
154+
call handle_allocate_error(ierr, sub, 'ssa_sw_liq')
155+
ssa_sw_liq = ssa_sw_liq_ccpp
156+
allocate(asm_sw_liq(nmu,nlambda,nswbands), stat=ierr)
157+
call handle_allocate_error(ierr, sub, 'asm_sw_liq')
158+
asm_sw_liq = asm_sw_liq_ccpp
159+
allocate(abs_lw_ice(n_g_d,nlwbands), stat=ierr)
160+
call handle_allocate_error(ierr, sub, 'abs_lw_ice')
161+
abs_lw_ice = abs_lw_ice_ccpp
162+
allocate(ext_sw_ice(n_g_d,nswbands), stat=ierr)
163+
call handle_allocate_error(ierr, sub, 'ext_sw_ice')
164+
ext_sw_ice = ext_sw_ice_ccpp
165+
allocate(ssa_sw_ice(n_g_d,nswbands), stat=ierr)
166+
call handle_allocate_error(ierr, sub, 'ssa_sw_ice')
167+
ssa_sw_ice = ssa_sw_ice_ccpp
168+
allocate(asm_sw_ice(n_g_d,nswbands), stat=ierr)
169+
call handle_allocate_error(ierr, sub, 'asm_sw_ice')
170+
asm_sw_ice = asm_sw_ice_ccpp
171+
allocate(g_mu(nmu), stat=ierr)
172+
call handle_allocate_error(ierr, sub, 'g_mu')
173+
g_mu = g_mu_ccpp
174+
allocate(g_lambda(nmu,nlambda), stat=ierr)
175+
call handle_allocate_error(ierr, sub, 'g_lambda')
176+
g_lambda = g_lambda_ccpp
177+
allocate(g_d_eff(n_g_d), stat=ierr)
178+
call handle_allocate_error(ierr, sub, 'g_d_eff')
179+
g_d_eff = g_d_eff_ccpp
180+
152181
! Set output variables
153-
nmu = size(g_mu)
154-
nlambda = size(g_lambda, 2)
155-
n_g_d = size(g_d_eff)
156182
tiny_out = tiny
157-
allocate(abs_lw_liq_out(nmu,nlambda,nlwbands), stat=ierr)
158-
call handle_allocate_error(ierr, sub, 'abs_lw_liq_out')
159-
abs_lw_liq_out = abs_lw_liq
160-
allocate(ext_sw_liq_out(nmu,nlambda,nswbands), stat=ierr)
161-
call handle_allocate_error(ierr, sub, 'ext_sw_liq_out')
162-
ext_sw_liq_out = ext_sw_liq
163-
allocate(ssa_sw_liq_out(nmu,nlambda,nswbands), stat=ierr)
164-
call handle_allocate_error(ierr, sub, 'ssa_sw_liq_out')
165-
ssa_sw_liq_out = ssa_sw_liq
166-
allocate(asm_sw_liq_out(nmu,nlambda,nswbands), stat=ierr)
167-
call handle_allocate_error(ierr, sub, 'asm_sw_liq_out')
168-
asm_sw_liq_out = asm_sw_liq
169-
allocate(abs_lw_ice_out(n_g_d,nlwbands), stat=ierr)
170-
call handle_allocate_error(ierr, sub, 'abs_lw_ice_out')
171-
abs_lw_ice_out = abs_lw_ice
172-
allocate(ext_sw_ice_out(n_g_d,nswbands), stat=ierr)
173-
call handle_allocate_error(ierr, sub, 'ext_sw_ice_out')
174-
ext_sw_ice_out = ext_sw_ice
175-
allocate(ssa_sw_ice_out(n_g_d,nswbands), stat=ierr)
176-
call handle_allocate_error(ierr, sub, 'ssa_sw_ice_out')
177-
ssa_sw_ice_out = ssa_sw_ice
178-
allocate(asm_sw_ice_out(n_g_d,nswbands), stat=ierr)
179-
call handle_allocate_error(ierr, sub, 'asm_sw_ice_out')
180-
asm_sw_ice_out = asm_sw_ice
181-
allocate(g_mu_out(nmu), stat=ierr)
182-
call handle_allocate_error(ierr, sub, 'g_mu_out')
183-
g_mu_out = g_mu
184-
allocate(g_lambda_out(nmu,nlambda), stat=ierr)
185-
call handle_allocate_error(ierr, sub, 'g_lambda_out')
186-
g_lambda_out = g_lambda
187-
allocate(g_d_eff_out(n_g_d), stat=ierr)
188-
call handle_allocate_error(ierr, sub, 'g_d_eff_out')
189-
g_d_eff_out = g_d_eff
190183
return
191184

192185
end subroutine cloud_rad_props_init

src/physics/rrtmg/radiation.F90

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -382,18 +382,6 @@ subroutine radiation_init(pbuf2d)
382382
integer :: history_budget_histfile_num ! output history file number for budget fields
383383
integer :: err
384384

385-
! Cloud optics variables
386-
real(kind=r8), allocatable :: abs_lw_ice(:,:)
387-
real(kind=r8), allocatable :: ext_sw_ice(:,:)
388-
real(kind=r8), allocatable :: ssa_sw_ice(:,:)
389-
real(kind=r8), allocatable :: asm_sw_ice(:,:)
390-
real(kind=r8), allocatable :: abs_lw_liq(:,:,:)
391-
real(kind=r8), allocatable :: ext_sw_liq(:,:,:)
392-
real(kind=r8), allocatable :: ssa_sw_liq(:,:,:)
393-
real(kind=r8), allocatable :: asm_sw_liq(:,:,:)
394-
real(kind=r8), allocatable :: g_lambda(:,:)
395-
real(kind=r8), allocatable :: g_mu(:)
396-
real(kind=r8), allocatable :: g_d_eff(:)
397385
real(kind=r8) :: tiny
398386

399387
integer :: dtime
@@ -404,9 +392,7 @@ subroutine radiation_init(pbuf2d)
404392
call rad_data_init(pbuf2d) ! initialize output fields for offline driver
405393
call radsw_init()
406394
call radlw_init()
407-
call cloud_rad_props_init(abs_lw_liq, abs_lw_ice, ext_sw_liq, ssa_sw_liq, &
408-
asm_sw_liq, ext_sw_ice, ssa_sw_ice, asm_sw_ice, g_mu, &
409-
g_lambda, g_d_eff, tiny)
395+
call cloud_rad_props_init(tiny)
410396

411397
cld_idx = pbuf_get_index('CLD')
412398
cldfsnow_idx = pbuf_get_index('CLDFSNOW',errcode=err)

src/physics/rrtmgp/radiation.F90

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,7 @@ subroutine radiation_init(pbuf2d)
500500
call rad_data_init(pbuf2d)
501501

502502
! Read ice and liquid optics files
503-
call cloud_rad_props_init(abs_lw_liq, abs_lw_ice, &
504-
ext_sw_liq, ssa_sw_liq, asm_sw_liq, ext_sw_ice, ssa_sw_ice, &
505-
asm_sw_ice, g_mu, g_lambda, g_d_eff, tiny)
503+
call cloud_rad_props_init(tiny)
506504
if (errflg /= 0) then
507505
call endrun(sub//': '//errmsg)
508506
end if
@@ -1293,10 +1291,9 @@ subroutine radiation_tend( &
12931291
! Set cloud optical properties in cloud_lw object.
12941292
call rrtmgp_lw_cloud_optics_run(dolw, ncol, nlay, nlaycam, cld(:ncol,:), cldfsnow_in, &
12951293
cldfgrau_in, cldfprime(:ncol,:), kdist_lw, cloud_lw, lambda(:ncol,:), mu(:ncol,:), &
1296-
iclwp(:ncol,:), iciwp(:ncol,:), abs_lw_liq, abs_lw_ice, g_mu, g_lambda, g_d_eff, &
1297-
tiny, dei(:ncol,:), icswp(:ncol,:), des(:ncol,:), icgrauwp(:ncol,:), degrau(:ncol,:), &
1298-
nlwbands, do_snow, do_graupel, pver, ktopcam, tauc, cldf, cld_lw_abs, snow_lw_abs, &
1299-
grau_lw_abs, errmsg, errflg)
1294+
iclwp(:ncol,:), iciwp(:ncol,:), tiny, dei(:ncol,:), icswp(:ncol,:), des(:ncol,:), &
1295+
icgrauwp(:ncol,:), degrau(:ncol,:), nlwbands, do_snow, do_graupel, pver, ktopcam, &
1296+
tauc, cldf, cld_lw_abs, snow_lw_abs, grau_lw_abs, errmsg, errflg)
13001297
if (errflg /= 0) then
13011298
call endrun(sub//': '//errmsg)
13021299
end if

0 commit comments

Comments
 (0)