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