15 subroutine gloopr (grid_fld, g3d_fld, aoi_fld,
16 & lats_nodes_r,global_lats_r, lonsperlar, phour,
17 & deltim,xlon,xlat,coszdg,coszen,slmsk,weasd,
18 & sncovr,snoalb,zorl,tsea,hprime,sfalb,
19 & alvsf,alnsf ,alvwf ,alnwf,facsf ,facwf,cv,cvt,
20 & cvb ,swh,swhc,hlw,hlwc,sfcnsw,sfcdlw,
21 & fice ,tisfc, sfcdsw, sfcemis,
22 & tsflw,fluxr, phy_f3d,phy_f2d,
23 & slag,sdec,cdec,nblck,kdt
74 use physcons, fv => con_fvirt, rerth => con_rerth, rk => con_rocp
76 use namelist_physics_def
, only : shoc_cld, use_nuopc
79 USE gfs_phy_tracer_config
, only : gfs_phy_tracer
81 use module_radsw_parameters
, only : topfsw_type, sfcfsw_type
82 use module_radlw_parameters
, only : topflw_type, sfcflw_type
85 use module_radsw_parameters
, only : nbdsw
86 use module_radlw_parameters
, only : nbdlw
88 use resol_def
, ONLY: levs, levr, latr, lonr, lotgr, &
89 & g_t, g_p, g_q, g_dp, g_ps, &
90 & ntcw, ntoz, ncld,num_p3d, &
91 & ntke, ntiw,ntlnc,ntinc, &
92 & nmtvr, ntrac, levp1, nfxr,g_dpdt,&
93 & lgocart,ntot3d,ntot2d, &
95 use layout1
, ONLY: me, nodes, lats_node_r, &
96 & lats_node_r_max, ipt_lats_node_r
97 use gg_def
, ONLY: coslat_r, sinlat_r
98 use date_def
, ONLY: idate
99 use namelist_physics_def
, ONLY: lsswr,iaer,lslwr,ras,shal_cnv, &
100 & lssav, flgmin, ldiag3d, &
101 & imfshalcnv, imfdeepcnv, &
102 & iovr_lw, iovr_sw, isol, iems, &
103 & ialb, fhlwr, fhswr, ico2, ngptc, &
104 & crick_proof, norad_precip,ccnorm,&
105 & ictm, isubc_sw, isubc_lw, fdaer, &
106 & sup, ndfi, fhdfi, cplflx
107 use d3d_def
, ONLY: cldcov
108 use gfs_physics_gridgr_mod
, ONLY: grid_var_data
109 use gfs_physics_g3d_mod
, ONLY: g3d_var_data
110 use gfs_physics_aoi_var_mod
, ONLY: aoi_var_data
111 use mersenne_twister
, only: random_setseed, random_index, &
133 & rad_run_savein, rad_run_readin,
134 & rad_run_saveout, rad_run_readout
138 real (kind=kind_phys),
parameter :: QMIN =1.0e-10 &
139 &, typical_pgr = 95.0 &
140 &, cons0 = 0.0, cons2 = 2.0 &
145 integer,
intent(in),
dimension(nodes) :: lats_nodes_r
146 integer,
intent(in),
dimension(latr) :: global_lats_r, lonsperlar
150 TYPE(grid_var_data) :: grid_fld
151 TYPE(g3d_var_data) :: g3d_fld
152 type(aoi_var_data) :: aoi_fld
154 integer,
intent(in) :: NBLCK
157 real (kind=kind_phys),
dimension(LONR,LATS_NODE_R),
intent(in) :: &
158 & xlon, xlat, slmsk, weasd, zorl, tsea, &
159 & alvsf, alnsf, alvwf, alnwf, facsf, facwf, &
160 & cv, cvt, cvb, FICE, tisfc, sncovr, snoalb
162 real (kind=kind_phys),
intent(inout) :: &
163 & hprime(NMTVR,LONR,LATS_NODE_R), phour, deltim, &
164 & phy_f3d(NGPTC,LEVS,ntot3d,NBLCK,LATS_NODE_R), &
165 & phy_f2d(lonr,lats_node_r,ntot2d)
168 real (kind=kind_phys),
intent(inout) :: &
169 & fluxr (NFXR,LONR,LATS_NODE_R)
171 integer,
intent(in) :: KDT
176 real (kind=kind_phys),
intent(out), dimension &
177 & (ngptc,levs,nblck,lats_node_r) :: swh, swhc, hlw, hlwc
179 real (kind=kind_phys),
dimension(LONR,LATS_NODE_R),
intent(out) :: &
180 & coszdg, coszen, sfcnsw, sfcdlw, tsflw, &
181 & sfcdsw, SFALB, sfcemis
183 real (kind=kind_phys),
intent(out) :: slag, sdec, cdec
191 real(kind=kind_phys) :: prsl(ngptc,levs), prslk(ngptc,levs), &
196 real (kind=kind_phys) :: dswcmp(ngptc,4), uswcmp(ngptc,4), &
197 & gt(NGPTC,LEVR), gr(NGPTC,LEVR)
199 real (kind=kind_phys),
allocatable :: gr1(:,:,:)
201 logical :: lmfshal, lmfdeep2
203 real (kind=kind_phys),
dimension(ngptc,levs) :: deltaq, cnvw, cnvc
204 &, f_ice, f_rain, r_rime, hlwc_v, swhc_v, cldcov_v, vvel
206 real (kind=kind_phys) :: fluxr_v(ngptc,nfxr)
207 real (kind=kind_phys) :: work1, work2
209 real (kind=kind_phys),
dimension(ngptc) :: coszen_v, coszdg_v, &
210 & sinlat_v, coslat_v, hprime_v, flgmin_v
215 real (kind=kind_phys) :: rinc(5), dtsw, dtlw, solcon, raddt, solhr
216 real (kind=4) :: rinc4(5)
217 integer w3kindreal,w3kindint
219 real (kind=kind_phys),
save :: facoz
221 integer :: njeff, lon, lan, lat, iblk, lons_lat, kk
222 integer :: idat(8), jdat(8), DAYS(13), iday, imon, midmon, id
223 integer :: nlnsp(lats_node_r)
227 type(topfsw_type),
dimension(NGPTC) :: topfsw
228 type(sfcfsw_type),
dimension(NGPTC) :: sfcfsw
230 type(topflw_type),
dimension(NGPTC) :: topflw
231 type(sfcflw_type),
dimension(NGPTC) :: sfcflw
234 type(random_stat) :: stat
236 integer :: numrdm(lonr*(latr+1)), ixseed(lonr,lats_node_r,2)
237 integer :: ipseed, icsdlw(ngptc), icsdsw(ngptc)
238 integer,
parameter :: ipsdlim = 1.0e8
344 real (kind=kind_phys) :: temlon, temlat, alon, alat
346 logical :: lprnt, uni_cld
348 integer i,j,k,n,item,dbgu,item2,ntl
362 if (n /= ntke .and. n /= ntlnc .and. n /= ntinc)
then 366 if (ntl > 0)
allocate(gr1(ngptc,levr,ntl))
379 call w3kind(w3kindreal,w3kindint)
380 if(w3kindreal == 4)
then 382 call w3movdat(rinc4, idat, jdat)
384 call w3movdat(rinc, idat, jdat)
392 raddt = min(dtsw, dtlw)
396 lmfshal = shal_cnv .and. (imfshalcnv > 0)
397 lmfdeep2 = (imfdeepcnv == 2)
400 if ( phour > 0.0 )
then 401 solhr = mod(float(jdat(5)),24.0)
409 & ( idat, jdat, dtsw, deltim, lsswr, me, &
411 & slag, sdec, cdec, solcon &
416 if ( isubc_lw == 2 .or. isubc_sw == 2 )
then 418 ipseed = mod(nint(100.0*sqrt(phour*3600)), ipsdlim) + 1 +
ipsd0 420 call random_setseed &
434 do j = 1, lats_node_r
435 lat = global_lats_r(ipt_lats_node_r-1+j)
439 ixseed(i,j,1) = numrdm(i+item)
440 ixseed(i,j,2) = numrdm(i+item2)
450 lat = global_lats_r(ipt_lats_node_r-1+lan)
451 lons_lat = lonsperlar(lat)
474 do lon=1,lons_lat,ngptc
476 njeff = min(ngptc,lons_lat-lon+1)
477 iblk = (lon-1)/ngptc + 1
507 gt(i,k) = grid_fld%t(item,lan,k)
508 gr(i,k) = max(qmin,grid_fld%tracers(1)%flds(item,lan,k))
509 prsl(i,k) = grid_fld%p(item,lan,k)
510 vvel(i,k) = grid_fld%dpdt(item,lan,k)
522 prsi(i,k) = prsi(i,k+1) + grid_fld%dp(item,lan,k)
532 if (n /= ntke .and. n /= ntlnc .and. n /= ntinc)
then 536 gr1(i,k,item) = max(0.0,
537 & grid_fld%tracers(n)%flds(lon+i-1,lan,k))
543 if(num_p3d == 4)
then 544 if(kdt == 1.or.(kdt == ndfi+1.and.fhdfi == 0.))
then 548 phy_f3d(i,k,1,iblk,lan) = gt(i,k)
549 phy_f3d(i,k,2,iblk,lan) = gr(i,k)
550 phy_f3d(i,k,3,iblk,lan) = gt(i,k)
551 phy_f3d(i,k,4,iblk,lan) = gr(i,k)
556 phy_f2d(item,lan,1) = prsi(i,1)
557 phy_f2d(item,lan,2) = prsi(i,1)
563 if (levr < levs)
then 565 prsi(i,levr+1) = prsi(i,levp1)
566 prsl(i,levr) = (prsi(i,levp1)+prsi(i,levr)) * 0.5
570 if (ntoz <= 0 .or.
iaerflg == 2)
then 573 prslk(i,k) = (prsl(i,k)*pt00001)**rk
581 cldcov_v(i,k) = phy_f3d(i,k,ntot3d-2,iblk,lan)
587 elseif (ncld == 2)
then 590 cldcov_v(i,k) = phy_f3d(i,k,1,iblk,lan)
598 hprime_v(i) = hprime(1,lon+i-1,lan)
603 fluxr_v(i,k) = fluxr(k,lon+i-1,lan)
608 sinlat_v(j) = sinlat_r(lat)
609 coslat_v(j) = coslat_r(lat)
612 if (num_p3d == 3)
then 615 f_ice(i,k) = phy_f3d(i,k,1,iblk,lan)
616 f_rain(i,k) = phy_f3d(i,k,2,iblk,lan)
617 r_rime(i,k) = phy_f3d(i,k,3,iblk,lan)
621 work1 = (log(coslat_r(lat)/(lons_lat*latr)) - dxmin) * dxinv
622 work1 = max(0.0, min(1.0,work1))
623 work2 = flgmin(1)*work1 + flgmin(2)*(1.0-work1)
633 if(num_p3d == 4 .and. npdf3d == 3)
then 636 deltaq(i,k) = phy_f3d(i,k,5,iblk,lan)
637 cnvw(i,k) = phy_f3d(i,k,6,iblk,lan)
638 cnvc(i,k) = phy_f3d(i,k,7,iblk,lan)
641 else if(npdf3d == 0 .and. ncnvcld3d == 1)
then 646 cnvw(i,k) = phy_f3d(i,k,kk,iblk,lan)
662 if ( isubc_lw==2 .or. isubc_sw==2 )
then 664 icsdsw(i) = ixseed(lon+i-1,lan,1)
665 icsdlw(i) = ixseed(lon+i-1,lan,2)
682 lonbnd = lon + njeff - 1
684 call dyn_parm%setrad(
685 & xlon(lon:lonbnd,lan), xlat(lon:lonbnd,lan),
686 & sinlat_v, coslat_v, solhr, ngptc, njeff, kdt,
687 & jdat, solcon, icsdsw, icsdlw, dtlw, dtsw,
688 & lsswr, lslwr, lssav, lmfshal, lmfdeep2,
689 & ipt, lprnt, deltim,
691 call state_fldin%setrad(prsi, prsl, prslk,
692 & gt, gr, gr1, vvel, ntl, uni_cld)
693 call sfc_prop%setrad(
694 & slmsk(lon:lonbnd,lan), tsea(lon:lonbnd,lan),
695 & weasd(lon:lonbnd,lan), sncovr(lon:lonbnd,lan),
696 & snoalb(lon:lonbnd,lan), zorl(lon:lonbnd,lan),
698 & fice(lon:lonbnd,lan), tisfc(lon:lonbnd,lan),
699 & alvsf(lon:lonbnd,lan), alnsf(lon:lonbnd,lan),
700 & alvwf(lon:lonbnd,lan), alnwf(lon:lonbnd,lan),
701 & facsf(lon:lonbnd,lan), facwf(lon:lonbnd,lan)
704 call diags%setrad(nfxr, fluxr_v, topfsw, topflw,
707 call cld_prop%setrad(cv(lon:lonbnd,lan), cvt(lon:lonbnd,lan)
708 &, cvb(lon:lonbnd,lan), f_ice, f_rain
710 &, cldcov_v, deltaq, sup, cnvw, cnvc )
712 call rad_tend%setrad(
713 & swh(1:ngptc,1:levr,iblk,lan), sfalb(lon:lonbnd,lan),
714 & coszen_v, hlw(1:ngptc,1:levr,iblk,lan),
715 & tsflw(lon:lonbnd,lan), sfcemis(lon:lonbnd,lan),
716 & coszdg_v, hlwc_v, swhc_v )
718 call intrfc_fld%setrad(sfcfsw, sfcflw)
721 if (me == 0 .and. kdt == 1)
then 722 print *, me,
": NUOPC DBG: before nuopc_rad_run in gloopr" 738 call nuopc_rad_run (state_fldin, sfc_prop,
740 & cld_prop, rad_tend, mdl_parm, dyn_parm)
742 if (me == 0 .and. kdt == 1)
then 743 print *, me,
": NUOPC DBG: after nuopc_rad_run in gloopr" 755 & ( prsi,prsl,prslk,gt,gr,gr1,vvel,slmsk(lon,lan), &
756 & xlon(lon,lan),xlat(lon,lan),tsea(lon,lan), &
757 & weasd(lon,lan),sncovr(lon,lan),snoalb(lon,lan), &
758 & zorl(lon,lan),hprime_v, &
759 & alvsf(lon,lan),alnsf(lon,lan),alvwf(lon,lan), &
760 & alnwf(lon,lan),facsf(lon,lan),facwf(lon,lan), &
761 & fice(lon,lan),tisfc(lon,lan), &
762 & sinlat_v,coslat_v,solhr,jdat,solcon, &
763 & cv(lon,lan),cvt(lon,lan),cvb(lon,lan), &
764 & f_ice,f_rain,r_rime,flgmin_v, &
765 & icsdsw,icsdlw,ntcw-1,ncld,ntoz-1,ntl,nfxr, &
768 & dtlw,dtsw, lsswr,lslwr,lssav,uni_cld,lmfshal,lmfdeep2, &
769 & ngptc,njeff,levr,me, lprnt, ipt, kdt, deltaq,sup,cnvw,cnvc,&
772 & swh(1:ngptc,1:levr,iblk,lan),topfsw,sfcfsw,dswcmp,uswcmp, &
773 & sfalb(lon,lan),coszen_v,coszdg_v, &
774 & hlw(1:ngptc,1:levr,iblk,lan),topflw,sfcflw,tsflw(lon,lan), &
775 & sfcemis(lon,lan),cldcov_v, &
780 & htrlw0=hlwc_v,htrsw0=swhc_v &
790 coszen(lon+j-1,lan) = coszen_v(j)
791 coszdg(lon+j-1,lan) = coszdg_v(j)
796 fluxr(k,lon+i-1,lan) = fluxr_v(i,k)
805 sfcdsw(j,lan) = sfcfsw(i)%dnfxc
806 sfcnsw(j,lan) = sfcfsw(i)%dnfxc - sfcfsw(i)%upfxc
820 aoi_fld%nirbmdi(j,lan) = dswcmp(i,1)
821 aoi_fld%nirdfdi(j,lan) = dswcmp(i,2)
822 aoi_fld%visbmdi(j,lan) = dswcmp(i,3)
823 aoi_fld%visdfdi(j,lan) = dswcmp(i,4)
824 aoi_fld%nirbmui(j,lan) = uswcmp(i,1)
825 aoi_fld%nirdfui(j,lan) = uswcmp(i,2)
826 aoi_fld%visbmui(j,lan) = uswcmp(i,3)
827 aoi_fld%visdfui(j,lan) = uswcmp(i,4)
835 sfcdlw(j,lan) = sfcflw(i)%dnfxc
839 hlwc(i,k,iblk,lan) = hlwc_v(i,k)
845 swhc(i,k,iblk,lan) = swhc_v(i,k)
849 if (levr < levs)
then 852 hlw(i,k,iblk,lan) = hlw(i,levr,iblk,lan)
853 hlwc(i,k,iblk,lan) = hlwc(i,levr,iblk,lan)
854 swh(i,k,iblk,lan) = swh(i,levr,iblk,lan)
855 swhc(i,k,iblk,lan) = swhc(i,levr,iblk,lan)
875 cldcov(k,item,lan) = cldcov(k,item,lan) &
876 & + cldcov_v(i,k) * raddt
884 g3d_fld%fcld(lon+i-1,lan,k) = cldcov_v(i,k)
901 if (
allocated(gr1))
deallocate(gr1)
DDT for fields typically only used for diagnostic output.
DDT for basic inputs of radiation and physics parameters.
subroutine, public rad_run_readin(statein, sfc_prop, diags, intrfc_fld, cld_prop, rad_tend, mdl_parm, dyn_parm)
Reads inputs to nuopc_rad_run from file radrun_savein.dat.
integer, save iaerflg
aerosol effect control flag 3-digit flag 'abc': a-stratospheric volcanic aerols b-tropospheric ...
DDT for radiation tendencies.
subroutine gloopr(grid_fld, g3d_fld, aoi_fld,
subroutine gloopr invokes the physcis driver's call to the radiation portion of the physics through t...
DDT for basic outputs from radiation and physics.
subroutine, public radupdate(idate, jdate, deltsw, deltim, lsswr, me, slag, sdec, cdec, solcon)
This subroutine checks and updates time sensitive data used by radiation computations. This subroutine needs to be placed inside the time advancement loop but outside of the horizontal grid loop. It is invoked at radiation calling frequncy but before any actual radiative transfer computations.
subroutine, public rad_run_savein(statein, sfc_prop, diags, intrfc_fld, cld_prop, rad_tend, mdl_parm, dyn_parm)
Write inputs to nuopc_rad_run to file radrun_savein.dat.
subroutine, public rad_run_readout(diags, intrfc_fld, cld_prop, rad_tend)
Read outputs from nuopc_rad_run from radrun_saveout.dat.
DDT for data that changes frequently (e.g. inner loops)
DDT for data used for coupling (e.g. land and ocean)
subroutine, public nuopc_rad_run(statein, sfc_prop, diags, intrfc_fld, cld_prop, rad_tend, mdl_parm, dyn_parm)
Wrapper for grrad (grrad.f).
DDT for non-changing model parameters - set once in initialize.
DDT for cloud data and parameters. Used by grrad and gbphys with different intent.
integer, save ipsd0
initial permutaion seed for mcica radiation
the interface between the dynamic core and the physics packages
subroutine, public nuopc_rad_update(mdl, dyn)
Wrapper for radupdate (grrad.f) - updates some fields between timesteps.
subroutine, public rad_run_saveout(diags, intrfc_fld, cld_prop, rad_tend)
Write outputs from nuopc_rad_run to radrun_saveout.dat.
subroutine, public grrad(prsi, prsl, prslk, tgrs, qgrs, tracer, vvl, slmsk, xlon, xlat, tsfc, snowd, sncovr, snoalb, zorl, hprim, alvsf, alnsf, alvwf, alnwf, facsf, facwf, fice, tisfc, sinlat, coslat, solhr, jdate, solcon, cv, cvt, cvb, fcice, frain, rrime, flgmin, icsdsw, icsdlw, ntcw, ncld, ntoz, NTRAC, NFXR, dtlw, dtsw, lsswr, lslwr, lssav, uni_cld, lmfshal, lmfdeep2, IX, IM, LM, me, lprnt, ipt, kdt, deltaq, sup, cnvw, cnvc, htrsw, topfsw, sfcfsw, dswcmp, uswcmp, sfalb, coszen, coszdg, htrlw, topflw, sfcflw, tsflw, semis, cldcov, fluxr , htrlw0, htrsw0, htrswb, htrlwb )
This subroutine is the driver of main radiation calculations. It sets up column profiles, such as pressure, temperature, moisture, gases, clouds, aerosols, etc., as well as surface radiative characteristics, such as surface albedo, and emissivity. The call of this subroutine is placed inside both the time advancing loop and the horizontal grid loop.