CCPP SciDoc v7.0.0  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
radsw_main.F90
1
4
5! ============================================================== !!!!!
6! sw-rrtm3 radiation package description !!!!!
7! ============================================================== !!!!!
8! !
9! this package includes ncep's modifications of the rrtmg-sw radiation !
10! code from aer inc. !
11! !
12! the sw-rrtm3 package includes these parts: !
13! !
14! 'radsw_rrtm3_param.f' !
15! 'radsw_rrtm3_datatb.f' !
16! 'radsw_rrtm3_main.f' !
17! !
18! the 'radsw_rrtm3_param.f' contains: !
19! !
20! 'module_radsw_parameters' -- band parameters set up !
21! !
22! the 'radsw_rrtm3_datatb.f' contains: !
23! !
24! 'module_radsw_ref' -- reference temperature and pressure !
25! 'module_radsw_cldprtb' -- cloud property coefficients table !
26! 'module_radsw_sflux' -- spectral distribution of solar flux !
27! 'module_radsw_kgbnn' -- absorption coeffients for 14 !
28! bands, where nn = 16-29 !
29! !
30! the 'radsw_rrtm3_main.f' contains: !
31! !
32! 'rrtmg_sw' -- main sw radiation transfer !
33! !
34! in the main module 'rrtmg_sw' there are only two !
35! externally callable subroutines: !
36! !
37! 'swrad' -- main sw radiation routine !
38! inputs: !
39! (plyr,plvl,tlyr,tlvl,qlyr,olyr,gasvmr, !
40! clouds,icseed,aerosols,sfcalb, !
41! dzlyr,delpin,de_lgth,alpha, !
42! cosz,solcon,NDAY,idxday, !
43! npts, nlay, nlp1, lprnt, !
44! outputs: !
45! hswc,topflx,sfcflx,cldtau, !
46!! optional outputs: !
47! HSW0,HSWB,FLXPRF,FDNCMP) !
48! ) !
49! !
50! 'rswinit' -- initialization routine !
51! inputs: !
52! ( me ) !
53! outputs: !
54! (none) !
55! !
56! all the sw radiation subprograms become contained subprograms !
57! in module 'rrtmg_sw' and many of them are not directly !
58! accessable from places outside the module. !
59! !
60! derived data type constructs used: !
61! !
62! 1. radiation flux at toa: (from module 'module_radsw_parameters') !
63! topfsw_type - derived data type for toa rad fluxes !
64! upfxc total sky upward flux at toa !
65! dnfxc total sky downward flux at toa !
66! upfx0 clear sky upward flux at toa !
67! !
68! 2. radiation flux at sfc: (from module 'module_radsw_parameters') !
69! sfcfsw_type - derived data type for sfc rad fluxes !
70! upfxc total sky upward flux at sfc !
71! dnfxc total sky downward flux at sfc !
72! upfx0 clear sky upward flux at sfc !
73! dnfx0 clear sky downward flux at sfc !
74! !
75! 3. radiation flux profiles(from module 'module_radsw_parameters') !
76! profsw_type - derived data type for rad vertical prof !
77! upfxc level upward flux for total sky !
78! dnfxc level downward flux for total sky !
79! upfx0 level upward flux for clear sky !
80! dnfx0 level downward flux for clear sky !
81! !
82! 4. surface component fluxes(from module 'module_radsw_parameters' !
83! cmpfsw_type - derived data type for component sfc flux !
84! uvbfc total sky downward uv-b flux at sfc !
85! uvbf0 clear sky downward uv-b flux at sfc !
86! nirbm surface downward nir direct beam flux !
87! nirdf surface downward nir diffused flux !
88! visbm surface downward uv+vis direct beam flx !
89! visdf surface downward uv+vis diffused flux !
90! !
91! external modules referenced: !
92! !
93! 'module physcons' !
94! 'mersenne_twister' !
95! !
96! compilation sequence is: !
97! !
98! 'radsw_rrtm3_param.f' !
99! 'radsw_rrtm3_datatb.f' !
100! 'radsw_rrtm3_main.f' !
101! !
102! and all should be put in front of routines that use sw modules !
103! !
104!==========================================================================!
105! !
106! the original aer program declarations: !
107! !
108!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
109! !
110! Copyright (c) 2002-2020, Atmospheric & Environmental Research, Inc. (AER) !
111! All rights reserved. !
112! !
113! Redistribution and use in source and binary forms, with or without !
114! modification, are permitted provided that the following conditions are met: !
115! * Redistributions of source code must retain the above copyright !
116! notice, this list of conditions and the following disclaimer. !
117! * Redistributions in binary form must reproduce the above copyright !
118! notice, this list of conditions and the following disclaimer in the !
119! documentation and/or other materials provided with the distribution. !
120! * Neither the name of Atmospheric & Environmental Research, Inc., nor !
121! the names of its contributors may be used to endorse or promote products !
122! derived from this software without specific prior written permission. !
123! !
124! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" !
125! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE !
126! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE !
127! ARE DISCLAIMED. IN NO EVENT SHALL ATMOSPHERIC & ENVIRONMENTAL RESEARCH, INC.,!
128! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR !
129! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF !
130! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS !
131! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN !
132! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) !
133! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF !
134! THE POSSIBILITY OF SUCH DAMAGE. !
135! (http://www.rtweb.aer.com/) !
136! !
137!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
138! !
139! ************************************************************************ !
140! !
141! rrtmg_sw !
142! !
143! !
144! a rapid radiative transfer model !
145! for the solar spectral region !
146! atmospheric and environmental research, inc. !
147! 131 hartwell avenue !
148! lexington, ma 02421 !
149! !
150! eli j. mlawer !
151! jennifer s. delamere !
152! michael j. iacono !
153! shepard a. clough !
154! !
155! !
156! email: miacono@aer.com !
157! email: emlawer@aer.com !
158! email: jdelamer@aer.com !
159! !
160! the authors wish to acknowledge the contributions of the !
161! following people: steven j. taubman, patrick d. brown, !
162! ronald e. farren, luke chen, robert bergstrom. !
163! !
164! ************************************************************************ !
165! !
166! references: !
167! (rrtmg_sw/rrtm_sw): !
168! iacono, m.j., j.s. delamere, e.j. mlawer, m.w. shepard, !
169! s.a. clough, and w.d collins, radiative forcing by long-lived !
170! greenhouse gases: calculations with the aer radiative transfer !
171! models, j, geophys. res., 113, d13103, doi:10.1029/2008jd009944, !
172! 2008. !
173! !
174! clough, s.a., m.w. shephard, e.j. mlawer, j.s. delamere, !
175! m.j. iacono, k. cady-pereira, s. boukabara, and p.d. brown: !
176! atmospheric radiative transfer modeling: a summary of the aer !
177! codes, j. quant. spectrosc. radiat. transfer, 91, 233-244, 2005. !
178! !
179! (mcica): !
180! pincus, r., h. w. barker, and j.-j. morcrette: a fast, flexible, !
181! approximation technique for computing radiative transfer in !
182! inhomogeneous cloud fields, j. geophys. res., 108(d13), 4376, !
183! doi:10.1029/2002jd003322, 2003. !
184! !
185! ************************************************************************ !
186! !
187! aer's revision history: !
188! this version of rrtmg_sw has been modified from rrtm_sw to use a !
189! reduced set of g-point intervals and a two-stream model for !
190! application to gcms. !
191! !
192! -- original version (derived from rrtm_sw) !
193! 2002: aer. inc. !
194! -- conversion to f90 formatting; addition of 2-stream radiative transfer!
195! feb 2003: j.-j. morcrette, ecmwf !
196! -- additional modifications for gcm application !
197! aug 2003: m. j. iacono, aer inc. !
198! -- total number of g-points reduced from 224 to 112. original !
199! set of 224 can be restored by exchanging code in module parrrsw.f90 !
200! and in file rrtmg_sw_init.f90. !
201! apr 2004: m. j. iacono, aer, inc. !
202! -- modifications to include output for direct and diffuse !
203! downward fluxes. there are output as "true" fluxes without !
204! any delta scaling applied. code can be commented to exclude !
205! this calculation in source file rrtmg_sw_spcvrt.f90. !
206! jan 2005: e. j. mlawer, m. j. iacono, aer, inc. !
207! -- revised to add mcica capability. !
208! nov 2005: m. j. iacono, aer, inc. !
209! -- reformatted for consistency with rrtmg_lw. !
210! feb 2007: m. j. iacono, aer, inc. !
211! -- modifications to formatting to use assumed-shape arrays. !
212! aug 2007: m. j. iacono, aer, inc. !
213! !
214! ************************************************************************ !
215! !
216! ncep modifications history log: !
217! !
218! sep 2003, yu-tai hou -- received aer's rrtmg-sw gcm version!
219! code (v224) !
220! nov 2003, yu-tai hou -- corrected errors in direct/diffuse !
221! surface alabedo components. !
222! jan 2004, yu-tai hou -- modified code into standard modular!
223! f9x code for ncep models. the original three cloud !
224! control flags are simplified into two: iflagliq and !
225! iflagice. combined the org subr sw_224 and setcoef !
226! into radsw (the main program); put all kgb##together !
227! and reformat into a separated data module; combine !
228! reftra and vrtqdr as swflux; optimized taumol and all !
229! taubgs to form a contained subroutines. !
230! jun 2004, yu-tai hou -- modified code based on aer's faster!
231! version rrtmg_sw (v2.0) with 112 g-points. !
232! mar 2005, yu-tai hou -- modified to aer v2.3, correct cloud!
233! scaling error, total sky properties are delta scaled !
234! after combining clear and cloudy parts. the testing !
235! criterion of ssa is saved before scaling. added cloud !
236! layer rain and snow contributions. all cloud water !
237! partical contents are treated the same way as other !
238! atmos particles. !
239! apr 2005, yu-tai hou -- modified on module structures (this!
240! version of code was given back to aer in jun 2006) !
241! nov 2006, yu-tai hou -- modified code to include the !
242! generallized aerosol optical property scheme for gcms.!
243! apr 2007, yu-tai hou -- added spectral band heating as an !
244! optional output to support the 500km model's upper !
245! stratospheric radiation calculations. restructure !
246! optional outputs for easy access by different models. !
247! oct 2008, yu-tai hou -- modified to include new features !
248! from aer's newer release v3.5-v3.61, including mcica !
249! sub-grid cloud option and true direct/diffuse fluxes !
250! without delta scaling. added rain/snow opt properties !
251! support to cloudy sky calculations. simplified and !
252! unified sw and lw sub-column cloud subroutines into !
253! one module by using optional parameters. !
254! mar 2009, yu-tai hou -- replaced the original random number!
255! generator coming with the original code with ncep w3 !
256! library to simplify the program and moved sub-column !
257! cloud subroutines inside the main module. added !
258! option of user provided permutation seeds that could !
259! be randomly generated from forecast time stamp. !
260! mar 2009, yu-tai hou -- replaced random number generator !
261! programs coming from the original code with the ncep !
262! w3 library to simplify the program and moved sub-col !
263! cloud subroutines inside the main module. added !
264! option of user provided permutation seeds that could !
265! be randomly generated from forecast time stamp. !
266! nov 2009, yu-tai hou -- updated to aer v3.7-v3.8 version. !
267! notice the input cloud ice/liquid are assumed as !
268! in-cloud quantities, not grid average quantities. !
269! aug 2010, yu-tai hou -- uptimized code to improve efficiency
270! splited subroutine spcvrt into two subs, spcvrc and !
271! spcvrm, to handling non-mcica and mcica type of calls.!
272! apr 2012, b. ferrier and y. hou -- added conversion factor to fu's!
273! cloud-snow optical property scheme. !
274! jul 2012, s. moorthi and Y. hou -- eliminated the pointer array !
275! in subr 'spcvrt' for multi-threading issue running !
276! under intel's fortran compiler. !
277! nov 2012, yu-tai hou -- modified control parameters thru !
278! module 'physparam'. !
279! jun 2013, yu-tai hou -- moving band 9 surface treatment !
280! back as in the rrtm2 version, spliting surface flux !
281! into two spectral regions (vis & nir), instead of !
282! designated it in nir region only. !
283! may 2016 yu-tai hou --reverting swflux name back to vrtqdr!
284! jun 2018 yu-tai hou --updated cloud optical coeffs with !
285! aer's newer version v3.9-v4.0 for hu and stamnes !
286! scheme. (used if iswcliq=2); added new option of !
287! cloud overlap method 'de-correlation-length'. !
288! !
289! ************************************************************************ !
290! !
291! additional aer revision history: !
292! jul 2020, m.j. iacono -- added new mcica cloud overlap options !
293! exponential and exponential-random. each method can !
294! use either a constant or a latitude-varying and !
295! day-of-year varying decorrelation length selected !
296! with parameter "idcor". !
297! !
298!!!!! ============================================================== !!!!!
299!!!!! end descriptions !!!!!
300!!!!! ============================================================== !!!!!
301
304 module rrtmg_sw
305!
306 use physcons, only : con_g, con_cp, con_avgd, con_amd, &
307 & con_amw, con_amo3
308 use machine, only : rb => kind_phys, im => kind_io4, &
309 & kind_phys, kind_dbl_prec
310
314 use module_radsw_ref, only : preflog, tref
316!
317 implicit none
318!
319 private
320!
321! --- version tag and last revision date
322 character(40), parameter :: &
323 & VTAGSW='NCEP SW v5.1 Nov 2012 -RRTMG-SW v3.8 '
324! & VTAGSW='NCEP SW v5.0 Aug 2012 -RRTMG-SW v3.8 '
325! & VTAGSW='RRTMG-SW v3.8 Nov 2009'
326! & VTAGSW='RRTMG-SW v3.7 Nov 2009'
327! & VTAGSW='RRTMG-SW v3.61 Oct 2008'
328! & VTAGSW='RRTMG-SW v3.5 Oct 2008'
329! & VTAGSW='RRTM-SW 112v2.3 Apr 2007'
330! & VTAGSW='RRTM-SW 112v2.3 Mar 2005'
331! & VTAGSW='RRTM-SW 112v2.0 Jul 2004'
332
333! \name constant values
334
335 real (kind=kind_phys), parameter :: eps = 1.0e-6
336 real (kind=kind_phys), parameter :: oneminus= 1.0 - eps
337! pade approx constant
338 real (kind=kind_phys), parameter :: bpade = 1.0/0.278
339 real (kind=kind_phys), parameter :: stpfac = 296.0/1013.0
340 real (kind=kind_phys), parameter :: ftiny = 1.0e-12
341 real (kind=kind_phys), parameter :: flimit = 1.0e-20
342! internal solar constant
343 real (kind=kind_phys), parameter :: s0 = 1368.22
344
345 real (kind=kind_phys), parameter :: f_zero = 0.0
346 real (kind=kind_phys), parameter :: f_one = 1.0
347
348! \name atomic weights for conversion from mass to volume mixing ratios
349 real (kind=kind_phys), parameter :: amdw = con_amd/con_amw
350 real (kind=kind_phys), parameter :: amdo3 = con_amd/con_amo3
351
352! \name band indices
353 integer, dimension(nblow:nbhgh) :: nspa, nspb
354! band index for sfc flux
355 integer, dimension(nblow:nbhgh) :: idxsfc
356! band index for cld prop
357 integer, dimension(nblow:nbhgh) :: idxebc
358
359 data nspa(:) / 9, 9, 9, 9, 1, 9, 9, 1, 9, 1, 0, 1, 9, 1 /
360 data nspb(:) / 1, 5, 1, 1, 1, 5, 1, 0, 1, 0, 0, 1, 5, 1 /
361
362! data idxsfc(:) / 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1 / ! band index for sfc flux
363 data idxsfc(:) / 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 1 / ! band index for sfc flux
364 data idxebc(:) / 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 1, 5 / ! band index for cld prop
365
366! --- band wavenumber intervals
367! real (kind=kind_phys), dimension(nblow:nbhgh):: wavenum1,wavenum2
368! data wavenum1(:) / &
369! & 2600.0, 3250.0, 4000.0, 4650.0, 5150.0, 6150.0, 7700.0, &
370! & 8050.0,12850.0,16000.0,22650.0,29000.0,38000.0, 820.0 /
371! data wavenum2(:) / &
372! 3250.0, 4000.0, 4650.0, 5150.0, 6150.0, 7700.0, 8050.0, &
373! & 12850.0,16000.0,22650.0,29000.0,38000.0,50000.0, 2600.0 /
374! real (kind=kind_phys), dimension(nblow:nbhgh) :: delwave
375! data delwave(:) / &
376! & 650.0, 750.0, 650.0, 500.0, 1000.0, 1550.0, 350.0, &
377! & 4800.0, 3150.0, 6650.0, 6350.0, 9000.0,12000.0, 1780.0 /
378
379! uv-b band index
380 integer, parameter :: nuvb = 27
381
382!\name logical flags for optional output fields
383 logical :: lhswb = .false.
384 logical :: lhsw0 = .false.
385 logical :: lflxprf= .false.
386 logical :: lfdncmp= .false.
387
388
389! those data will be set up only once by "rswinit"
390 real (kind=kind_phys) :: exp_tbl(0:ntbmx)
391
392
393! the factor for heating rates (in k/day, or k/sec set by subroutine
394!! 'rswinit')
395 real (kind=kind_phys) :: heatfac
396
397
398! initial permutation seed used for sub-column cloud scheme
399 integer, parameter :: ipsdsw0 = 1
400
401! --- public accessable subprograms
402
403 public rrtmg_sw_run, rswinit
404
405! =================
406 contains
407! =================
408
492!-----------------------------------
493 subroutine rrtmg_sw_run &
494 & ( plyr,plvl,tlyr,tlvl,qlyr,olyr, &
495 & gasvmr_co2,gasvmr_n2o,gasvmr_ch4,gasvmr_o2,gasvmr_co, &
496 & gasvmr_cfc11,gasvmr_cfc12,gasvmr_cfc22,gasvmr_ccl4, & ! --- inputs
497 & icseed, aeraod, aerssa, aerasy, &
498 & sfcalb_nir_dir, sfcalb_nir_dif, &
499 & sfcalb_uvis_dir, sfcalb_uvis_dif, &
500 & dzlyr,delpin,de_lgth,alpha, &
501 & cosz,solcon,nday,idxday, &
502 & npts, nlay, nlp1, lprnt, inc_minor_gas, iswcliq, iswcice, &
503 & isubcsw, iovr, top_at_1, iswmode, cld_cf, lsswr, iovr_rand,&
504 & iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp, iovr_exprand,&
505 & hswc,topflx,sfcflx,cldtau, & ! --- outputs
506 & hsw0,hswb,flxprf,fdncmp, & ! --- optional
507 & cld_lwp, cld_ref_liq, cld_iwp, cld_ref_ice, &
508 & cld_rwp,cld_ref_rain, cld_swp, cld_ref_snow, &
509 & cld_od, cld_ssa, cld_asy, errmsg, errflg &
510 & )
511
512! ==================== defination of variables ==================== !
513! !
514! input variables: !
515! plyr (npts,nlay) : model layer mean pressure in mb !
516! plvl (npts,nlp1) : model level pressure in mb !
517! tlyr (npts,nlay) : model layer mean temperature in k !
518! tlvl (npts,nlp1) : model level temperature in k (not in use) !
519! qlyr (npts,nlay) : layer specific humidity in gm/gm *see inside !
520! olyr (npts,nlay) : layer ozone concentration in gm/gm !
521! gasvmr(npts,nlay,:): atmospheric constent gases: !
522! (check module_radiation_gases for definition) !
523! gasvmr(:,:,1) - co2 volume mixing ratio !
524! gasvmr(:,:,2) - n2o volume mixing ratio !
525! gasvmr(:,:,3) - ch4 volume mixing ratio !
526! gasvmr(:,:,4) - o2 volume mixing ratio !
527! gasvmr(:,:,5) - co volume mixing ratio (not used) !
528! gasvmr(:,:,6) - cfc11 volume mixing ratio (not used) !
529! gasvmr(:,:,7) - cfc12 volume mixing ratio (not used) !
530! gasvmr(:,:,8) - cfc22 volume mixing ratio (not used) !
531! gasvmr(:,:,9) - ccl4 volume mixing ratio (not used) !
532! clouds(npts,nlay,:): cloud profile !
533! (check module_radiation_clouds for definition) !
534! clouds(:,:,1) - layer total cloud fraction !
535! clouds(:,:,2) - layer in-cloud liq water path (g/m**2) !
536! clouds(:,:,3) - mean eff radius for liq cloud (micron) !
537! clouds(:,:,4) - layer in-cloud ice water path (g/m**2) !
538! clouds(:,:,5) - mean eff radius for ice cloud (micron) !
539! clouds(:,:,6) - layer rain drop water path (g/m**2) !
540! clouds(:,:,7) - mean eff radius for rain drop (micron) !
541! clouds(:,:,8) - layer snow flake water path (g/m**2) !
542! clouds(:,:,9) - mean eff radius for snow flake (micron) !
543! icseed(npts) : auxiliary special cloud related array !
544! when module variable isubcsw=2, it provides !
545! permutation seed for each column profile that !
546! are used for generating random numbers. !
547! when isubcsw /=2, it will not be used. !
548! aerosols(npts,nlay,nbdsw,:) : aerosol optical properties !
549! (check module_radiation_aerosols for definition) !
550! (:,:,:,1) - optical depth !
551! (:,:,:,2) - single scattering albedo !
552! (:,:,:,3) - asymmetry parameter !
553! sfcalb(npts, : ) : surface albedo in fraction !
554! (check module_radiation_surface for definition) !
555! ( :, 1 ) - near ir direct beam albedo !
556! ( :, 2 ) - near ir diffused albedo !
557! ( :, 3 ) - uv+vis direct beam albedo !
558! ( :, 4 ) - uv+vis diffused albedo !
559! dzlyr(npts,nlay) : layer thickness in km !
560! delpin(npts,nlay): layer pressure thickness (mb) !
561! de_lgth(npts) : clouds decorrelation length (km) !
562! alpha(npts,nlay) : EXP/ER cloud overlap decorrelation parameter !
563! cosz (npts) : cosine of solar zenith angle !
564! solcon : solar constant (w/m**2) !
565! NDAY : num of daytime points !
566! idxday(npts) : index array for daytime points !
567! npts : number of horizontal points !
568! nlay,nlp1 : vertical layer/lavel numbers !
569! lprnt : logical check print flag !
570! iswcliq - control flag for liq-cloud optical properties !
571! =0: input cloud optical depth, fixed ssa, asy !
572! =1: use hu and stamnes(1993) method for liq cld !
573! =2: use updated coeffs for hu and stamnes scheme !
574! iswcice - control flag for ice-cloud optical properties !
575! *** if iswcliq==0, iswcice is ignored !
576! =1: use ebert and curry (1992) scheme for ice clouds !
577! =2: use streamer v3.0 (2001) method for ice clouds !
578! =3: use fu's method (1996) for ice clouds !
579! iswmode - control flag for 2-stream transfer scheme !
580! =1; delta-eddington (joseph et al., 1976) !
581! =2: pifm (zdunkowski et al., 1980) !
582! =3: discrete ordinates (liou, 1973) !
583! isubcsw - sub-column cloud approximation control flag !
584! =0: no sub-col cld treatment, use grid-mean cld quantities !
585! =1: mcica sub-col, prescribed seeds to get random numbers !
586! =2: mcica sub-col, providing array icseed for random numbers!
587! iovr - clouds vertical overlapping control flag !
588! =iovr_rand !
589! =iovr_maxrand !
590! =iovr_max !
591! =iovr_dcorr !
592! =iovr_exp !
593! =iovr_exprand !
594! iovr_rand - choice of cloud-overlap: random !
595! iovr_maxrand - choice of cloud-overlap: maximum random !
596! iovr_max - choice of cloud-overlap: maximum !
597! iovr_dcorr - choice of cloud-overlap: decorrelation length !
598! iovr_exp - choice of cloud-overlap: exponential !
599! iovr_exprand - choice of cloud-overlap: exponential random !
600! !
601! output variables: !
602! hswc (npts,nlay): total sky heating rates (k/sec or k/day) !
603! topflx(npts) : radiation fluxes at toa (w/m**2), components: !
604! (check module_radsw_parameters for definition) !
605! upfxc - total sky upward flux at toa !
606! dnflx - total sky downward flux at toa !
607! upfx0 - clear sky upward flux at toa !
608! sfcflx(npts) : radiation fluxes at sfc (w/m**2), components: !
609! (check module_radsw_parameters for definition) !
610! upfxc - total sky upward flux at sfc !
611! dnfxc - total sky downward flux at sfc !
612! upfx0 - clear sky upward flux at sfc !
613! dnfx0 - clear sky downward flux at sfc !
614! cldtau(npts,nlay): spectral band layer cloud optical depth (~0.55 mu)
615! !
616!!optional outputs variables: !
617! hswb(npts,nlay,nbdsw): spectral band total sky heating rates !
618! hsw0 (npts,nlay): clear sky heating rates (k/sec or k/day) !
619! flxprf(npts,nlp1): level radiation fluxes (w/m**2), components: !
620! (check module_radsw_parameters for definition) !
621! dnfxc - total sky downward flux at interface !
622! upfxc - total sky upward flux at interface !
623! dnfx0 - clear sky downward flux at interface !
624! upfx0 - clear sky upward flux at interface !
625! fdncmp(npts) : component surface downward fluxes (w/m**2): !
626! (check module_radsw_parameters for definition) !
627! uvbfc - total sky downward uv-b flux at sfc !
628! uvbf0 - clear sky downward uv-b flux at sfc !
629! nirbm - downward surface nir direct beam flux !
630! nirdf - downward surface nir diffused flux !
631! visbm - downward surface uv+vis direct beam flux !
632! visdf - downward surface uv+vis diffused flux !
633! !
634! module parameters, control variables: !
635! nblow,nbhgh - lower and upper limits of spectral bands !
636! maxgas - maximum number of absorbing gaseous !
637! ngptsw - total number of g-point subintervals !
638! ng## - number of g-points in band (##=16-29) !
639! ngb(ngptsw) - band indices for each g-point !
640! bpade - pade approximation constant (1/0.278) !
641! nspa,nspb(nblow:nbhgh) !
642! - number of lower/upper ref atm's per band !
643! ipsdsw0 - permutation seed for mcica sub-col clds !
644! !
645! major local variables: !
646! pavel (nlay) - layer pressures (mb) !
647! delp (nlay) - layer pressure thickness (mb) !
648! tavel (nlay) - layer temperatures (k) !
649! coldry (nlay) - dry air column amount !
650! (1.e-20*molecules/cm**2) !
651! cldfrc (nlay) - layer cloud fraction (norm by tot cld) !
652! cldfmc (nlay,ngptsw) - layer cloud fraction for g-point !
653! taucw (nlay,nbdsw) - cloud optical depth !
654! ssacw (nlay,nbdsw) - cloud single scattering albedo (weighted) !
655! asycw (nlay,nbdsw) - cloud asymmetry factor (weighted) !
656! tauaer (nlay,nbdsw) - aerosol optical depths !
657! ssaaer (nlay,nbdsw) - aerosol single scattering albedo !
658! asyaer (nlay,nbdsw) - aerosol asymmetry factor !
659! colamt (nlay,maxgas) - column amounts of absorbing gases !
660! 1 to maxgas are for h2o, co2, o3, n2o, !
661! ch4, o2, co, respectively (mol/cm**2) !
662! facij (nlay) - indicator of interpolation factors !
663! =0/1: indicate lower/higher temp & height !
664! selffac(nlay) - scale factor for self-continuum, equals !
665! (w.v. density)/(atm density at 296K,1013 mb) !
666! selffrac(nlay) - factor for temp interpolation of ref !
667! self-continuum data !
668! indself(nlay) - index of the lower two appropriate ref !
669! temp for the self-continuum interpolation !
670! forfac (nlay) - scale factor for w.v. foreign-continuum !
671! forfrac(nlay) - factor for temp interpolation of ref !
672! w.v. foreign-continuum data !
673! indfor (nlay) - index of the lower two appropriate ref !
674! temp for the foreign-continuum interp !
675! laytrop - layer at which switch is made from one !
676! combination of key species to another !
677! jp(nlay),jt(nlay),jt1(nlay) !
678! - lookup table indexes !
679! flxucb(nlp1,nbdsw) - spectral bnd total-sky upward flx (w/m2) !
680! flxdcb(nlp1,nbdsw) - spectral bnd total-sky downward flx (w/m2)!
681! flxu0b(nlp1,nbdsw) - spectral bnd clear-sky upward flx (w/m2) !
682! flxd0b(nlp1,nbdsw) - spectral b d clear-sky downward flx (w/m2)!
683! !
684! !
685! ===================== end of definitions ==================== !
686
687! --- inputs:
688 integer, intent(in) :: npts, nlay, nlp1, nday, iswcliq, iswcice, &
689 isubcsw, iovr, iswmode, iovr_dcorr, iovr_exp, iovr_exprand, &
690 iovr_rand, iovr_maxrand, iovr_max
691
692 integer, dimension(:), intent(in) :: idxday
693 integer, dimension(:), intent(in), optional :: icseed
694
695 logical, intent(in) :: lprnt, lsswr, inc_minor_gas, top_at_1
696
697 real (kind=kind_phys), dimension(:,:), intent(in) :: &
698 & plvl, tlvl
699 real (kind=kind_phys), dimension(:,:), intent(in) :: &
700 & plyr, tlyr, qlyr, olyr, dzlyr, delpin
701
702 real (kind=kind_phys),dimension(:),intent(in):: sfcalb_nir_dir
703 real (kind=kind_phys),dimension(:),intent(in):: sfcalb_nir_dif
704 real (kind=kind_phys),dimension(:),intent(in):: sfcalb_uvis_dir
705 real (kind=kind_phys),dimension(:),intent(in):: sfcalb_uvis_dif
706
707 real(kind=kind_phys),dimension(:,:),intent(in)::gasvmr_co2
708 real(kind=kind_phys),dimension(:,:),intent(in)::gasvmr_n2o
709 real(kind=kind_phys),dimension(:,:),intent(in)::gasvmr_ch4
710 real(kind=kind_phys),dimension(:,:),intent(in)::gasvmr_o2
711 real(kind=kind_phys),dimension(:,:),intent(in)::gasvmr_co
712 real(kind=kind_phys),dimension(:,:),intent(in)::gasvmr_cfc11
713 real(kind=kind_phys),dimension(:,:),intent(in)::gasvmr_cfc12
714 real(kind=kind_phys),dimension(:,:),intent(in)::gasvmr_cfc22
715 real(kind=kind_phys),dimension(:,:),intent(in)::gasvmr_ccl4
716
717 real (kind=kind_phys), dimension(:,:),intent(in):: cld_cf
718 real (kind=kind_phys), dimension(:,:),intent(in),optional:: &
719 & cld_lwp, cld_ref_liq, cld_iwp, cld_ref_ice, &
720 & cld_rwp, cld_ref_rain, cld_swp, cld_ref_snow, &
721 & cld_od, cld_ssa, cld_asy
722
723 real(kind=kind_phys),dimension(:,:,:),intent(in)::aeraod
724 real(kind=kind_phys),dimension(:,:,:),intent(in)::aerssa
725 real(kind=kind_phys),dimension(:,:,:),intent(in)::aerasy
726
727 real (kind=kind_phys), intent(in) :: cosz(npts), solcon, &
728 & de_lgth(npts)
729 real (kind=kind_phys), dimension(npts,nlay), intent(in) :: alpha
730
731! --- outputs:
732 real (kind=kind_phys), dimension(:,:), intent(inout) :: hswc
733 real (kind=kind_phys), dimension(:,:), intent(inout) :: &
734 & cldtau
735
736 type (topfsw_type), dimension(:), intent(inout) :: topflx
737 type (sfcfsw_type), dimension(:), intent(inout) :: sfcflx
738
739 character(len=*), intent(out) :: errmsg
740 integer, intent(out) :: errflg
741
742!! --- optional outputs:
743 real (kind=kind_phys), dimension(:,:,:), optional, &
744 & intent(inout) :: hswb
745
746 real (kind=kind_phys), dimension(:,:), optional, &
747 & intent(inout) :: hsw0
748 type (profsw_type), dimension(:,:), optional, &
749 & intent(inout) :: flxprf
750 type (cmpfsw_type), dimension(:), optional, &
751 & intent(inout) :: fdncmp
752
753! --- locals:
754 real (kind=kind_phys), dimension(nlay,ngptsw) :: cldfmc, &
755 & cldfmc_save, &
756 & taug, taur
757 real (kind=kind_phys), dimension(nlp1,nbdsw):: fxupc, fxdnc, &
758 & fxup0, fxdn0
759
760 real (kind=kind_phys), dimension(nlay,nbdsw) :: &
761 & tauae, ssaae, asyae, taucw, ssacw, asycw
762
763 real (kind=kind_phys), dimension(ngptsw) :: sfluxzen
764
765 real (kind=kind_phys), dimension(nlay) :: cldfrc, delp, &
766 & pavel, tavel, coldry, colmol, h2ovmr, o3vmr, temcol, &
767 & cliqp, reliq, cicep, reice, cdat1, cdat2, cdat3, cdat4, &
768 & cfrac, fac00, fac01, fac10, fac11, forfac, forfrac, &
769 & selffac, selffrac, rfdelp, dz
770
771 real (kind=kind_phys), dimension(nlp1) :: fnet, flxdc, flxuc, &
772 & flxd0, flxu0
773
774 real (kind=kind_phys), dimension(2) :: albbm, albdf, sfbmc, &
775 & sfbm0, sfdfc, sfdf0
776
777 real (kind=kind_phys) :: cosz1, sntz1, tem0, tem1, tem2, s0fac, &
778 & ssolar, zcf0, zcf1, ftoau0, ftoauc, ftoadc, &
779 & fsfcu0, fsfcuc, fsfcd0, fsfcdc, suvbfc, suvbf0, delgth
780 real (kind=kind_phys), dimension(nlay) :: alph
781
782! --- column amount of absorbing gases:
783! (:,m) m = 1-h2o, 2-co2, 3-o3, 4-n2o, 5-ch4, 6-o2, 7-co
784 real (kind=kind_phys) :: colamt(nlay,maxgas)
785
786 integer, dimension(npts) :: ipseed
787 integer, dimension(nlay) :: indfor, indself, jp, jt, jt1
788
789 integer :: i, ib, ipt, j1, k, kk, laytrop, mb, ig
790 integer :: inflgsw, iceflgsw, liqflgsw
791 integer :: irng, permuteseed
792!
793!===> ... begin here
794!
795 ! Initialize CCPP error handling variables
796 errmsg = ''
797 errflg = 0
798
799! Select cloud liquid and ice optics parameterization options
800! For passing in cloud optical properties directly:
801! inflgsw = 0
802! iceflgsw = 0
803! liqflgsw = 0
804! For passing in cloud physical properties; cloud optics parameterized in RRTMG:
805 inflgsw = 2
806 iceflgsw = 3
807 liqflgsw = 1
808!
809 if (.not. lsswr) return
810 if (nday <= 0) return
811
812 lhswb = present ( hswb )
813 lhsw0 = present ( hsw0 )
814 lflxprf= present ( flxprf )
815 lfdncmp= present ( fdncmp )
816
818! *** s0, the solar constant at toa in w/m**2, is hard-coded with
819! each spectra band, the total flux is about 1368.22 w/m**2.
820
821 s0fac = solcon / s0
822
824
825 hswc(:,:) = f_zero
826 cldtau(:,:) = f_zero
827 topflx = topfsw_type( f_zero, f_zero, f_zero )
828 sfcflx = sfcfsw_type( f_zero, f_zero, f_zero, f_zero )
829
830!! --- ... initial optional outputs
831 if ( lflxprf ) then
832 flxprf = profsw_type( f_zero, f_zero, f_zero, f_zero )
833 endif
834
835 if ( lfdncmp ) then
836 fdncmp = cmpfsw_type(f_zero,f_zero,f_zero,f_zero,f_zero,f_zero)
837 endif
838
839 if ( lhsw0 ) then
840 hsw0(:,:) = f_zero
841 endif
842
843 if ( lhswb ) then
844 hswb(:,:,:) = f_zero
845 endif
846
847!! --- check for optional input arguments, depending on cloud method
848 if (iswcliq > 0) then ! use prognostic cloud method
849 if ( .not.present(cld_lwp) .or. .not.present(cld_ref_liq) .or. &
850 & .not.present(cld_iwp) .or. .not.present(cld_ref_ice) .or. &
851 & .not.present(cld_rwp) .or. .not.present(cld_ref_rain) .or. &
852 & .not.present(cld_swp) .or. .not.present(cld_ref_snow) )then
853 write(errmsg,'(*(a))') &
854 & 'Logic error: iswcliq>0 requires the following', &
855 & ' optional arguments to be present:', &
856 & ' cld_lwp, cld_ref_liq, cld_iwp, cld_ref_ice,', &
857 & ' cld_rwp, cld_ref_rain, cld_swp, cld_ref_snow'
858 errflg = 1
859 return
860 end if
861 else ! use diagnostic cloud method
862 if ( .not.present(cld_od) .or. .not.present(cld_ssa) .or. &
863 & .not.present(cld_asy)) then
864 write(errmsg,'(*(a))') &
865 & 'Logic error: iswcliq<=0 requires the following', &
866 & ' optional arguments to be present:', &
867 & ' cld_od, cld_ssa, cld_asy'
868 errflg = 1
869 return
870 end if
871 endif ! end if_iswcliq
872
875
876 if ( isubcsw == 1 ) then ! advance prescribed permutation seed
877 do i = 1, npts
878 ipseed(i) = ipsdsw0 + i
879 enddo
880 elseif ( isubcsw == 2 ) then ! use input array of permutaion seeds
881 do i = 1, npts
882 ipseed(i) = icseed(i)
883 enddo
884 endif
885
886 if ( lprnt ) then
887 write(0,*)' In radsw, isubcsw, ipsdsw0,ipseed =', &
888 & isubcsw, ipsdsw0, ipseed
889 endif
890
891! --- ... loop over each daytime grid point
892
893 lab_do_ipt : do ipt = 1, nday
894
895 j1 = idxday(ipt)
896
897 cosz1 = cosz(j1)
898 sntz1 = f_one / cosz(j1)
899 ssolar = s0fac * cosz(j1)
900 if (iovr == iovr_dcorr) delgth = de_lgth(j1) ! clouds decorr-length
901
903 albbm(1) = sfcalb_nir_dir(j1)
904 albdf(1) = sfcalb_nir_dif(j1)
905 albbm(2) = sfcalb_uvis_dir(j1)
906 albdf(2) = sfcalb_uvis_dif(j1)
907
909! the vertical index of internal array is from surface to top
910
911 if (top_at_1) then ! input from toa to sfc
912
913 tem1 = 100.0 * con_g
914 tem2 = 1.0e-20 * 1.0e3 * con_avgd
915
916 do k = 1, nlay
917 kk = nlp1 - k
918 pavel(k) = plyr(j1,kk)
919 tavel(k) = tlyr(j1,kk)
920 delp(k) = delpin(j1,kk)
921 dz(k) = dzlyr(j1,kk)
922 if (iovr == iovr_exp .or. iovr == iovr_exprand) alph(k) = alpha(j1,k) ! alpha decorrelation
923
929
930!test use
931! h2ovmr(k)= max(f_zero,qlyr(j1,kk)*amdw) ! input mass mixing ratio
932! h2ovmr(k)= max(f_zero,qlyr(j1,kk)) ! input vol mixing ratio
933! o3vmr (k)= max(f_zero,olyr(j1,kk)) ! input vol mixing ratio
934!ncep model use
935 h2ovmr(k)= max(f_zero,qlyr(j1,kk)*amdw/(f_one-qlyr(j1,kk))) ! input specific humidity
936 o3vmr(k)= max(f_zero,olyr(j1,kk)*amdo3) ! input mass mixing ratio
937
938 tem0 = (f_one - h2ovmr(k))*con_amd + h2ovmr(k)*con_amw
939 coldry(k) = tem2 * delp(k) / (tem1*tem0*(f_one + h2ovmr(k)))
940 temcol(k) = 1.0e-12 * coldry(k)
941
942 colamt(k,1) = max(f_zero, coldry(k)*h2ovmr(k)) ! h2o
943 colamt(k,2) = max(temcol(k), coldry(k)*gasvmr_co2(j1,kk)) ! co2
944 colamt(k,3) = max(f_zero, coldry(k)*o3vmr(k)) ! o3
945 colmol(k) = coldry(k) + colamt(k,1)
946 enddo
947
948! --- ... set up gas column amount, convert from volume mixing ratio
949! to molec/cm2 based on coldry (scaled to 1.0e-20)
950
951 if (inc_minor_gas) then
952 do k = 1, nlay
953 kk = nlp1 - k
954 colamt(k,4) = max(temcol(k), coldry(k)*gasvmr_n2o(j1,kk)) ! n2o
955 colamt(k,5) = max(temcol(k), coldry(k)*gasvmr_ch4(j1,kk)) ! ch4
956 colamt(k,6) = max(temcol(k), coldry(k)*gasvmr_o2(j1,kk)) ! o2
957! colamt(k,7) = max(temcol(k), coldry(k)*gasvmr(j1,kk,5)) ! co - notused
958 enddo
959 else
960 do k = 1, nlay
961 colamt(k,4) = temcol(k) ! n2o
962 colamt(k,5) = temcol(k) ! ch4
963 colamt(k,6) = temcol(k) ! o2
964! colamt(k,7) = temcol(k) ! co - notused
965 enddo
966 endif
967
969
970 do k = 1, nlay
971 kk = nlp1 - k
972 do ib = 1, nbdsw
973 tauae(k,ib) = aeraod(j1,kk,ib)
974 ssaae(k,ib) = aerssa(j1,kk,ib)
975 asyae(k,ib) = aerasy(j1,kk,ib)
976 enddo
977 enddo
978
980 if (iswcliq > 0) then ! use prognostic cloud method
981 do k = 1, nlay
982 kk = nlp1 - k
983 cfrac(k) = cld_cf(j1,kk) ! cloud fraction
984 cliqp(k) = cld_lwp(j1,kk) ! cloud liq path
985 reliq(k) = cld_ref_liq(j1,kk) ! liq partical effctive radius
986 cicep(k) = cld_iwp(j1,kk) ! cloud ice path
987 reice(k) = cld_ref_ice(j1,kk) ! ice partical effctive radius
988 cdat1(k) = cld_rwp(j1,kk) ! cloud rain drop path
989 cdat2(k) = cld_ref_rain(j1,kk) ! rain partical effctive radius
990 cdat3(k) = cld_swp(j1,kk) ! cloud snow path
991 cdat4(k) = cld_ref_snow(j1,kk) ! snow partical effctive radius
992 enddo
993 else ! use diagnostic cloud method
994 do k = 1, nlay
995 kk = nlp1 - k
996 cfrac(k) = cld_cf(j1,kk) ! cloud fraction
997 cdat1(k) = cld_od(j1,kk) ! cloud optical depth
998 cdat2(k) = cld_ssa(j1,kk) ! cloud single scattering albedo
999 cdat3(k) = cld_asy(j1,kk) ! cloud asymmetry factor
1000 enddo
1001 endif ! end if_iswcliq
1002
1003 else ! input from sfc to toa
1004
1005 tem1 = 100.0 * con_g
1006 tem2 = 1.0e-20 * 1.0e3 * con_avgd
1007
1008 do k = 1, nlay
1009 pavel(k) = plyr(j1,k)
1010 tavel(k) = tlyr(j1,k)
1011 delp(k) = delpin(j1,k)
1012 dz(k) = dzlyr(j1,k)
1013 if (iovr == iovr_exp .or. iovr == iovr_exprand) alph(k) = alpha(j1,k) ! alpha decorrelation
1014
1015! --- ... set absorber amount
1016!test use
1017! h2ovmr(k)= max(f_zero,qlyr(j1,k)*amdw) ! input mass mixing ratio
1018! h2ovmr(k)= max(f_zero,qlyr(j1,k)) ! input vol mixing ratio
1019! o3vmr (k)= max(f_zero,olyr(j1,k)) ! input vol mixing ratio
1020!ncep model use
1021 h2ovmr(k)= max(f_zero,qlyr(j1,k)*amdw/(f_one-qlyr(j1,k))) ! input specific humidity
1022 o3vmr(k)= max(f_zero,olyr(j1,k)*amdo3) ! input mass mixing ratio
1023
1024 tem0 = (f_one - h2ovmr(k))*con_amd + h2ovmr(k)*con_amw
1025 coldry(k) = tem2 * delp(k) / (tem1*tem0*(f_one + h2ovmr(k)))
1026 temcol(k) = 1.0e-12 * coldry(k)
1027
1028 colamt(k,1) = max(f_zero, coldry(k)*h2ovmr(k)) ! h2o
1029 colamt(k,2) = max(temcol(k), coldry(k)*gasvmr_co2(j1,k)) ! co2
1030 colamt(k,3) = max(f_zero, coldry(k)*o3vmr(k)) ! o3
1031 colmol(k) = coldry(k) + colamt(k,1)
1032 enddo
1033
1034
1035 if (lprnt) then
1036 if (ipt == 1) then
1037 write(0,*)' pavel=',pavel
1038 write(0,*)' tavel=',tavel
1039 write(0,*)' delp=',delp
1040 write(0,*)' h2ovmr=',h2ovmr*1000
1041 write(0,*)' o3vmr=',o3vmr*1000000
1042 endif
1043 endif
1044
1045! --- ... set up gas column amount, convert from volume mixing ratio
1046! to molec/cm2 based on coldry (scaled to 1.0e-20)
1047
1048 if (inc_minor_gas) then
1049 do k = 1, nlay
1050 colamt(k,4) = max(temcol(k), coldry(k)*gasvmr_n2o(j1,k)) ! n2o
1051 colamt(k,5) = max(temcol(k), coldry(k)*gasvmr_ch4(j1,k)) ! ch4
1052 colamt(k,6) = max(temcol(k), coldry(k)*gasvmr_o2(j1,k)) ! o2
1053! colamt(k,7) = max(temcol(k), coldry(k)*gasvmr(j1,k,5)) ! co - notused
1054 enddo
1055 else
1056 do k = 1, nlay
1057 colamt(k,4) = temcol(k) ! n2o
1058 colamt(k,5) = temcol(k) ! ch4
1059 colamt(k,6) = temcol(k) ! o2
1060! colamt(k,7) = temcol(k) ! co - notused
1061 enddo
1062 endif
1063
1064! --- ... set aerosol optical properties
1065
1066 do ib = 1, nbdsw
1067 do k = 1, nlay
1068 tauae(k,ib) = aeraod(j1,k,ib)
1069 ssaae(k,ib) = aerssa(j1,k,ib)
1070 asyae(k,ib) = aerasy(j1,k,ib)
1071 enddo
1072 enddo
1073
1074 if (iswcliq > 0) then ! use prognostic cloud method
1075 do k = 1, nlay
1076 cfrac(k) = cld_cf(j1,k) ! cloud fraction
1077 cliqp(k) = cld_lwp(j1,k) ! cloud liq path
1078 reliq(k) = cld_ref_liq(j1,k) ! liq partical effctive radius
1079 cicep(k) = cld_iwp(j1,k) ! cloud ice path
1080 reice(k) = cld_ref_ice(j1,k) ! ice partical effctive radius
1081 cdat1(k) = cld_rwp(j1,k) ! cloud rain drop path
1082 cdat2(k) = cld_ref_rain(j1,k) ! rain partical effctive radius
1083 cdat3(k) = cld_swp(j1,k) ! cloud snow path
1084 cdat4(k) = cld_ref_snow(j1,k) ! snow partical effctive radius
1085 enddo
1086 else ! use diagnostic cloud method
1087 do k = 1, nlay
1088 cfrac(k) = cld_cf(j1,k) ! cloud fraction
1089 cdat1(k) = cld_od(j1,k) ! cloud optical depth
1090 cdat2(k) = cld_ssa(j1,k) ! cloud single scattering albedo
1091 cdat3(k) = cld_asy(j1,k) ! cloud asymmetry factor
1092 enddo
1093 endif ! end if_iswcliq
1094
1095 endif ! if_top_at_1
1096
1101
1102 zcf0 = f_one
1103 zcf1 = f_one
1104 if (iovr == iovr_rand) then ! random overlapping
1105 do k = 1, nlay
1106 zcf0 = zcf0 * (f_one - cfrac(k))
1107 enddo
1108 else if (iovr == iovr_maxrand) then ! max/ran/exp overlapping
1109 do k = 1, nlay
1110 if (cfrac(k) > ftiny) then ! cloudy layer
1111 zcf1 = min( zcf1, f_one-cfrac(k) )
1112 elseif (zcf1 < f_one) then ! clear layer
1113 zcf0 = zcf0 * zcf1
1114 zcf1 = f_one
1115 endif
1116 enddo
1117 zcf0 = zcf0 * zcf1
1118 else if (iovr >= 2) then
1119 do k = 1, nlay
1120 zcf0 = min( zcf0, f_one-cfrac(k) ) ! used only as clear/cloudy indicator
1121 enddo
1122 endif
1123
1124 if (zcf0 <= ftiny) zcf0 = f_zero
1125 if (zcf0 > oneminus) zcf0 = f_one
1126 zcf1 = f_one - zcf0
1127
1130
1131 if (zcf1 > f_zero) then ! cloudy sky column
1132
1133 call cldprop &
1134! --- inputs:
1135 & ( cfrac,cliqp,reliq,cicep,reice,cdat1,cdat2,cdat3,cdat4, &
1136 & zcf1, nlay, ipseed(j1), dz, delgth, alph, iswcliq, iswcice,&
1137 & isubcsw, iovr, &
1138! --- outputs:
1139 & taucw, ssacw, asycw, cldfrc, cldfmc &
1140 & )
1141
1142! --- ... save computed layer cloud optical depth for output
1143! rrtm band 10 is approx to the 0.55 mu spectrum
1144
1145 if (top_at_1) then ! input from toa to sfc
1146 do k = 1, nlay
1147 kk = nlp1 - k
1148 cldtau(j1,kk) = taucw(k,10)
1149 enddo
1150 else ! input from sfc to toa
1151 do k = 1, nlay
1152 cldtau(j1,k) = taucw(k,10)
1153 enddo
1154 endif ! end if_top_at_1_block
1155
1156 else ! clear sky column
1157 cldfrc(:) = f_zero
1158 cldfmc(:,:)= f_zero
1159 do i = 1, nbdsw
1160 do k = 1, nlay
1161 taucw(k,i) = f_zero
1162 ssacw(k,i) = f_zero
1163 asycw(k,i) = f_zero
1164 enddo
1165 enddo
1166 endif ! end if_zcf1_block
1167
1170 call setcoef &
1171! --- inputs:
1172 & ( pavel,tavel,h2ovmr, nlay,nlp1, &
1173! --- outputs:
1174 & laytrop,jp,jt,jt1,fac00,fac01,fac10,fac11, &
1175 & selffac,selffrac,indself,forfac,forfrac,indfor &
1176 & )
1177
1180 call taumol &
1181! --- inputs:
1182 & ( colamt,colmol,fac00,fac01,fac10,fac11,jp,jt,jt1,laytrop, &
1183 & forfac,forfrac,indfor,selffac,selffrac,indself, nlay, &
1184! --- outputs:
1185 & sfluxzen, taug, taur &
1186 & )
1187
1193
1194 if ( isubcsw <= 0 ) then ! use standard cloud scheme
1195
1196 call spcvrtc &
1197! --- inputs:
1198 & ( ssolar,cosz1,sntz1,albbm,albdf,sfluxzen,cldfrc, &
1199 & zcf1,zcf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw, &
1200 & nlay, nlp1, iswmode, &
1201! --- outputs:
1202 & fxupc,fxdnc,fxup0,fxdn0, &
1203 & ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0, &
1204 & sfbmc,sfdfc,sfbm0,sfdf0,suvbfc,suvbf0 &
1205 & )
1206
1207 else ! use mcica cloud scheme
1208
1209 call spcvrtm &
1210! --- inputs:
1211 & ( ssolar,cosz1,sntz1,albbm,albdf,sfluxzen,cldfmc, &
1212 & zcf1,zcf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw, &
1213 & nlay, nlp1, iswmode, &
1214! --- outputs:
1215 & fxupc,fxdnc,fxup0,fxdn0, &
1216 & ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0, &
1217 & sfbmc,sfdfc,sfbm0,sfdf0,suvbfc,suvbf0 &
1218 & )
1219
1220 endif
1221
1223! --- ... sum up total spectral fluxes for total-sky
1224
1225 do k = 1, nlp1
1226 flxuc(k) = f_zero
1227 flxdc(k) = f_zero
1228
1229 do ib = 1, nbdsw
1230 flxuc(k) = flxuc(k) + fxupc(k,ib)
1231 flxdc(k) = flxdc(k) + fxdnc(k,ib)
1232 enddo
1233 enddo
1234
1235!! --- ... optional clear sky fluxes
1236
1237 if ( lhsw0 .or. lflxprf ) then
1238 do k = 1, nlp1
1239 flxu0(k) = f_zero
1240 flxd0(k) = f_zero
1241
1242 do ib = 1, nbdsw
1243 flxu0(k) = flxu0(k) + fxup0(k,ib)
1244 flxd0(k) = flxd0(k) + fxdn0(k,ib)
1245 enddo
1246 enddo
1247 endif
1248
1249! --- ... prepare for final outputs
1250
1251 do k = 1, nlay
1252 rfdelp(k) = heatfac / delp(k)
1253 enddo
1254
1255 if ( lfdncmp ) then
1256!! --- ... optional uv-b surface downward flux
1257 fdncmp(j1)%uvbf0 = suvbf0
1258 fdncmp(j1)%uvbfc = suvbfc
1259
1260!! --- ... optional beam and diffuse sfc fluxes
1261 fdncmp(j1)%nirbm = sfbmc(1)
1262 fdncmp(j1)%nirdf = sfdfc(1)
1263 fdncmp(j1)%visbm = sfbmc(2)
1264 fdncmp(j1)%visdf = sfdfc(2)
1265 endif ! end if_lfdncmp
1266
1267! --- ... toa and sfc fluxes
1268
1269 topflx(j1)%upfxc = ftoauc
1270 topflx(j1)%dnfxc = ftoadc
1271 topflx(j1)%upfx0 = ftoau0
1272
1273 sfcflx(j1)%upfxc = fsfcuc
1274 sfcflx(j1)%dnfxc = fsfcdc
1275 sfcflx(j1)%upfx0 = fsfcu0
1276 sfcflx(j1)%dnfx0 = fsfcd0
1277
1278 if (top_at_1) then ! output from toa to sfc
1279
1280! --- ... compute heating rates
1281
1282 fnet(1) = flxdc(1) - flxuc(1)
1283
1284 do k = 2, nlp1
1285 kk = nlp1 - k + 1
1286 fnet(k) = flxdc(k) - flxuc(k)
1287 hswc(j1,kk) = (fnet(k)-fnet(k-1)) * rfdelp(k-1)
1288 enddo
1289
1290!! --- ... optional flux profiles
1291
1292 if ( lflxprf ) then
1293 do k = 1, nlp1
1294 kk = nlp1 - k + 1
1295 flxprf(j1,kk)%upfxc = flxuc(k)
1296 flxprf(j1,kk)%dnfxc = flxdc(k)
1297 flxprf(j1,kk)%upfx0 = flxu0(k)
1298 flxprf(j1,kk)%dnfx0 = flxd0(k)
1299 enddo
1300 endif
1301
1302!! --- ... optional clear sky heating rates
1303
1304 if ( lhsw0 ) then
1305 fnet(1) = flxd0(1) - flxu0(1)
1306
1307 do k = 2, nlp1
1308 kk = nlp1 - k + 1
1309 fnet(k) = flxd0(k) - flxu0(k)
1310 hsw0(j1,kk) = (fnet(k)-fnet(k-1)) * rfdelp(k-1)
1311 enddo
1312 endif
1313
1314!! --- ... optional spectral band heating rates
1315
1316 if ( lhswb ) then
1317 do mb = 1, nbdsw
1318 fnet(1) = fxdnc(1,mb) - fxupc(1,mb)
1319
1320 do k = 2, nlp1
1321 kk = nlp1 - k + 1
1322 fnet(k) = fxdnc(k,mb) - fxupc(k,mb)
1323 hswb(j1,kk,mb) = (fnet(k) - fnet(k-1)) * rfdelp(k-1)
1324 enddo
1325 enddo
1326 endif
1327
1328 else ! output from sfc to toa
1329
1330! --- ... compute heating rates
1331
1332 fnet(1) = flxdc(1) - flxuc(1)
1333
1334 do k = 2, nlp1
1335 fnet(k) = flxdc(k) - flxuc(k)
1336 hswc(j1,k-1) = (fnet(k)-fnet(k-1)) * rfdelp(k-1)
1337 enddo
1338
1339!! --- ... optional flux profiles
1340
1341 if ( lflxprf ) then
1342 do k = 1, nlp1
1343 flxprf(j1,k)%upfxc = flxuc(k)
1344 flxprf(j1,k)%dnfxc = flxdc(k)
1345 flxprf(j1,k)%upfx0 = flxu0(k)
1346 flxprf(j1,k)%dnfx0 = flxd0(k)
1347 enddo
1348 endif
1349
1350!! --- ... optional clear sky heating rates
1351
1352 if ( lhsw0 ) then
1353 fnet(1) = flxd0(1) - flxu0(1)
1354
1355 do k = 2, nlp1
1356 fnet(k) = flxd0(k) - flxu0(k)
1357 hsw0(j1,k-1) = (fnet(k)-fnet(k-1)) * rfdelp(k-1)
1358 enddo
1359 endif
1360
1361!! --- ... optional spectral band heating rates
1362
1363 if ( lhswb ) then
1364 do mb = 1, nbdsw
1365 fnet(1) = fxdnc(1,mb) - fxupc(1,mb)
1366
1367 do k = 1, nlay
1368 fnet(k+1) = fxdnc(k+1,mb) - fxupc(k+1,mb)
1369 hswb(j1,k,mb) = (fnet(k+1) - fnet(k)) * rfdelp(k)
1370 enddo
1371 enddo
1372 endif
1373
1374 endif ! if_top_at_1
1375
1376 enddo lab_do_ipt
1377
1378 return
1379!...................................
1380 end subroutine rrtmg_sw_run
1381!-----------------------------------
1382
1388!-----------------------------------
1389 subroutine rswinit( me, rad_hr_units, inc_minor_gas, iswcliq, &
1390 isubcsw, iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,&
1391 iovr_exp, iovr_exprand, iswmode, errflg, errmsg )
1392
1393! =================== program usage description =================== !
1394! !
1395! purpose: initialize non-varying module variables, conversion factors,!
1396! and look-up tables. !
1397! !
1398! subprograms called: none !
1399! !
1400! ==================== defination of variables ==================== !
1401! !
1402! inputs: !
1403! me - print control for parallel process !
1404! rad_hr_units - !
1405! iswcliq - liquid cloud optical properties contrl flag !
1406! =0: input cloud opt depth from diagnostic scheme !
1407! >0: input cwp,rew, and other cloud content parameters !
1408! isubcsw - sub-column cloud approximation control flag !
1409! =0: no sub-col cld treatment, use grid-mean cld quantities !
1410! =1: mcica sub-col, prescribed seeds to get random numbers !
1411! =2: mcica sub-col, providing array icseed for random numbers!
1412! iovr - clouds vertical overlapping control flag !
1413! =iovr_rand !
1414! =iovr_maxrand !
1415! =iovr_max !
1416! =iovr_dcorr !
1417! =iovr_exp !
1418! =iovr_exprand !
1419! iovr_rand - choice of cloud-overlap: random !
1420! iovr_maxrand - choice of cloud-overlap: maximum random !
1421! iovr_max - choice of cloud-overlap: maximum !
1422! iovr_dcorr - choice of cloud-overlap: decorrelation length !
1423! iovr_exp - choice of cloud-overlap: exponential !
1424! iovr_exprand - choice of cloud-overlap: exponential random !
1425! iswmode - control flag for 2-stream transfer scheme !
1426! =1; delta-eddington (joseph et al., 1976) !
1427! =2: pifm (zdunkowski et al., 1980) !
1428! =3: discrete ordinates (liou, 1973) !
1429! !
1430! outputs: !
1431! errflg - error flag !
1432! errmsg - error message !
1433! ******************************************************************* !
1434! !
1435! definitions: !
1436! arrays for 10000-point look-up tables: !
1437! tau_tbl clear-sky optical depth !
1438! exp_tbl exponential lookup table for transmittance !
1439! !
1440! ******************************************************************* !
1441! !
1442! ====================== end of description block ================= !
1443
1444! --- inputs:
1445 integer, intent(in) :: me, rad_hr_units, iswcliq, isubcsw, iovr, &
1446 iswmode, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, &
1447 iovr_exp, iovr_exprand
1448 logical, intent(in) :: inc_minor_gas
1449! --- outputs:
1450 character(len=*), intent(out) :: errmsg
1451 integer, intent(out) :: errflg
1452
1453! --- locals:
1454 real (kind=kind_phys), parameter :: expeps = 1.e-20
1455
1456 integer :: i
1457
1458 real (kind=kind_phys) :: tfn, tau
1459
1460!
1461!===> ... begin here
1462!
1463 ! Initialize error-handling
1464 errflg = 0
1465 errmsg = ''
1466
1467 if ((iovr .ne. iovr_rand) .and. (iovr .ne. iovr_maxrand) .and. &
1468 (iovr .ne. iovr_max) .and. (iovr .ne. iovr_dcorr) .and. &
1469 (iovr .ne. iovr_exp) .and. (iovr .ne. iovr_exprand)) then
1470 errflg = 1
1471 errmsg = 'ERROR(rswinit): Error in specification of cloud overlap flag'
1472 endif
1473
1474 if (me == 0) then
1475 print *,' - Using AER Shortwave Radiation, Version: ',vtagsw
1476
1477 if (iswmode == 1) then
1478 print *,' --- Delta-eddington 2-stream transfer scheme'
1479 else if (iswmode == 2) then
1480 print *,' --- PIFM 2-stream transfer scheme'
1481 else if (iswmode == 3) then
1482 print *,' --- Discrete ordinates 2-stream transfer scheme'
1483 endif
1484
1485 if (.not. inc_minor_gas) then
1486 print *,' --- Rare gases absorption is NOT included in SW'
1487 else
1488 print *,' --- Include rare gases N2O, CH4, O2, absorptions',&
1489 & ' in SW'
1490 endif
1491
1492 if ( isubcsw == 0 ) then
1493 print *,' --- Using standard grid average clouds, no ', &
1494 & 'sub-column clouds approximation applied'
1495 elseif ( isubcsw == 1 ) then
1496 print *,' --- Using MCICA sub-colum clouds approximation ', &
1497 & 'with a prescribed sequence of permutation seeds'
1498 elseif ( isubcsw == 2 ) then
1499 print *,' --- Using MCICA sub-colum clouds approximation ', &
1500 & 'with provided input array of permutation seeds'
1501 endif
1502 endif
1503
1506
1507 if (rad_hr_units == 1) then
1508! heatfac = 8.4391
1509! heatfac = con_g * 86400. * 1.0e-2 / con_cp ! (in k/day)
1510 heatfac = con_g * 864.0 / con_cp ! (in k/day)
1511 else
1512 heatfac = con_g * 1.0e-2 / con_cp ! (in k/second)
1513 endif
1514
1516! tau is computed as a function of the \a tau transition function, and
1517! transmittance is calculated as a function of tau. all tables
1518! are computed at intervals of 0.0001. the inverse of the
1519! constant used in the Pade approximation to the tau transition
1520! function is set to bpade.
1521
1522 exp_tbl(0) = 1.0
1523 exp_tbl(ntbmx) = expeps
1524
1525 do i = 1, ntbmx-1
1526 tfn = float(i) / float(ntbmx-i)
1527 tau = bpade * tfn
1528 exp_tbl(i) = exp( -tau )
1529#ifdef SINGLE_PREC
1530 ! from WRF version, prevents zero at single prec
1531 if (exp_tbl(i) .le. expeps) exp_tbl(i) = expeps
1532#endif
1533 enddo
1534
1535 return
1536!...................................
1537 end subroutine rswinit
1538!-----------------------------------
1539
1567 subroutine cldprop &
1568 & ( cfrac,cliqp,reliq,cicep,reice,cdat1,cdat2,cdat3,cdat4, & ! --- inputs
1569 & cf1, nlay, ipseed, dz, delgth, alpha, iswcliq, iswcice, &
1570 & isubcsw, iovr, taucw, ssacw, asycw, cldfrc, cldfmc & ! --- output
1571 & )
1572
1573! =================== program usage description =================== !
1574! !
1575! Purpose: Compute the cloud optical properties for each cloudy layer !
1576! and g-point interval. !
1577! !
1578! subprograms called: none !
1579! !
1580! ==================== defination of variables ==================== !
1581! !
1582! inputs: size !
1583! cfrac - real, layer cloud fraction nlay !
1584! ..... for iswcliq > 0 (prognostic cloud scheme) - - - !
1585! cliqp - real, layer in-cloud liq water path (g/m**2) nlay !
1586! reliq - real, mean eff radius for liq cloud (micron) nlay !
1587! cicep - real, layer in-cloud ice water path (g/m**2) nlay !
1588! reice - real, mean eff radius for ice cloud (micron) nlay !
1589! cdat1 - real, layer rain drop water path (g/m**2) nlay !
1590! cdat2 - real, effective radius for rain drop (micron) nlay !
1591! cdat3 - real, layer snow flake water path(g/m**2) nlay !
1592! cdat4 - real, mean eff radius for snow flake(micron) nlay !
1593! ..... for iswcliq = 0 (diagnostic cloud scheme) - - - !
1594! cdat1 - real, layer cloud optical depth nlay !
1595! cdat2 - real, layer cloud single scattering albedo nlay !
1596! cdat3 - real, layer cloud asymmetry factor nlay !
1597! cdat4 - real, optional use nlay !
1598! cliqp - real, not used nlay !
1599! cicep - real, not used nlay !
1600! reliq - real, not used nlay !
1601! reice - real, not used nlay !
1602! !
1603! cf1 - real, effective total cloud cover at surface 1 !
1604! nlay - integer, vertical layer number 1 !
1605! ipseed- permutation seed for generating random numbers (isubcsw>0) !
1606! dz - real, layer thickness (km) nlay !
1607! delgth- real, layer cloud decorrelation length (km) 1 !
1608! alpha - real, EXP/ER decorrelation parameter nlay !
1609! !
1610! outputs: !
1611! taucw - real, cloud optical depth, w/o delta scaled nlay*nbdsw !
1612! ssacw - real, weighted cloud single scattering albedo nlay*nbdsw !
1613! (ssa = ssacw / taucw) !
1614! asycw - real, weighted cloud asymmetry factor nlay*nbdsw !
1615! (asy = asycw / ssacw) !
1616! cldfrc - real, cloud fraction of grid mean value nlay !
1617! cldfmc - real, cloud fraction for each sub-column nlay*ngptsw!
1618! !
1619! !
1620! explanation of the method for each value of iswcliq, and iswcice. !
1621! provided by host-model !
1622! !
1623! iswcliq=0 : input cloud optical property (tau, ssa, asy). !
1624! (used for diagnostic cloud method) !
1625! iswcliq>0 : input cloud liq/ice path and effective radius, also !
1626! require the user of 'iswcice' to specify the method !
1627! used to compute aborption due to water/ice parts. !
1628! ................................................................... !
1629! !
1630! iswcliq=1 : liquid water cloud optical properties are computed !
1631! as in hu and stamnes (1993), j. clim., 6, 728-742. !
1632! iswcliq=2 : updated coeffs for hu and stamnes (1993) by aer !
1633! w v3.9-v4.0. !
1634! !
1635! iswcice used only when iswcliq > 0 !
1636! the cloud ice path (g/m2) and ice effective radius !
1637! (microns) are inputs. !
1638! iswcice=1 : ice cloud optical properties are computed as in !
1639! ebert and curry (1992), jgr, 97, 3831-3836. !
1640! iswcice=2 : ice cloud optical properties are computed as in !
1641! streamer v3.0 (2001), key, streamer user's guide, !
1642! cooperative institude for meteorological studies,95pp!
1643! iswcice=3 : ice cloud optical properties are computed as in !
1644! fu (1996), j. clim., 9. !
1645! !
1646! other cloud control module variables: !
1647! isubcsw =0: standard cloud scheme, no sub-col cloud approximation !
1648! >0: mcica sub-col cloud scheme using ipseed as permutation!
1649! seed for generating rundom numbers !
1650! !
1651! ====================== end of description block ================= !
1652!
1654
1655! --- inputs:
1656 integer, intent(in) :: nlay, ipseed, iswcliq, iswcice, isubcsw, &
1657 iovr
1658 real (kind=kind_phys), intent(in) :: cf1, delgth
1659
1660 real (kind=kind_phys), dimension(nlay), intent(in) :: cliqp, &
1661 & reliq, cicep, reice, cdat1, cdat2, cdat3, cdat4, cfrac, dz
1662 real (kind=kind_phys), dimension(nlay), intent(in) :: alpha
1663
1664! --- outputs:
1665 real (kind=kind_phys), dimension(nlay,ngptsw), intent(out) :: &
1666 & cldfmc
1667 real (kind=kind_phys), dimension(nlay,nbdsw), intent(out) :: &
1668 & taucw, ssacw, asycw
1669 real (kind=kind_phys), dimension(nlay), intent(out) :: cldfrc
1670
1671! --- locals:
1672 real (kind=kind_phys), dimension(nblow:nbhgh) :: tauliq, tauice, &
1673 & ssaliq, ssaice, ssaran, ssasnw, asyliq, asyice, &
1674 & asyran, asysnw
1675 real (kind=kind_phys), dimension(nlay) :: cldf
1676
1677 real (kind=kind_phys) :: dgeice, factor, fint, tauran, tausnw, &
1678 & cldliq, refliq, cldice, refice, cldran, cldsnw, refsnw, &
1679 & extcoliq, ssacoliq, asycoliq, extcoice, ssacoice, asycoice,&
1680 & dgesnw
1681
1682 logical :: lcloudy(nlay,ngptsw)
1683 integer :: ia, ib, ig, jb, k, index
1684
1685!
1686!===> ... begin here
1687!
1688 do ib = 1, nbdsw
1689 do k = 1, nlay
1690 taucw(k,ib) = f_zero
1691 ssacw(k,ib) = f_one
1692 asycw(k,ib) = f_zero
1693 enddo
1694 enddo
1695
1697
1698 lab_if_iswcliq : if (iswcliq > 0) then
1699
1700 lab_do_k : do k = 1, nlay
1701 lab_if_cld : if (cfrac(k) > ftiny) then
1702
1714
1715 cldran = cdat1(k)
1716! refran = cdat2(k)
1717 cldsnw = cdat3(k)
1718 refsnw = cdat4(k)
1719 dgesnw = 1.0315 * refsnw ! for fu's snow formula
1720
1721 tauran = cldran * a0r
1722
1729 if (cldsnw>f_zero .and. refsnw>10.0_kind_phys) then
1730! tausnw = cldsnw * (a0s + a1s/refsnw)
1731 tausnw = cldsnw*1.09087*(a0s + a1s/dgesnw) ! fu's formula
1732 else
1733 tausnw = f_zero
1734 endif
1735
1736 do ib = nblow, nbhgh
1737 ssaran(ib) = tauran * (f_one - b0r(ib))
1738 ssasnw(ib) = tausnw * (f_one - (b0s(ib)+b1s(ib)*dgesnw))
1739 asyran(ib) = ssaran(ib) * c0r(ib)
1740 asysnw(ib) = ssasnw(ib) * c0s(ib)
1741 enddo
1742
1743 cldliq = cliqp(k)
1744 cldice = cicep(k)
1745 refliq = reliq(k)
1746 refice = reice(k)
1747
1749
1750 if ( cldliq <= f_zero ) then
1751 do ib = nblow, nbhgh
1752 tauliq(ib) = f_zero
1753 ssaliq(ib) = f_zero
1754 asyliq(ib) = f_zero
1755 enddo
1756 else
1757 factor = refliq - 1.5
1758 index = max( 1, min( 57, int( factor ) ))
1759 fint = factor - float(index)
1760
1761 if ( iswcliq == 1 ) then
1762 do ib = nblow, nbhgh
1763 extcoliq = max(f_zero, extliq1(index,ib) &
1764 & + fint*(extliq1(index+1,ib)-extliq1(index,ib)) )
1765 ssacoliq = max(f_zero, min(f_one, ssaliq1(index,ib) &
1766 & + fint*(ssaliq1(index+1,ib)-ssaliq1(index,ib)) ))
1767
1768 asycoliq = max(f_zero, min(f_one, asyliq1(index,ib) &
1769 & + fint*(asyliq1(index+1,ib)-asyliq1(index,ib)) ))
1770! forcoliq = asycoliq * asycoliq
1771
1772 tauliq(ib) = cldliq * extcoliq
1773 ssaliq(ib) = tauliq(ib) * ssacoliq
1774 asyliq(ib) = ssaliq(ib) * asycoliq
1775 enddo
1776 elseif ( iswcliq == 2 ) then ! use updated coeffs
1777 do ib = nblow, nbhgh
1778 extcoliq = max(f_zero, extliq2(index,ib) &
1779 & + fint*(extliq2(index+1,ib)-extliq2(index,ib)) )
1780 ssacoliq = max(f_zero, min(f_one, ssaliq2(index,ib) &
1781 & + fint*(ssaliq2(index+1,ib)-ssaliq2(index,ib)) ))
1782
1783 asycoliq = max(f_zero, min(f_one, asyliq2(index,ib) &
1784 & + fint*(asyliq2(index+1,ib)-asyliq2(index,ib)) ))
1785! forcoliq = asycoliq * asycoliq
1786
1787 tauliq(ib) = cldliq * extcoliq
1788 ssaliq(ib) = tauliq(ib) * ssacoliq
1789 asyliq(ib) = ssaliq(ib) * asycoliq
1790 enddo
1791 endif ! end if_iswcliq_block
1792 endif ! end if_cldliq_block
1793
1795
1796 if ( cldice <= f_zero ) then
1797 do ib = nblow, nbhgh
1798 tauice(ib) = f_zero
1799 ssaice(ib) = f_zero
1800 asyice(ib) = f_zero
1801 enddo
1802 else
1803
1806
1807 if ( iswcice == 1 ) then
1808 refice = min(130.0_kind_phys,max(13.0_kind_phys,refice))
1809
1810 do ib = nblow, nbhgh
1811 ia = idxebc(ib) ! eb_&_c band index for ice cloud coeff
1812
1813 extcoice = max(f_zero, abari(ia)+bbari(ia)/refice )
1814 ssacoice = max(f_zero, min(f_one, &
1815 & f_one-cbari(ia)-dbari(ia)*refice ))
1816 asycoice = max(f_zero, min(f_one, &
1817 & ebari(ia)+fbari(ia)*refice ))
1818! forcoice = asycoice * asycoice
1819
1820 tauice(ib) = cldice * extcoice
1821 ssaice(ib) = tauice(ib) * ssacoice
1822 asyice(ib) = ssaice(ib) * asycoice
1823 enddo
1824
1826
1827 elseif ( iswcice == 2 ) then
1828 refice = min(131.0_kind_phys,max(5.0_kind_phys,refice))
1829
1830 factor = (refice - 2.0) / 3.0
1831 index = max( 1, min( 42, int( factor ) ))
1832 fint = factor - float(index)
1833
1834 do ib = nblow, nbhgh
1835 extcoice = max(f_zero, extice2(index,ib) &
1836 & + fint*(extice2(index+1,ib)-extice2(index,ib)) )
1837 ssacoice = max(f_zero, min(f_one, ssaice2(index,ib) &
1838 & + fint*(ssaice2(index+1,ib)-ssaice2(index,ib)) ))
1839 asycoice = max(f_zero, min(f_one, asyice2(index,ib) &
1840 & + fint*(asyice2(index+1,ib)-asyice2(index,ib)) ))
1841! forcoice = asycoice * asycoice
1842
1843 tauice(ib) = cldice * extcoice
1844 ssaice(ib) = tauice(ib) * ssacoice
1845 asyice(ib) = ssaice(ib) * asycoice
1846 enddo
1847
1850
1851 elseif ( iswcice == 3 ) then
1852 dgeice = max( 5.0, min( 140.0, 1.0315*refice ))
1853
1854 factor = (dgeice - 2.0) / 3.0
1855 index = max( 1, min( 45, int( factor ) ))
1856 fint = factor - float(index)
1857
1858 do ib = nblow, nbhgh
1859 extcoice = max(f_zero, extice3(index,ib) &
1860 & + fint*(extice3(index+1,ib)-extice3(index,ib)) )
1861 ssacoice = max(f_zero, min(f_one, ssaice3(index,ib) &
1862 & + fint*(ssaice3(index+1,ib)-ssaice3(index,ib)) ))
1863 asycoice = max(f_zero, min(f_one, asyice3(index,ib) &
1864 & + fint*(asyice3(index+1,ib)-asyice3(index,ib)) ))
1865! fdelta = max(f_zero, min(f_one, fdlice3(index,ib) &
1866! & + fint*(fdlice3(index+1,ib)-fdlice3(index,ib)) ))
1867! forcoice = min( asycoice, fdelta+0.5/ssacoice ) ! see fu 1996 p. 2067
1868
1869 tauice(ib) = cldice * extcoice
1870 ssaice(ib) = tauice(ib) * ssacoice
1871 asyice(ib) = ssaice(ib) * asycoice
1872 enddo
1873
1874 endif ! end if_iswcice_block
1875 endif ! end if_cldice_block
1876
1877 do ib = 1, nbdsw
1878 jb = nblow + ib - 1
1879 taucw(k,ib) = tauliq(jb)+tauice(jb)+tauran+tausnw
1880 ssacw(k,ib) = ssaliq(jb)+ssaice(jb)+ssaran(jb)+ssasnw(jb)
1881 asycw(k,ib) = asyliq(jb)+asyice(jb)+asyran(jb)+asysnw(jb)
1882 enddo
1883
1884 endif lab_if_cld
1885 enddo lab_do_k
1886
1887 else lab_if_iswcliq
1888
1889 do k = 1, nlay
1890 if (cfrac(k) > ftiny) then
1891 do ib = 1, nbdsw
1892 taucw(k,ib) = cdat1(k)
1893 ssacw(k,ib) = cdat1(k) * cdat2(k)
1894 asycw(k,ib) = ssacw(k,ib) * cdat3(k)
1895 enddo
1896 endif
1897 enddo
1898
1899 endif lab_if_iswcliq
1900
1903
1904 if ( isubcsw > 0 ) then ! mcica sub-col clouds approx
1905
1906 cldf(:) = cfrac(:)
1907 where (cldf(:) < ftiny)
1908 cldf(:) = f_zero
1909 end where
1910
1911! --- ... call sub-column cloud generator
1912
1913 call mcica_subcol &
1914! --- inputs:
1915 & ( cldf, nlay, ipseed, dz, delgth, alpha, iovr, &
1916! --- outputs:
1917 & lcloudy &
1918 & )
1919
1920 do ig = 1, ngptsw
1921 do k = 1, nlay
1922 if ( lcloudy(k,ig) ) then
1923 cldfmc(k,ig) = f_one
1924 else
1925 cldfmc(k,ig) = f_zero
1926 endif
1927 enddo
1928 enddo
1929
1930 else ! non-mcica, normalize cloud
1931
1932 do k = 1, nlay
1933 cldfrc(k) = cfrac(k) / cf1
1934 enddo
1935 endif ! end if_isubcsw_block
1936
1937 return
1938!...................................
1939 end subroutine cldprop
1940!-----------------------------------
1941
1952! ----------------------------------
1953 subroutine mcica_subcol &
1954 & ( cldf, nlay, ipseed, dz, de_lgth, alpha, iovr, & ! --- inputs
1955 & lcloudy & ! --- outputs
1956 & )
1957
1958! ==================== defination of variables ==================== !
1959! !
1960! input variables: size !
1961! cldf - real, layer cloud fraction nlay !
1962! nlay - integer, number of model vertical layers 1 !
1963! ipseed - integer, permute seed for random num generator 1 !
1964! ** note : if the cloud generator is called multiple times, need !
1965! to permute the seed between each call; if between calls !
1966! for lw and sw, use values differ by the number of g-pts. !
1967! dz - real, layer thickness (km) nlay !
1968! de_lgth - real, layer cloud decorrelation length (km) 1 !
1969! alpha - real, EXP/ER decorrelation parameter nlay !
1970! iovr - control flag for cloud overlapping method 1 !
1971! =0: random !
1972! =1: maximum/random overlapping clouds !
1973! =2: maximum overlap cloud !
1974! =3: cloud decorrelation-length overlap method !
1975! =4: exponential cloud overlap method (AER) !
1976! =5: exponential-random cloud overlap method (AER) !
1977! !
1978! output variables: !
1979! lcloudy - logical, sub-colum cloud profile flag array nlay*ngptsw!
1980! !
1981! ===================== end of definitions ==================== !
1982
1983 implicit none
1984
1985! --- inputs:
1986 integer, intent(in) :: nlay, ipseed, iovr
1987
1988 real (kind=kind_phys), dimension(nlay), intent(in) :: cldf, dz
1989 real (kind=kind_phys), intent(in) :: de_lgth
1990 real (kind=kind_phys), dimension(nlay), intent(in) :: alpha
1991
1992! --- outputs:
1993 logical, dimension(nlay,ngptsw), intent(out):: lcloudy
1994
1995! --- locals:
1996 real (kind=kind_phys) :: cdfunc(nlay,ngptsw), tem1, &
1997 & fac_lcf(nlay), &
1998 & cdfun2(nlay,ngptsw)
1999 real (kind=kind_dbl_prec) :: rand2d(nlay*ngptsw), rand1d(ngptsw) ! must be default real kind to match mersenne twister code
2000
2001 type (random_stat) :: stat ! for thread safe random generator
2002
2003 integer :: k, n, k1
2004!
2005!===> ... begin here
2006!
2008
2009 call random_setseed &
2010! --- inputs:
2011 & ( ipseed, &
2012! --- outputs:
2013 & stat &
2014 & )
2015
2017
2018 select case ( iovr )
2019
2020 case( 0 ) ! random overlap, pick a random value at every level
2021
2022 call random_number &
2023! --- inputs: ( none )
2024! --- outputs:
2025 & ( rand2d, stat )
2026
2027 k1 = 0
2028 do n = 1, ngptsw
2029 do k = 1, nlay
2030 k1 = k1 + 1
2031 cdfunc(k,n) = rand2d(k1)
2032 enddo
2033 enddo
2034
2035 case( 1 ) ! max-ran overlap
2036
2037 call random_number &
2038! --- inputs: ( none )
2039! --- outputs:
2040 & ( rand2d, stat )
2041
2042 k1 = 0
2043 do n = 1, ngptsw
2044 do k = 1, nlay
2045 k1 = k1 + 1
2046 cdfunc(k,n) = rand2d(k1)
2047 enddo
2048 enddo
2049
2050! --- first pick a random number for bottom/top layer.
2051! then walk up the column: (aer's code)
2052! if layer below is cloudy, use the same rand num in the layer below
2053! if layer below is clear, use a new random number
2054
2055! --- from bottom up
2056 do k = 2, nlay
2057 k1 = k - 1
2058 tem1 = f_one - cldf(k1)
2059
2060 do n = 1, ngptsw
2061 if ( cdfunc(k1,n) > tem1 ) then
2062 cdfunc(k,n) = cdfunc(k1,n)
2063 else
2064 cdfunc(k,n) = cdfunc(k,n) * tem1
2065 endif
2066 enddo
2067 enddo
2068
2069! --- then walk down the column: (if use original author's method)
2070! if layer above is cloudy, use the same rand num in the layer above
2071! if layer above is clear, use a new random number
2072
2073! --- from top down
2074! do k = nlay-1, 1, -1
2075! k1 = k + 1
2076! tem1 = f_one - cldf(k1)
2077
2078! do n = 1, ngptsw
2079! if ( cdfunc(k1,n) > tem1 ) then
2080! cdfunc(k,n) = cdfunc(k1,n)
2081! else
2082! cdfunc(k,n) = cdfunc(k,n) * tem1
2083! endif
2084! enddo
2085! enddo
2086
2087 case( 2 ) ! maximum overlap, pick same random numebr at every level
2088
2089 call random_number &
2090! --- inputs: ( none )
2091! --- outputs:
2092 & ( rand1d, stat )
2093
2094 do n = 1, ngptsw
2095 tem1 = rand1d(n)
2096
2097 do k = 1, nlay
2098 cdfunc(k,n) = tem1
2099 enddo
2100 enddo
2101
2102 case( 3 ) ! decorrelation length overlap
2103
2104! --- compute overlapping factors based on layer midpoint distances
2105! and decorrelation depths
2106
2107 do k = nlay, 2, -1
2108 fac_lcf(k) = exp( -0.5 * (dz(k)+dz(k-1)) / de_lgth )
2109 enddo
2110
2111! --- setup 2 sets of random numbers
2112
2113 call random_number ( rand2d, stat )
2114
2115 k1 = 0
2116 do n = 1, ngptsw
2117 do k = 1, nlay
2118 k1 = k1 + 1
2119 cdfunc(k,n) = rand2d(k1)
2120 enddo
2121 enddo
2122
2123 call random_number ( rand2d, stat )
2124
2125 k1 = 0
2126 do n = 1, ngptsw
2127 do k = 1, nlay
2128 k1 = k1 + 1
2129 cdfun2(k,n) = rand2d(k1)
2130 enddo
2131 enddo
2132
2133! --- then working from the top down:
2134! if a random number (from an independent set -cdfun2) is smaller then the
2135! scale factor: use the upper layer's number, otherwise use a new random
2136! number (keep the original assigned one).
2137
2138 do n = 1, ngptsw
2139 do k = nlay-1, 1, -1
2140 k1 = k + 1
2141 if ( cdfun2(k,n) <= fac_lcf(k1) ) then
2142 cdfunc(k,n) = cdfunc(k1,n)
2143 endif
2144 enddo
2145 enddo
2146
2147 case( 4:5 ) ! exponential and exponential-random cloud overlap
2148
2149! --- Use previously derived decorrelation parameter, alpha, to specify
2150! the exponenential transition of cloud correlation in the vertical column.
2151!
2152! For exponential cloud overlap, the correlation is applied across layers
2153! without regard to the configuration of clear and cloudy layers.
2154
2155! For exponential-random cloud overlap, a new exponential transition is
2156! performed within each group of adjacent cloudy layers and blocks of
2157! cloudy layers with clear layers between them are correlated randomly.
2158!
2159! NOTE: The code below is identical for case (4) and (5) because the
2160! distinction in the vertical correlation between EXP and ER is already
2161! built into the specification of alpha (in subroutine get_alpha_exper).
2162
2163! --- setup 2 sets of random numbers
2164
2165 call random_number ( rand2d, stat )
2166
2167 k1 = 0
2168 do n = 1, ngptsw
2169 do k = 1, nlay
2170 k1 = k1 + 1
2171 cdfunc(k,n) = rand2d(k1)
2172 enddo
2173 enddo
2174
2175 call random_number ( rand2d, stat )
2176
2177 k1 = 0
2178 do n = 1, ngptsw
2179 do k = 1, nlay
2180 k1 = k1 + 1
2181 cdfun2(k,n) = rand2d(k1)
2182 enddo
2183 enddo
2184
2185! --- then working upward from the surface:
2186! if a random number (from an independent set: cdfun2) is smaller than
2187! alpha, then use the previous layer's number, otherwise use a new random
2188! number (keep the originally assigned one in cdfunc for that layer).
2189
2190 do n = 1, ngptsw
2191 do k = 2, nlay
2192 k1 = k - 1
2193 if ( cdfun2(k,n) < alpha(k) ) then
2194 cdfunc(k,n) = cdfunc(k1,n)
2195 endif
2196 enddo
2197 enddo
2198
2199 end select
2200
2202
2203 do k = 1, nlay
2204 tem1 = f_one - cldf(k)
2205
2206 do n = 1, ngptsw
2207 lcloudy(k,n) = cdfunc(k,n) >= tem1
2208 enddo
2209 enddo
2210
2211 return
2212! ..................................
2213 end subroutine mcica_subcol
2214! ----------------------------------
2215
2242! ----------------------------------
2243 subroutine setcoef &
2244 & ( pavel,tavel,h2ovmr, nlay,nlp1, & ! --- inputs
2245 & laytrop,jp,jt,jt1,fac00,fac01,fac10,fac11, & ! --- outputs
2246 & selffac,selffrac,indself,forfac,forfrac,indfor &
2247 & )
2248
2249! =================== program usage description =================== !
2250! !
2251! purpose: compute various coefficients needed in radiative transfer !
2252! calculations. !
2253! !
2254! subprograms called: none !
2255! !
2256! ==================== defination of variables ==================== !
2257! !
2258! inputs: -size- !
2259! pavel - real, layer pressures (mb) nlay !
2260! tavel - real, layer temperatures (k) nlay !
2261! h2ovmr - real, layer w.v. volum mixing ratio (kg/kg) nlay !
2262! nlay/nlp1 - integer, total number of vertical layers, levels 1 !
2263! !
2264! outputs: !
2265! laytrop - integer, tropopause layer index (unitless) 1 !
2266! jp - real, indices of lower reference pressure nlay !
2267! jt, jt1 - real, indices of lower reference temperatures nlay !
2268! at levels of jp and jp+1 !
2269! facij - real, factors multiply the reference ks, nlay !
2270! i,j=0/1 for lower/higher of the 2 appropriate !
2271! temperatures and altitudes. !
2272! selffac - real, scale factor for w. v. self-continuum nlay !
2273! equals (w. v. density)/(atmospheric density !
2274! at 296k and 1013 mb) !
2275! selffrac - real, factor for temperature interpolation of nlay !
2276! reference w. v. self-continuum data !
2277! indself - integer, index of lower ref temp for selffac nlay !
2278! forfac - real, scale factor for w. v. foreign-continuum nlay !
2279! forfrac - real, factor for temperature interpolation of nlay !
2280! reference w.v. foreign-continuum data !
2281! indfor - integer, index of lower ref temp for forfac nlay !
2282! !
2283! ====================== end of definitions =================== !
2284
2285! --- inputs:
2286 integer, intent(in) :: nlay, nlp1
2287
2288 real (kind=kind_phys), dimension(:), intent(in) :: pavel, tavel, &
2289 & h2ovmr
2290
2291! --- outputs:
2292 integer, dimension(nlay), intent(out) :: indself, indfor, &
2293 & jp, jt, jt1
2294 integer, intent(out) :: laytrop
2295
2296 real (kind=kind_phys), dimension(nlay), intent(out) :: fac00, &
2297 & fac01, fac10, fac11, selffac, selffrac, forfac, forfrac
2298
2299! --- locals:
2300 real (kind=kind_phys) :: plog, fp, fp1, ft, ft1, tem1, tem2
2301
2302 integer :: i, k, jp1
2303!
2304!===> ... begin here
2305!
2306 laytrop= nlay
2307
2308 do k = 1, nlay
2309
2310 forfac(k) = pavel(k)*stpfac / (tavel(k)*(f_one + h2ovmr(k)))
2311
2316
2317 plog = log(pavel(k))
2318 jp(k) = max(1, min(58, int(36.0 - 5.0*(plog+0.04)) ))
2319 jp1 = jp(k) + 1
2320 fp = 5.0 * (preflog(jp(k)) - plog)
2321
2328
2329 tem1 = (tavel(k) - tref(jp(k))) / 15.0
2330 tem2 = (tavel(k) - tref(jp1 )) / 15.0
2331 jt(k) = max(1, min(4, int(3.0 + tem1) ))
2332 jt1(k) = max(1, min(4, int(3.0 + tem2) ))
2333 ft = tem1 - float(jt(k) - 3)
2334 ft1 = tem2 - float(jt1(k) - 3)
2335
2342
2343 fp1 = f_one - fp
2344 fac10(k) = fp1 * ft
2345 fac00(k) = fp1 * (f_one - ft)
2346 fac11(k) = fp * ft1
2347 fac01(k) = fp * (f_one - ft1)
2348
2351
2352 if ( plog > 4.56 ) then
2353
2354 laytrop = k
2355
2358
2359 tem1 = (332.0 - tavel(k)) / 36.0
2360 indfor(k) = min(2, max(1, int(tem1)))
2361 forfrac(k) = tem1 - float(indfor(k))
2362
2365
2366 tem2 = (tavel(k) - 188.0) / 7.2
2367 indself(k) = min(9, max(1, int(tem2)-7))
2368 selffrac(k) = tem2 - float(indself(k) + 7)
2369 selffac(k) = h2ovmr(k) * forfac(k)
2370
2371 else
2372
2373! --- ... set up factors needed to separately include the water vapor
2374! foreign-continuum in the calculation of absorption coefficient.
2375
2376 tem1 = (tavel(k) - 188.0) / 36.0
2377 indfor(k) = 3
2378 forfrac(k) = tem1 - f_one
2379
2380 indself(k) = 0
2381 selffrac(k) = f_zero
2382 selffac(k) = f_zero
2383
2384 endif
2385
2386 enddo ! end_do_k_loop
2387
2388 return
2389! ..................................
2390 end subroutine setcoef
2391! ----------------------------------
2392
2432!-----------------------------------
2433 subroutine spcvrtc &
2434 & ( ssolar,cosz,sntz,albbm,albdf,sfluxzen,cldfrc, & ! --- inputs
2435 & cf1,cf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw, &
2436 & nlay, nlp1, iswmode, &
2437 & fxupc,fxdnc,fxup0,fxdn0, & ! --- outputs
2438 & ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0, &
2439 & sfbmc,sfdfc,sfbm0,sfdf0,suvbfc,suvbf0 &
2440 & )
2441
2442! =================== program usage description =================== !
2443! !
2444! purpose: computes the shortwave radiative fluxes using two-stream !
2445! method !
2446! !
2447! subprograms called: vrtqdr !
2448! !
2449! ==================== defination of variables ==================== !
2450! !
2451! inputs: size !
2452! ssolar - real, incoming solar flux at top 1 !
2453! cosz - real, cosine solar zenith angle 1 !
2454! sntz - real, secant solar zenith angle 1 !
2455! albbm - real, surface albedo for direct beam radiation 2 !
2456! albdf - real, surface albedo for diffused radiation 2 !
2457! sfluxzen- real, spectral distribution of incoming solar flux ngptsw!
2458! cldfrc - real, layer cloud fraction nlay !
2459! cf1 - real, >0: cloudy sky, otherwise: clear sky 1 !
2460! cf0 - real, =1-cf1 1 !
2461! taug - real, spectral optical depth for gases nlay*ngptsw!
2462! taur - real, optical depth for rayleigh scattering nlay*ngptsw!
2463! tauae - real, aerosols optical depth nlay*nbdsw !
2464! ssaae - real, aerosols single scattering albedo nlay*nbdsw !
2465! asyae - real, aerosols asymmetry factor nlay*nbdsw !
2466! taucw - real, weighted cloud optical depth nlay*nbdsw !
2467! ssacw - real, weighted cloud single scat albedo nlay*nbdsw !
2468! asycw - real, weighted cloud asymmetry factor nlay*nbdsw !
2469! nlay,nlp1 - integer, number of layers/levels 1 !
2470! !
2471! output variables: !
2472! fxupc - real, tot sky upward flux nlp1*nbdsw !
2473! fxdnc - real, tot sky downward flux nlp1*nbdsw !
2474! fxup0 - real, clr sky upward flux nlp1*nbdsw !
2475! fxdn0 - real, clr sky downward flux nlp1*nbdsw !
2476! ftoauc - real, tot sky toa upwd flux 1 !
2477! ftoau0 - real, clr sky toa upwd flux 1 !
2478! ftoadc - real, toa downward (incoming) solar flux 1 !
2479! fsfcuc - real, tot sky sfc upwd flux 1 !
2480! fsfcu0 - real, clr sky sfc upwd flux 1 !
2481! fsfcdc - real, tot sky sfc dnwd flux 1 !
2482! fsfcd0 - real, clr sky sfc dnwd flux 1 !
2483! sfbmc - real, tot sky sfc dnwd beam flux (nir/uv+vis) 2 !
2484! sfdfc - real, tot sky sfc dnwd diff flux (nir/uv+vis) 2 !
2485! sfbm0 - real, clr sky sfc dnwd beam flux (nir/uv+vis) 2 !
2486! sfdf0 - real, clr sky sfc dnwd diff flux (nir/uv+vis) 2 !
2487! suvbfc - real, tot sky sfc dnwd uv-b flux 1 !
2488! suvbf0 - real, clr sky sfc dnwd uv-b flux 1 !
2489! !
2490! internal variables: !
2491! zrefb - real, direct beam reflectivity for clear/cloudy nlp1 !
2492! zrefd - real, diffuse reflectivity for clear/cloudy nlp1 !
2493! ztrab - real, direct beam transmissivity for clear/cloudy nlp1 !
2494! ztrad - real, diffuse transmissivity for clear/cloudy nlp1 !
2495! zldbt - real, layer beam transmittance for clear/cloudy nlp1 !
2496! ztdbt - real, lev total beam transmittance for clr/cld nlp1 !
2497! !
2498! control parameters in module "GFS_typedefs" !
2499! iswmode - control flag for 2-stream transfer schemes !
2500! = 1 delta-eddington (joseph et al., 1976) !
2501! = 2 pifm (zdunkowski et al., 1980) !
2502! = 3 discrete ordinates (liou, 1973) !
2503! !
2504! ******************************************************************* !
2505! original code description !
2506! !
2507! method: !
2508! ------- !
2509! standard delta-eddington, p.i.f.m., or d.o.m. layer calculations. !
2510! kmodts = 1 eddington (joseph et al., 1976) !
2511! = 2 pifm (zdunkowski et al., 1980) !
2512! = 3 discrete ordinates (liou, 1973) !
2513! !
2514! modifications: !
2515! -------------- !
2516! original: h. barker !
2517! revision: merge with rrtmg_sw: j.-j.morcrette, ecmwf, feb 2003 !
2518! revision: add adjustment for earth/sun distance:mjiacono,aer,oct2003!
2519! revision: bug fix for use of palbp and palbd: mjiacono, aer, nov2003!
2520! revision: bug fix to apply delta scaling to clear sky: aer, dec2004 !
2521! revision: code modified so that delta scaling is not done in cloudy !
2522! profiles if routine cldprop is used; delta scaling can be !
2523! applied by swithcing code below if cldprop is not used to !
2524! get cloud properties. aer, jan 2005 !
2525! revision: uniform formatting for rrtmg: mjiacono, aer, jul 2006 !
2526! revision: use exponential lookup table for transmittance: mjiacono, !
2527! aer, aug 2007 !
2528! !
2529! ******************************************************************* !
2530! ====================== end of description block ================= !
2531
2532! --- constant parameters:
2533 real (kind=kind_phys), parameter :: zcrit = 0.9999995 ! thresold for conservative scattering
2534 real (kind=kind_phys), parameter :: zsr3 = sqrt(3.0)
2535 real (kind=kind_phys), parameter :: od_lo = 0.06
2536 real (kind=kind_phys), parameter :: eps1 = 1.0e-8
2537
2538! --- inputs:
2539 integer, intent(in) :: nlay, nlp1, iswmode
2540
2541 real (kind=kind_phys), dimension(nlay,ngptsw), intent(in) :: &
2542 & taug, taur
2543 real (kind=kind_phys), dimension(nlay,nbdsw), intent(in) :: &
2544 & taucw, ssacw, asycw, tauae, ssaae, asyae
2545
2546 real (kind=kind_phys), dimension(ngptsw), intent(in) :: sfluxzen
2547 real (kind=kind_phys), dimension(nlay), intent(in) :: cldfrc
2548
2549 real (kind=kind_phys), dimension(2), intent(in) :: albbm, albdf
2550
2551 real (kind=kind_phys), intent(in) :: cosz, sntz, cf1, cf0, ssolar
2552
2553! --- outputs:
2554 real (kind=kind_phys), dimension(nlp1,nbdsw), intent(out) :: &
2555 & fxupc, fxdnc, fxup0, fxdn0
2556
2557 real (kind=kind_phys), dimension(2), intent(out) :: sfbmc, sfdfc, &
2558 & sfbm0, sfdf0
2559
2560 real (kind=kind_phys), intent(out) :: suvbfc, suvbf0, ftoadc, &
2561 & ftoauc, ftoau0, fsfcuc, fsfcu0, fsfcdc, fsfcd0
2562
2563! --- locals:
2564 real (kind=kind_phys), dimension(nlay) :: ztaus, zssas, zasys, &
2565 & zldbt0
2566
2567 real (kind=kind_phys), dimension(nlp1) :: zrefb, zrefd, ztrab, &
2568 & ztrad, ztdbt, zldbt, zfu, zfd
2569
2570 real (kind=kind_phys) :: ztau1, zssa1, zasy1, ztau0, zssa0, &
2571 & zasy0, zasy3, zssaw, zasyw, zgam1, zgam2, zgam3, zgam4, &
2572 & zc0, zc1, za1, za2, zb1, zb2, zrk, zrk2, zrp, zrp1, zrm1, &
2573 & zrpp, zrkg1, zrkg3, zrkg4, zexp1, zexm1, zexp2, zexm2, &
2574 & zexp3, zexp4, zden1, ze1r45, ftind, zsolar, zrefb1, &
2575 & zrefd1, ztrab1, ztrad1, ztdbt0, zr1, zr2, zr3, zr4, zr5, &
2576 & zt1, zt2, zt3, zf1, zf2, zrpp1
2577
2578 integer :: ib, ibd, jb, jg, k, kp, itind
2579!
2580!===> ... begin here
2581
2583 do ib = 1, nbdsw
2584 do k = 1, nlp1
2585 fxdnc(k,ib) = f_zero
2586 fxupc(k,ib) = f_zero
2587 fxdn0(k,ib) = f_zero
2588 fxup0(k,ib) = f_zero
2589 enddo
2590 enddo
2591
2592 ftoadc = f_zero
2593 ftoauc = f_zero
2594 ftoau0 = f_zero
2595 fsfcuc = f_zero
2596 fsfcu0 = f_zero
2597 fsfcdc = f_zero
2598 fsfcd0 = f_zero
2599
2600!! --- ... uv-b surface downward fluxes
2601 suvbfc = f_zero
2602 suvbf0 = f_zero
2603
2604!! --- ... output surface flux components
2605 sfbmc(1) = f_zero
2606 sfbmc(2) = f_zero
2607 sfdfc(1) = f_zero
2608 sfdfc(2) = f_zero
2609 sfbm0(1) = f_zero
2610 sfbm0(2) = f_zero
2611 sfdf0(1) = f_zero
2612 sfdf0(2) = f_zero
2613
2615
2616 lab_do_jg : do jg = 1, ngptsw
2617
2618 jb = ngb(jg)
2619 ib = jb + 1 - nblow
2620 ibd = idxsfc(jb)
2621
2622 zsolar = ssolar * sfluxzen(jg)
2623
2625
2626 ztdbt(nlp1) = f_one
2627 ztdbt0 = f_one
2628
2629 zldbt(1) = f_zero
2630 if (ibd /= 0) then
2631 zrefb(1) = albbm(ibd)
2632 zrefd(1) = albdf(ibd)
2633 else
2634 zrefb(1) = 0.5 * (albbm(1) + albbm(2))
2635 zrefd(1) = 0.5 * (albdf(1) + albdf(2))
2636 endif
2637 ztrab(1) = f_zero
2638 ztrad(1) = f_zero
2639
2642! - Set up toa direct beam and surface values (beam and diff).
2643! - Delta scaling for clear-sky condition.
2644! - General two-stream expressions.
2645! - Compute homogeneous reflectance and transmittance for both
2646! conservative and non-conservative scattering.
2647! - Pre-delta-scaling clear and cloudy direct beam transmittance.
2648! - Call swflux() to compute the upward and downward radiation
2649! fluxes.
2650
2651 do k = nlay, 1, -1
2652 kp = k + 1
2653
2654 ztau0 = max( ftiny, taur(k,jg)+taug(k,jg)+tauae(k,ib) )
2655 zssa0 = taur(k,jg) + tauae(k,ib)*ssaae(k,ib)
2656 zasy0 = asyae(k,ib)*ssaae(k,ib)*tauae(k,ib)
2657 zssaw = min( oneminus, zssa0 / ztau0 )
2658 zasyw = zasy0 / max( ftiny, zssa0 )
2659
2661 ztaus(k) = ztau0
2662 zssas(k) = zssa0
2663 zasys(k) = zasy0
2664
2666 za1 = zasyw * zasyw
2667 za2 = zssaw * za1
2668
2669 ztau1 = (f_one - za2) * ztau0
2670 zssa1 = (zssaw - za2) / (f_one - za2)
2671!org zasy1 = (zasyw - za1) / (f_one - za1) ! this line is replaced by the next
2672 zasy1 = zasyw / (f_one + zasyw) ! to reduce truncation error
2673 zasy3 = 0.75 * zasy1
2674
2681 if ( iswmode == 1 ) then
2682 zgam1 = 1.75 - zssa1 * (f_one + zasy3)
2683 zgam2 =-0.25 + zssa1 * (f_one - zasy3)
2684 zgam3 = 0.5 - zasy3 * cosz
2685 elseif ( iswmode == 2 ) then ! pifm
2686 zgam1 = 2.0 - zssa1 * (1.25 + zasy3)
2687 zgam2 = 0.75* zssa1 * (f_one- zasy1)
2688 zgam3 = 0.5 - zasy3 * cosz
2689 elseif ( iswmode == 3 ) then ! discrete ordinates
2690 zgam1 = zsr3 * (2.0 - zssa1 * (1.0 + zasy1)) * 0.5
2691 zgam2 = zsr3 * zssa1 * (1.0 - zasy1) * 0.5
2692 zgam3 = (1.0 - zsr3 * zasy1 * cosz) * 0.5
2693 endif
2694 zgam4 = f_one - zgam3
2695
2698
2699 if ( zssaw >= zcrit ) then ! for conservative scattering
2700 za1 = zgam1 * cosz - zgam3
2701 za2 = zgam1 * ztau1
2702
2703! --- ... use exponential lookup table for transmittance, or expansion
2704! of exponential for low optical depth
2705
2706 zb1 = min( ztau1*sntz , 500.0 )
2707 if ( zb1 <= od_lo ) then
2708 zb2 = f_one - zb1 + 0.5*zb1*zb1
2709 else
2710 ftind = zb1 / (bpade + zb1)
2711 itind = ftind*ntbmx + 0.5
2712 zb2 = exp_tbl(itind)
2713 endif
2714
2715! ... collimated beam
2716 zrefb(kp) = max(f_zero, min(f_one, &
2717 & (za2 - za1*(f_one - zb2))/(f_one + za2) ))
2718 ztrab(kp) = max(f_zero, min(f_one, f_one-zrefb(kp) ))
2719
2720! ... isotropic incidence
2721 zrefd(kp) = max(f_zero, min(f_one, za2/(f_one + za2) ))
2722 ztrad(kp) = max(f_zero, min(f_one, f_one-zrefd(kp) ))
2723
2724 else ! for non-conservative scattering
2725 za1 = zgam1*zgam4 + zgam2*zgam3
2726 za2 = zgam1*zgam3 + zgam2*zgam4
2727 zrk = (zgam1 - zgam2) * (zgam1 + zgam2)
2728 if (zrk > eps1) then
2729 zrk = sqrt(zrk)
2730 else
2731 zrk = f_zero
2732 endif
2733 zrk2= zrk + zrk
2734
2735 zrp = zrk * cosz
2736 zrp1 = f_one + zrp
2737 zrm1 = f_one - zrp
2738 zrpp1= f_one - zrp*zrp
2739 zrpp = sign( max(flimit, abs(zrpp1)), zrpp1 ) ! avoid numerical singularity
2740 zrkg1= zrk + zgam1
2741 zrkg3= zrk * zgam3
2742 zrkg4= zrk * zgam4
2743
2744 zr1 = zrm1 * (za2 + zrkg3)
2745 zr2 = zrp1 * (za2 - zrkg3)
2746 zr3 = zrk2 * (zgam3 - za2*cosz)
2747 zr4 = zrpp * zrkg1
2748 zr5 = zrpp * (zrk - zgam1)
2749
2750 zt1 = zrp1 * (za1 + zrkg4)
2751 zt2 = zrm1 * (za1 - zrkg4)
2752 zt3 = zrk2 * (zgam4 + za1*cosz)
2753
2754! --- ... use exponential lookup table for transmittance, or expansion
2755! of exponential for low optical depth
2756
2757 zb1 = min( zrk*ztau1, 500.0 )
2758 if ( zb1 <= od_lo ) then
2759 zexm1 = f_one - zb1 + 0.5*zb1*zb1
2760 else
2761 ftind = zb1 / (bpade + zb1)
2762 itind = ftind*ntbmx + 0.5
2763 zexm1 = exp_tbl(itind)
2764 endif
2765 zexp1 = f_one / zexm1
2766
2767 zb2 = min( sntz*ztau1, 500.0 )
2768 if ( zb2 <= od_lo ) then
2769 zexm2 = f_one - zb2 + 0.5*zb2*zb2
2770 else
2771 ftind = zb2 / (bpade + zb2)
2772 itind = ftind*ntbmx + 0.5
2773 zexm2 = exp_tbl(itind)
2774 endif
2775 zexp2 = f_one / zexm2
2776 ze1r45 = zr4*zexp1 + zr5*zexm1
2777
2778! ... collimated beam
2779! if (ze1r45>=-eps1 .and. ze1r45<=eps1) then
2780 if (abs(ze1r45) <= eps1) then
2781 zrefb(kp) = eps1
2782 ztrab(kp) = zexm2
2783 else
2784 zden1 = zssa1 / ze1r45
2785 zrefb(kp) = max(f_zero, min(f_one, &
2786 & (zr1*zexp1 - zr2*zexm1 - zr3*zexm2)*zden1 ))
2787 ztrab(kp) = max(f_zero, min(f_one, zexm2*(f_one &
2788 & - (zt1*zexp1 - zt2*zexm1 - zt3*zexp2)*zden1) ))
2789 endif
2790
2791! ... diffuse beam
2792 if (ze1r45 >= f_zero) then
2793 zden1 = zr4 / max(eps1, ze1r45*zrkg1)
2794 else
2795 zden1 = zr4 / min(-eps1, ze1r45*zrkg1)
2796 endif
2797 zrefd(kp) = max(f_zero, min(f_one, &
2798 & zgam2*(zexp1 - zexm1)*zden1 ))
2799 ztrad(kp) = max(f_zero, min(f_one, zrk2*zden1 ))
2800 endif ! end if_zssaw_block
2801
2804
2805 zr1 = ztau1 * sntz
2806 if ( zr1 <= od_lo ) then
2807 zexp3 = f_one - zr1 + 0.5*zr1*zr1
2808 else
2809 ftind = zr1 / (bpade + zr1)
2810 itind = max(0, min(ntbmx, int(0.5+ntbmx*ftind) ))
2811 zexp3 = exp_tbl(itind)
2812 endif
2813
2814 ztdbt(k) = zexp3 * ztdbt(kp)
2815 zldbt(kp) = zexp3
2816
2818! (must use 'orig', unscaled cloud optical depth)
2819
2820 zr1 = ztau0 * sntz
2821 if ( zr1 <= od_lo ) then
2822 zexp4 = f_one - zr1 + 0.5*zr1*zr1
2823 else
2824 ftind = zr1 / (bpade + zr1)
2825 itind = max(0, min(ntbmx, int(0.5+ntbmx*ftind) ))
2826 zexp4 = exp_tbl(itind)
2827 endif
2828
2829 zldbt0(k) = zexp4
2830 ztdbt0 = zexp4 * ztdbt0
2831 enddo ! end do_k_loop
2832
2834 call vrtqdr &
2835! --- inputs:
2836 & ( zrefb,zrefd,ztrab,ztrad,zldbt,ztdbt, &
2837 & nlay, nlp1, &
2838! --- outputs:
2839 & zfu, zfd &
2840 & )
2841
2843 do k = 1, nlp1
2844 fxup0(k,ib) = fxup0(k,ib) + zsolar*zfu(k)
2845 fxdn0(k,ib) = fxdn0(k,ib) + zsolar*zfd(k)
2846 enddo
2847
2849 zb1 = zsolar*ztdbt0
2850 zb2 = zsolar*(zfd(1) - ztdbt0)
2851
2852 if (ibd /= 0) then
2853 sfbm0(ibd) = sfbm0(ibd) + zb1
2854 sfdf0(ibd) = sfdf0(ibd) + zb2
2855 else
2856 zf1 = 0.5 * zb1
2857 zf2 = 0.5 * zb2
2858 sfbm0(1) = sfbm0(1) + zf1
2859 sfdf0(1) = sfdf0(1) + zf2
2860 sfbm0(2) = sfbm0(2) + zf1
2861 sfdf0(2) = sfdf0(2) + zf2
2862 endif
2863! sfbm0(ibd) = sfbm0(ibd) + zsolar*ztdbt0
2864! sfdf0(ibd) = sfdf0(ibd) + zsolar*(zfd(1) - ztdbt0)
2865
2868! - Set up toa direct beam and surface values (beam and diff)
2869! - Delta scaling for total-sky condition
2870! - General two-stream expressions
2871! - Compute homogeneous reflectance and transmittance for
2872! conservative scattering and non-conservative scattering
2873! - Pre-delta-scaling clear and cloudy direct beam transmittance
2874! - Call swflux() to compute the upward and downward radiation fluxes
2875
2876 if ( cf1 > eps ) then
2877
2879 ztdbt0 = f_one
2880 zldbt(1) = f_zero
2881
2882 do k = nlay, 1, -1
2883 kp = k + 1
2884 zc0 = f_one - cldfrc(k)
2885 zc1 = cldfrc(k)
2886 if ( zc1 > ftiny ) then ! it is a cloudy-layer
2887
2888 ztau0 = ztaus(k) + taucw(k,ib)
2889 zssa0 = zssas(k) + ssacw(k,ib)
2890 zasy0 = zasys(k) + asycw(k,ib)
2891 zssaw = min(oneminus, zssa0 / ztau0)
2892 zasyw = zasy0 / max(ftiny, zssa0)
2893
2895 za1 = zasyw * zasyw
2896 za2 = zssaw * za1
2897
2898 ztau1 = (f_one - za2) * ztau0
2899 zssa1 = (zssaw - za2) / (f_one - za2)
2900!org zasy1 = (zasyw - za1) / (f_one - za1)
2901 zasy1 = zasyw / (f_one + zasyw)
2902 zasy3 = 0.75 * zasy1
2903
2910
2911 if ( iswmode == 1 ) then
2912 zgam1 = 1.75 - zssa1 * (f_one + zasy3)
2913 zgam2 =-0.25 + zssa1 * (f_one - zasy3)
2914 zgam3 = 0.5 - zasy3 * cosz
2915 elseif ( iswmode == 2 ) then ! pifm
2916 zgam1 = 2.0 - zssa1 * (1.25 + zasy3)
2917 zgam2 = 0.75* zssa1 * (f_one- zasy1)
2918 zgam3 = 0.5 - zasy3 * cosz
2919 elseif ( iswmode == 3 ) then ! discrete ordinates
2920 zgam1 = zsr3 * (2.0 - zssa1 * (1.0 + zasy1)) * 0.5
2921 zgam2 = zsr3 * zssa1 * (1.0 - zasy1) * 0.5
2922 zgam3 = (1.0 - zsr3 * zasy1 * cosz) * 0.5
2923 endif
2924 zgam4 = f_one - zgam3
2925
2926 zrefb1 = zrefb(kp)
2927 zrefd1 = zrefd(kp)
2928 ztrab1 = ztrab(kp)
2929 ztrad1 = ztrad(kp)
2930
2933
2934 if ( zssaw >= zcrit ) then ! for conservative scattering
2935 za1 = zgam1 * cosz - zgam3
2936 za2 = zgam1 * ztau1
2937
2938! --- ... use exponential lookup table for transmittance, or expansion
2939! of exponential for low optical depth
2940
2941 zb1 = min( ztau1*sntz , 500.0 )
2942 if ( zb1 <= od_lo ) then
2943 zb2 = f_one - zb1 + 0.5*zb1*zb1
2944 else
2945 ftind = zb1 / (bpade + zb1)
2946 itind = ftind*ntbmx + 0.5
2947 zb2 = exp_tbl(itind)
2948 endif
2949
2950! ... collimated beam
2951 zrefb(kp) = max(f_zero, min(f_one, &
2952 & (za2 - za1*(f_one - zb2))/(f_one + za2) ))
2953 ztrab(kp) = max(f_zero, min(f_one, f_one-zrefb(kp)))
2954
2955! ... isotropic incidence
2956 zrefd(kp) = max(f_zero, min(f_one, za2 / (f_one+za2) ))
2957 ztrad(kp) = max(f_zero, min(f_one, f_one - zrefd(kp) ))
2958
2959 else ! for non-conservative scattering
2960 za1 = zgam1*zgam4 + zgam2*zgam3
2961 za2 = zgam1*zgam3 + zgam2*zgam4
2962 zrk = (zgam1 - zgam2) * (zgam1 + zgam2)
2963 if (zrk > eps1) then
2964 zrk = sqrt(zrk)
2965 else
2966 zrk = f_zero
2967 endif
2968 zrk2= zrk + zrk
2969
2970 zrp = zrk * cosz
2971 zrp1 = f_one + zrp
2972 zrm1 = f_one - zrp
2973 zrpp1= f_one - zrp*zrp
2974 zrpp = sign( max(flimit, abs(zrpp1)), zrpp1 ) ! avoid numerical singularity
2975 zrkg1= zrk + zgam1
2976 zrkg3= zrk * zgam3
2977 zrkg4= zrk * zgam4
2978
2979 zr1 = zrm1 * (za2 + zrkg3)
2980 zr2 = zrp1 * (za2 - zrkg3)
2981 zr3 = zrk2 * (zgam3 - za2*cosz)
2982 zr4 = zrpp * zrkg1
2983 zr5 = zrpp * (zrk - zgam1)
2984
2985 zt1 = zrp1 * (za1 + zrkg4)
2986 zt2 = zrm1 * (za1 - zrkg4)
2987 zt3 = zrk2 * (zgam4 + za1*cosz)
2988
2989! --- ... use exponential lookup table for transmittance, or expansion
2990! of exponential for low optical depth
2991
2992 zb1 = min( zrk*ztau1, 500.0 )
2993 if ( zb1 <= od_lo ) then
2994 zexm1 = f_one - zb1 + 0.5*zb1*zb1
2995 else
2996 ftind = zb1 / (bpade + zb1)
2997 itind = ftind*ntbmx + 0.5
2998 zexm1 = exp_tbl(itind)
2999 endif
3000 zexp1 = f_one / zexm1
3001
3002 zb2 = min( ztau1*sntz, 500.0 )
3003 if ( zb2 <= od_lo ) then
3004 zexm2 = f_one - zb2 + 0.5*zb2*zb2
3005 else
3006 ftind = zb2 / (bpade + zb2)
3007 itind = ftind*ntbmx + 0.5
3008 zexm2 = exp_tbl(itind)
3009 endif
3010 zexp2 = f_one / zexm2
3011 ze1r45 = zr4*zexp1 + zr5*zexm1
3012
3013! ... collimated beam
3014! if ( ze1r45>=-eps1 .and. ze1r45<=eps1 ) then
3015 if ( abs(ze1r45) <= eps1 ) then
3016 zrefb(kp) = eps1
3017 ztrab(kp) = zexm2
3018 else
3019 zden1 = zssa1 / ze1r45
3020 zrefb(kp) = max(f_zero, min(f_one, &
3021 & (zr1*zexp1-zr2*zexm1-zr3*zexm2)*zden1 ))
3022 ztrab(kp) = max(f_zero, min(f_one, zexm2*(f_one - &
3023 & (zt1*zexp1-zt2*zexm1-zt3*zexp2)*zden1) ))
3024 endif
3025
3026! ... diffuse beam
3027 if (ze1r45 >= f_zero) then
3028 zden1 = zr4 / max(eps1, ze1r45*zrkg1)
3029 else
3030 zden1 = zr4 / min(-eps1, ze1r45*zrkg1)
3031 endif
3032 zrefd(kp) = max(f_zero, min(f_one, &
3033 & zgam2*(zexp1 - zexm1)*zden1 ))
3034 ztrad(kp) = max(f_zero, min(f_one, zrk2*zden1 ))
3035 endif ! end if_zssaw_block
3036
3037! --- ... combine clear and cloudy contributions for total sky
3038! and calculate direct beam transmittances
3039
3040 zrefb(kp) = zc0*zrefb1 + zc1*zrefb(kp)
3041 zrefd(kp) = zc0*zrefd1 + zc1*zrefd(kp)
3042 ztrab(kp) = zc0*ztrab1 + zc1*ztrab(kp)
3043 ztrad(kp) = zc0*ztrad1 + zc1*ztrad(kp)
3044
3045! --- ... direct beam transmittance. use exponential lookup table
3046! for transmittance, or expansion of exponential for low
3047! optical depth
3048
3049 zr1 = ztau1 * sntz
3050 if ( zr1 <= od_lo ) then
3051 zexp3 = f_one - zr1 + 0.5*zr1*zr1
3052 else
3053 ftind = zr1 / (bpade + zr1)
3054 itind = max(0, min(ntbmx, int(0.5+ntbmx*ftind) ))
3055 zexp3 = exp_tbl(itind)
3056 endif
3057
3058 zldbt(kp) = zc0*zldbt(kp) + zc1*zexp3
3059 ztdbt(k) = zldbt(kp) * ztdbt(kp)
3060
3062! (must use 'orig', unscaled cloud optical depth)
3063
3064 zr1 = ztau0 * sntz
3065 if ( zr1 <= od_lo ) then
3066 zexp4 = f_one - zr1 + 0.5*zr1*zr1
3067 else
3068 ftind = zr1 / (bpade + zr1)
3069 itind = max(0, min(ntbmx, int(0.5+ntbmx*ftind) ))
3070 zexp4 = exp_tbl(itind)
3071 endif
3072
3073 ztdbt0 = (zc0*zldbt0(k) + zc1*zexp4) * ztdbt0
3074
3075 else ! if_zc1_block --- it is a clear layer
3076
3077! --- ... direct beam transmittance
3078 ztdbt(k) = zldbt(kp) * ztdbt(kp)
3079
3080! --- ... pre-delta-scaling clear and cloudy direct beam transmittance
3081 ztdbt0 = zldbt0(k) * ztdbt0
3082
3083 endif ! end if_zc1_block
3084 enddo ! end do_k_loop
3085
3087
3088 call vrtqdr &
3089! --- inputs:
3090 & ( zrefb,zrefd,ztrab,ztrad,zldbt,ztdbt, &
3091 & nlay, nlp1, &
3092! --- outputs:
3093 & zfu, zfd &
3094 & )
3095
3097 do k = 1, nlp1
3098 fxupc(k,ib) = fxupc(k,ib) + zsolar*zfu(k)
3099 fxdnc(k,ib) = fxdnc(k,ib) + zsolar*zfd(k)
3100 enddo
3101
3104 zb1 = zsolar*ztdbt0
3105 zb2 = zsolar*(zfd(1) - ztdbt0)
3106
3107 if (ibd /= 0) then
3108 sfbmc(ibd) = sfbmc(ibd) + zb1
3109 sfdfc(ibd) = sfdfc(ibd) + zb2
3110 else
3111 zf1 = 0.5 * zb1
3112 zf2 = 0.5 * zb2
3113 sfbmc(1) = sfbmc(1) + zf1
3114 sfdfc(1) = sfdfc(1) + zf2
3115 sfbmc(2) = sfbmc(2) + zf1
3116 sfdfc(2) = sfdfc(2) + zf2
3117 endif
3118! sfbmc(ibd) = sfbmc(ibd) + zsolar*ztdbt0
3119! sfdfc(ibd) = sfdfc(ibd) + zsolar*(zfd(1) - ztdbt0)
3120
3121 endif ! end if_cf1_block
3122
3123 enddo lab_do_jg
3124
3125! --- ... end of g-point loop
3126
3127 do ib = 1, nbdsw
3128 ftoadc = ftoadc + fxdn0(nlp1,ib)
3129 ftoau0 = ftoau0 + fxup0(nlp1,ib)
3130 fsfcu0 = fsfcu0 + fxup0(1,ib)
3131 fsfcd0 = fsfcd0 + fxdn0(1,ib)
3132 enddo
3133
3135 ibd = nuvb - nblow + 1
3136 suvbf0 = fxdn0(1,ibd)
3137
3138 if ( cf1 <= eps ) then ! clear column, set total-sky=clear-sky fluxes
3139 do ib = 1, nbdsw
3140 do k = 1, nlp1
3141 fxupc(k,ib) = fxup0(k,ib)
3142 fxdnc(k,ib) = fxdn0(k,ib)
3143 enddo
3144 enddo
3145
3146 ftoauc = ftoau0
3147 fsfcuc = fsfcu0
3148 fsfcdc = fsfcd0
3149
3151 sfbmc(1) = sfbm0(1)
3152 sfdfc(1) = sfdf0(1)
3153 sfbmc(2) = sfbm0(2)
3154 sfdfc(2) = sfdf0(2)
3155
3157 suvbfc = suvbf0
3158 else ! cloudy column, compute total-sky fluxes
3159 do ib = 1, nbdsw
3160 do k = 1, nlp1
3161 fxupc(k,ib) = cf1*fxupc(k,ib) + cf0*fxup0(k,ib)
3162 fxdnc(k,ib) = cf1*fxdnc(k,ib) + cf0*fxdn0(k,ib)
3163 enddo
3164 enddo
3165
3166 do ib = 1, nbdsw
3167 ftoauc = ftoauc + fxupc(nlp1,ib)
3168 fsfcuc = fsfcuc + fxupc(1,ib)
3169 fsfcdc = fsfcdc + fxdnc(1,ib)
3170 enddo
3171
3173 suvbfc = fxdnc(1,ibd)
3174
3176 sfbmc(1) = cf1*sfbmc(1) + cf0*sfbm0(1)
3177 sfbmc(2) = cf1*sfbmc(2) + cf0*sfbm0(2)
3178 sfdfc(1) = cf1*sfdfc(1) + cf0*sfdf0(1)
3179 sfdfc(2) = cf1*sfdfc(2) + cf0*sfdf0(2)
3180 endif ! end if_cf1_block
3181
3182 return
3183!...................................
3184 end subroutine spcvrtc
3185!-----------------------------------
3186
3228!-----------------------------------
3229 subroutine spcvrtm &
3230 & ( ssolar,cosz,sntz,albbm,albdf,sfluxzen,cldfmc, & ! --- inputs
3231 & cf1,cf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw, &
3232 & nlay, nlp1, iswmode, &
3233 & fxupc,fxdnc,fxup0,fxdn0, & ! --- outputs
3234 & ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0, &
3235 & sfbmc,sfdfc,sfbm0,sfdf0,suvbfc,suvbf0 &
3236 & )
3237
3238! =================== program usage description =================== !
3239! !
3240! purpose: computes the shortwave radiative fluxes using two-stream !
3241! method of h. barker and mcica, the monte-carlo independent!
3242! column approximation, for the representation of sub-grid !
3243! cloud variability (i.e. cloud overlap). !
3244! !
3245! subprograms called: vrtqdr !
3246! !
3247! ==================== defination of variables ==================== !
3248! !
3249! inputs: size !
3250! ssolar - real, incoming solar flux at top 1 !
3251! cosz - real, cosine solar zenith angle 1 !
3252! sntz - real, secant solar zenith angle 1 !
3253! albbm - real, surface albedo for direct beam radiation 2 !
3254! albdf - real, surface albedo for diffused radiation 2 !
3255! sfluxzen- real, spectral distribution of incoming solar flux ngptsw!
3256! cldfmc - real, layer cloud fraction for g-point nlay*ngptsw!
3257! cf1 - real, >0: cloudy sky, otherwise: clear sky 1 !
3258! cf0 - real, =1-cf1 1 !
3259! taug - real, spectral optical depth for gases nlay*ngptsw!
3260! taur - real, optical depth for rayleigh scattering nlay*ngptsw!
3261! tauae - real, aerosols optical depth nlay*nbdsw !
3262! ssaae - real, aerosols single scattering albedo nlay*nbdsw !
3263! asyae - real, aerosols asymmetry factor nlay*nbdsw !
3264! taucw - real, weighted cloud optical depth nlay*nbdsw !
3265! ssacw - real, weighted cloud single scat albedo nlay*nbdsw !
3266! asycw - real, weighted cloud asymmetry factor nlay*nbdsw !
3267! nlay,nlp1 - integer, number of layers/levels 1 !
3268! iswmode - control flag for 2-stream transfer schemes !
3269! = 1 delta-eddington (joseph et al., 1976) !
3270! = 2 pifm (zdunkowski et al., 1980) !
3271! = 3 discrete ordinates (liou, 1973) !
3272! !
3273! output variables: !
3274! fxupc - real, tot sky upward flux nlp1*nbdsw !
3275! fxdnc - real, tot sky downward flux nlp1*nbdsw !
3276! fxup0 - real, clr sky upward flux nlp1*nbdsw !
3277! fxdn0 - real, clr sky downward flux nlp1*nbdsw !
3278! ftoauc - real, tot sky toa upwd flux 1 !
3279! ftoau0 - real, clr sky toa upwd flux 1 !
3280! ftoadc - real, toa downward (incoming) solar flux 1 !
3281! fsfcuc - real, tot sky sfc upwd flux 1 !
3282! fsfcu0 - real, clr sky sfc upwd flux 1 !
3283! fsfcdc - real, tot sky sfc dnwd flux 1 !
3284! fsfcd0 - real, clr sky sfc dnwd flux 1 !
3285! sfbmc - real, tot sky sfc dnwd beam flux (nir/uv+vis) 2 !
3286! sfdfc - real, tot sky sfc dnwd diff flux (nir/uv+vis) 2 !
3287! sfbm0 - real, clr sky sfc dnwd beam flux (nir/uv+vis) 2 !
3288! sfdf0 - real, clr sky sfc dnwd diff flux (nir/uv+vis) 2 !
3289! suvbfc - real, tot sky sfc dnwd uv-b flux 1 !
3290! suvbf0 - real, clr sky sfc dnwd uv-b flux 1 !
3291! !
3292! internal variables: !
3293! zrefb - real, direct beam reflectivity for clear/cloudy nlp1 !
3294! zrefd - real, diffuse reflectivity for clear/cloudy nlp1 !
3295! ztrab - real, direct beam transmissivity for clear/cloudy nlp1 !
3296! ztrad - real, diffuse transmissivity for clear/cloudy nlp1 !
3297! zldbt - real, layer beam transmittance for clear/cloudy nlp1 !
3298! ztdbt - real, lev total beam transmittance for clr/cld nlp1 !
3299! !
3300! ******************************************************************* !
3301! original code description !
3302! !
3303! method: !
3304! ------- !
3305! standard delta-eddington, p.i.f.m., or d.o.m. layer calculations. !
3306! kmodts = 1 eddington (joseph et al., 1976) !
3307! = 2 pifm (zdunkowski et al., 1980) !
3308! = 3 discrete ordinates (liou, 1973) !
3309! !
3310! modifications: !
3311! -------------- !
3312! original: h. barker !
3313! revision: merge with rrtmg_sw: j.-j.morcrette, ecmwf, feb 2003 !
3314! revision: add adjustment for earth/sun distance:mjiacono,aer,oct2003!
3315! revision: bug fix for use of palbp and palbd: mjiacono, aer, nov2003!
3316! revision: bug fix to apply delta scaling to clear sky: aer, dec2004 !
3317! revision: code modified so that delta scaling is not done in cloudy !
3318! profiles if routine cldprop is used; delta scaling can be !
3319! applied by swithcing code below if cldprop is not used to !
3320! get cloud properties. aer, jan 2005 !
3321! revision: uniform formatting for rrtmg: mjiacono, aer, jul 2006 !
3322! revision: use exponential lookup table for transmittance: mjiacono, !
3323! aer, aug 2007 !
3324! !
3325! ******************************************************************* !
3326! ====================== end of description block ================= !
3327
3328! --- constant parameters:
3329 real (kind=kind_phys), parameter :: zcrit = 0.9999995 ! thresold for conservative scattering
3330 real (kind=kind_phys), parameter :: zsr3 = sqrt(3.0)
3331 real (kind=kind_phys), parameter :: od_lo = 0.06
3332 real (kind=kind_phys), parameter :: eps1 = 1.0e-8
3333
3334! --- inputs:
3335 integer, intent(in) :: nlay, nlp1, iswmode
3336
3337 real (kind=kind_phys), dimension(nlay,ngptsw), intent(in) :: &
3338 & taug, taur, cldfmc
3339 real (kind=kind_phys), dimension(nlay,nbdsw), intent(in) :: &
3340 & taucw, ssacw, asycw, tauae, ssaae, asyae
3341
3342 real (kind=kind_phys), dimension(ngptsw), intent(in) :: sfluxzen
3343
3344 real (kind=kind_phys), dimension(2), intent(in) :: albbm, albdf
3345
3346 real (kind=kind_phys), intent(in) :: cosz, sntz, cf1, cf0, ssolar
3347
3348! --- outputs:
3349 real (kind=kind_phys), dimension(nlp1,nbdsw), intent(out) :: &
3350 & fxupc, fxdnc, fxup0, fxdn0
3351
3352 real (kind=kind_phys), dimension(2), intent(out) :: sfbmc, sfdfc, &
3353 & sfbm0, sfdf0
3354
3355 real (kind=kind_phys), intent(out) :: suvbfc, suvbf0, ftoadc, &
3356 & ftoauc, ftoau0, fsfcuc, fsfcu0, fsfcdc, fsfcd0
3357
3358! --- locals:
3359 real (kind=kind_phys), dimension(nlay) :: ztaus, zssas, zasys, &
3360 & zldbt0
3361
3362 real (kind=kind_phys), dimension(nlp1) :: zrefb, zrefd, ztrab, &
3363 & ztrad, ztdbt, zldbt, zfu, zfd
3364
3365 real (kind=kind_phys) :: ztau1, zssa1, zasy1, ztau0, zssa0, &
3366 & zasy0, zasy3, zssaw, zasyw, zgam1, zgam2, zgam3, zgam4, &
3367 & za1, za2, zb1, zb2, zrk, zrk2, zrp, zrp1, zrm1, zrpp, &
3368 & zrkg1, zrkg3, zrkg4, zexp1, zexm1, zexp2, zexm2, zden1, &
3369 & zexp3, zexp4, ze1r45, ftind, zsolar, ztdbt0, zr1, zr2, &
3370 & zr3, zr4, zr5, zt1, zt2, zt3, zf1, zf2, zrpp1
3371
3372 integer :: ib, ibd, jb, jg, k, kp, itind
3373!
3374!===> ... begin here
3375!
3377
3378 do ib = 1, nbdsw
3379 do k = 1, nlp1
3380 fxdnc(k,ib) = f_zero
3381 fxupc(k,ib) = f_zero
3382 fxdn0(k,ib) = f_zero
3383 fxup0(k,ib) = f_zero
3384 enddo
3385 enddo
3386
3387 ftoadc = f_zero
3388 ftoauc = f_zero
3389 ftoau0 = f_zero
3390 fsfcuc = f_zero
3391 fsfcu0 = f_zero
3392 fsfcdc = f_zero
3393 fsfcd0 = f_zero
3394
3395!! --- ... uv-b surface downward fluxes
3396 suvbfc = f_zero
3397 suvbf0 = f_zero
3398
3399!! --- ... output surface flux components
3400 sfbmc(1) = f_zero
3401 sfbmc(2) = f_zero
3402 sfdfc(1) = f_zero
3403 sfdfc(2) = f_zero
3404 sfbm0(1) = f_zero
3405 sfbm0(2) = f_zero
3406 sfdf0(1) = f_zero
3407 sfdf0(2) = f_zero
3408
3410
3411 lab_do_jg : do jg = 1, ngptsw
3412
3413 jb = ngb(jg)
3414 ib = jb + 1 - nblow
3415 ibd = idxsfc(jb) ! spectral band index
3416
3417 zsolar = ssolar * sfluxzen(jg)
3418
3420
3421 ztdbt(nlp1) = f_one
3422 ztdbt0 = f_one
3423
3424 zldbt(1) = f_zero
3425 if (ibd /= 0) then
3426 zrefb(1) = albbm(ibd)
3427 zrefd(1) = albdf(ibd)
3428 else
3429 zrefb(1) = 0.5 * (albbm(1) + albbm(2))
3430 zrefd(1) = 0.5 * (albdf(1) + albdf(2))
3431 endif
3432 ztrab(1) = f_zero
3433 ztrad(1) = f_zero
3434
3437! - Set up toa direct beam and surface values (beam and diff)
3438! - Delta scaling for clear-sky condition
3439! - General two-stream expressions
3440! - Compute homogeneous reflectance and transmittance for both
3441! conservative and non-conservative scattering
3442! - Pre-delta-scaling clear and cloudy direct beam transmittance
3443! - Call swflux() to compute the upward and downward radiation fluxes
3444
3445 do k = nlay, 1, -1
3446 kp = k + 1
3447
3448 ztau0 = max( ftiny, taur(k,jg)+taug(k,jg)+tauae(k,ib) )
3449 zssa0 = taur(k,jg) + tauae(k,ib)*ssaae(k,ib)
3450 zasy0 = asyae(k,ib)*ssaae(k,ib)*tauae(k,ib)
3451 zssaw = min( oneminus, zssa0 / ztau0 )
3452 zasyw = zasy0 / max( ftiny, zssa0 )
3453
3455 ztaus(k) = ztau0
3456 zssas(k) = zssa0
3457 zasys(k) = zasy0
3458
3460 za1 = zasyw * zasyw
3461 za2 = zssaw * za1
3462
3463 ztau1 = (f_one - za2) * ztau0
3464 zssa1 = (zssaw - za2) / (f_one - za2)
3465!org zasy1 = (zasyw - za1) / (f_one - za1) ! this line is replaced by the next
3466 zasy1 = zasyw / (f_one + zasyw) ! to reduce truncation error
3467 zasy3 = 0.75 * zasy1
3468
3475 if ( iswmode == 1 ) then
3476 zgam1 = 1.75 - zssa1 * (f_one + zasy3)
3477 zgam2 =-0.25 + zssa1 * (f_one - zasy3)
3478 zgam3 = 0.5 - zasy3 * cosz
3479 elseif ( iswmode == 2 ) then ! pifm
3480 zgam1 = 2.0 - zssa1 * (1.25 + zasy3)
3481 zgam2 = 0.75* zssa1 * (f_one- zasy1)
3482 zgam3 = 0.5 - zasy3 * cosz
3483 elseif ( iswmode == 3 ) then ! discrete ordinates
3484 zgam1 = zsr3 * (2.0 - zssa1 * (1.0 + zasy1)) * 0.5
3485 zgam2 = zsr3 * zssa1 * (1.0 - zasy1) * 0.5
3486 zgam3 = (1.0 - zsr3 * zasy1 * cosz) * 0.5
3487 endif
3488 zgam4 = f_one - zgam3
3489
3491
3492 if ( zssaw >= zcrit ) then ! for conservative scattering
3493 za1 = zgam1 * cosz - zgam3
3494 za2 = zgam1 * ztau1
3495
3496! --- ... use exponential lookup table for transmittance, or expansion
3497! of exponential for low optical depth
3498
3499 zb1 = min( ztau1*sntz , 500.0 )
3500 if ( zb1 <= od_lo ) then
3501 zb2 = f_one - zb1 + 0.5*zb1*zb1
3502 else
3503 ftind = zb1 / (bpade + zb1)
3504 itind = ftind*ntbmx + 0.5
3505 zb2 = exp_tbl(itind)
3506 endif
3507
3508! ... collimated beam
3509 zrefb(kp) = max(f_zero, min(f_one, &
3510 & (za2 - za1*(f_one - zb2))/(f_one + za2) ))
3511 ztrab(kp) = max(f_zero, min(f_one, f_one-zrefb(kp) ))
3512
3513! ... isotropic incidence
3514 zrefd(kp) = max(f_zero, min(f_one, za2/(f_one + za2) ))
3515 ztrad(kp) = max(f_zero, min(f_one, f_one-zrefd(kp) ))
3516
3517 else ! for non-conservative scattering
3518 za1 = zgam1*zgam4 + zgam2*zgam3
3519 za2 = zgam1*zgam3 + zgam2*zgam4
3520 zrk = (zgam1 - zgam2) * (zgam1 + zgam2)
3521 if (zrk > eps1) then
3522 zrk = sqrt(zrk)
3523 else
3524 zrk = f_zero
3525 endif
3526 zrk2= zrk + zrk
3527
3528 zrp = zrk * cosz
3529 zrp1 = f_one + zrp
3530 zrm1 = f_one - zrp
3531 zrpp1= f_one - zrp*zrp
3532 zrpp = sign( max(flimit, abs(zrpp1)), zrpp1 ) ! avoid numerical singularity
3533 zrkg1= zrk + zgam1
3534 zrkg3= zrk * zgam3
3535 zrkg4= zrk * zgam4
3536
3537 zr1 = zrm1 * (za2 + zrkg3)
3538 zr2 = zrp1 * (za2 - zrkg3)
3539 zr3 = zrk2 * (zgam3 - za2*cosz)
3540 zr4 = zrpp * zrkg1
3541 zr5 = zrpp * (zrk - zgam1)
3542
3543 zt1 = zrp1 * (za1 + zrkg4)
3544 zt2 = zrm1 * (za1 - zrkg4)
3545 zt3 = zrk2 * (zgam4 + za1*cosz)
3546
3547! --- ... use exponential lookup table for transmittance, or expansion
3548! of exponential for low optical depth
3549
3550 zb1 = min( zrk*ztau1, 500.0 )
3551 if ( zb1 <= od_lo ) then
3552 zexm1 = f_one - zb1 + 0.5*zb1*zb1
3553 else
3554 ftind = zb1 / (bpade + zb1)
3555 itind = ftind*ntbmx + 0.5
3556 zexm1 = exp_tbl(itind)
3557 endif
3558 zexp1 = f_one / zexm1
3559
3560 zb2 = min( sntz*ztau1, 500.0 )
3561 if ( zb2 <= od_lo ) then
3562 zexm2 = f_one - zb2 + 0.5*zb2*zb2
3563 else
3564 ftind = zb2 / (bpade + zb2)
3565 itind = ftind*ntbmx + 0.5
3566 zexm2 = exp_tbl(itind)
3567 endif
3568 zexp2 = f_one / zexm2
3569 ze1r45 = zr4*zexp1 + zr5*zexm1
3570
3571! ... collimated beam
3572! if (ze1r45>=-eps1 .and. ze1r45<=eps1) then
3573 if (abs(ze1r45) <= eps1) then
3574 zrefb(kp) = eps1
3575 ztrab(kp) = zexm2
3576 else
3577 zden1 = zssa1 / ze1r45
3578 zrefb(kp) = max(f_zero, min(f_one, &
3579 & (zr1*zexp1 - zr2*zexm1 - zr3*zexm2)*zden1 ))
3580 ztrab(kp) = max(f_zero, min(f_one, zexm2*(f_one &
3581 & - (zt1*zexp1 - zt2*zexm1 - zt3*zexp2)*zden1) ))
3582 endif
3583
3584! ... diffuse beam
3585 if (ze1r45 >= f_zero) then
3586 zden1 = zr4 / max(eps1, ze1r45*zrkg1)
3587 else
3588 zden1 = zr4 / min(-eps1, ze1r45*zrkg1)
3589 endif
3590 zrefd(kp) = max(f_zero, min(f_one, &
3591 & zgam2*(zexp1 - zexm1)*zden1 ))
3592 ztrad(kp) = max(f_zero, min(f_one, zrk2*zden1 ))
3593 endif ! end if_zssaw_block
3594
3597
3598 zr1 = ztau1 * sntz
3599 if ( zr1 <= od_lo ) then
3600 zexp3 = f_one - zr1 + 0.5*zr1*zr1
3601 else
3602 ftind = zr1 / (bpade + zr1)
3603 itind = max(0, min(ntbmx, int(0.5+ntbmx*ftind) ))
3604 zexp3 = exp_tbl(itind)
3605 endif
3606
3607 ztdbt(k) = zexp3 * ztdbt(kp)
3608 zldbt(kp) = zexp3
3609
3611! (must use 'orig', unscaled cloud optical depth)
3612
3613 zr1 = ztau0 * sntz
3614 if ( zr1 <= od_lo ) then
3615 zexp4 = f_one - zr1 + 0.5*zr1*zr1
3616 else
3617 ftind = zr1 / (bpade + zr1)
3618 itind = max(0, min(ntbmx, int(0.5+ntbmx*ftind) ))
3619 zexp4 = exp_tbl(itind)
3620 endif
3621
3622 zldbt0(k) = zexp4
3623 ztdbt0 = zexp4 * ztdbt0
3624 enddo ! end do_k_loop
3625
3627 call vrtqdr &
3628! --- inputs:
3629 & ( zrefb,zrefd,ztrab,ztrad,zldbt,ztdbt, &
3630 & nlay, nlp1, &
3631! --- outputs:
3632 & zfu, zfd &
3633 & )
3634
3636 do k = 1, nlp1
3637 fxup0(k,ib) = fxup0(k,ib) + zsolar*zfu(k)
3638 fxdn0(k,ib) = fxdn0(k,ib) + zsolar*zfd(k)
3639 enddo
3640
3642 zb1 = zsolar*ztdbt0
3643 zb2 = zsolar*(zfd(1) - ztdbt0)
3644
3645 if (ibd /= 0) then
3646 sfbm0(ibd) = sfbm0(ibd) + zb1
3647 sfdf0(ibd) = sfdf0(ibd) + zb2
3648 else
3649 zf1 = 0.5 * zb1
3650 zf2 = 0.5 * zb2
3651 sfbm0(1) = sfbm0(1) + zf1
3652 sfdf0(1) = sfdf0(1) + zf2
3653 sfbm0(2) = sfbm0(2) + zf1
3654 sfdf0(2) = sfdf0(2) + zf2
3655 endif
3656! sfbm0(ibd) = sfbm0(ibd) + zsolar*ztdbt0
3657! sfdf0(ibd) = sfdf0(ibd) + zsolar*(zfd(1) - ztdbt0)
3658
3661! - Set up toa direct beam and surface values (beam and diff)
3662! - Delta scaling for total-sky condition
3663! - General two-stream expressions
3664! - Compute homogeneous reflectance and transmittance for
3665! conservative scattering and non-conservative scattering
3666! - Pre-delta-scaling clear and cloudy direct beam transmittance
3667! - Call swflux() to compute the upward and downward radiation fluxes
3668
3669 if ( cf1 > eps ) then
3670
3672 ztdbt0 = f_one
3673 zldbt(1) = f_zero
3674
3675 do k = nlay, 1, -1
3676 kp = k + 1
3677 if ( cldfmc(k,jg) > ftiny ) then ! it is a cloudy-layer
3678
3679 ztau0 = ztaus(k) + taucw(k,ib)
3680 zssa0 = zssas(k) + ssacw(k,ib)
3681 zasy0 = zasys(k) + asycw(k,ib)
3682 zssaw = min(oneminus, zssa0 / ztau0)
3683 zasyw = zasy0 / max(ftiny, zssa0)
3684
3686 za1 = zasyw * zasyw
3687 za2 = zssaw * za1
3688
3689 ztau1 = (f_one - za2) * ztau0
3690 zssa1 = (zssaw - za2) / (f_one - za2)
3691!org zasy1 = (zasyw - za1) / (f_one - za1)
3692 zasy1 = zasyw / (f_one + zasyw)
3693 zasy3 = 0.75 * zasy1
3694
3696 if ( iswmode == 1 ) then
3697 zgam1 = 1.75 - zssa1 * (f_one + zasy3)
3698 zgam2 =-0.25 + zssa1 * (f_one - zasy3)
3699 zgam3 = 0.5 - zasy3 * cosz
3700 elseif ( iswmode == 2 ) then ! pifm
3701 zgam1 = 2.0 - zssa1 * (1.25 + zasy3)
3702 zgam2 = 0.75* zssa1 * (f_one- zasy1)
3703 zgam3 = 0.5 - zasy3 * cosz
3704 elseif ( iswmode == 3 ) then ! discrete ordinates
3705 zgam1 = zsr3 * (2.0 - zssa1 * (1.0 + zasy1)) * 0.5
3706 zgam2 = zsr3 * zssa1 * (1.0 - zasy1) * 0.5
3707 zgam3 = (1.0 - zsr3 * zasy1 * cosz) * 0.5
3708 endif
3709 zgam4 = f_one - zgam3
3710
3713
3714 if ( zssaw >= zcrit ) then ! for conservative scattering
3715 za1 = zgam1 * cosz - zgam3
3716 za2 = zgam1 * ztau1
3717
3718! --- ... use exponential lookup table for transmittance, or expansion
3719! of exponential for low optical depth
3720
3721 zb1 = min( ztau1*sntz , 500.0 )
3722 if ( zb1 <= od_lo ) then
3723 zb2 = f_one - zb1 + 0.5*zb1*zb1
3724 else
3725 ftind = zb1 / (bpade + zb1)
3726 itind = ftind*ntbmx + 0.5
3727 zb2 = exp_tbl(itind)
3728 endif
3729
3730! ... collimated beam
3731 zrefb(kp) = max(f_zero, min(f_one, &
3732 & (za2 - za1*(f_one - zb2))/(f_one + za2) ))
3733 ztrab(kp) = max(f_zero, min(f_one, f_one-zrefb(kp)))
3734
3735! ... isotropic incidence
3736 zrefd(kp) = max(f_zero, min(f_one, za2 / (f_one+za2) ))
3737 ztrad(kp) = max(f_zero, min(f_one, f_one - zrefd(kp) ))
3738
3739 else ! for non-conservative scattering
3740 za1 = zgam1*zgam4 + zgam2*zgam3
3741 za2 = zgam1*zgam3 + zgam2*zgam4
3742 zrk = (zgam1 - zgam2) * (zgam1 + zgam2)
3743 if (zrk > eps1) then
3744 zrk = sqrt(zrk)
3745 else
3746 zrk = f_zero
3747 endif
3748 zrk2= zrk + zrk
3749
3750 zrp = zrk * cosz
3751 zrp1 = f_one + zrp
3752 zrm1 = f_one - zrp
3753 zrpp1= f_one - zrp*zrp
3754 zrpp = sign( max(flimit, abs(zrpp1)), zrpp1 ) ! avoid numerical singularity
3755 zrkg1= zrk + zgam1
3756 zrkg3= zrk * zgam3
3757 zrkg4= zrk * zgam4
3758
3759 zr1 = zrm1 * (za2 + zrkg3)
3760 zr2 = zrp1 * (za2 - zrkg3)
3761 zr3 = zrk2 * (zgam3 - za2*cosz)
3762 zr4 = zrpp * zrkg1
3763 zr5 = zrpp * (zrk - zgam1)
3764
3765 zt1 = zrp1 * (za1 + zrkg4)
3766 zt2 = zrm1 * (za1 - zrkg4)
3767 zt3 = zrk2 * (zgam4 + za1*cosz)
3768
3769! --- ... use exponential lookup table for transmittance, or expansion
3770! of exponential for low optical depth
3771
3772 zb1 = min( zrk*ztau1, 500.0 )
3773 if ( zb1 <= od_lo ) then
3774 zexm1 = f_one - zb1 + 0.5*zb1*zb1
3775 else
3776 ftind = zb1 / (bpade + zb1)
3777 itind = ftind*ntbmx + 0.5
3778 zexm1 = exp_tbl(itind)
3779 endif
3780 zexp1 = f_one / zexm1
3781
3782 zb2 = min( ztau1*sntz, 500.0 )
3783 if ( zb2 <= od_lo ) then
3784 zexm2 = f_one - zb2 + 0.5*zb2*zb2
3785 else
3786 ftind = zb2 / (bpade + zb2)
3787 itind = ftind*ntbmx + 0.5
3788 zexm2 = exp_tbl(itind)
3789 endif
3790 zexp2 = f_one / zexm2
3791 ze1r45 = zr4*zexp1 + zr5*zexm1
3792
3793! ... collimated beam
3794! if ( ze1r45>=-eps1 .and. ze1r45<=eps1 ) then
3795 if ( abs(ze1r45) <= eps1 ) then
3796 zrefb(kp) = eps1
3797 ztrab(kp) = zexm2
3798 else
3799 zden1 = zssa1 / ze1r45
3800 zrefb(kp) = max(f_zero, min(f_one, &
3801 & (zr1*zexp1-zr2*zexm1-zr3*zexm2)*zden1 ))
3802 ztrab(kp) = max(f_zero, min(f_one, zexm2*(f_one - &
3803 & (zt1*zexp1-zt2*zexm1-zt3*zexp2)*zden1) ))
3804 endif
3805
3806! ... diffuse beam
3807 if (ze1r45 >= f_zero) then
3808 zden1 = zr4 / max(eps1, ze1r45*zrkg1)
3809 else
3810 zden1 = zr4 / min(-eps1, ze1r45*zrkg1)
3811 endif
3812 zrefd(kp) = max(f_zero, min(f_one, &
3813 & zgam2*(zexp1 - zexm1)*zden1 ))
3814 ztrad(kp) = max(f_zero, min(f_one, zrk2*zden1 ))
3815 endif ! end if_zssaw_block
3816
3817! --- ... direct beam transmittance. use exponential lookup table
3818! for transmittance, or expansion of exponential for low
3819! optical depth
3820
3821 zr1 = ztau1 * sntz
3822 if ( zr1 <= od_lo ) then
3823 zexp3 = f_one - zr1 + 0.5*zr1*zr1
3824 else
3825 ftind = zr1 / (bpade + zr1)
3826 itind = max(0, min(ntbmx, int(0.5+ntbmx*ftind) ))
3827 zexp3 = exp_tbl(itind)
3828 endif
3829
3830 zldbt(kp) = zexp3
3831 ztdbt(k) = zexp3 * ztdbt(kp)
3832
3833! --- ... pre-delta-scaling clear and cloudy direct beam transmittance
3834! (must use 'orig', unscaled cloud optical depth)
3835
3836 zr1 = ztau0 * sntz
3837 if ( zr1 <= od_lo ) then
3838 zexp4 = f_one - zr1 + 0.5*zr1*zr1
3839 else
3840 ftind = zr1 / (bpade + zr1)
3841 itind = max(0, min(ntbmx, int(0.5+ntbmx*ftind) ))
3842 zexp4 = exp_tbl(itind)
3843 endif
3844
3845 ztdbt0 = zexp4 * ztdbt0
3846
3847 else ! if_cldfmc_block --- it is a clear layer
3848
3849! --- ... direct beam transmittance
3850 ztdbt(k) = zldbt(kp) * ztdbt(kp)
3851
3853 ztdbt0 = zldbt0(k) * ztdbt0
3854
3855 endif ! end if_cldfmc_block
3856 enddo ! end do_k_loop
3857
3859
3860 call vrtqdr &
3861! --- inputs:
3862 & ( zrefb,zrefd,ztrab,ztrad,zldbt,ztdbt, &
3863 & nlay, nlp1, &
3864! --- outputs:
3865 & zfu, zfd &
3866 & )
3867
3868! --- ... compute upward and downward fluxes at levels
3869 do k = 1, nlp1
3870 fxupc(k,ib) = fxupc(k,ib) + zsolar*zfu(k)
3871 fxdnc(k,ib) = fxdnc(k,ib) + zsolar*zfd(k)
3872 enddo
3873
3876 zb1 = zsolar*ztdbt0
3877 zb2 = zsolar*(zfd(1) - ztdbt0)
3878
3879 if (ibd /= 0) then
3880 sfbmc(ibd) = sfbmc(ibd) + zb1
3881 sfdfc(ibd) = sfdfc(ibd) + zb2
3882 else
3883 zf1 = 0.5 * zb1
3884 zf2 = 0.5 * zb2
3885 sfbmc(1) = sfbmc(1) + zf1
3886 sfdfc(1) = sfdfc(1) + zf2
3887 sfbmc(2) = sfbmc(2) + zf1
3888 sfdfc(2) = sfdfc(2) + zf2
3889 endif
3890! sfbmc(ibd) = sfbmc(ibd) + zsolar*ztdbt0
3891! sfdfc(ibd) = sfdfc(ibd) + zsolar*(zfd(1) - ztdbt0)
3892
3893 endif ! end if_cf1_block
3894
3895 enddo lab_do_jg
3896
3897! --- ... end of g-point loop
3898
3899 do ib = 1, nbdsw
3900 ftoadc = ftoadc + fxdn0(nlp1,ib)
3901 ftoau0 = ftoau0 + fxup0(nlp1,ib)
3902 fsfcu0 = fsfcu0 + fxup0(1,ib)
3903 fsfcd0 = fsfcd0 + fxdn0(1,ib)
3904 enddo
3905
3907 ibd = nuvb - nblow + 1
3908 suvbf0 = fxdn0(1,ibd)
3909
3910 if ( cf1 <= eps ) then ! clear column, set total-sky=clear-sky fluxes
3911 do ib = 1, nbdsw
3912 do k = 1, nlp1
3913 fxupc(k,ib) = fxup0(k,ib)
3914 fxdnc(k,ib) = fxdn0(k,ib)
3915 enddo
3916 enddo
3917
3918 ftoauc = ftoau0
3919 fsfcuc = fsfcu0
3920 fsfcdc = fsfcd0
3921
3923 sfbmc(1) = sfbm0(1)
3924 sfdfc(1) = sfdf0(1)
3925 sfbmc(2) = sfbm0(2)
3926 sfdfc(2) = sfdf0(2)
3927
3929 suvbfc = suvbf0
3930 else ! cloudy column, compute total-sky fluxes
3931 do ib = 1, nbdsw
3932 ftoauc = ftoauc + fxupc(nlp1,ib)
3933 fsfcuc = fsfcuc + fxupc(1,ib)
3934 fsfcdc = fsfcdc + fxdnc(1,ib)
3935 enddo
3936
3937!! --- ... uv-b surface downward flux
3938 suvbfc = fxdnc(1,ibd)
3939 endif ! end if_cf1_block
3940
3941 return
3942!...................................
3943 end subroutine spcvrtm
3944!-----------------------------------
3945
3959!-----------------------------------
3960 subroutine vrtqdr &
3961 & ( zrefb,zrefd,ztrab,ztrad,zldbt,ztdbt, & ! inputs
3962 & nlay, nlp1, &
3963 & zfu, zfd & ! outputs:
3964 & )
3965
3966! =================== program usage description =================== !
3967! !
3968! purpose: computes the upward and downward radiation fluxes !
3969! !
3970! interface: "vrtqdr" is called by "spcvrc" and "spcvrm" !
3971! !
3972! subroutines called : none !
3973! !
3974! ==================== defination of variables ==================== !
3975! !
3976! input variables: !
3977! zrefb(NLP1) - layer direct beam reflectivity !
3978! zrefd(NLP1) - layer diffuse reflectivity !
3979! ztrab(NLP1) - layer direct beam transmissivity !
3980! ztrad(NLP1) - layer diffuse transmissivity !
3981! zldbt(NLP1) - layer mean beam transmittance !
3982! ztdbt(NLP1) - total beam transmittance at levels !
3983! NLAY, NLP1 - number of layers/levels !
3984! !
3985! output variables: !
3986! zfu (NLP1) - upward flux at layer interface !
3987! zfd (NLP1) - downward flux at layer interface !
3988! !
3989! ******************************************************************* !
3990! ====================== end of description block ================= !
3991
3992! --- inputs:
3993 integer, intent(in) :: nlay, nlp1
3994
3995 real (kind=kind_phys), dimension(nlp1), intent(in) :: zrefb, &
3996 & zrefd, ztrab, ztrad, ztdbt, zldbt
3997
3998! --- outputs:
3999 real (kind=kind_phys), dimension(nlp1), intent(out) :: zfu, zfd
4000
4001! --- locals:
4002 real (kind=kind_phys), dimension(nlp1) :: zrupb,zrupd,zrdnd,ztdn
4003
4004 real (kind=kind_phys) :: zden1
4005
4006 integer :: k, kp
4007!
4008!===> ... begin here
4009!
4010
4012 zrupb(1) = zrefb(1) ! direct beam
4013 zrupd(1) = zrefd(1) ! diffused
4014
4016 do k = 1, nlay
4017 kp = k + 1
4018
4019 zden1 = f_one / ( f_one - zrupd(k)*zrefd(kp) )
4020 zrupb(kp) = zrefb(kp) + ( ztrad(kp) * &
4021 & ( (ztrab(kp) - zldbt(kp))*zrupd(k) + &
4022 & zldbt(kp)*zrupb(k)) ) * zden1
4023 zrupd(kp) = zrefd(kp) + ztrad(kp)*ztrad(kp)*zrupd(k)*zden1
4024 enddo
4025
4027 ztdn(nlp1) = f_one
4028 zrdnd(nlp1) = f_zero
4029 ztdn(nlay) = ztrab(nlp1)
4030 zrdnd(nlay) = zrefd(nlp1)
4031
4033 do k = nlay, 2, -1
4034 zden1 = f_one / (f_one - zrefd(k)*zrdnd(k))
4035 ztdn(k-1) = ztdbt(k)*ztrab(k) + ( ztrad(k) * &
4036 & ( (ztdn(k) - ztdbt(k)) + ztdbt(k) * &
4037 & zrefb(k)*zrdnd(k) )) * zden1
4038 zrdnd(k-1) = zrefd(k) + ztrad(k)*ztrad(k)*zrdnd(k)*zden1
4039 enddo
4040
4042 do k = 1, nlp1
4043 zden1 = f_one / (f_one - zrdnd(k)*zrupd(k))
4044 zfu(k) = ( ztdbt(k)*zrupb(k) + &
4045 & (ztdn(k) - ztdbt(k))*zrupd(k) ) * zden1
4046 zfd(k) = ztdbt(k) + ( ztdn(k) - ztdbt(k) + &
4047 & ztdbt(k)*zrupb(k)*zrdnd(k) ) * zden1
4048 enddo
4049
4050 return
4051!...................................
4052 end subroutine vrtqdr
4053!-----------------------------------
4054
4094!-----------------------------------
4095 subroutine taumol &
4096 & ( colamt,colmol,fac00,fac01,fac10,fac11,jp,jt,jt1,laytrop, & ! --- inputs
4097 & forfac,forfrac,indfor,selffac,selffrac,indself, nlay, &
4098 & sfluxzen, taug, taur & ! --- outputs
4099 & )
4100
4101! ================== program usage description ================== !
4102! !
4103! description: !
4104! calculate optical depths for gaseous absorption and rayleigh !
4105! scattering. !
4106! !
4107! subroutines called: taugb## (## = 16 - 29) !
4108! !
4109! ==================== defination of variables ==================== !
4110! !
4111! inputs: size !
4112! colamt - real, column amounts of absorbing gases the index !
4113! are for h2o, co2, o3, n2o, ch4, and o2, !
4114! respectively (molecules/cm**2) nlay*maxgas!
4115! colmol - real, total column amount (dry air+water vapor) nlay !
4116! facij - real, for each layer, these are factors that are !
4117! needed to compute the interpolation factors !
4118! that multiply the appropriate reference k- !
4119! values. a value of 0/1 for i,j indicates !
4120! that the corresponding factor multiplies !
4121! reference k-value for the lower/higher of the !
4122! two appropriate temperatures, and altitudes, !
4123! respectively. naly !
4124! jp - real, the index of the lower (in altitude) of the !
4125! two appropriate ref pressure levels needed !
4126! for interpolation. nlay !
4127! jt, jt1 - integer, the indices of the lower of the two approp !
4128! ref temperatures needed for interpolation (for !
4129! pressure levels jp and jp+1, respectively) nlay !
4130! laytrop - integer, tropopause layer index 1 !
4131! forfac - real, scale factor needed to foreign-continuum. nlay !
4132! forfrac - real, factor needed for temperature interpolation nlay !
4133! indfor - integer, index of the lower of the two appropriate !
4134! reference temperatures needed for foreign- !
4135! continuum interpolation nlay !
4136! selffac - real, scale factor needed to h2o self-continuum. nlay !
4137! selffrac- real, factor needed for temperature interpolation !
4138! of reference h2o self-continuum data nlay !
4139! indself - integer, index of the lower of the two appropriate !
4140! reference temperatures needed for the self- !
4141! continuum interpolation nlay !
4142! nlay - integer, number of vertical layers 1 !
4143! !
4144! output: !
4145! sfluxzen- real, spectral distribution of incoming solar flux ngptsw!
4146! taug - real, spectral optical depth for gases nlay*ngptsw!
4147! taur - real, opt depth for rayleigh scattering nlay*ngptsw!
4148! !
4149! =================================================================== !
4150! ************ original subprogram description *************** !
4151! !
4152! optical depths developed for the !
4153! !
4154! rapid radiative transfer model (rrtm) !
4155! !
4156! atmospheric and environmental research, inc. !
4157! 131 hartwell avenue !
4158! lexington, ma 02421 !
4159! !
4160! !
4161! eli j. mlawer !
4162! jennifer delamere !
4163! steven j. taubman !
4164! shepard a. clough !
4165! !
4166! !
4167! !
4168! email: mlawer@aer.com !
4169! email: jdelamer@aer.com !
4170! !
4171! the authors wish to acknowledge the contributions of the !
4172! following people: patrick d. brown, michael j. iacono, !
4173! ronald e. farren, luke chen, robert bergstrom. !
4174! !
4175! ******************************************************************* !
4176! !
4177! taumol !
4178! !
4179! this file contains the subroutines taugbn (where n goes from !
4180! 16 to 29). taugbn calculates the optical depths and Planck !
4181! fractions per g-value and layer for band n. !
4182! !
4183! output: optical depths (unitless) !
4184! fractions needed to compute planck functions at every layer !
4185! and g-value !
4186! !
4187! modifications: !
4188! !
4189! revised: adapted to f90 coding, j.-j.morcrette, ecmwf, feb 2003 !
4190! revised: modified for g-point reduction, mjiacono, aer, dec 2003 !
4191! revised: reformatted for consistency with rrtmg_lw, mjiacono, aer, !
4192! jul 2006 !
4193! !
4194! ******************************************************************* !
4195! ====================== end of description block ================= !
4196
4197! --- inputs:
4198 integer, intent(in) :: nlay, laytrop
4199
4200 integer, dimension(nlay), intent(in) :: indfor, indself, &
4201 & jp, jt, jt1
4202
4203 real (kind=kind_phys), dimension(nlay), intent(in) :: colmol, &
4204 & fac00, fac01, fac10, fac11, forfac, forfrac, selffac, &
4205 & selffrac
4206
4207 real (kind=kind_phys), dimension(nlay,maxgas),intent(in) :: colamt
4208
4209! --- outputs:
4210 real (kind=kind_phys), dimension(ngptsw), intent(out) :: sfluxzen
4211
4212 real (kind=kind_phys), dimension(nlay,ngptsw), intent(out) :: &
4213 & taug, taur
4214
4215! --- locals:
4216 real (kind=kind_phys) :: fs, speccomb, specmult, colm1, colm2
4217
4218 integer, dimension(nlay,nblow:nbhgh) :: id0, id1
4219
4220 integer :: ibd, j, jb, js, k, klow, khgh, klim, ks, njb, ns
4221!
4222!===> ... begin here
4223!
4224! --- ... loop over each spectral band
4225
4226 do jb = nblow, nbhgh
4227
4228! --- ... indices for layer optical depth
4229
4230 do k = 1, laytrop
4231 id0(k,jb) = ((jp(k)-1)*5 + (jt(k)-1)) * nspa(jb)
4232 id1(k,jb) = ( jp(k) *5 + (jt1(k)-1)) * nspa(jb)
4233 enddo
4234
4235 do k = laytrop+1, nlay
4236 id0(k,jb) = ((jp(k)-13)*5 + (jt(k)-1)) * nspb(jb)
4237 id1(k,jb) = ((jp(k)-12)*5 + (jt1(k)-1)) * nspb(jb)
4238 enddo
4239
4240! --- ... calculate spectral flux at toa
4241
4242 ibd = ibx(jb)
4243 njb = ng(jb)
4244 ns = ngs(jb)
4245
4246 select case (jb)
4247
4248 case (16, 20, 23, 25, 26, 29)
4249
4250 do j = 1, njb
4251 sfluxzen(ns+j) = sfluxref01(j,1,ibd)
4252 enddo
4253
4254 case (27)
4255
4256 do j = 1, njb
4257 sfluxzen(ns+j) = scalekur * sfluxref01(j,1,ibd)
4258 enddo
4259
4260 case default
4261
4262 if (jb==17 .or. jb==28) then
4263
4264 ks = nlay
4265 lab_do_k1 : do k = laytrop, nlay-1
4266 if (jp(k)<layreffr(jb) .and. jp(k+1)>=layreffr(jb)) then
4267 ks = k + 1
4268 exit lab_do_k1
4269 endif
4270 enddo lab_do_k1
4271
4272 colm1 = colamt(ks,ix1(jb))
4273 colm2 = colamt(ks,ix2(jb))
4274 speccomb = colm1 + strrat(jb)*colm2
4275 specmult = specwt(jb) * min( oneminus, colm1/speccomb )
4276 js = 1 + int( specmult )
4277 fs = mod(specmult, f_one)
4278
4279 do j = 1, njb
4280 sfluxzen(ns+j) = sfluxref02(j,js,ibd) &
4281 & + fs * (sfluxref02(j,js+1,ibd) - sfluxref02(j,js,ibd))
4282 enddo
4283
4284 else
4285
4286 ks = laytrop
4287 lab_do_k2 : do k = 1, laytrop-1
4288 if (jp(k)<layreffr(jb) .and. jp(k+1)>=layreffr(jb)) then
4289 ks = k + 1
4290 exit lab_do_k2
4291 endif
4292 enddo lab_do_k2
4293
4294 colm1 = colamt(ks,ix1(jb))
4295 colm2 = colamt(ks,ix2(jb))
4296 speccomb = colm1 + strrat(jb)*colm2
4297 specmult = specwt(jb) * min( oneminus, colm1/speccomb )
4298 js = 1 + int( specmult )
4299 fs = mod(specmult, f_one)
4300
4301 do j = 1, njb
4302 sfluxzen(ns+j) = sfluxref03(j,js,ibd) &
4303 & + fs * (sfluxref03(j,js+1,ibd) - sfluxref03(j,js,ibd))
4304 enddo
4305
4306 endif
4307
4308 end select
4309
4310 enddo
4311
4313
4315 call taumol16
4317 call taumol17
4319 call taumol18
4321 call taumol19
4323 call taumol20
4325 call taumol21
4327 call taumol22
4329 call taumol23
4331 call taumol24
4333 call taumol25
4335 call taumol26
4337 call taumol27
4339 call taumol28
4341 call taumol29
4342
4343
4344! =================
4345 contains
4346! =================
4347
4351!-----------------------------------
4352 subroutine taumol16
4353!...................................
4354
4355! ------------------------------------------------------------------ !
4356! band 16: 2600-3250 cm-1 (low - h2o,ch4; high - ch4) !
4357! ------------------------------------------------------------------ !
4358!
4360
4361! --- locals:
4362
4363 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
4364 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
4365
4366 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4367 integer :: inds, indf, indsp, indfp, j, js, k
4368
4369!
4370!===> ... begin here
4371!
4372
4373! --- ... compute the optical depth by interpolating in ln(pressure),
4374! temperature, and appropriate species. below laytrop, the water
4375! vapor self-continuum is interpolated (in temperature) separately.
4376
4377 do k = 1, nlay
4378 tauray = colmol(k) * rayl
4379
4380 do j = 1, ng16
4381 taur(k,ns16+j) = tauray
4382 enddo
4383 enddo
4384
4385 do k = 1, laytrop
4386 speccomb = colamt(k,1) + strrat(16)*colamt(k,5)
4387 specmult = 8.0 * min( oneminus, colamt(k,1)/speccomb )
4388
4389 js = 1 + int( specmult )
4390 fs = mod( specmult, f_one )
4391 fs1= f_one - fs
4392 fac000 = fs1 * fac00(k)
4393 fac010 = fs1 * fac10(k)
4394 fac100 = fs * fac00(k)
4395 fac110 = fs * fac10(k)
4396 fac001 = fs1 * fac01(k)
4397 fac011 = fs1 * fac11(k)
4398 fac101 = fs * fac01(k)
4399 fac111 = fs * fac11(k)
4400
4401 ind01 = id0(k,16) + js
4402 ind02 = ind01 + 1
4403 ind03 = ind01 + 9
4404 ind04 = ind01 + 10
4405 ind11 = id1(k,16) + js
4406 ind12 = ind11 + 1
4407 ind13 = ind11 + 9
4408 ind14 = ind11 + 10
4409 inds = indself(k)
4410 indf = indfor(k)
4411 indsp= inds + 1
4412 indfp= indf + 1
4413
4414 do j = 1, ng16
4415 taug(k,ns16+j) = speccomb &
4416 & *( fac000 * absa(ind01,j) + fac100 * absa(ind02,j) &
4417 & + fac010 * absa(ind03,j) + fac110 * absa(ind04,j) &
4418 & + fac001 * absa(ind11,j) + fac101 * absa(ind12,j) &
4419 & + fac011 * absa(ind13,j) + fac111 * absa(ind14,j) ) &
4420 & + colamt(k,1) * (selffac(k) * (selfref(inds,j) &
4421 & + selffrac(k) * (selfref(indsp,j)-selfref(inds,j))) &
4422 & + forfac(k) * (forref(indf,j) + forfrac(k) &
4423 & * (forref(indfp,j) - forref(indf,j))))
4424 enddo
4425 enddo
4426
4427 do k = laytrop+1, nlay
4428 ind01 = id0(k,16) + 1
4429 ind02 = ind01 + 1
4430 ind11 = id1(k,16) + 1
4431 ind12 = ind11 + 1
4432
4433 do j = 1, ng16
4434 taug(k,ns16+j) = colamt(k,5) &
4435 & * ( fac00(k)*absb(ind01,j) + fac10(k)*absb(ind02,j) &
4436 & + fac01(k)*absb(ind11,j) + fac11(k)*absb(ind12,j) )
4437 enddo
4438 enddo
4439
4440 return
4441!...................................
4442 end subroutine taumol16
4443!-----------------------------------
4444
4448!-----------------------------------
4449 subroutine taumol17
4450!...................................
4451
4452! ------------------------------------------------------------------ !
4453! band 17: 3250-4000 cm-1 (low - h2o,co2; high - h2o,co2) !
4454! ------------------------------------------------------------------ !
4455!
4457
4458! --- locals:
4459 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
4460 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
4461
4462 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4463 integer :: inds, indf, indsp, indfp, j, js, k
4464
4465!
4466!===> ... begin here
4467!
4468
4469! --- ... compute the optical depth by interpolating in ln(pressure),
4470! temperature, and appropriate species. below laytrop, the water
4471! vapor self-continuum is interpolated (in temperature) separately.
4472
4473 do k = 1, nlay
4474 tauray = colmol(k) * rayl
4475
4476 do j = 1, ng17
4477 taur(k,ns17+j) = tauray
4478 enddo
4479 enddo
4480
4481 do k = 1, laytrop
4482 speccomb = colamt(k,1) + strrat(17)*colamt(k,2)
4483 specmult = 8.0 * min(oneminus, colamt(k,1) / speccomb)
4484
4485 js = 1 + int(specmult)
4486 fs = mod(specmult, f_one)
4487 fs1= f_one - fs
4488 fac000 = fs1 * fac00(k)
4489 fac010 = fs1 * fac10(k)
4490 fac100 = fs * fac00(k)
4491 fac110 = fs * fac10(k)
4492 fac001 = fs1 * fac01(k)
4493 fac011 = fs1 * fac11(k)
4494 fac101 = fs * fac01(k)
4495 fac111 = fs * fac11(k)
4496
4497 ind01 = id0(k,17) + js
4498 ind02 = ind01 + 1
4499 ind03 = ind01 + 9
4500 ind04 = ind01 + 10
4501 ind11 = id1(k,17) + js
4502 ind12 = ind11 + 1
4503 ind13 = ind11 + 9
4504 ind14 = ind11 + 10
4505
4506 inds = indself(k)
4507 indf = indfor(k)
4508 indsp= inds + 1
4509 indfp= indf + 1
4510
4511 do j = 1, ng17
4512 taug(k,ns17+j) = speccomb &
4513 & * ( fac000 * absa(ind01,j) + fac100 * absa(ind02,j) &
4514 & + fac010 * absa(ind03,j) + fac110 * absa(ind04,j) &
4515 & + fac001 * absa(ind11,j) + fac101 * absa(ind12,j) &
4516 & + fac011 * absa(ind13,j) + fac111 * absa(ind14,j) ) &
4517 & + colamt(k,1) * (selffac(k) * (selfref(inds,j) &
4518 & + selffrac(k) * (selfref(indsp,j)-selfref(inds,j))) &
4519 & + forfac(k) * (forref(indf,j) + forfrac(k) &
4520 & * (forref(indfp,j) - forref(indf,j))))
4521 enddo
4522 enddo
4523
4524 do k = laytrop+1, nlay
4525 speccomb = colamt(k,1) + strrat(17)*colamt(k,2)
4526 specmult = 4.0 * min(oneminus, colamt(k,1) / speccomb)
4527
4528 js = 1 + int(specmult)
4529 fs = mod(specmult, f_one)
4530 fs1= f_one - fs
4531 fac000 = fs1 * fac00(k)
4532 fac010 = fs1 * fac10(k)
4533 fac100 = fs * fac00(k)
4534 fac110 = fs * fac10(k)
4535 fac001 = fs1 * fac01(k)
4536 fac011 = fs1 * fac11(k)
4537 fac101 = fs * fac01(k)
4538 fac111 = fs * fac11(k)
4539
4540 ind01 = id0(k,17) + js
4541 ind02 = ind01 + 1
4542 ind03 = ind01 + 5
4543 ind04 = ind01 + 6
4544 ind11 = id1(k,17) + js
4545 ind12 = ind11 + 1
4546 ind13 = ind11 + 5
4547 ind14 = ind11 + 6
4548
4549 indf = indfor(k)
4550 indfp= indf + 1
4551
4552 do j = 1, ng17
4553 taug(k,ns17+j) = speccomb &
4554 & * ( fac000 * absb(ind01,j) + fac100 * absb(ind02,j) &
4555 & + fac010 * absb(ind03,j) + fac110 * absb(ind04,j) &
4556 & + fac001 * absb(ind11,j) + fac101 * absb(ind12,j) &
4557 & + fac011 * absb(ind13,j) + fac111 * absb(ind14,j) ) &
4558 & + colamt(k,1) * forfac(k) * (forref(indf,j) &
4559 & + forfrac(k) * (forref(indfp,j) - forref(indf,j)))
4560 enddo
4561 enddo
4562
4563 return
4564!...................................
4565 end subroutine taumol17
4566!-----------------------------------
4567
4571!-----------------------------------
4572 subroutine taumol18
4573!...................................
4574
4575! ------------------------------------------------------------------ !
4576! band 18: 4000-4650 cm-1 (low - h2o,ch4; high - ch4) !
4577! ------------------------------------------------------------------ !
4578!
4580
4581! --- locals:
4582 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
4583 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
4584
4585 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4586 integer :: inds, indf, indsp, indfp, j, js, k
4587
4588!
4589!===> ... begin here
4590!
4591
4592! --- ... compute the optical depth by interpolating in ln(pressure),
4593! temperature, and appropriate species. below laytrop, the water
4594! vapor self-continuum is interpolated (in temperature) separately.
4595
4596 do k = 1, nlay
4597 tauray = colmol(k) * rayl
4598
4599 do j = 1, ng18
4600 taur(k,ns18+j) = tauray
4601 enddo
4602 enddo
4603
4604 do k = 1, laytrop
4605 speccomb = colamt(k,1) + strrat(18)*colamt(k,5)
4606 specmult = 8.0 * min(oneminus, colamt(k,1) / speccomb)
4607
4608 js = 1 + int(specmult)
4609 fs = mod(specmult, f_one)
4610 fs1= f_one - fs
4611 fac000 = fs1 * fac00(k)
4612 fac010 = fs1 * fac10(k)
4613 fac100 = fs * fac00(k)
4614 fac110 = fs * fac10(k)
4615 fac001 = fs1 * fac01(k)
4616 fac011 = fs1 * fac11(k)
4617 fac101 = fs * fac01(k)
4618 fac111 = fs * fac11(k)
4619
4620 ind01 = id0(k,18) + js
4621 ind02 = ind01 + 1
4622 ind03 = ind01 + 9
4623 ind04 = ind01 + 10
4624 ind11 = id1(k,18) + js
4625 ind12 = ind11 + 1
4626 ind13 = ind11 + 9
4627 ind14 = ind11 + 10
4628
4629 inds = indself(k)
4630 indf = indfor(k)
4631 indsp= inds + 1
4632 indfp= indf + 1
4633
4634 do j = 1, ng18
4635 taug(k,ns18+j) = speccomb &
4636 & * ( fac000 * absa(ind01,j) + fac100 * absa(ind02,j) &
4637 & + fac010 * absa(ind03,j) + fac110 * absa(ind04,j) &
4638 & + fac001 * absa(ind11,j) + fac101 * absa(ind12,j) &
4639 & + fac011 * absa(ind13,j) + fac111 * absa(ind14,j) ) &
4640 & + colamt(k,1) * (selffac(k) * (selfref(inds,j) &
4641 & + selffrac(k) * (selfref(indsp,j)-selfref(inds,j))) &
4642 & + forfac(k) * (forref(indf,j) + forfrac(k) &
4643 & * (forref(indfp,j) - forref(indf,j))))
4644 enddo
4645 enddo
4646
4647 do k = laytrop+1, nlay
4648 ind01 = id0(k,18) + 1
4649 ind02 = ind01 + 1
4650 ind11 = id1(k,18) + 1
4651 ind12 = ind11 + 1
4652
4653 do j = 1, ng18
4654 taug(k,ns18+j) = colamt(k,5) &
4655 & * ( fac00(k)*absb(ind01,j) + fac10(k)*absb(ind02,j) &
4656 & + fac01(k)*absb(ind11,j) + fac11(k)*absb(ind12,j) )
4657 enddo
4658 enddo
4659
4660 return
4661!...................................
4662 end subroutine taumol18
4663!-----------------------------------
4664
4668!-----------------------------------
4669 subroutine taumol19
4670!...................................
4671
4672! ------------------------------------------------------------------ !
4673! band 19: 4650-5150 cm-1 (low - h2o,co2; high - co2) !
4674! ------------------------------------------------------------------ !
4675!
4677
4678! --- locals:
4679 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
4680 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
4681
4682 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4683 integer :: inds, indf, indsp, indfp, j, js, k
4684
4685!
4686!===> ... begin here
4687!
4688
4689! --- ... compute the optical depth by interpolating in ln(pressure),
4690! temperature, and appropriate species. below laytrop, the water
4691! vapor self-continuum is interpolated (in temperature) separately.
4692
4693 do k = 1, nlay
4694 tauray = colmol(k) * rayl
4695
4696 do j = 1, ng19
4697 taur(k,ns19+j) = tauray
4698 enddo
4699 enddo
4700
4701 do k = 1, laytrop
4702 speccomb = colamt(k,1) + strrat(19)*colamt(k,2)
4703 specmult = 8.0 * min(oneminus, colamt(k,1) / speccomb)
4704
4705 js = 1 + int(specmult)
4706 fs = mod(specmult, f_one)
4707 fs1= f_one - fs
4708 fac000 = fs1 * fac00(k)
4709 fac010 = fs1 * fac10(k)
4710 fac100 = fs * fac00(k)
4711 fac110 = fs * fac10(k)
4712 fac001 = fs1 * fac01(k)
4713 fac011 = fs1 * fac11(k)
4714 fac101 = fs * fac01(k)
4715 fac111 = fs * fac11(k)
4716
4717 ind01 = id0(k,19) + js
4718 ind02 = ind01 + 1
4719 ind03 = ind01 + 9
4720 ind04 = ind01 + 10
4721 ind11 = id1(k,19) + js
4722 ind12 = ind11 + 1
4723 ind13 = ind11 + 9
4724 ind14 = ind11 + 10
4725
4726 inds = indself(k)
4727 indf = indfor(k)
4728 indsp= inds + 1
4729 indfp= indf + 1
4730
4731 do j = 1, ng19
4732 taug(k,ns19+j) = speccomb &
4733 & * ( fac000 * absa(ind01,j) + fac100 * absa(ind02,j) &
4734 & + fac010 * absa(ind03,j) + fac110 * absa(ind04,j) &
4735 & + fac001 * absa(ind11,j) + fac101 * absa(ind12,j) &
4736 & + fac011 * absa(ind13,j) + fac111 * absa(ind14,j) ) &
4737 & + colamt(k,1) * (selffac(k) * (selfref(inds,j) &
4738 & + selffrac(k) * (selfref(indsp,j)-selfref(inds,j))) &
4739 & + forfac(k) * (forref(indf,j) + forfrac(k) &
4740 & * (forref(indfp,j) - forref(indf,j))))
4741 enddo
4742 enddo
4743
4744 do k = laytrop+1, nlay
4745 ind01 = id0(k,19) + 1
4746 ind02 = ind01 + 1
4747 ind11 = id1(k,19) + 1
4748 ind12 = ind11 + 1
4749
4750 do j = 1, ng19
4751 taug(k,ns19+j) = colamt(k,2) &
4752 & * ( fac00(k)*absb(ind01,j) + fac10(k)*absb(ind02,j) &
4753 & + fac01(k)*absb(ind11,j) + fac11(k)*absb(ind12,j) )
4754 enddo
4755 enddo
4756
4757!...................................
4758 end subroutine taumol19
4759!-----------------------------------
4760
4764!-----------------------------------
4765 subroutine taumol20
4766!...................................
4767
4768! ------------------------------------------------------------------ !
4769! band 20: 5150-6150 cm-1 (low - h2o; high - h2o) !
4770! ------------------------------------------------------------------ !
4771!
4773
4774! --- locals:
4775 real (kind=kind_phys) :: tauray
4776
4777 integer :: ind01, ind02, ind11, ind12
4778 integer :: inds, indf, indsp, indfp, j, k
4779
4780!
4781!===> ... begin here
4782!
4783
4784! --- ... compute the optical depth by interpolating in ln(pressure),
4785! temperature, and appropriate species. below laytrop, the water
4786! vapor self-continuum is interpolated (in temperature) separately.
4787
4788 do k = 1, nlay
4789 tauray = colmol(k) * rayl
4790
4791 do j = 1, ng20
4792 taur(k,ns20+j) = tauray
4793 enddo
4794 enddo
4795
4796 do k = 1, laytrop
4797 ind01 = id0(k,20) + 1
4798 ind02 = ind01 + 1
4799 ind11 = id1(k,20) + 1
4800 ind12 = ind11 + 1
4801
4802 inds = indself(k)
4803 indf = indfor(k)
4804 indsp= inds + 1
4805 indfp= indf + 1
4806
4807 do j = 1, ng20
4808 taug(k,ns20+j) = colamt(k,1) &
4809 & * ( (fac00(k)*absa(ind01,j) + fac10(k)*absa(ind02,j) &
4810 & + fac01(k)*absa(ind11,j) + fac11(k)*absa(ind12,j)) &
4811 & + selffac(k) * (selfref(inds,j) + selffrac(k) &
4812 & * (selfref(indsp,j) - selfref(inds,j))) &
4813 & + forfac(k) * (forref(indf,j) + forfrac(k) &
4814 & * (forref(indfp,j) - forref(indf,j))) ) &
4815 & + colamt(k,5) * absch4(j)
4816 enddo
4817 enddo
4818
4819 do k = laytrop+1, nlay
4820 ind01 = id0(k,20) + 1
4821 ind02 = ind01 + 1
4822 ind11 = id1(k,20) + 1
4823 ind12 = ind11 + 1
4824
4825 indf = indfor(k)
4826 indfp= indf + 1
4827
4828 do j = 1, ng20
4829 taug(k,ns20+j) = colamt(k,1) &
4830 & * ( fac00(k)*absb(ind01,j) + fac10(k)*absb(ind02,j) &
4831 & + fac01(k)*absb(ind11,j) + fac11(k)*absb(ind12,j) &
4832 & + forfac(k) * (forref(indf,j) + forfrac(k) &
4833 & * (forref(indfp,j) - forref(indf,j))) ) &
4834 & + colamt(k,5) * absch4(j)
4835 enddo
4836 enddo
4837
4838 return
4839!...................................
4840 end subroutine taumol20
4841!-----------------------------------
4842
4846!-----------------------------------
4847 subroutine taumol21
4848!...................................
4849
4850! ------------------------------------------------------------------ !
4851! band 21: 6150-7700 cm-1 (low - h2o,co2; high - h2o,co2) !
4852! ------------------------------------------------------------------ !
4853!
4855
4856! --- locals:
4857 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
4858 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
4859
4860 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4861 integer :: inds, indf, indsp, indfp, j, js, k
4862
4863!
4864!===> ... begin here
4865!
4866
4867! --- ... compute the optical depth by interpolating in ln(pressure),
4868! temperature, and appropriate species. below laytrop, the water
4869! vapor self-continuum is interpolated (in temperature) separately.
4870
4871 do k = 1, nlay
4872 tauray = colmol(k) * rayl
4873
4874 do j = 1, ng21
4875 taur(k,ns21+j) = tauray
4876 enddo
4877 enddo
4878
4879 do k = 1, laytrop
4880 speccomb = colamt(k,1) + strrat(21)*colamt(k,2)
4881 specmult = 8.0 * min(oneminus, colamt(k,1) / speccomb)
4882
4883 js = 1 + int(specmult)
4884 fs = mod(specmult, f_one)
4885 fs1= f_one - fs
4886 fac000 = fs1 * fac00(k)
4887 fac010 = fs1 * fac10(k)
4888 fac100 = fs * fac00(k)
4889 fac110 = fs * fac10(k)
4890 fac001 = fs1 * fac01(k)
4891 fac011 = fs1 * fac11(k)
4892 fac101 = fs * fac01(k)
4893 fac111 = fs * fac11(k)
4894
4895 ind01 = id0(k,21) + js
4896 ind02 = ind01 + 1
4897 ind03 = ind01 + 9
4898 ind04 = ind01 + 10
4899 ind11 = id1(k,21) + js
4900 ind12 = ind11 + 1
4901 ind13 = ind11 + 9
4902 ind14 = ind11 + 10
4903
4904 inds = indself(k)
4905 indf = indfor(k)
4906 indsp= inds + 1
4907 indfp= indf + 1
4908
4909 do j = 1, ng21
4910 taug(k,ns21+j) = speccomb &
4911 & * ( fac000 * absa(ind01,j) + fac100 * absa(ind02,j) &
4912 & + fac010 * absa(ind03,j) + fac110 * absa(ind04,j) &
4913 & + fac001 * absa(ind11,j) + fac101 * absa(ind12,j) &
4914 & + fac011 * absa(ind13,j) + fac111 * absa(ind14,j) ) &
4915 & + colamt(k,1) * (selffac(k) * (selfref(inds,j) &
4916 & + selffrac(k) * (selfref(indsp,j) - selfref(inds,j))) &
4917 & + forfac(k) * (forref(indf,j) + forfrac(k) &
4918 & * (forref(indfp,j) - forref(indf,j))))
4919 enddo
4920 enddo
4921
4922 do k = laytrop+1, nlay
4923 speccomb = colamt(k,1) + strrat(21)*colamt(k,2)
4924 specmult = 4.0 * min(oneminus, colamt(k,1) / speccomb)
4925
4926 js = 1 + int(specmult)
4927 fs = mod(specmult, f_one)
4928 fs1= f_one - fs
4929 fac000 = fs1 * fac00(k)
4930 fac010 = fs1 * fac10(k)
4931 fac100 = fs * fac00(k)
4932 fac110 = fs * fac10(k)
4933 fac001 = fs1 * fac01(k)
4934 fac011 = fs1 * fac11(k)
4935 fac101 = fs * fac01(k)
4936 fac111 = fs * fac11(k)
4937
4938 ind01 = id0(k,21) + js
4939 ind02 = ind01 + 1
4940 ind03 = ind01 + 5
4941 ind04 = ind01 + 6
4942 ind11 = id1(k,21) + js
4943 ind12 = ind11 + 1
4944 ind13 = ind11 + 5
4945 ind14 = ind11 + 6
4946
4947 indf = indfor(k)
4948 indfp= indf + 1
4949
4950 do j = 1, ng21
4951 taug(k,ns21+j) = speccomb &
4952 & * ( fac000 * absb(ind01,j) + fac100 * absb(ind02,j) &
4953 & + fac010 * absb(ind03,j) + fac110 * absb(ind04,j) &
4954 & + fac001 * absb(ind11,j) + fac101 * absb(ind12,j) &
4955 & + fac011 * absb(ind13,j) + fac111 * absb(ind14,j) ) &
4956 & + colamt(k,1) * forfac(k) * (forref(indf,j) &
4957 & + forfrac(k) * (forref(indfp,j) - forref(indf,j)))
4958 enddo
4959 enddo
4960
4961!...................................
4962 end subroutine taumol21
4963!-----------------------------------
4964
4968!-----------------------------------
4969 subroutine taumol22
4970!...................................
4971
4972! ------------------------------------------------------------------ !
4973! band 22: 7700-8050 cm-1 (low - h2o,o2; high - o2) !
4974! ------------------------------------------------------------------ !
4975!
4977
4978! --- locals:
4979 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
4980 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111, &
4981 & o2adj, o2cont, o2tem
4982
4983 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4984 integer :: inds, indf, indsp, indfp, j, js, k
4985
4986!
4987!===> ... begin here
4988!
4989! --- ... the following factor is the ratio of total o2 band intensity (lines
4990! and mate continuum) to o2 band intensity (line only). it is needed
4991! to adjust the optical depths since the k's include only lines.
4992
4993 o2adj = 1.6
4994 o2tem = 4.35e-4 / (350.0*2.0)
4995
4996
4997! --- ... compute the optical depth by interpolating in ln(pressure),
4998! temperature, and appropriate species. below laytrop, the water
4999! vapor self-continuum is interpolated (in temperature) separately.
5000
5001 do k = 1, nlay
5002 tauray = colmol(k) * rayl
5003
5004 do j = 1, ng22
5005 taur(k,ns22+j) = tauray
5006 enddo
5007 enddo
5008
5009 do k = 1, laytrop
5010 o2cont = o2tem * colamt(k,6)
5011 speccomb = colamt(k,1) + strrat(22)*colamt(k,6)
5012 specmult = 8.0 * min(oneminus, colamt(k,1) / speccomb)
5013
5014 js = 1 + int(specmult)
5015 fs = mod(specmult, f_one)
5016 fs1= f_one - fs
5017 fac000 = fs1 * fac00(k)
5018 fac010 = fs1 * fac10(k)
5019 fac100 = fs * fac00(k)
5020 fac110 = fs * fac10(k)
5021 fac001 = fs1 * fac01(k)
5022 fac011 = fs1 * fac11(k)
5023 fac101 = fs * fac01(k)
5024 fac111 = fs * fac11(k)
5025
5026 ind01 = id0(k,22) + js
5027 ind02 = ind01 + 1
5028 ind03 = ind01 + 9
5029 ind04 = ind01 + 10
5030 ind11 = id1(k,22) + js
5031 ind12 = ind11 + 1
5032 ind13 = ind11 + 9
5033 ind14 = ind11 + 10
5034
5035 inds = indself(k)
5036 indf = indfor(k)
5037 indsp= inds + 1
5038 indfp= indf + 1
5039
5040 do j = 1, ng22
5041 taug(k,ns22+j) = speccomb &
5042 & * ( fac000 * absa(ind01,j) + fac100 * absa(ind02,j) &
5043 & + fac010 * absa(ind03,j) + fac110 * absa(ind04,j) &
5044 & + fac001 * absa(ind11,j) + fac101 * absa(ind12,j) &
5045 & + fac011 * absa(ind13,j) + fac111 * absa(ind14,j) ) &
5046 & + colamt(k,1) * (selffac(k) * (selfref(inds,j) &
5047 & + selffrac(k) * (selfref(indsp,j)-selfref(inds,j))) &
5048 & + forfac(k) * (forref(indf,j) + forfrac(k) &
5049 & * (forref(indfp,j) - forref(indf,j)))) + o2cont
5050 enddo
5051 enddo
5052
5053 do k = laytrop+1, nlay
5054 o2cont = o2tem * colamt(k,6)
5055
5056 ind01 = id0(k,22) + 1
5057 ind02 = ind01 + 1
5058 ind11 = id1(k,22) + 1
5059 ind12 = ind11 + 1
5060
5061 do j = 1, ng22
5062 taug(k,ns22+j) = colamt(k,6) * o2adj &
5063 & * ( fac00(k)*absb(ind01,j) + fac10(k)*absb(ind02,j) &
5064 & + fac01(k)*absb(ind11,j) + fac11(k)*absb(ind12,j) ) &
5065 & + o2cont
5066 enddo
5067 enddo
5068
5069 return
5070!...................................
5071 end subroutine taumol22
5072!-----------------------------------
5073
5077!-----------------------------------
5078 subroutine taumol23
5079!...................................
5080
5081! ------------------------------------------------------------------ !
5082! band 23: 8050-12850 cm-1 (low - h2o; high - nothing) !
5083! ------------------------------------------------------------------ !
5084!
5086
5087! --- locals:
5088 integer :: ind01, ind02, ind11, ind12
5089 integer :: inds, indf, indsp, indfp, j, k
5090
5091!
5092!===> ... begin here
5093!
5094
5095! --- ... compute the optical depth by interpolating in ln(pressure),
5096! temperature, and appropriate species. below laytrop, the water
5097! vapor self-continuum is interpolated (in temperature) separately.
5098
5099 do k = 1, nlay
5100 do j = 1, ng23
5101 taur(k,ns23+j) = colmol(k) * rayl(j)
5102 enddo
5103 enddo
5104
5105 do k = 1, laytrop
5106 ind01 = id0(k,23) + 1
5107 ind02 = ind01 + 1
5108 ind11 = id1(k,23) + 1
5109 ind12 = ind11 + 1
5110
5111 inds = indself(k)
5112 indf = indfor(k)
5113 indsp= inds + 1
5114 indfp= indf + 1
5115
5116 do j = 1, ng23
5117 taug(k,ns23+j) = colamt(k,1) * (givfac &
5118 & * ( fac00(k)*absa(ind01,j) + fac10(k)*absa(ind02,j) &
5119 & + fac01(k)*absa(ind11,j) + fac11(k)*absa(ind12,j) ) &
5120 & + selffac(k) * (selfref(inds,j) + selffrac(k) &
5121 & * (selfref(indsp,j) - selfref(inds,j))) &
5122 & + forfac(k) * (forref(indf,j) + forfrac(k) &
5123 & * (forref(indfp,j) - forref(indf,j))))
5124 enddo
5125 enddo
5126
5127 do k = laytrop+1, nlay
5128 do j = 1, ng23
5129 taug(k,ns23+j) = f_zero
5130 enddo
5131 enddo
5132
5133!...................................
5134 end subroutine taumol23
5135!-----------------------------------
5136
5140!-----------------------------------
5141 subroutine taumol24
5142!...................................
5143
5144! ------------------------------------------------------------------ !
5145! band 24: 12850-16000 cm-1 (low - h2o,o2; high - o2) !
5146! ------------------------------------------------------------------ !
5147!
5149
5150! --- locals:
5151 real (kind=kind_phys) :: speccomb, specmult, fs, fs1, &
5152 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
5153
5154 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
5155 integer :: inds, indf, indsp, indfp, j, js, k
5156
5157!
5158!===> ... begin here
5159!
5160
5161! --- ... compute the optical depth by interpolating in ln(pressure),
5162! temperature, and appropriate species. below laytrop, the water
5163! vapor self-continuum is interpolated (in temperature) separately.
5164
5165 do k = 1, laytrop
5166 speccomb = colamt(k,1) + strrat(24)*colamt(k,6)
5167 specmult = 8.0 * min(oneminus, colamt(k,1) / speccomb)
5168
5169 js = 1 + int(specmult)
5170 fs = mod(specmult, f_one)
5171 fs1= f_one - fs
5172 fac000 = fs1 * fac00(k)
5173 fac010 = fs1 * fac10(k)
5174 fac100 = fs * fac00(k)
5175 fac110 = fs * fac10(k)
5176 fac001 = fs1 * fac01(k)
5177 fac011 = fs1 * fac11(k)
5178 fac101 = fs * fac01(k)
5179 fac111 = fs * fac11(k)
5180
5181 ind01 = id0(k,24) + js
5182 ind02 = ind01 + 1
5183 ind03 = ind01 + 9
5184 ind04 = ind01 + 10
5185 ind11 = id1(k,24) + js
5186 ind12 = ind11 + 1
5187 ind13 = ind11 + 9
5188 ind14 = ind11 + 10
5189
5190 inds = indself(k)
5191 indf = indfor(k)
5192 indsp= inds + 1
5193 indfp= indf + 1
5194
5195 do j = 1, ng24
5196 taug(k,ns24+j) = speccomb &
5197 & * ( fac000 * absa(ind01,j) + fac100 * absa(ind02,j) &
5198 & + fac010 * absa(ind03,j) + fac110 * absa(ind04,j) &
5199 & + fac001 * absa(ind11,j) + fac101 * absa(ind12,j) &
5200 & + fac011 * absa(ind13,j) + fac111 * absa(ind14,j) ) &
5201 & + colamt(k,3) * abso3a(j) + colamt(k,1) &
5202 & * (selffac(k) * (selfref(inds,j) + selffrac(k) &
5203 & * (selfref(indsp,j) - selfref(inds,j))) &
5204 & + forfac(k) * (forref(indf,j) + forfrac(k) &
5205 & * (forref(indfp,j) - forref(indf,j))))
5206
5207 taur(k,ns24+j) = colmol(k) &
5208 & * (rayla(j,js) + fs*(rayla(j,js+1) - rayla(j,js)))
5209 enddo
5210 enddo
5211
5212 do k = laytrop+1, nlay
5213 ind01 = id0(k,24) + 1
5214 ind02 = ind01 + 1
5215 ind11 = id1(k,24) + 1
5216 ind12 = ind11 + 1
5217
5218 do j = 1, ng24
5219 taug(k,ns24+j) = colamt(k,6) &
5220 & * ( fac00(k)*absb(ind01,j) + fac10(k)*absb(ind02,j) &
5221 & + fac01(k)*absb(ind11,j) + fac11(k)*absb(ind12,j) ) &
5222 & + colamt(k,3) * abso3b(j)
5223
5224 taur(k,ns24+j) = colmol(k) * raylb(j)
5225 enddo
5226 enddo
5227
5228 return
5229!...................................
5230 end subroutine taumol24
5231!-----------------------------------
5232
5236!-----------------------------------
5237 subroutine taumol25
5238!...................................
5239
5240! ------------------------------------------------------------------ !
5241! band 25: 16000-22650 cm-1 (low - h2o; high - nothing) !
5242! ------------------------------------------------------------------ !
5243!
5245
5246! --- locals:
5247 integer :: ind01, ind02, ind11, ind12
5248 integer :: j, k
5249
5250!
5251!===> ... begin here
5252!
5253
5254! --- ... compute the optical depth by interpolating in ln(pressure),
5255! temperature, and appropriate species. below laytrop, the water
5256! vapor self-continuum is interpolated (in temperature) separately.
5257
5258 do k = 1, nlay
5259 do j = 1, ng25
5260 taur(k,ns25+j) = colmol(k) * rayl(j)
5261 enddo
5262 enddo
5263
5264 do k = 1, laytrop
5265 ind01 = id0(k,25) + 1
5266 ind02 = ind01 + 1
5267 ind11 = id1(k,25) + 1
5268 ind12 = ind11 + 1
5269
5270 do j = 1, ng25
5271 taug(k,ns25+j) = colamt(k,1) &
5272 & * ( fac00(k)*absa(ind01,j) + fac10(k)*absa(ind02,j) &
5273 & + fac01(k)*absa(ind11,j) + fac11(k)*absa(ind12,j) ) &
5274 & + colamt(k,3) * abso3a(j)
5275 enddo
5276 enddo
5277
5278 do k = laytrop+1, nlay
5279 do j = 1, ng25
5280 taug(k,ns25+j) = colamt(k,3) * abso3b(j)
5281 enddo
5282 enddo
5283
5284 return
5285!...................................
5286 end subroutine taumol25
5287!-----------------------------------
5288
5292!-----------------------------------
5293 subroutine taumol26
5294!...................................
5295
5296! ------------------------------------------------------------------ !
5297! band 26: 22650-29000 cm-1 (low - nothing; high - nothing) !
5298! ------------------------------------------------------------------ !
5299!
5301
5302! --- locals:
5303 integer :: j, k
5304
5305!
5306!===> ... begin here
5307!
5308
5309! --- ... compute the optical depth by interpolating in ln(pressure),
5310! temperature, and appropriate species. below laytrop, the water
5311! vapor self-continuum is interpolated (in temperature) separately.
5312
5313 do k = 1, nlay
5314 do j = 1, ng26
5315 taug(k,ns26+j) = f_zero
5316 taur(k,ns26+j) = colmol(k) * rayl(j)
5317 enddo
5318 enddo
5319
5320 return
5321!...................................
5322 end subroutine taumol26
5323!-----------------------------------
5324
5328!-----------------------------------
5329 subroutine taumol27
5330!...................................
5331
5332! ------------------------------------------------------------------ !
5333! band 27: 29000-38000 cm-1 (low - o3; high - o3) !
5334! ------------------------------------------------------------------ !
5335!
5337!
5338! --- locals:
5339 integer :: ind01, ind02, ind11, ind12
5340 integer :: j, k
5341
5342!
5343!===> ... begin here
5344!
5345
5346! --- ... compute the optical depth by interpolating in ln(pressure),
5347! temperature, and appropriate species. below laytrop, the water
5348! vapor self-continuum is interpolated (in temperature) separately.
5349
5350 do k = 1, nlay
5351 do j = 1, ng27
5352 taur(k,ns27+j) = colmol(k) * rayl(j)
5353 enddo
5354 enddo
5355
5356 do k = 1, laytrop
5357 ind01 = id0(k,27) + 1
5358 ind02 = ind01 + 1
5359 ind11 = id1(k,27) + 1
5360 ind12 = ind11 + 1
5361
5362 do j = 1, ng27
5363 taug(k,ns27+j) = colamt(k,3) &
5364 & * ( fac00(k)*absa(ind01,j) + fac10(k)*absa(ind02,j) &
5365 & + fac01(k)*absa(ind11,j) + fac11(k)*absa(ind12,j) )
5366 enddo
5367 enddo
5368
5369 do k = laytrop+1, nlay
5370 ind01 = id0(k,27) + 1
5371 ind02 = ind01 + 1
5372 ind11 = id1(k,27) + 1
5373 ind12 = ind11 + 1
5374
5375 do j = 1, ng27
5376 taug(k,ns27+j) = colamt(k,3) &
5377 & * ( fac00(k)*absb(ind01,j) + fac10(k)*absb(ind02,j) &
5378 & + fac01(k)*absb(ind11,j) + fac11(k)*absb(ind12,j) )
5379 enddo
5380 enddo
5381
5382 return
5383!...................................
5384 end subroutine taumol27
5385!-----------------------------------
5386
5390!-----------------------------------
5391 subroutine taumol28
5392!...................................
5393
5394! ------------------------------------------------------------------ !
5395! band 28: 38000-50000 cm-1 (low - o3,o2; high - o3,o2) !
5396! ------------------------------------------------------------------ !
5397!
5399
5400! --- locals:
5401 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
5402 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
5403
5404 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
5405 integer :: j, js, k
5406
5407!
5408!===> ... begin here
5409!
5410
5411! --- ... compute the optical depth by interpolating in ln(pressure),
5412! temperature, and appropriate species. below laytrop, the water
5413! vapor self-continuum is interpolated (in temperature) separately.
5414
5415 do k = 1, nlay
5416 tauray = colmol(k) * rayl
5417
5418 do j = 1, ng28
5419 taur(k,ns28+j) = tauray
5420 enddo
5421 enddo
5422
5423 do k = 1, laytrop
5424 speccomb = colamt(k,3) + strrat(28)*colamt(k,6)
5425 specmult = 8.0 * min(oneminus, colamt(k,3) / speccomb)
5426
5427 js = 1 + int(specmult)
5428 fs = mod(specmult, f_one)
5429 fs1= f_one - fs
5430 fac000 = fs1 * fac00(k)
5431 fac010 = fs1 * fac10(k)
5432 fac100 = fs * fac00(k)
5433 fac110 = fs * fac10(k)
5434 fac001 = fs1 * fac01(k)
5435 fac011 = fs1 * fac11(k)
5436 fac101 = fs * fac01(k)
5437 fac111 = fs * fac11(k)
5438
5439 ind01 = id0(k,28) + js
5440 ind02 = ind01 + 1
5441 ind03 = ind01 + 9
5442 ind04 = ind01 + 10
5443 ind11 = id1(k,28) + js
5444 ind12 = ind11 + 1
5445 ind13 = ind11 + 9
5446 ind14 = ind11 + 10
5447
5448 do j = 1, ng28
5449 taug(k,ns28+j) = speccomb &
5450 & * ( fac000 * absa(ind01,j) + fac100 * absa(ind02,j) &
5451 & + fac010 * absa(ind03,j) + fac110 * absa(ind04,j) &
5452 & + fac001 * absa(ind11,j) + fac101 * absa(ind12,j) &
5453 & + fac011 * absa(ind13,j) + fac111 * absa(ind14,j) )
5454 enddo
5455 enddo
5456
5457 do k = laytrop+1, nlay
5458 speccomb = colamt(k,3) + strrat(28)*colamt(k,6)
5459 specmult = 4.0 * min(oneminus, colamt(k,3) / speccomb)
5460
5461 js = 1 + int(specmult)
5462 fs = mod(specmult, f_one)
5463 fs1= f_one - fs
5464 fac000 = fs1 * fac00(k)
5465 fac010 = fs1 * fac10(k)
5466 fac100 = fs * fac00(k)
5467 fac110 = fs * fac10(k)
5468 fac001 = fs1 * fac01(k)
5469 fac011 = fs1 * fac11(k)
5470 fac101 = fs * fac01(k)
5471 fac111 = fs * fac11(k)
5472
5473 ind01 = id0(k,28) + js
5474 ind02 = ind01 + 1
5475 ind03 = ind01 + 5
5476 ind04 = ind01 + 6
5477 ind11 = id1(k,28) + js
5478 ind12 = ind11 + 1
5479 ind13 = ind11 + 5
5480 ind14 = ind11 + 6
5481
5482 do j = 1, ng28
5483 taug(k,ns28+j) = speccomb &
5484 & * ( fac000 * absb(ind01,j) + fac100 * absb(ind02,j) &
5485 & + fac010 * absb(ind03,j) + fac110 * absb(ind04,j) &
5486 & + fac001 * absb(ind11,j) + fac101 * absb(ind12,j) &
5487 & + fac011 * absb(ind13,j) + fac111 * absb(ind14,j) )
5488 enddo
5489 enddo
5490
5491 return
5492!...................................
5493 end subroutine taumol28
5494!-----------------------------------
5495
5499!-----------------------------------
5500 subroutine taumol29
5501!...................................
5502
5503! ------------------------------------------------------------------ !
5504! band 29: 820-2600 cm-1 (low - h2o; high - co2) !
5505! ------------------------------------------------------------------ !
5506!
5508
5509! --- locals:
5510 real (kind=kind_phys) :: tauray
5511
5512 integer :: ind01, ind02, ind11, ind12
5513 integer :: inds, indf, indsp, indfp, j, k
5514
5515!
5516!===> ... begin here
5517!
5518
5519! --- ... compute the optical depth by interpolating in ln(pressure),
5520! temperature, and appropriate species. below laytrop, the water
5521! vapor self-continuum is interpolated (in temperature) separately.
5522
5523 do k = 1, nlay
5524 tauray = colmol(k) * rayl
5525
5526 do j = 1, ng29
5527 taur(k,ns29+j) = tauray
5528 enddo
5529 enddo
5530
5531 do k = 1, laytrop
5532 ind01 = id0(k,29) + 1
5533 ind02 = ind01 + 1
5534 ind11 = id1(k,29) + 1
5535 ind12 = ind11 + 1
5536
5537 inds = indself(k)
5538 indf = indfor(k)
5539 indsp= inds + 1
5540 indfp= indf + 1
5541
5542 do j = 1, ng29
5543 taug(k,ns29+j) = colamt(k,1) &
5544 & * ( (fac00(k)*absa(ind01,j) + fac10(k)*absa(ind02,j) &
5545 & + fac01(k)*absa(ind11,j) + fac11(k)*absa(ind12,j) ) &
5546 & + selffac(k) * (selfref(inds,j) + selffrac(k) &
5547 & * (selfref(indsp,j) - selfref(inds,j))) &
5548 & + forfac(k) * (forref(indf,j) + forfrac(k) &
5549 & * (forref(indfp,j) - forref(indf,j)))) &
5550 & + colamt(k,2) * absco2(j)
5551 enddo
5552 enddo
5553
5554 do k = laytrop+1, nlay
5555 ind01 = id0(k,29) + 1
5556 ind02 = ind01 + 1
5557 ind11 = id1(k,29) + 1
5558 ind12 = ind11 + 1
5559
5560 do j = 1, ng29
5561 taug(k,ns29+j) = colamt(k,2) &
5562 & * ( fac00(k)*absb(ind01,j) + fac10(k)*absb(ind02,j) &
5563 & + fac01(k)*absb(ind11,j) + fac11(k)*absb(ind12,j) ) &
5564 & + colamt(k,1) * absh2o(j)
5565 enddo
5566 enddo
5567
5568 return
5569!...................................
5570 end subroutine taumol29
5571!-----------------------------------
5572
5573!...................................
5574 end subroutine taumol
5575!-----------------------------------
5576
5578!........................................!
5579 end module rrtmg_sw !
5580!========================================!
subroutine taumol18
The subroutine computes the optical depth in band 18: 4000-4650 cm-1 (low - h2o,ch4; high - ch4)
subroutine taumol29
The subroutine computes the optical depth in band 29: 820-2600 cm-1 (low - h2o; high - co2)
subroutine vrtqdr(zrefb, zrefd, ztrab, ztrad, zldbt, ztdbt, nlay, nlp1, zfu, zfd)
This subroutine is called by spcvrtc() and spcvrtm(), and computes the upward and downward radiation ...
subroutine taumol26
The subroutine computes the optical depth in band 26: 22650-29000 cm-1 (low - nothing; high - nothing...
subroutine taumol28
The subroutine computes the optical depth in band 28: 38000-50000 cm-1 (low - o3,o2; high - o3,...
subroutine taumol25
The subroutine computes the optical depth in band 25: 16000-22650 cm-1 (low - h2o; high - nothing)
subroutine mcica_subcol(cldf, nlay, ipseed, dz, de_lgth, alpha, iovr, lcloudy)
This subroutine computes the sub-colum cloud profile flag array.
subroutine cldprop(cfrac, cliqp, reliq, cicep, reice, cdat1, cdat2, cdat3, cdat4, cf1, nlay, ipseed, dz, delgth, alpha, iswcliq, iswcice, isubcsw, iovr, taucw, ssacw, asycw, cldfrc, cldfmc)
This subroutine computes the cloud optical properties for each cloudy layer and g-point interval.
subroutine taumol22
The subroutine computes the optical depth in band 22: 7700-8050 cm-1 (low - h2o,o2; high - o2)
subroutine taumol21
The subroutine computes the optical depth in band 21: 6150-7700 cm-1 (low - h2o,co2; high - h2o,...
subroutine taumol20
The subroutine computes the optical depth in band 20: 5150-6150 cm-1 (low - h2o; high - h2o)
subroutine setcoef(pavel, tavel, h2ovmr, nlay, nlp1, laytrop, jp, jt, jt1, fac00, fac01, fac10, fac11, selffac, selffrac, indself, forfac, forfrac, indfor)
This subroutine computes various coefficients needed in radiative transfer calculation.
subroutine taumol19
The subroutine computes the optical depth in band 19: 4650-5150 cm-1 (low - h2o,co2; high - co2)
subroutine taumol27
The subroutine computes the optical depth in band 27: 29000-38000 cm-1 (low - o3; high - o3)
subroutine taumol16
The subroutine computes the optical depth in band 16: 2600-3250 cm-1 (low - h2o,ch4; high - ch4)
subroutine, public rrtmg_sw_run(plyr, plvl, tlyr, tlvl, qlyr, olyr, gasvmr_co2, gasvmr_n2o, gasvmr_ch4, gasvmr_o2, gasvmr_co, gasvmr_cfc11, gasvmr_cfc12, gasvmr_cfc22, gasvmr_ccl4, icseed, aeraod, aerssa, aerasy, sfcalb_nir_dir, sfcalb_nir_dif, sfcalb_uvis_dir, sfcalb_uvis_dif, dzlyr, delpin, de_lgth, alpha, cosz, solcon, nday, idxday, npts, nlay, nlp1, lprnt, inc_minor_gas, iswcliq, iswcice, isubcsw, iovr, top_at_1, iswmode, cld_cf, lsswr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp, iovr_exprand, hswc, topflx, sfcflx, cldtau, hsw0, hswb, flxprf, fdncmp, cld_lwp, cld_ref_liq, cld_iwp, cld_ref_ice, cld_rwp, cld_ref_rain, cld_swp, cld_ref_snow, cld_od, cld_ssa, cld_asy, errmsg, errflg)
subroutine spcvrtm(ssolar, cosz, sntz, albbm, albdf, sfluxzen, cldfmc, cf1, cf0, taug, taur, tauae, ssaae, asyae, taucw, ssacw, asycw, nlay, nlp1, iswmode, fxupc, fxdnc, fxup0, fxdn0, ftoauc, ftoau0, ftoadc, fsfcuc, fsfcu0, fsfcdc, fsfcd0, sfbmc, sfdfc, sfbm0, sfdf0, suvbfc, suvbf0)
This subroutine computes the shortwave radiative fluxes using two-stream method of h....
subroutine spcvrtc(ssolar, cosz, sntz, albbm, albdf, sfluxzen, cldfrc, cf1, cf0, taug, taur, tauae, ssaae, asyae, taucw, ssacw, asycw, nlay, nlp1, iswmode, fxupc, fxdnc, fxup0, fxdn0, ftoauc, ftoau0, ftoadc, fsfcuc, fsfcu0, fsfcdc, fsfcd0, sfbmc, sfdfc, sfbm0, sfdf0, suvbfc, suvbf0)
This subroutine computes the shortwave radiative fluxes using two-stream method.
subroutine taumol(colamt, colmol, fac00, fac01, fac10, fac11, jp, jt, jt1, laytrop, forfac, forfrac, indfor, selffac, selffrac, indself, nlay, sfluxzen, taug, taur)
This subroutine calculates optical depths for gaseous absorption and rayleigh scattering subroutine...
subroutine, public rswinit(me, rad_hr_units, inc_minor_gas, iswcliq, isubcsw, iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp, iovr_exprand, iswmode, errflg, errmsg)
This subroutine initializes non-varying module variables, conversion factors, and look-up tables.
subroutine taumol23
The subroutine computes the optical depth in band 23: 8050-12850 cm-1 (low - h2o; high - nothing)
subroutine taumol24
The subroutine computes the optical depth in band 24: 12850-16000 cm-1 (low - h2o,...
subroutine taumol17
The subroutine computes the optical depth in band 17: 3250-4000 cm-1 (low - h2o,co2; high - h2o,...
This module calculates random numbers using the Mersenne twister.
This module contains cloud radiative property coefficients.
This module sets up absorption coefficients for band 16: 2600-3250 cm-1 (low - h2o,...
This module sets up absorption coeffients for band 17: 3250-4000 cm-1 (low - h2o,co2; high - h2o,...
This module sets up absorption coeffients for band 18: 4000-4650 cm-1 (low - h2o,ch4; high - ch4)
This module sets up absorption coeffients for band 19: 4650-5150 cm-1 (low - h2o,co2; high - co2)
This module sets up absorption coeffients for band 20: 5150-6150 cm-1 (low - h2o; high - h2o)
This module sets up absorption coeffients for band 21: 6150-7700 cm-1 (low - h2o,co2; high - h2o,...
This module sets up absorption coeffients for band 22: 7700-8050 cm-1 (low - h2o, o2; high - o2)
This module sets up absorption coeffients for band 23: 8050-12850 cm-1 (low - h2o; high - nothing)
This module sets up absorption coeffients for band 24: 12850-16000 cm-1 (low - h2o,...
This module sets up absorption coeffients for band 25: 16000-22650 cm-1 (low - h2o; high - nothing)
This module sets up absorption coeffients for band 26: 22650-29000 cm-1 (low - nothing; high - nothin...
This module sets up absorption coeffients for band 27: 29000-38000 cm-1 (low - o3; high - o3)
This module sets up absorption coeffients for band 28: 38000-50000 cm-1 (low - o3,...
This module sets up absorption coeffients for band 29: 820-2600 cm-1 (low - h2o; high - co2)
This module is for specifying the band structures and program parameters used by the RRTMG-SW scheme.
Definition radsw_param.f:62
This module contains the reference pressures (in logarithm form) at 59 vertical levels (TOA is omitte...
This module contains various indexes and coefficients for SW spectral bands, as well as the spectral ...
This module contains the CCPP-compliant NCEP's modifications of the rrtmg-sw radiation code from aer ...
derived type for special components of surface SW fluxes
derived type for SW fluxes' column profiles (at layer interfaces)
derived type for SW fluxes at surface
Definition radsw_param.f:89
derived type for SW fluxes at TOA
Definition radsw_param.f:79