1 subroutine da_setup_be_regional(xb, be, grid)
3 !---------------------------------------------------------------------------
4 ! Purpose: Define and allocate components of background errors
8 ! Implementation of multi-variate BE
9 ! Syed RH Rizvi, MMM/NESL/NCAR, Date: 02/01/2010
10 !---------------------------------------------------------------------------
13 USE module_state_description, ONLY : p_bc1, p_bc2, p_oc1, p_oc2 & !inline gocart
14 ,p_dust_1, p_dust_2, p_dust_3 ,p_dust_4 &
15 ,p_seas_1, p_seas_2, p_seas_3 ,p_seas_4 &
16 ,p_co, p_o3, p_no2, p_so2 &
19 USE module_state_description, ONLY : p_bc_a01, p_bc_a02, p_bc_a03, p_bc_a04 & !inline mosaic
20 ,p_oc_a01, p_oc_a02, p_oc_a03, p_oc_a04 &
21 ,p_so4_a01, p_so4_a02, p_so4_a03, p_so4_a04 &
22 ,p_no3_a01, p_no3_a02, p_no3_a03, p_no3_a04 &
23 ,p_nh4_a01, p_nh4_a02, p_nh4_a03, p_nh4_a04 &
24 ,p_cl_a01, p_cl_a02, p_cl_a03, p_cl_a04 &
25 ,p_na_a01, p_na_a02, p_na_a03, p_na_a04 &
26 ,p_oin_a01, p_oin_a02, p_oin_a03, p_oin_a04
28 USE module_state_description, ONLY : p_so4aj, p_so4ai, p_nh4aj, p_nh4ai, & ! racm_soa_vbs_da
29 p_no3aj, p_no3ai, p_naaj, p_naai, &
30 p_asoa1j, p_asoa1i, p_asoa2j, p_asoa2i, &
31 p_asoa3j, p_asoa3i, p_asoa4j, p_asoa4i, &
32 p_bsoa1j, p_bsoa1i, p_bsoa2j, p_bsoa2i, &
33 p_bsoa3j, p_bsoa3i, p_bsoa4j, p_bsoa4i, &
34 p_orgpaj, p_orgpai, p_ecj, p_eci, &
35 p_p25j, p_p25i, p_antha, p_seas, &
36 p_claj, p_clai, p_soila
37 ! p_so2, p_no2, p_o3, p_co ! gas species
43 type (xb_type), intent(in) :: xb ! First guess structure.
44 type (be_type), intent(inout) :: be ! Back. errors structure.
45 type (domain), intent(in) :: grid
47 logical do_normalize1 ! Test do_normalize.
48 integer :: i, j, k, m ! Loop counters.
49 integer, allocatable:: bin(:,:,:) ! Bin assigned to each 3D point
50 integer, allocatable:: bin2d(:,:) ! Bin assigned to each 2D point
51 integer :: bin_type ! Type of bin to average over.
52 integer :: num_bins ! Number of bins (3D fields).
53 integer :: num_bins2d ! Number of bins (3D fields).
54 real*8 :: junk ! For reading truncated sd, wsd
55 real*8 :: lat_min, lat_max, binwidth_lat ! Used if bin_type = 2 (degrees)..
56 real*8 :: hgt_min, hgt_max, binwidth_hgt ! Used if bin_type = 2 (m). .
58 integer :: num_cv_3d_basic ! number of 3D mandatory control variables
59 integer :: num_cv_3d_extra ! number of 3D optional control variables
60 integer :: num_cv_2d ! number of 2D control variables
62 real*8, allocatable :: be1_eval_loc(:,:) ! Temp arrays.
63 real*8, allocatable :: be2_eval_loc(:,:) ! Temp arrays.
64 real*8, allocatable :: be3_eval_loc(:,:) ! Temp arrays.
65 real*8, allocatable :: be4_eval_loc(:,:) ! Temp arrays.
66 real*8, allocatable :: be5_eval_loc(:,:) ! Temp arrays.
68 real*8, allocatable :: be6_eval_loc(:,:) ! Temp arrays.
69 real*8, allocatable :: be7_eval_loc(:,:) ! Temp arrays.
70 real*8, allocatable :: be8_eval_loc(:,:) ! Temp arrays.
71 real*8, allocatable :: be9_eval_loc(:,:) ! Temp arrays.
72 real*8, allocatable :: be10_eval_loc(:,:) ! Temp arrays.
73 real*8, allocatable :: be11_eval_loc(:,:) ! Temp arrays.
75 real*8, allocatable :: be1_eval_glo(:) ! Global Eigenvalues.
76 real*8, allocatable :: be2_eval_glo(:) ! Global Eigenvalues.
77 real*8, allocatable :: be3_eval_glo(:) ! Global Eigenvalues.
78 real*8, allocatable :: be4_eval_glo(:) ! Global Eigenvalues.
79 real*8, allocatable :: be5_eval_glo(:) ! Global Eigenvalues.
81 real*8, allocatable :: be6_eval_glo(:) ! Global Eigenvalues.
82 real*8, allocatable :: be7_eval_glo(:) ! Global Eigenvalues.
83 real*8, allocatable :: be8_eval_glo(:) ! Global Eigenvalues.
84 real*8, allocatable :: be9_eval_glo(:) ! Global Eigenvalues.
85 real*8, allocatable :: be10_eval_glo(:) ! Global Eigenvalues.
86 real*8, allocatable :: be11_eval_glo(:) ! Global Eigenvalues.
88 real*8, allocatable :: alpha_val(:) ! Global Eigenvalues.
90 real*8, allocatable :: be1_evec_loc(:,:,:) ! Local Eigenvectors.
91 real*8, allocatable :: be2_evec_loc(:,:,:) ! Local Eigenvectors.
92 real*8, allocatable :: be3_evec_loc(:,:,:) ! Local Eigenvectors.
93 real*8, allocatable :: be4_evec_loc(:,:,:) ! Local Eigenvectors.
94 real*8, allocatable :: be5_evec_loc(:,:,:) ! Local Eigenvectors.
96 real*8, allocatable :: be6_evec_loc(:,:,:) ! Local Eigenvectors.
97 real*8, allocatable :: be7_evec_loc(:,:,:) ! Local Eigenvectors.
98 real*8, allocatable :: be8_evec_loc(:,:,:) ! Local Eigenvectors.
99 real*8, allocatable :: be9_evec_loc(:,:,:) ! Local Eigenvectors.
100 real*8, allocatable :: be10_evec_loc(:,:,:) ! Local Eigenvectors.
101 real*8, allocatable :: be11_evec_loc(:,:,:) ! Local Eigenvectors.
103 real*8, allocatable :: be1_evec_glo(:,:) ! Global Eigenvectors.
104 real*8, allocatable :: be2_evec_glo(:,:) ! Global Eigenvectors.
105 real*8, allocatable :: be3_evec_glo(:,:) ! Global Eigenvectors.
106 real*8, allocatable :: be4_evec_glo(:,:) ! Global Eigenvectors.
107 real*8, allocatable :: be5_evec_glo(:,:) ! Global Eigenvectors.
109 real*8, allocatable :: be6_evec_glo(:,:) ! Global Eigenvectors.
110 real*8, allocatable :: be7_evec_glo(:,:) ! Global Eigenvectors.
111 real*8, allocatable :: be8_evec_glo(:,:) ! Global Eigenvectors.
112 real*8, allocatable :: be9_evec_glo(:,:) ! Global Eigenvectors.
113 real*8, allocatable :: be10_evec_glo(:,:) ! Global Eigenvectors.
114 real*8, allocatable :: be11_evec_glo(:,:) ! Global Eigenvectors.
117 real*8, allocatable :: alpha_evec(:,:) ! Global Eigenvectors.
119 real*8, allocatable :: be1_rf_lengthscale(:) ! RF lengthscale.
120 real*8, allocatable :: be2_rf_lengthscale(:) ! RF lengthscale.
121 real*8, allocatable :: be3_rf_lengthscale(:) ! RF lengthscale.
122 real*8, allocatable :: be4_rf_lengthscale(:) ! RF lengthscale.
123 real*8, allocatable :: be5_rf_lengthscale(:)
125 real*8, allocatable :: be6_rf_lengthscale(:)
126 real*8, allocatable :: be7_rf_lengthscale(:)
127 real*8, allocatable :: be8_rf_lengthscale(:)
128 real*8, allocatable :: be9_rf_lengthscale(:)
129 real*8, allocatable :: be10_rf_lengthscale(:)
130 real*8, allocatable :: be11_rf_lengthscale(:)
132 real*8, allocatable :: alpha_rf_lengthscale(:)
133 real*8, allocatable :: alpha_rf_scale_factor(:)
135 real*8, allocatable :: evec_loc(:,:,:) ! Latitudinally varying eigenvectors.
136 real*8, allocatable :: eval_loc(:,:) ! Latitudinally varying eigenvalues.
139 integer :: ispcc ! chem species index.
140 integer :: num_cv_3d_chem ! number of 3D chem control variables
141 real*8, allocatable :: be12_eval_loc(:,:,:) ! Temp arrays for chem.
142 real*8, allocatable :: be12_eval_glo(:,:) ! Global Eigenvalues for chem.
143 real*8, allocatable :: be12_evec_loc(:,:,:,:) ! Local Eigenvectors for chem.
144 real*8, allocatable :: be12_evec_glo(:,:,:) ! Global Eigenvectors for chem.
145 real*8, allocatable :: be12_rf_lengthscale(:,:) ! for chem
148 character*5 :: namv(5)=(/"psi ","chi_u","t_u ","rh ","ps_u "/)
149 character*10 :: variable
150 character*80 :: var80c
151 character(len=15) :: write_fmt
152 integer :: ni, nj, nk, nk_2d, b
153 integer :: ix, jy, kz, kzs(5), mz, mzs(5)
154 real, allocatable :: regcoeff_psi_chi(:) ! psi/chi regression cooefficient.
155 real, allocatable :: regcoeff_psi_t(:,:,:) ! psi/t regression cooefficient.
156 real, allocatable :: regcoeff_psi_ps(:,:) ! psi/ps regression cooefficient.
157 real, allocatable :: regcoeff_psi_rh(:,:,:) ! psi/rh regression cooefficient.
158 real, allocatable :: regcoeff_chi_u_t(:,:,:) ! chi_u/t regression coefficient
159 real, allocatable :: regcoeff_chi_u_ps(:,:) ! chi_u/ps regression coefficient
160 real, allocatable :: regcoeff_chi_u_rh(:,:,:) ! chi_u/rh regression coefficient
161 real, allocatable :: regcoeff_t_u_rh(:,:,:) ! t_u/rh regression coefficient
162 real, allocatable :: regcoeff_ps_u_rh(:,:) ! ps_u/rh regression coefficient
163 !real :: qrain_th_low, qrain_th_high
165 integer :: be_unit, ier, be_rf_unit, be_print_unit, it, idummy
167 !-----------for interpolating CV5--------------------------------------------------------------
168 REAL, ALLOCATABLE :: reg_psi_ps0(:,:), reg_psi_chi0(:,:), reg_psi_t0(:,:,:), &
169 reg_psi_ps (:), reg_psi_chi (:), reg_psi_t (:,:), &
170 reg_psi_ps_be(:), reg_psi_chi_be(:), reg_psi_t_be(:,:)
171 REAL, DIMENSION(:,:), ALLOCATABLE:: covm1_be, covm2_be, covm3_be, covm4_be,&
172 covm1 , covm2 , covm3 , covm4
173 REAL, DIMENSION(:), ALLOCATABLE:: rfls1_be, rfls2_be, rfls3_be, rfls4_be
174 REAL, DIMENSION(:), ALLOCATABLE:: eta_be
175 ! For write out the Interpolated CV5 BE (bin_type=5) file:
176 integer :: bin_type_out, num_bins_out, num_bins2d_out
177 integer, allocatable :: bin_out(:,:,:), bin2d_out(:,:)
178 integer, parameter :: be_out_unit = 135
180 !===========for interpolating CV5==============================================================
182 if (trace_use) call da_trace_entry("da_setup_be_regional")
188 if ( jb_factor > 0.0 ) then
189 if( (cv_options == 5) .or. (cv_options == 6) .or. (cv_options == 7) ) then
190 write (unit=message(1),fmt='(A,I3)') &
191 'Set up background errors for regional application for cv_options = ',cv_options
192 write (unit=message(2),fmt='(a)') ' '
193 call da_message(message(1:2))
194 if ( (cv_options == 7 .or. cv_options == 6) .and. interpolate_stats ) then
195 write (unit=message(1),fmt='(A,I3)') 'interpolate_stats is not implemented for cv_options=',cv_options
196 call da_error(__FILE__,__LINE__,message(1:1))
198 if ( ( cloud_cv_options >=2 ) .and. interpolate_stats ) then
199 write (unit=message(1),fmt='(A,I3)') 'interpolate_stats is not implemented for cloud_cv_options=',cloud_cv_options
200 call da_error(__FILE__,__LINE__,message(1:1))
203 if ( ( chem_cv_options >=10 ) .and. interpolate_stats ) then
204 write (unit=message(1),fmt='(A,I3)') 'interpolate_stats is not implemented for chem_cv_options=',chem_cv_options
205 call da_error(__FILE__,__LINE__,message(1:1))
209 write (unit=message(1),fmt='(a)') 'cv_options should be 5, 6, or 7'
210 call da_error(__FILE__,__LINE__,message(1:1))
213 !be_rf_unit = unit_end + 1
214 !be_print_unit = unit_end + 2
216 call da_get_unit(be_unit)
217 call da_get_unit(be_rf_unit)
218 call da_get_unit(be_print_unit)
219 open(unit=be_unit,file="be.dat", status="old",form="unformatted")
220 open(unit=be_rf_unit ,file="be_rf.dat" , status="unknown",form="unformatted")
221 open(unit=be_print_unit,file="be_print.dat", status="unknown")
224 read (be_unit, iostat=ier) ni, nj, nk
225 print *, 'ni, nj, nk = ', ni, nj, nk
227 write (unit=message(1),fmt='(a,i3)') 'Error in reading be.dat, unit= ',be_unit
228 call da_error(__FILE__,__LINE__,message(1:1))
230 read (be_unit) bin_type
231 print *, 'bin_type = ', bin_type
233 !-----------for interpolating CV5--------------------------------------------------------------
234 if ( .not. interpolate_stats ) then
235 if (ni /= ix .or. nj /= jy .or. nk /= kz) then
236 write(unit=message(1),fmt='(a)') &
237 'Dimensions of the assimilation domain do not match those in the BE file.'
238 write(unit=message(2),fmt='(3x,a,3i4)') "in be.dat: ni, nj, nk = ",ni, nj, nk
239 write(unit=message(3),fmt='(3x,a,3i4)') "in fg: ix, jy, kz = ",ix, jy, kz
240 write(message(4),'(a)') 'be.dat need to be generated using data consistent with the assimilation domain.'
241 call da_error(__FILE__,__LINE__,message(1:4))
243 else ! when interpolate_stats = true
244 ! Must use the domain averaged Reg. Coeff.:
245 lat_stats_option = .FALSE.
246 ! Must use the global Eigenvector/eigenvalue
248 write (unit=message(1),fmt='(A,I3,A)') 'interpolate_stats is .true., BE for cv_options = ',cv_options,' will be interpolated.'
249 call da_message(message(1:1))
250 if (rootproc) write(be_out_unit) ix, jy, kz
251 write(6,'(a/("k=",i3,2x,f10.4))') 'xb%sigmah=',(k,xb%sigmah(k),k=1,kz)
252 allocate (eta_be(1:nk))
253 read(be_unit,iostat=ier) eta_be
254 ! If not available from BE file, get it from namelist
256 write(message(1),'("ier=",i5,2x,a)') ier, " NO Eta values existed in BE file."
257 write(message(2),'(a)') "Will use BE Eta values from the namelist be_eta."
258 call da_message(message(1:2))
260 read(be_unit) idummy, idummy, idummy
262 eta_be = be_eta(1:nk)
264 write(6,'(a/("k=",i3,2x,f10.4))') 'eta_be=',(k,eta_be(k),k=1,nk)
265 ! If eta values not defined correctly, stop
266 if (eta_be(1) == eta_be(nk)) then
267 write(message(1),'(a)') 'Wrong eta values found.'
268 write(message(2),'(a)') 'The eta levels used in generating be.dat should be specified in namelist &wrfvar10 be_eta.'
269 call da_error(__FILE__,__LINE__,message(1:2))
273 !===========for interpolating CV5==============================================================
275 allocate (bin(1:ni,1:nj,1:nk))
276 allocate (bin2d(1:ni,1:nj))
278 !if(cloud_cv_options.eq.2)then
279 ! read (be_unit)num_bins, num_bins2d
280 ! read (be_unit)lat_min, lat_max, binwidth_lat
281 ! read (be_unit)hgt_min, hgt_max, binwidth_hgt
282 ! read (be_unit)qrain_th_low, qrain_th_high
283 ! read (be_unit)bin(1:ni,1:nj,1:nk)
284 ! read (be_unit)bin2d(1:ni,1:nj)
286 read (be_unit)lat_min, lat_max, binwidth_lat
287 read (be_unit)hgt_min, hgt_max, binwidth_hgt
288 read (be_unit)num_bins, num_bins2d
289 read (be_unit)bin(1:ni,1:nj,1:nk)
290 read (be_unit)bin2d(1:ni,1:nj)
293 print *, lat_min, lat_max, binwidth_lat
294 print *, hgt_min, hgt_max, binwidth_hgt
295 print *, 'num_bins, num_bins2d = ', num_bins, num_bins2d
296 print *, 'bin = ', bin(1:1,1:1,1:1)
297 print *, 'bin2d = ', bin2d(1:1,1:1)
299 num_cv_3d_basic = 4 ! (Psi, Chi_u, T_u, Pseudo RH) or (U,V,T,Pseudo RH)
300 num_cv_3d_extra = 0 ! default: no cloud and w
302 if ( cloud_cv_options >= 2 ) then
303 num_cv_3d_extra = 5 ! 5 hydrometeors, qc,qr,qi,qs,qg
306 select case ( chem_cv_options )
311 case ( 108 ) ! racm_soa_vbs_da
313 case default ! mozcart_da
316 if ( chem_cv_options >= 1 ) then
317 allocate (be % v12 (num_cv_3d_chem) )
318 num_cv_3d_extra = num_cv_3d_extra + num_cv_3d_chem
319 endif ! ( chem_cv_options >= 1 )
322 num_cv_3d_extra = num_cv_3d_extra + 1 ! clouds+w
325 !-----------for interpolating CV5--------------------------------------------------------------
326 ! Write out the interpolated CV5 BE:
327 if (interpolate_stats) then
329 ! No matter which bin_type BE inputed, after Interpolated, the BE always
330 ! became bin_type = 1 BE, i.e. the global BE.
335 write(be_out_unit)bin_type_out
336 write(be_out_unit)lat_min, lat_max, binwidth_lat
337 write(be_out_unit)hgt_min, hgt_max, binwidth_hgt
338 write(be_out_unit)num_bins_out, num_bins2d_out
340 allocate (bin_out(1:ix,1:jy,1:kz))
341 allocate (bin2d_out(1:ix,1:jy))
347 write(be_out_unit)bin_out
348 write(be_out_unit)bin2d_out
351 deallocate (bin2d_out)
353 !===========for interpolating CV5==============================================================
355 if ( cv_options /= 7 ) then ! No regression coefficients for cv_options == 7
357 ! 1.1 Read in regression coefficients
358 allocate (regcoeff_psi_chi(1:num_bins))
359 allocate (regcoeff_psi_t(1:nk,1:nk,1:num_bins2d))
360 allocate (regcoeff_psi_ps(1:nk,1:num_bins2d))
361 if ( cv_options == 6 ) then
362 allocate (regcoeff_psi_rh(1:nk,1:nk,1:num_bins2d))
363 allocate (regcoeff_chi_u_t(1:nk,1:nk,1:num_bins2d))
364 allocate (regcoeff_chi_u_ps(1:nk,1:num_bins2d))
365 allocate (regcoeff_chi_u_rh(1:nk,1:nk,1:num_bins2d))
366 allocate (regcoeff_t_u_rh(1:nk,1:nk,1:num_bins2d))
367 allocate (regcoeff_ps_u_rh(1:nk,1:num_bins2d))
370 if ( cv_options == 5 ) then
371 read (be_unit) regcoeff_psi_chi
372 read (be_unit) regcoeff_psi_ps
373 read (be_unit) regcoeff_psi_t
376 read (be_unit) var80c
377 select case( trim(adjustl(var80c)) )
378 case ('regcoeff_psi_chi')
379 read (be_unit) regcoeff_psi_chi
380 case ('regcoeff_psi_t')
381 read (be_unit) regcoeff_psi_t
382 case ('regcoeff_psi_ps')
383 read (be_unit) regcoeff_psi_ps
384 case ('regcoeff_psi_rh')
385 read (be_unit) regcoeff_psi_rh
386 case ('regcoeff_chi_u_t')
387 read (be_unit) regcoeff_chi_u_t
388 case ('regcoeff_chi_u_ps')
389 read (be_unit) regcoeff_chi_u_ps
390 case ('regcoeff_chi_u_rh')
391 read (be_unit) regcoeff_chi_u_rh
392 case ('regcoeff_t_u_rh')
393 read (be_unit) regcoeff_t_u_rh
394 case ('regcoeff_ps_u_rh')
395 read (be_unit) regcoeff_ps_u_rh
397 message(1)=' Read problem in regression coefficients in BE file '
398 write (unit=message(2),fmt='(A,A)') ' Trying to read regression coefficients for variable: ',trim(adjustl(var80c))
399 call da_error(__FILE__,__LINE__,message(1:2))
403 ! 1.2 Fill regression coeff. array for model BE, vertical dimension is kz:
405 allocate (be%reg_psi_chi (1:jy,1:kz))
406 allocate (be%reg_psi_t (1:jy,1:kz,1:kz))
407 allocate (be%reg_psi_ps (1:jy,1:kz))
408 if ( cv_options == 6 ) then
409 allocate (be%reg_psi_rh (1:jy,1:kz,1:kz))
410 allocate (be%reg_chi_u_t (1:jy,1:kz,1:kz))
411 allocate (be%reg_chi_u_ps (1:jy,1:kz))
412 allocate (be%reg_chi_u_rh (1:jy,1:kz,1:kz))
413 allocate (be%reg_t_u_rh (1:jy,1:kz,1:kz))
414 allocate (be%reg_ps_u_rh (1:jy,1:kz))
417 !-----------for interpolating CV5--------------------------------------------------------------
418 if ( interpolate_stats ) then
419 allocate (reg_psi_chi0(1:nj,1:nk))
420 allocate (reg_psi_ps0 (1:nj,1:nk))
421 allocate (reg_psi_t0 (1:nj,1:nk,1:nk))
427 if ( cv_options == 6 ) then
435 if ( interpolate_stats ) then
438 reg_psi_chi0(j,k) = regcoeff_psi_chi(bin(1,j,k))
440 reg_psi_ps0(j,k) = regcoeff_psi_ps(k,b)
447 reg_psi_t0(j,i,k) = regcoeff_psi_t(i,k,b)
451 end if ! if interpolate_stats
453 if ( .not. interpolate_stats ) then
456 be%reg_psi_chi(j,k) = psi_chi_factor * regcoeff_psi_chi(bin(1,j,k))
458 be%reg_psi_ps(j,k) = psi_ps_factor * regcoeff_psi_ps(k,b)
465 be%reg_psi_t(j,i,k) = psi_t_factor * regcoeff_psi_t(i,k,b)
470 if ( cv_options == 6 ) then
474 be%reg_ps_u_rh(j,k) = ps_u_rh_factor * regcoeff_ps_u_rh(k,b)
475 be%reg_chi_u_ps(j,k) = chi_u_ps_factor * regcoeff_chi_u_ps(k,b)
482 be%reg_psi_rh(j,i,k) = psi_rh_factor * regcoeff_psi_rh(i,k,b)
483 be%reg_chi_u_t(j,i,k) = chi_u_t_factor * regcoeff_chi_u_t(i,k,b)
484 be%reg_chi_u_rh(j,i,k) = chi_u_rh_factor * regcoeff_chi_u_rh(i,k,b)
485 be%reg_t_u_rh(j,i,k) = t_u_rh_factor * regcoeff_t_u_rh(i,k,b)
489 end if ! if cv_options 6
490 end if ! if not interpolate_stats
492 deallocate (regcoeff_psi_chi)
493 deallocate (regcoeff_psi_t)
494 deallocate (regcoeff_psi_ps)
495 if ( cv_options == 6 ) then
496 deallocate (regcoeff_psi_rh)
497 deallocate (regcoeff_chi_u_t)
498 deallocate (regcoeff_chi_u_ps)
499 deallocate (regcoeff_chi_u_rh)
500 deallocate (regcoeff_t_u_rh)
501 deallocate (regcoeff_ps_u_rh)
503 ! 1.3 Domain_averaged regression coefficients
505 if (.not.lat_stats_option) then
506 write (unit=message(1), fmt='(a)') ' '
507 write (unit=message(2), fmt='(3x, a)') &
508 'Using the averaged regression coefficients for unbalanced part'
510 !-----------for interpolating CV5--------------------------------------------------------------
511 if ( interpolate_stats ) then
512 allocate (reg_psi_ps_be (1:nk))
513 allocate (reg_psi_chi_be(1:nk))
514 allocate (reg_psi_t_be (1:nk,1:nk))
516 reg_psi_ps_be(k) = sum(reg_psi_ps0 (:,k))/dble(nj)
517 reg_psi_chi_be(k) = sum(reg_psi_chi0(:,k))/dble(nj)
521 reg_psi_t_be(k,m)=sum(reg_psi_t0(:,k,m))/dble(nj)
524 deallocate (reg_psi_chi0)
525 deallocate (reg_psi_ps0 )
526 deallocate (reg_psi_t0 )
527 end if ! if interpolate_stats
528 !===========for interpolating CV5==============================================================
530 if ( (.not. interpolate_stats) .and. (bin_type /= 5) ) then
532 be%reg_psi_ps (:,k) = sum(be%reg_psi_ps (:,k))/dble(jy)
533 be%reg_psi_chi (:,k) = sum(be%reg_psi_chi(:,k))/dble(jy)
537 be%reg_psi_t (:,k,m) = sum(be%reg_psi_t(:,k,m))/dble(jy)
540 if ( cv_options == 6 ) then
542 be%reg_ps_u_rh (:,k) = sum(be%reg_ps_u_rh (:,k))/dble(jy)
543 be%reg_chi_u_ps(:,k) = sum(be%reg_chi_u_ps(:,k))/dble(jy)
547 be%reg_psi_rh (:,k,m) = sum(be%reg_psi_rh (:,k,m))/dble(jy)
548 be%reg_chi_u_t (:,k,m) = sum(be%reg_chi_u_t (:,k,m))/dble(jy)
549 be%reg_chi_u_rh(:,k,m) = sum(be%reg_chi_u_rh(:,k,m))/dble(jy)
550 be%reg_t_u_rh (:,k,m) = sum(be%reg_t_u_rh (:,k,m))/dble(jy)
553 end if ! if cv_options 6
554 end if ! if not interpolate_stats
557 write (unit=message(1), fmt='(a)') ' '
558 write (unit=message(2), fmt='(3x, a)') &
559 'Using the geographically-dependent regression coefficients for unbalanced part'
562 call da_message(message(1:2))
564 end if ! cv_options /= 7
566 ! 2.0 Load the eigenvector and eigenvalue
568 allocate (be1_eval_loc (1:nj,1:nk))
569 allocate (be2_eval_loc (1:nj,1:nk))
570 allocate (be3_eval_loc (1:nj,1:nk))
571 allocate (be4_eval_loc (1:nj,1:nk))
572 allocate (be5_eval_loc (1:nj,1:1))
574 if ( cloud_cv_options >= 2 ) then
575 allocate (be6_eval_loc (1:nj,1:nk))
576 allocate (be7_eval_loc (1:nj,1:nk))
577 allocate (be8_eval_loc (1:nj,1:nk))
578 allocate (be9_eval_loc (1:nj,1:nk))
579 allocate (be10_eval_loc (1:nj,1:nk))
582 if ( chem_cv_options >= 10 ) then
583 allocate (be12_eval_loc (num_cv_3d_chem,1:nj,1:nk))
587 allocate (be11_eval_loc (1:nj,1:nk))
590 if (vert_corr == vert_corr_2) then
592 allocate (be1_eval_glo(1:nk))
593 allocate (be2_eval_glo(1:nk))
594 allocate (be3_eval_glo(1:nk))
595 allocate (be4_eval_glo(1:nk))
596 allocate (be5_eval_glo(1:1))
598 if ( cloud_cv_options >= 2 ) then
599 allocate (be6_eval_glo(1:nk))
600 allocate (be7_eval_glo(1:nk))
601 allocate (be8_eval_glo(1:nk))
602 allocate (be9_eval_glo(1:nk))
603 allocate (be10_eval_glo(1:nk))
607 if ( chem_cv_options >= 10 ) then
608 allocate (be12_eval_glo(num_cv_3d_chem,1:nk))
613 allocate (be11_eval_glo(1:nk))
616 allocate (be1_evec_loc(1:nj,1:nk,1:nk))
617 allocate (be2_evec_loc(1:nj,1:nk,1:nk))
618 allocate (be3_evec_loc(1:nj,1:nk,1:nk))
619 allocate (be4_evec_loc(1:nj,1:nk,1:nk))
620 allocate (be5_evec_loc(1:nj,1: 1,1: 1))
622 if ( cloud_cv_options >= 2 ) then
623 allocate (be6_evec_loc (1:nj,1:nk,1:nk))
624 allocate (be7_evec_loc (1:nj,1:nk,1:nk))
625 allocate (be8_evec_loc (1:nj,1:nk,1:nk))
626 allocate (be9_evec_loc (1:nj,1:nk,1:nk))
627 allocate (be10_evec_loc(1:nj,1:nk,1:nk))
630 if ( chem_cv_options >= 10 ) then
631 allocate (be12_evec_loc (num_cv_3d_chem,1:nj,1:nk,1:nk))
635 allocate (be11_evec_loc(1:nj,1:nk,1:nk))
638 allocate (be1_evec_glo(1:nk,1:nk))
639 allocate (be2_evec_glo(1:nk,1:nk))
640 allocate (be3_evec_glo(1:nk,1:nk))
641 allocate (be4_evec_glo(1:nk,1:nk))
642 allocate (be5_evec_glo(1:1,1:1))
644 if ( cloud_cv_options >= 2 ) then
645 allocate (be6_evec_glo (1:nk,1:nk))
646 allocate (be7_evec_glo (1:nk,1:nk))
647 allocate (be8_evec_glo (1:nk,1:nk))
648 allocate (be9_evec_glo (1:nk,1:nk))
649 allocate (be10_evec_glo(1:nk,1:nk))
653 if ( chem_cv_options >= 10 ) then
654 allocate (be12_evec_glo(num_cv_3d_chem,1:nk,1:nk))
659 allocate (be11_evec_glo(1:nk,1:nk))
665 if ( cloud_cv_options >= 2 ) then
666 allocate ( be6_rf_lengthscale(1:kz))
667 allocate ( be7_rf_lengthscale(1:kz))
668 allocate ( be8_rf_lengthscale(1:kz))
669 allocate ( be9_rf_lengthscale(1:kz))
670 allocate (be10_rf_lengthscale(1:kz))
673 if ( chem_cv_options >= 10 ) then
674 allocate (be12_rf_lengthscale(num_cv_3d_chem,1:kz))
678 allocate (be11_rf_lengthscale(1:kz))
682 if ( cloud_cv_options == 3 ) then
683 ! hard-coded the v6-v11 BE values here
684 be % v6 % name = "qcloud"
685 be % v7 % name = "qrain"
686 be % v8 % name = "qice"
687 be % v9 % name = "qsnow"
688 be % v10 % name = "qgraup"
689 be6_eval_glo = 1.0e-6
690 be7_eval_glo = 1.0e-6
691 be8_eval_glo = 1.0e-6
692 be9_eval_glo = 1.0e-6
693 be10_eval_glo = 1.0e-6
695 be % v11 % name = "w"
699 be6_rf_lengthscale = 1.0
700 be7_rf_lengthscale = 1.0
701 be8_rf_lengthscale = 1.0
702 be9_rf_lengthscale = 1.0
703 be10_rf_lengthscale = 1.0
705 be11_rf_lengthscale = 1.0
710 ! 2.2 Read in the eigenvector and eigenvalue
712 print *, '-------- reading eigen vector/value -------'
713 do i = 1 , num_cv_3d_basic
714 read (be_unit) variable
715 read (be_unit) nk, num_bins2d
716 print *, trim(adjustl(variable)), nk, num_bins2d
718 allocate (evec_loc(1:nk,1:nk,1:num_bins2d))
719 allocate (eval_loc(1:nk, 1:num_bins2d))
721 select case( trim(adjustl(variable)) )
723 be % v1 % name = trim(adjustl(variable))
724 read (be_unit) be1_evec_glo
725 read (be_unit) be1_eval_glo
726 read (be_unit) evec_loc
727 read (be_unit) eval_loc
730 be1_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
731 be1_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
735 be % v2 % name = trim(adjustl(variable))
736 read (be_unit) be2_evec_glo
737 read (be_unit) be2_eval_glo
738 read (be_unit) evec_loc
739 read (be_unit) eval_loc
742 be2_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
743 be2_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
747 be % v3 % name = trim(adjustl(variable))
748 read (be_unit) be3_evec_glo
749 read (be_unit) be3_eval_glo
750 read (be_unit) evec_loc
751 read (be_unit) eval_loc
754 be3_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
755 be3_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
758 case ('rh_u' , 'rh' )
759 be % v4 % name = trim(adjustl(variable))
760 read (be_unit) be4_evec_glo
761 read (be_unit) be4_eval_glo
762 read (be_unit) evec_loc
763 read (be_unit) eval_loc
766 be4_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
767 be4_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
771 message(1)=' Read problem in eigen vectors/values in BE file '
772 write (unit=message(2),fmt='(A,A)') ' Trying to read Eigenvectors for variable: ',trim(adjustl(variable))
773 write (unit=message(3),fmt='(A)') ' Make sure you are using the correct be.dat file for your cv_options setting!'
774 call da_error(__FILE__,__LINE__,message(1:3))
777 end do !1-num_cv_3d_basic
779 if ( cloud_cv_options == 2 ) then
780 print*,"cloud_cv_options == 2 variables from id ",num_cv_3d_basic+1 ,"to id", num_cv_3d_basic+num_cv_3d_extra
781 do i = num_cv_3d_basic+1 , num_cv_3d_basic+num_cv_3d_extra
783 read (be_unit) variable
784 read (be_unit) nk, num_bins2d
785 print *, trim(adjustl(variable)), nk, num_bins2d
787 select case( trim(adjustl(variable)) )
790 be % v6 % name = trim(adjustl(variable))
791 read (be_unit) be6_evec_glo
792 read (be_unit) be6_eval_glo
793 read (be_unit) evec_loc
794 read (be_unit) eval_loc
797 be6_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
798 be6_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
802 be % v7 % name = trim(adjustl(variable))
803 read (be_unit) be7_evec_glo
804 read (be_unit) be7_eval_glo
805 read (be_unit) evec_loc
806 read (be_unit) eval_loc
809 be7_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
810 be7_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
814 be % v8 % name = trim(adjustl(variable))
815 read (be_unit) be8_evec_glo
816 read (be_unit) be8_eval_glo
817 read (be_unit) evec_loc
818 read (be_unit) eval_loc
821 be8_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
822 be8_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
826 be % v9 % name = trim(adjustl(variable))
827 read (be_unit) be9_evec_glo
828 read (be_unit) be9_eval_glo
829 read (be_unit) evec_loc
830 read (be_unit) eval_loc
833 be9_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
834 be9_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
838 be % v10 % name = trim(adjustl(variable))
839 !read (be_unit) nk, num_bins2d
840 read (be_unit) be10_evec_glo
841 read (be_unit) be10_eval_glo
842 read (be_unit) evec_loc
843 read (be_unit) eval_loc
846 be10_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
847 be10_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
851 !if ( use_cv_w ) then
852 ! if ( trim(adjustl(variable)) == 'w' ) then
853 be % v11 % name = trim(adjustl(variable))
854 read (be_unit) be11_evec_glo
855 read (be_unit) be11_eval_glo
856 read (be_unit) evec_loc
857 read (be_unit) eval_loc
860 be11_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
861 be11_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
867 message(1)=' Read problem in eigen vectors/values in BE file '
868 write (unit=message(2),fmt='(A,A)') ' Trying to read Eigenvectors for variable: ',trim(adjustl(variable))
869 write (unit=message(3),fmt='(A)') ' Make sure you are using the correct be.dat file for your cv_options setting!'
870 call da_error(__FILE__,__LINE__,message(1:3))
873 end do ! num_cv_3d_basic+1 - num_cv_3d_basic+num_cv_3d_extra-1
874 print*,"reading variables for cloud_cv_options=2 is done"
875 end if ! cloud_cv_options=2
878 if ( chem_cv_options == 10 ) then
879 print*,"chem_cv_options == 10 variables from id ",num_cv_3d_basic+1 ,"to id", num_cv_3d_basic+num_cv_3d_extra
880 do i = num_cv_3d_basic+1 , num_cv_3d_basic+num_cv_3d_extra
882 read (be_unit) variable
883 read (be_unit) nk, num_bins2d
884 print *, trim(adjustl(variable)), nk, num_bins2d
886 select case( trim(adjustl(variable)) )
890 be % v12(ispcc) % name = trim(adjustl(variable))
891 read (be_unit) be12_evec_glo(ispcc,:,:)
892 read (be_unit) be12_eval_glo(ispcc,:)
893 read (be_unit) evec_loc
894 read (be_unit) eval_loc
897 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
898 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
903 be % v12(ispcc) % name = trim(adjustl(variable))
904 read (be_unit) be12_evec_glo(ispcc,:,:)
905 read (be_unit) be12_eval_glo(ispcc,:)
906 read (be_unit) evec_loc
907 read (be_unit) eval_loc
910 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
911 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
916 be % v12(ispcc) % name = trim(adjustl(variable))
917 read (be_unit) be12_evec_glo(ispcc,:,:)
918 read (be_unit) be12_eval_glo(ispcc,:)
919 read (be_unit) evec_loc
920 read (be_unit) eval_loc
923 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
924 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
929 be % v12(ispcc) % name = trim(adjustl(variable))
930 read (be_unit) be12_evec_glo(ispcc,:,:)
931 read (be_unit) be12_eval_glo(ispcc,:)
932 read (be_unit) evec_loc
933 read (be_unit) eval_loc
936 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
937 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
942 be % v12(ispcc) % name = trim(adjustl(variable))
943 read (be_unit) be12_evec_glo(ispcc,:,:)
944 read (be_unit) be12_eval_glo(ispcc,:)
945 read (be_unit) evec_loc
946 read (be_unit) eval_loc
949 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
950 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
955 be % v12(ispcc) % name = trim(adjustl(variable))
956 read (be_unit) be12_evec_glo(ispcc,:,:)
957 read (be_unit) be12_eval_glo(ispcc,:)
958 read (be_unit) evec_loc
959 read (be_unit) eval_loc
962 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
963 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
968 be % v12(ispcc) % name = trim(adjustl(variable))
969 read (be_unit) be12_evec_glo(ispcc,:,:)
970 read (be_unit) be12_eval_glo(ispcc,:)
971 read (be_unit) evec_loc
972 read (be_unit) eval_loc
975 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
976 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
981 be % v12(ispcc) % name = trim(adjustl(variable))
982 read (be_unit) be12_evec_glo(ispcc,:,:)
983 read (be_unit) be12_eval_glo(ispcc,:)
984 read (be_unit) evec_loc
985 read (be_unit) eval_loc
988 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
989 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
994 be % v12(ispcc) % name = trim(adjustl(variable))
995 read (be_unit) be12_evec_glo(ispcc,:,:)
996 read (be_unit) be12_eval_glo(ispcc,:)
997 read (be_unit) evec_loc
998 read (be_unit) eval_loc
1001 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1002 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1007 be % v12(ispcc) % name = trim(adjustl(variable))
1008 read (be_unit) be12_evec_glo(ispcc,:,:)
1009 read (be_unit) be12_eval_glo(ispcc,:)
1010 read (be_unit) evec_loc
1011 read (be_unit) eval_loc
1014 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1015 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1020 be % v12(ispcc) % name = trim(adjustl(variable))
1021 read (be_unit) be12_evec_glo(ispcc,:,:)
1022 read (be_unit) be12_eval_glo(ispcc,:)
1023 read (be_unit) evec_loc
1024 read (be_unit) eval_loc
1027 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1028 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1033 be % v12(ispcc) % name = trim(adjustl(variable))
1034 read (be_unit) be12_evec_glo(ispcc,:,:)
1035 read (be_unit) be12_eval_glo(ispcc,:)
1036 read (be_unit) evec_loc
1037 read (be_unit) eval_loc
1040 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1041 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1046 be % v12(ispcc) % name = trim(adjustl(variable))
1047 read (be_unit) be12_evec_glo(ispcc,:,:)
1048 read (be_unit) be12_eval_glo(ispcc,:)
1049 read (be_unit) evec_loc
1050 read (be_unit) eval_loc
1053 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1054 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1059 be % v12(ispcc) % name = trim(adjustl(variable))
1060 read (be_unit) be12_evec_glo(ispcc,:,:)
1061 read (be_unit) be12_eval_glo(ispcc,:)
1062 read (be_unit) evec_loc
1063 read (be_unit) eval_loc
1066 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1067 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1072 be % v12(ispcc) % name = trim(adjustl(variable))
1073 read (be_unit) be12_evec_glo(ispcc,:,:)
1074 read (be_unit) be12_eval_glo(ispcc,:)
1075 read (be_unit) evec_loc
1076 read (be_unit) eval_loc
1079 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1080 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1085 be % v12(ispcc) % name = trim(adjustl(variable))
1086 read (be_unit) be12_evec_glo(ispcc,:,:)
1087 read (be_unit) be12_eval_glo(ispcc,:)
1088 read (be_unit) evec_loc
1089 read (be_unit) eval_loc
1092 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1093 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1098 be % v12(ispcc) % name = trim(adjustl(variable))
1099 read (be_unit) be12_evec_glo(ispcc,:,:)
1100 read (be_unit) be12_eval_glo(ispcc,:)
1101 read (be_unit) evec_loc
1102 read (be_unit) eval_loc
1105 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1106 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1111 be % v12(ispcc) % name = trim(adjustl(variable))
1112 read (be_unit) be12_evec_glo(ispcc,:,:)
1113 read (be_unit) be12_eval_glo(ispcc,:)
1114 read (be_unit) evec_loc
1115 read (be_unit) eval_loc
1118 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1119 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1124 be % v12(ispcc) % name = trim(adjustl(variable))
1125 read (be_unit) be12_evec_glo(ispcc,:,:)
1126 read (be_unit) be12_eval_glo(ispcc,:)
1127 read (be_unit) evec_loc
1128 read (be_unit) eval_loc
1131 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1132 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1136 !if ( use_cv_w ) then
1137 ! if ( trim(adjustl(variable)) == 'w' ) then
1138 be % v11 % name = trim(adjustl(variable))
1139 read (be_unit) be11_evec_glo
1140 read (be_unit) be11_eval_glo
1141 read (be_unit) evec_loc
1142 read (be_unit) eval_loc
1145 be11_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1146 be11_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
1152 message(1)=' Read problem in eigen vectors/values in BE file '
1153 write (unit=message(2),fmt='(A,A)') ' Trying to read Eigenvectors for variable: ',trim(adjustl(variable))
1154 write (unit=message(3),fmt='(A)') ' Make sure you are using the correct be.dat file for your cv_options setting!'
1155 call da_error(__FILE__,__LINE__,message(1:3))
1158 end do ! num_cv_3d_basic+1 - num_cv_3d_basic+num_cv_3d_extra-1
1159 print*,"reading variables for chem_cv_options=10 is done"
1160 end if ! chem_cv_options=10
1163 if ( chem_cv_options == 20 ) then
1164 print*,"chem_cv_options == 20 variables from id ",num_cv_3d_basic+1 ,"to id", num_cv_3d_basic+num_cv_3d_extra
1165 do i = num_cv_3d_basic+1 , num_cv_3d_basic+num_cv_3d_extra
1166 read (be_unit) variable
1167 read (be_unit) nk, num_bins2d
1168 print *, trim(adjustl(variable)), nk, num_bins2d
1169 select case( trim(adjustl(variable)) )
1173 be % v12(ispcc) % name = trim(adjustl(variable))
1174 read (be_unit) be12_evec_glo(ispcc,:,:)
1175 read (be_unit) be12_eval_glo(ispcc,:)
1176 read (be_unit) evec_loc
1177 read (be_unit) eval_loc
1180 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1181 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1186 be % v12(ispcc) % name = trim(adjustl(variable))
1187 read (be_unit) be12_evec_glo(ispcc,:,:)
1188 read (be_unit) be12_eval_glo(ispcc,:)
1189 read (be_unit) evec_loc
1190 read (be_unit) eval_loc
1193 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1194 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1199 be % v12(ispcc) % name = trim(adjustl(variable))
1200 read (be_unit) be12_evec_glo(ispcc,:,:)
1201 read (be_unit) be12_eval_glo(ispcc,:)
1202 read (be_unit) evec_loc
1203 read (be_unit) eval_loc
1206 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1207 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1212 be % v12(ispcc) % name = trim(adjustl(variable))
1213 read (be_unit) be12_evec_glo(ispcc,:,:)
1214 read (be_unit) be12_eval_glo(ispcc,:)
1215 read (be_unit) evec_loc
1216 read (be_unit) eval_loc
1219 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1220 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1225 be % v12(ispcc) % name = trim(adjustl(variable))
1226 read (be_unit) be12_evec_glo(ispcc,:,:)
1227 read (be_unit) be12_eval_glo(ispcc,:)
1228 read (be_unit) evec_loc
1229 read (be_unit) eval_loc
1232 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1233 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1238 be % v12(ispcc) % name = trim(adjustl(variable))
1239 read (be_unit) be12_evec_glo(ispcc,:,:)
1240 read (be_unit) be12_eval_glo(ispcc,:)
1241 read (be_unit) evec_loc
1242 read (be_unit) eval_loc
1245 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1246 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1251 be % v12(ispcc) % name = trim(adjustl(variable))
1252 read (be_unit) be12_evec_glo(ispcc,:,:)
1253 read (be_unit) be12_eval_glo(ispcc,:)
1254 read (be_unit) evec_loc
1255 read (be_unit) eval_loc
1258 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1259 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1264 be % v12(ispcc) % name = trim(adjustl(variable))
1265 read (be_unit) be12_evec_glo(ispcc,:,:)
1266 read (be_unit) be12_eval_glo(ispcc,:)
1267 read (be_unit) evec_loc
1268 read (be_unit) eval_loc
1271 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1272 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1277 be % v12(ispcc) % name = trim(adjustl(variable))
1278 read (be_unit) be12_evec_glo(ispcc,:,:)
1279 read (be_unit) be12_eval_glo(ispcc,:)
1280 read (be_unit) evec_loc
1281 read (be_unit) eval_loc
1284 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1285 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1290 be % v12(ispcc) % name = trim(adjustl(variable))
1291 read (be_unit) be12_evec_glo(ispcc,:,:)
1292 read (be_unit) be12_eval_glo(ispcc,:)
1293 read (be_unit) evec_loc
1294 read (be_unit) eval_loc
1297 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1298 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1303 be % v12(ispcc) % name = trim(adjustl(variable))
1304 read (be_unit) be12_evec_glo(ispcc,:,:)
1305 read (be_unit) be12_eval_glo(ispcc,:)
1306 read (be_unit) evec_loc
1307 read (be_unit) eval_loc
1310 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1311 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1316 be % v12(ispcc) % name = trim(adjustl(variable))
1317 read (be_unit) be12_evec_glo(ispcc,:,:)
1318 read (be_unit) be12_eval_glo(ispcc,:)
1319 read (be_unit) evec_loc
1320 read (be_unit) eval_loc
1323 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1324 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1329 be % v12(ispcc) % name = trim(adjustl(variable))
1330 read (be_unit) be12_evec_glo(ispcc,:,:)
1331 read (be_unit) be12_eval_glo(ispcc,:)
1332 read (be_unit) evec_loc
1333 read (be_unit) eval_loc
1336 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1337 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1342 be % v12(ispcc) % name = trim(adjustl(variable))
1343 read (be_unit) be12_evec_glo(ispcc,:,:)
1344 read (be_unit) be12_eval_glo(ispcc,:)
1345 read (be_unit) evec_loc
1346 read (be_unit) eval_loc
1349 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1350 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1355 be % v12(ispcc) % name = trim(adjustl(variable))
1356 read (be_unit) be12_evec_glo(ispcc,:,:)
1357 read (be_unit) be12_eval_glo(ispcc,:)
1358 read (be_unit) evec_loc
1359 read (be_unit) eval_loc
1362 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1363 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1368 be % v12(ispcc) % name = trim(adjustl(variable))
1369 read (be_unit) be12_evec_glo(ispcc,:,:)
1370 read (be_unit) be12_eval_glo(ispcc,:)
1371 read (be_unit) evec_loc
1372 read (be_unit) eval_loc
1375 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1376 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1381 be % v12(ispcc) % name = trim(adjustl(variable))
1382 read (be_unit) be12_evec_glo(ispcc,:,:)
1383 read (be_unit) be12_eval_glo(ispcc,:)
1384 read (be_unit) evec_loc
1385 read (be_unit) eval_loc
1388 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1389 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1394 be % v12(ispcc) % name = trim(adjustl(variable))
1395 read (be_unit) be12_evec_glo(ispcc,:,:)
1396 read (be_unit) be12_eval_glo(ispcc,:)
1397 read (be_unit) evec_loc
1398 read (be_unit) eval_loc
1401 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1402 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1407 be % v12(ispcc) % name = trim(adjustl(variable))
1408 read (be_unit) be12_evec_glo(ispcc,:,:)
1409 read (be_unit) be12_eval_glo(ispcc,:)
1410 read (be_unit) evec_loc
1411 read (be_unit) eval_loc
1414 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1415 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1420 be % v12(ispcc) % name = trim(adjustl(variable))
1421 read (be_unit) be12_evec_glo(ispcc,:,:)
1422 read (be_unit) be12_eval_glo(ispcc,:)
1423 read (be_unit) evec_loc
1424 read (be_unit) eval_loc
1427 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1428 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1433 be % v12(ispcc) % name = trim(adjustl(variable))
1434 read (be_unit) be12_evec_glo(ispcc,:,:)
1435 read (be_unit) be12_eval_glo(ispcc,:)
1436 read (be_unit) evec_loc
1437 read (be_unit) eval_loc
1440 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1441 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1446 be % v12(ispcc) % name = trim(adjustl(variable))
1447 read (be_unit) be12_evec_glo(ispcc,:,:)
1448 read (be_unit) be12_eval_glo(ispcc,:)
1449 read (be_unit) evec_loc
1450 read (be_unit) eval_loc
1453 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1454 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1459 be % v12(ispcc) % name = trim(adjustl(variable))
1460 read (be_unit) be12_evec_glo(ispcc,:,:)
1461 read (be_unit) be12_eval_glo(ispcc,:)
1462 read (be_unit) evec_loc
1463 read (be_unit) eval_loc
1466 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1467 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1472 be % v12(ispcc) % name = trim(adjustl(variable))
1473 read (be_unit) be12_evec_glo(ispcc,:,:)
1474 read (be_unit) be12_eval_glo(ispcc,:)
1475 read (be_unit) evec_loc
1476 read (be_unit) eval_loc
1479 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1480 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1485 be % v12(ispcc) % name = trim(adjustl(variable))
1486 read (be_unit) be12_evec_glo(ispcc,:,:)
1487 read (be_unit) be12_eval_glo(ispcc,:)
1488 read (be_unit) evec_loc
1489 read (be_unit) eval_loc
1492 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1493 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1498 be % v12(ispcc) % name = trim(adjustl(variable))
1499 read (be_unit) be12_evec_glo(ispcc,:,:)
1500 read (be_unit) be12_eval_glo(ispcc,:)
1501 read (be_unit) evec_loc
1502 read (be_unit) eval_loc
1505 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1506 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1511 be % v12(ispcc) % name = trim(adjustl(variable))
1512 read (be_unit) be12_evec_glo(ispcc,:,:)
1513 read (be_unit) be12_eval_glo(ispcc,:)
1514 read (be_unit) evec_loc
1515 read (be_unit) eval_loc
1518 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1519 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1524 be % v12(ispcc) % name = trim(adjustl(variable))
1525 read (be_unit) be12_evec_glo(ispcc,:,:)
1526 read (be_unit) be12_eval_glo(ispcc,:)
1527 read (be_unit) evec_loc
1528 read (be_unit) eval_loc
1531 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1532 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1537 be % v12(ispcc) % name = trim(adjustl(variable))
1538 read (be_unit) be12_evec_glo(ispcc,:,:)
1539 read (be_unit) be12_eval_glo(ispcc,:)
1540 read (be_unit) evec_loc
1541 read (be_unit) eval_loc
1544 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1545 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1550 be % v12(ispcc) % name = trim(adjustl(variable))
1551 read (be_unit) be12_evec_glo(ispcc,:,:)
1552 read (be_unit) be12_eval_glo(ispcc,:)
1553 read (be_unit) evec_loc
1554 read (be_unit) eval_loc
1557 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1558 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1563 be % v12(ispcc) % name = trim(adjustl(variable))
1564 read (be_unit) be12_evec_glo(ispcc,:,:)
1565 read (be_unit) be12_eval_glo(ispcc,:)
1566 read (be_unit) evec_loc
1567 read (be_unit) eval_loc
1570 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1571 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1576 be % v12(ispcc) % name = trim(adjustl(variable))
1577 read (be_unit) be12_evec_glo(ispcc,:,:)
1578 read (be_unit) be12_eval_glo(ispcc,:)
1579 read (be_unit) evec_loc
1580 read (be_unit) eval_loc
1583 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1584 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1589 be % v12(ispcc) % name = trim(adjustl(variable))
1590 read (be_unit) be12_evec_glo(ispcc,:,:)
1591 read (be_unit) be12_eval_glo(ispcc,:)
1592 read (be_unit) evec_loc
1593 read (be_unit) eval_loc
1596 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1597 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1602 be % v12(ispcc) % name = trim(adjustl(variable))
1603 read (be_unit) be12_evec_glo(ispcc,:,:)
1604 read (be_unit) be12_eval_glo(ispcc,:)
1605 read (be_unit) evec_loc
1606 read (be_unit) eval_loc
1609 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1610 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1615 be % v12(ispcc) % name = trim(adjustl(variable))
1616 read (be_unit) be12_evec_glo(ispcc,:,:)
1617 read (be_unit) be12_eval_glo(ispcc,:)
1618 read (be_unit) evec_loc
1619 read (be_unit) eval_loc
1622 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1623 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1628 be % v12(ispcc) % name = trim(adjustl(variable))
1629 read (be_unit) be12_evec_glo(ispcc,:,:)
1630 read (be_unit) be12_eval_glo(ispcc,:)
1631 read (be_unit) evec_loc
1632 read (be_unit) eval_loc
1635 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1636 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1640 if ( use_cv_w ) then
1641 be % v11 % name = trim(adjustl(variable))
1642 read (be_unit) be11_evec_glo
1643 read (be_unit) be11_eval_glo
1644 read (be_unit) evec_loc
1645 read (be_unit) eval_loc
1648 be11_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1649 be11_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
1654 message(1)=' Read problem in eigen vectors/values in BE file '
1655 write (unit=message(2),fmt='(A,A)') ' Trying to read Eigenvectors for variable: ',trim(adjustl(variable))
1656 write (unit=message(3),fmt='(A)') ' Make sure you are using the correct be.dat file for your cv_options setting!'
1657 call da_error(__FILE__,__LINE__,message(1:3))
1660 end do ! num_cv_3d_basic+1 - num_cv_3d_basic+num_cv_3d_extra-1
1661 print*,"reading variables for chem_cv_options=20 is done"
1662 end if ! chem_cv_options=20
1664 if ( chem_cv_options == 108 ) then ! racm_soa_vbs_da
1665 print*,"chem_cv_options == 108 variables from id ",num_cv_3d_basic+1 ,"to id", &
1666 num_cv_3d_basic+num_cv_3d_extra
1667 do i = num_cv_3d_basic+1 , num_cv_3d_basic+num_cv_3d_extra
1668 read (be_unit) variable
1669 read (be_unit) nk, num_bins2d
1670 !print *, trim(adjustl(variable)), nk, num_bins2d
1672 select case( trim(adjustl(variable)) )
1676 be % v12(ispcc) % name = trim(adjustl(variable))
1677 read (be_unit) be12_evec_glo(ispcc,:,:)
1678 read (be_unit) be12_eval_glo(ispcc,:)
1679 read (be_unit) evec_loc
1680 read (be_unit) eval_loc
1683 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1684 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1689 be % v12(ispcc) % name = trim(adjustl(variable))
1690 read (be_unit) be12_evec_glo(ispcc,:,:)
1691 read (be_unit) be12_eval_glo(ispcc,:)
1692 read (be_unit) evec_loc
1693 read (be_unit) eval_loc
1696 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1697 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1702 be % v12(ispcc) % name = trim(adjustl(variable))
1703 read (be_unit) be12_evec_glo(ispcc,:,:)
1704 read (be_unit) be12_eval_glo(ispcc,:)
1705 read (be_unit) evec_loc
1706 read (be_unit) eval_loc
1709 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1710 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1715 be % v12(ispcc) % name = trim(adjustl(variable))
1716 read (be_unit) be12_evec_glo(ispcc,:,:)
1717 read (be_unit) be12_eval_glo(ispcc,:)
1718 read (be_unit) evec_loc
1719 read (be_unit) eval_loc
1722 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1723 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1728 be % v12(ispcc) % name = trim(adjustl(variable))
1729 read (be_unit) be12_evec_glo(ispcc,:,:)
1730 read (be_unit) be12_eval_glo(ispcc,:)
1731 read (be_unit) evec_loc
1732 read (be_unit) eval_loc
1735 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1736 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1741 be % v12(ispcc) % name = trim(adjustl(variable))
1742 read (be_unit) be12_evec_glo(ispcc,:,:)
1743 read (be_unit) be12_eval_glo(ispcc,:)
1744 read (be_unit) evec_loc
1745 read (be_unit) eval_loc
1748 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1749 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1754 be % v12(ispcc) % name = trim(adjustl(variable))
1755 read (be_unit) be12_evec_glo(ispcc,:,:)
1756 read (be_unit) be12_eval_glo(ispcc,:)
1757 read (be_unit) evec_loc
1758 read (be_unit) eval_loc
1761 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1762 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1767 be % v12(ispcc) % name = trim(adjustl(variable))
1768 read (be_unit) be12_evec_glo(ispcc,:,:)
1769 read (be_unit) be12_eval_glo(ispcc,:)
1770 read (be_unit) evec_loc
1771 read (be_unit) eval_loc
1774 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1775 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1780 be % v12(ispcc) % name = trim(adjustl(variable))
1781 read (be_unit) be12_evec_glo(ispcc,:,:)
1782 read (be_unit) be12_eval_glo(ispcc,:)
1783 read (be_unit) evec_loc
1784 read (be_unit) eval_loc
1787 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1788 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1793 be % v12(ispcc) % name = trim(adjustl(variable))
1794 read (be_unit) be12_evec_glo(ispcc,:,:)
1795 read (be_unit) be12_eval_glo(ispcc,:)
1796 read (be_unit) evec_loc
1797 read (be_unit) eval_loc
1800 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1801 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1806 be % v12(ispcc) % name = trim(adjustl(variable))
1807 read (be_unit) be12_evec_glo(ispcc,:,:)
1808 read (be_unit) be12_eval_glo(ispcc,:)
1809 read (be_unit) evec_loc
1810 read (be_unit) eval_loc
1813 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1814 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1819 be % v12(ispcc) % name = trim(adjustl(variable))
1820 read (be_unit) be12_evec_glo(ispcc,:,:)
1821 read (be_unit) be12_eval_glo(ispcc,:)
1822 read (be_unit) evec_loc
1823 read (be_unit) eval_loc
1826 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1827 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1832 be % v12(ispcc) % name = trim(adjustl(variable))
1833 read (be_unit) be12_evec_glo(ispcc,:,:)
1834 read (be_unit) be12_eval_glo(ispcc,:)
1835 read (be_unit) evec_loc
1836 read (be_unit) eval_loc
1839 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1840 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1845 be % v12(ispcc) % name = trim(adjustl(variable))
1846 read (be_unit) be12_evec_glo(ispcc,:,:)
1847 read (be_unit) be12_eval_glo(ispcc,:)
1848 read (be_unit) evec_loc
1849 read (be_unit) eval_loc
1852 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1853 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1858 be % v12(ispcc) % name = trim(adjustl(variable))
1859 read (be_unit) be12_evec_glo(ispcc,:,:)
1860 read (be_unit) be12_eval_glo(ispcc,:)
1861 read (be_unit) evec_loc
1862 read (be_unit) eval_loc
1865 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1866 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1871 be % v12(ispcc) % name = trim(adjustl(variable))
1872 read (be_unit) be12_evec_glo(ispcc,:,:)
1873 read (be_unit) be12_eval_glo(ispcc,:)
1874 read (be_unit) evec_loc
1875 read (be_unit) eval_loc
1878 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1879 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1884 be % v12(ispcc) % name = trim(adjustl(variable))
1885 read (be_unit) be12_evec_glo(ispcc,:,:)
1886 read (be_unit) be12_eval_glo(ispcc,:)
1887 read (be_unit) evec_loc
1888 read (be_unit) eval_loc
1891 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1892 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1897 be % v12(ispcc) % name = trim(adjustl(variable))
1898 read (be_unit) be12_evec_glo(ispcc,:,:)
1899 read (be_unit) be12_eval_glo(ispcc,:)
1900 read (be_unit) evec_loc
1901 read (be_unit) eval_loc
1904 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1905 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1910 be % v12(ispcc) % name = trim(adjustl(variable))
1911 read (be_unit) be12_evec_glo(ispcc,:,:)
1912 read (be_unit) be12_eval_glo(ispcc,:)
1913 read (be_unit) evec_loc
1914 read (be_unit) eval_loc
1917 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1918 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1923 be % v12(ispcc) % name = trim(adjustl(variable))
1924 read (be_unit) be12_evec_glo(ispcc,:,:)
1925 read (be_unit) be12_eval_glo(ispcc,:)
1926 read (be_unit) evec_loc
1927 read (be_unit) eval_loc
1930 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1931 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1936 be % v12(ispcc) % name = trim(adjustl(variable))
1937 read (be_unit) be12_evec_glo(ispcc,:,:)
1938 read (be_unit) be12_eval_glo(ispcc,:)
1939 read (be_unit) evec_loc
1940 read (be_unit) eval_loc
1943 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1944 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1949 be % v12(ispcc) % name = trim(adjustl(variable))
1950 read (be_unit) be12_evec_glo(ispcc,:,:)
1951 read (be_unit) be12_eval_glo(ispcc,:)
1952 read (be_unit) evec_loc
1953 read (be_unit) eval_loc
1956 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1957 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1962 be % v12(ispcc) % name = trim(adjustl(variable))
1963 read (be_unit) be12_evec_glo(ispcc,:,:)
1964 read (be_unit) be12_eval_glo(ispcc,:)
1965 read (be_unit) evec_loc
1966 read (be_unit) eval_loc
1969 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1970 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1975 be % v12(ispcc) % name = trim(adjustl(variable))
1976 read (be_unit) be12_evec_glo(ispcc,:,:)
1977 read (be_unit) be12_eval_glo(ispcc,:)
1978 read (be_unit) evec_loc
1979 read (be_unit) eval_loc
1982 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1983 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
1988 be % v12(ispcc) % name = trim(adjustl(variable))
1989 read (be_unit) be12_evec_glo(ispcc,:,:)
1990 read (be_unit) be12_eval_glo(ispcc,:)
1991 read (be_unit) evec_loc
1992 read (be_unit) eval_loc
1995 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
1996 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2001 be % v12(ispcc) % name = trim(adjustl(variable))
2002 read (be_unit) be12_evec_glo(ispcc,:,:)
2003 read (be_unit) be12_eval_glo(ispcc,:)
2004 read (be_unit) evec_loc
2005 read (be_unit) eval_loc
2008 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2009 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2014 be % v12(ispcc) % name = trim(adjustl(variable))
2015 read (be_unit) be12_evec_glo(ispcc,:,:)
2016 read (be_unit) be12_eval_glo(ispcc,:)
2017 read (be_unit) evec_loc
2018 read (be_unit) eval_loc
2021 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2022 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2027 be % v12(ispcc) % name = trim(adjustl(variable))
2028 read (be_unit) be12_evec_glo(ispcc,:,:)
2029 read (be_unit) be12_eval_glo(ispcc,:)
2030 read (be_unit) evec_loc
2031 read (be_unit) eval_loc
2034 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2035 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2040 be % v12(ispcc) % name = trim(adjustl(variable))
2041 read (be_unit) be12_evec_glo(ispcc,:,:)
2042 read (be_unit) be12_eval_glo(ispcc,:)
2043 read (be_unit) evec_loc
2044 read (be_unit) eval_loc
2047 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2048 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2053 be % v12(ispcc) % name = trim(adjustl(variable))
2054 read (be_unit) be12_evec_glo(ispcc,:,:)
2055 read (be_unit) be12_eval_glo(ispcc,:)
2056 read (be_unit) evec_loc
2057 read (be_unit) eval_loc
2060 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2061 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2066 be % v12(ispcc) % name = trim(adjustl(variable))
2067 read (be_unit) be12_evec_glo(ispcc,:,:)
2068 read (be_unit) be12_eval_glo(ispcc,:)
2069 read (be_unit) evec_loc
2070 read (be_unit) eval_loc
2073 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2074 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2079 be % v12(ispcc) % name = trim(adjustl(variable))
2080 read (be_unit) be12_evec_glo(ispcc,:,:)
2081 read (be_unit) be12_eval_glo(ispcc,:)
2082 read (be_unit) evec_loc
2083 read (be_unit) eval_loc
2086 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2087 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2092 be % v12(ispcc) % name = trim(adjustl(variable))
2093 read (be_unit) be12_evec_glo(ispcc,:,:)
2094 read (be_unit) be12_eval_glo(ispcc,:)
2095 read (be_unit) evec_loc
2096 read (be_unit) eval_loc
2099 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2100 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2105 be % v12(ispcc) % name = trim(adjustl(variable))
2106 read (be_unit) be12_evec_glo(ispcc,:,:)
2107 read (be_unit) be12_eval_glo(ispcc,:)
2108 read (be_unit) evec_loc
2109 read (be_unit) eval_loc
2112 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2113 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2118 be % v12(ispcc) % name = trim(adjustl(variable))
2119 read (be_unit) be12_evec_glo(ispcc,:,:)
2120 read (be_unit) be12_eval_glo(ispcc,:)
2121 read (be_unit) evec_loc
2122 read (be_unit) eval_loc
2125 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2126 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2131 be % v12(ispcc) % name = trim(adjustl(variable))
2132 read (be_unit) be12_evec_glo(ispcc,:,:)
2133 read (be_unit) be12_eval_glo(ispcc,:)
2134 read (be_unit) evec_loc
2135 read (be_unit) eval_loc
2138 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2139 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2144 be % v12(ispcc) % name = trim(adjustl(variable))
2145 read (be_unit) be12_evec_glo(ispcc,:,:)
2146 read (be_unit) be12_eval_glo(ispcc,:)
2147 read (be_unit) evec_loc
2148 read (be_unit) eval_loc
2151 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2152 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2157 be % v12(ispcc) % name = trim(adjustl(variable))
2158 read (be_unit) be12_evec_glo(ispcc,:,:)
2159 read (be_unit) be12_eval_glo(ispcc,:)
2160 read (be_unit) evec_loc
2161 read (be_unit) eval_loc
2164 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2165 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2170 be % v12(ispcc) % name = trim(adjustl(variable))
2171 read (be_unit) be12_evec_glo(ispcc,:,:)
2172 read (be_unit) be12_eval_glo(ispcc,:)
2173 read (be_unit) evec_loc
2174 read (be_unit) eval_loc
2177 be12_evec_loc(ispcc,j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2178 be12_eval_loc(ispcc,j,1:nk ) = eval_loc(1:nk,b)
2182 if ( use_cv_w ) then
2183 be % v11 % name = trim(adjustl(variable))
2184 read (be_unit) be11_evec_glo
2185 read (be_unit) be11_eval_glo
2186 read (be_unit) evec_loc
2187 read (be_unit) eval_loc
2190 be11_evec_loc(j,1:nk,1:nk) = evec_loc(1:nk,1:nk,b)
2191 be11_eval_loc(j,1:nk ) = eval_loc(1:nk,b)
2196 message(1)=' Read problem in eigen vectors/values in BE file '
2197 write (unit=message(2),fmt='(A,A)') ' Trying to read Eigenvectors for variable: ',trim(adjustl(variable))
2198 write (unit=message(3),fmt='(A)') ' Make sure you are using the correct be.dat file for your cv_options setting!'
2199 call da_error(__FILE__,__LINE__,message(1:3))
2202 !print '(A6,3(A,I4),I5)', trim(adjustl(variable)), ' i =', i, ' , ispcc =', ispcc,' , nk =', nk, num_bins2d
2203 end do ! num_cv_3d_basic+1 - num_cv_3d_basic+num_cv_3d_extra-1
2204 print*,"reading variables for chem_cv_options=108 (racm_soa_vbs_da) is done"
2205 end if ! ( chem_cv_options == 108 ) then ! racm_soa_vbs_da
2208 deallocate (evec_loc)
2209 deallocate (eval_loc)
2211 ! 2.2.5 Read in 2D Control variable ps_u
2213 read (be_unit) variable
2214 read (be_unit) nk_2d, num_bins2d
2215 print *, trim(adjustl(variable)), nk_2d, num_bins2d
2221 allocate (evec_loc(1:nk_2d,1:nk_2d,1:num_bins2d))
2222 allocate (eval_loc(1:nk_2d, 1:num_bins2d))
2223 read (be_unit) be5_evec_glo
2224 read (be_unit) be5_eval_glo
2225 read (be_unit) evec_loc
2226 read (be_unit) eval_loc
2227 if( (trim(adjustl(variable)) /= 'ps_u') .and. (trim(adjustl(variable)) /= 'ps') ) then
2228 message(1)=' Variable mismatch while transfering eigen values from BE file '
2229 if (cv_options == 7) then
2230 write (unit=message(2),fmt='(A,A)') ' Expected ps but got ',trim(adjustl(variable))
2232 write (unit=message(2),fmt='(A,A)') ' Expected ps_u but got ',trim(adjustl(variable))
2234 call da_error(__FILE__,__LINE__,message(1:2))
2236 be % v5 % name = trim(adjustl(variable))
2239 be5_evec_loc(j,1:1,1:1) = evec_loc(1:1,1:1,b)
2240 be5_eval_loc(j,1:1 ) = eval_loc(1:1,b)
2243 deallocate (evec_loc)
2244 deallocate (eval_loc)
2246 if(use_radarobs .and. use_radar_rf .or. use_rad .and. crtm_cloud) then
2247 if ( cloud_cv_options == 1 ) be % v4 % name = 'qt '
2251 write (unit=message(1),fmt='(3x,A,i2)') 'cloud_cv_options = ', cloud_cv_options
2253 write (unit=message(1),fmt='(3x,A,i3)') 'chem_cv_options = ', chem_cv_options
2255 write (unit=message(2),fmt='(3x,A,7A)') 'WRFDA dry control variables are: ', &
2256 trim(be % v1 % name), ', ', trim(be % v2 % name), ', ', &
2257 trim(be % v3 % name), ' and ', trim(be % v5 % name)
2258 write (unit=message(3),fmt='(3x,A,A)') &
2259 'WRFDA Humidity control variable is ', trim(be % v4 % name)
2260 if ( cloud_cv_options >= 2 ) then
2261 write (unit=message(4),fmt='(3x,A,10A)') 'WRFDA hydrometeor control variables are: ', &
2262 trim(be % v6 % name), ', ', trim(be % v7 % name), ', ', &
2263 trim(be % v8 % name), ', ', trim(be % v9 % name), ', and ', &
2264 trim(be % v10 % name)
2266 !#if (WRF_CHEM == 1)
2267 ! if ( chem_cv_options >= 10 ) then
2268 ! write (unit=message(4),fmt='(3x,A,10A)') 'WRFDA chem control variables are: ', &
2269 ! be % v12(:) % name
2272 if ( use_cv_w ) then
2273 write (unit=message(5),fmt='(3x,A)') &
2274 'w control variable is activated'
2276 call da_message(message(1:5))
2280 ! 3.0 Load the scale lengths
2282 ! 3.1 allocate the array for scale lengths
2283 allocate (rfls1_be(1:nk))
2284 allocate (rfls2_be(1:nk))
2285 allocate (rfls3_be(1:nk))
2286 allocate (rfls4_be(1:nk))
2288 allocate (be1_rf_lengthscale(1:kz))
2289 allocate (be2_rf_lengthscale(1:kz))
2290 allocate (be3_rf_lengthscale(1:kz))
2291 allocate (be4_rf_lengthscale(1:kz))
2292 allocate (be5_rf_lengthscale(1:1))
2295 ! ===================================================================
2296 ! This is used for do_normalize = .T., I am not sure if it is working
2297 ! properly (???), more testing needed. (YRG, 01/12/2012)
2299 b=0 ! pointer to variable*mode
2300 allocate(nij(0:0,0:1,0:0))
2302 kzs=(/kz,kz,kz,kz,1/)
2303 be%v1%mz=1; be%v2%mz=1;be%v3%mz=1;be%v4%mz=1;be%v5%mz=1;
2304 mzs=(/be%v1%mz,be%v2%mz,be%v3%mz,be%v4%mz,be%v5%mz/)
2305 ! ====================================================================
2307 ! 3.2 read in the scale lengths
2309 print *, '----- read lengthscale --------'
2310 do i = 1 , num_cv_3d_basic
2311 read (be_unit) variable
2312 print *, trim(adjustl(variable))
2313 select case( trim(adjustl(variable)) )
2315 read(be_unit) rfls1_be
2316 if (.not.interpolate_stats) be1_rf_lengthscale = rfls1_be
2318 read(be_unit) rfls2_be
2319 if (.not.interpolate_stats) be2_rf_lengthscale = rfls2_be
2321 read(be_unit) rfls3_be
2322 if (.not.interpolate_stats) be3_rf_lengthscale = rfls3_be
2323 case ('rh_u' , 'rh')
2324 read(be_unit) rfls4_be
2325 if (.not.interpolate_stats) be4_rf_lengthscale = rfls4_be
2327 message(1)='Read problem in lengthscales in be.dat'
2328 write(message(2),'("Trying to read lengthscales for variable ",I0,": ",A)')i,trim(adjustl(variable))
2329 call da_error(__FILE__,__LINE__,message(1:2))
2331 end do ! num_cv_3d_basic
2333 if ( cloud_cv_options == 2 ) then
2334 do i = num_cv_3d_basic+1 , num_cv_3d_basic+num_cv_3d_extra
2335 read (be_unit) variable
2336 print *, trim(adjustl(variable))
2337 select case( trim(adjustl(variable)) )
2339 read(be_unit) be6_rf_lengthscale
2341 read(be_unit) be7_rf_lengthscale
2343 read(be_unit) be8_rf_lengthscale
2345 read(be_unit) be9_rf_lengthscale
2347 read(be_unit) be10_rf_lengthscale
2349 !if ( use_cv_w ) then
2350 ! if ( trim(adjustl(variable)) == 'w' ) then
2351 read(be_unit) be11_rf_lengthscale
2355 message(1)='Read problem in lengthscales in be.dat'
2356 write(message(2),'("Trying to read lengthscales for variable ",I0,": ",A)')i,trim(adjustl(variable))
2357 call da_error(__FILE__,__LINE__,message(1:2))
2359 end do ! num_cv_3d_basic+1 - num_cv_3d_basic+num_cv_3d_extra
2363 if ( chem_cv_options == 10 ) then
2364 do i = num_cv_3d_basic+1 , num_cv_3d_basic+num_cv_3d_extra
2365 read (be_unit) variable
2366 print *, trim(adjustl(variable))
2367 select case( trim(adjustl(variable)) )
2370 read(be_unit) be12_rf_lengthscale(ispcc,:)
2373 read(be_unit) be12_rf_lengthscale(ispcc,:)
2376 read(be_unit) be12_rf_lengthscale(ispcc,:)
2379 read(be_unit) be12_rf_lengthscale(ispcc,:)
2383 read(be_unit) be12_rf_lengthscale(ispcc,:)
2386 read(be_unit) be12_rf_lengthscale(ispcc,:)
2389 read(be_unit) be12_rf_lengthscale(ispcc,:)
2392 read(be_unit) be12_rf_lengthscale(ispcc,:)
2396 read(be_unit) be12_rf_lengthscale(ispcc,:)
2399 read(be_unit) be12_rf_lengthscale(ispcc,:)
2402 read(be_unit) be12_rf_lengthscale(ispcc,:)
2405 read(be_unit) be12_rf_lengthscale(ispcc,:)
2409 read(be_unit) be12_rf_lengthscale(ispcc,:)
2412 read(be_unit) be12_rf_lengthscale(ispcc,:)
2415 read(be_unit) be12_rf_lengthscale(ispcc,:)
2418 read(be_unit) be12_rf_lengthscale(ispcc,:)
2421 read(be_unit) be12_rf_lengthscale(ispcc,:)
2424 read(be_unit) be12_rf_lengthscale(ispcc,:)
2427 read(be_unit) be12_rf_lengthscale(ispcc,:)
2430 !if ( use_cv_w ) then
2431 ! if ( trim(adjustl(variable)) == 'w' ) then
2432 read(be_unit) be11_rf_lengthscale
2436 message(1)='Read problem in lengthscales in be.dat'
2437 write(message(2),'("Trying to read lengthscales for variable ",I0,": ",A)')i,trim(adjustl(variable))
2438 call da_error(__FILE__,__LINE__,message(1:2))
2440 end do ! num_cv_3d_basic+1 - num_cv_3d_basic+num_cv_3d_extra
2443 if ( chem_cv_options == 20 ) then
2444 do i = num_cv_3d_basic+1 , num_cv_3d_basic+num_cv_3d_extra
2445 read (be_unit) variable
2446 print *, trim(adjustl(variable))
2447 select case( trim(adjustl(variable)) )
2450 read(be_unit) be12_rf_lengthscale(ispcc,:)
2453 read(be_unit) be12_rf_lengthscale(ispcc,:)
2456 read(be_unit) be12_rf_lengthscale(ispcc,:)
2459 read(be_unit) be12_rf_lengthscale(ispcc,:)
2463 read(be_unit) be12_rf_lengthscale(ispcc,:)
2466 read(be_unit) be12_rf_lengthscale(ispcc,:)
2469 read(be_unit) be12_rf_lengthscale(ispcc,:)
2472 read(be_unit) be12_rf_lengthscale(ispcc,:)
2476 read(be_unit) be12_rf_lengthscale(ispcc,:)
2479 read(be_unit) be12_rf_lengthscale(ispcc,:)
2482 read(be_unit) be12_rf_lengthscale(ispcc,:)
2485 read(be_unit) be12_rf_lengthscale(ispcc,:)
2489 read(be_unit) be12_rf_lengthscale(ispcc,:)
2492 read(be_unit) be12_rf_lengthscale(ispcc,:)
2495 read(be_unit) be12_rf_lengthscale(ispcc,:)
2498 read(be_unit) be12_rf_lengthscale(ispcc,:)
2502 read(be_unit) be12_rf_lengthscale(ispcc,:)
2505 read(be_unit) be12_rf_lengthscale(ispcc,:)
2508 read(be_unit) be12_rf_lengthscale(ispcc,:)
2511 read(be_unit) be12_rf_lengthscale(ispcc,:)
2515 read(be_unit) be12_rf_lengthscale(ispcc,:)
2518 read(be_unit) be12_rf_lengthscale(ispcc,:)
2521 read(be_unit) be12_rf_lengthscale(ispcc,:)
2524 read(be_unit) be12_rf_lengthscale(ispcc,:)
2528 read(be_unit) be12_rf_lengthscale(ispcc,:)
2531 read(be_unit) be12_rf_lengthscale(ispcc,:)
2534 read(be_unit) be12_rf_lengthscale(ispcc,:)
2537 read(be_unit) be12_rf_lengthscale(ispcc,:)
2541 read(be_unit) be12_rf_lengthscale(ispcc,:)
2544 read(be_unit) be12_rf_lengthscale(ispcc,:)
2547 read(be_unit) be12_rf_lengthscale(ispcc,:)
2550 read(be_unit) be12_rf_lengthscale(ispcc,:)
2554 read(be_unit) be12_rf_lengthscale(ispcc,:)
2557 read(be_unit) be12_rf_lengthscale(ispcc,:)
2560 read(be_unit) be12_rf_lengthscale(ispcc,:)
2563 read(be_unit) be12_rf_lengthscale(ispcc,:)
2566 if ( use_cv_w ) then
2567 read(be_unit) be11_rf_lengthscale
2570 message(1)='Read problem in lengthscales in be.dat'
2571 write(message(2),'("Trying to read lengthscales for variable ",I0,": ",A)')i,trim(adjustl(variable))
2572 call da_error(__FILE__,__LINE__,message(1:2))
2574 end do ! num_cv_3d_basic+1 - num_cv_3d_basic+num_cv_3d_extra
2575 end if ! if ( chem_cv_options == 20 ) then
2577 if ( chem_cv_options == 108 ) then ! racm_soa_vbs_da
2578 do i = num_cv_3d_basic+1 , num_cv_3d_basic+num_cv_3d_extra
2579 read (be_unit) variable
2580 print *, trim(adjustl(variable))
2581 select case( trim(adjustl(variable)) )
2584 read(be_unit) be12_rf_lengthscale(ispcc,:)
2587 read(be_unit) be12_rf_lengthscale(ispcc,:)
2590 read(be_unit) be12_rf_lengthscale(ispcc,:)
2593 read(be_unit) be12_rf_lengthscale(ispcc,:)
2596 read(be_unit) be12_rf_lengthscale(ispcc,:)
2599 read(be_unit) be12_rf_lengthscale(ispcc,:)
2602 read(be_unit) be12_rf_lengthscale(ispcc,:)
2605 read(be_unit) be12_rf_lengthscale(ispcc,:)
2608 read(be_unit) be12_rf_lengthscale(ispcc,:)
2611 read(be_unit) be12_rf_lengthscale(ispcc,:)
2614 read(be_unit) be12_rf_lengthscale(ispcc,:)
2617 read(be_unit) be12_rf_lengthscale(ispcc,:)
2620 read(be_unit) be12_rf_lengthscale(ispcc,:)
2623 read(be_unit) be12_rf_lengthscale(ispcc,:)
2626 read(be_unit) be12_rf_lengthscale(ispcc,:)
2629 read(be_unit) be12_rf_lengthscale(ispcc,:)
2632 read(be_unit) be12_rf_lengthscale(ispcc,:)
2635 read(be_unit) be12_rf_lengthscale(ispcc,:)
2638 read(be_unit) be12_rf_lengthscale(ispcc,:)
2641 read(be_unit) be12_rf_lengthscale(ispcc,:)
2644 read(be_unit) be12_rf_lengthscale(ispcc,:)
2647 read(be_unit) be12_rf_lengthscale(ispcc,:)
2650 read(be_unit) be12_rf_lengthscale(ispcc,:)
2653 read(be_unit) be12_rf_lengthscale(ispcc,:)
2656 read(be_unit) be12_rf_lengthscale(ispcc,:)
2659 read(be_unit) be12_rf_lengthscale(ispcc,:)
2662 read(be_unit) be12_rf_lengthscale(ispcc,:)
2665 read(be_unit) be12_rf_lengthscale(ispcc,:)
2668 read(be_unit) be12_rf_lengthscale(ispcc,:)
2671 read(be_unit) be12_rf_lengthscale(ispcc,:)
2674 read(be_unit) be12_rf_lengthscale(ispcc,:)
2677 read(be_unit) be12_rf_lengthscale(ispcc,:)
2680 read(be_unit) be12_rf_lengthscale(ispcc,:)
2683 read(be_unit) be12_rf_lengthscale(ispcc,:)
2686 read(be_unit) be12_rf_lengthscale(ispcc,:)
2689 read(be_unit) be12_rf_lengthscale(ispcc,:)
2692 read(be_unit) be12_rf_lengthscale(ispcc,:)
2695 read(be_unit) be12_rf_lengthscale(ispcc,:)
2698 read(be_unit) be12_rf_lengthscale(ispcc,:)
2700 if ( use_cv_w ) then
2701 read(be_unit) be11_rf_lengthscale
2704 message(1)='Read problem in lengthscales in be.dat'
2705 write(message(2),'("Trying to read lengthscales for variable ",I0,": ",A)')i,trim(adjustl(variable))
2706 call da_error(__FILE__,__LINE__,message(1:2))
2708 end do ! num_cv_3d_basic+1 - num_cv_3d_basic+num_cv_3d_extra
2709 endif !( chem_cv_options == 108 ) then ! racm_soa_vbs_da
2712 ! Read in lengthscale of 2D Control variable ps_u
2714 read (be_unit) variable
2715 print *, trim(adjustl(variable))
2716 if ( trim(adjustl(variable)) /= 'ps_u' .and. &
2717 trim(adjustl(variable)) /= 'ps' ) then
2718 message(1)='Read problem in lengthscales in be.dat'
2719 write(message(2),'("Trying to read lengthscales for variable : ",A)') trim(adjustl(variable))
2720 call da_error(__FILE__,__LINE__,message(1:2))
2722 read (be_unit) be5_rf_lengthscale(1:1)
2724 if( do_normalize )then
2725 read(be_unit)do_normalize1
2726 if( do_normalize.neqv.do_normalize1 ) &
2727 call da_error(__FILE__,__LINE__,(/namv(i)//": do_normalize.neqv.do_normalize1"/))
2729 if( i==1 )allocate(be%sd(nij(0,1,0),nij(0,0,0),sum(mzs)))
2731 read(be_unit)be%sd(:,:,b+k)
2733 do k=mzs(i)+1,kzs(i)! read and discard truncated modes:
2734 read(be_unit)(junk,j=1,nij(0,1,0)*nij(0,0,0))
2736 write(*,'(A,": |sd[",A,"]|=",es9.3)')__FILE__,namv(i),sqrt(sum(be%sd(:,:,b+1:b+mzs(i))**2))
2737 b=b+mzs(i) ! point to next variable.
2740 if (print_detail_be) then
2741 ! Lengthscale variables (except 5!) are arrays of length "kz", so need to account for this in fmt statement
2742 write(write_fmt,'(A,I0,A)')'(A,',kz,'F10.5)'
2743 write(unit=message(1),fmt='(A)') 'BE Length scales:'
2744 write(unit=message(2),fmt=write_fmt) 'be1= ',be1_rf_lengthscale
2745 write(unit=message(3),fmt=write_fmt) 'be2= ',be2_rf_lengthscale
2746 write(unit=message(4),fmt=write_fmt) 'be3= ',be3_rf_lengthscale
2747 write(unit=message(5),fmt=write_fmt) 'be4= ',be4_rf_lengthscale
2748 write(unit=message(6),fmt='(A,F10.5)') 'be5= ',be5_rf_lengthscale
2749 call da_message(message(1:6))
2751 if ( cloud_cv_options >= 2 ) then
2752 write(unit=message(7),fmt=write_fmt) 'be6= ',be6_rf_lengthscale
2753 write(unit=message(8),fmt=write_fmt) 'be7= ',be7_rf_lengthscale
2754 write(unit=message(9),fmt=write_fmt) 'be8= ',be8_rf_lengthscale
2755 write(unit=message(10),fmt=write_fmt) 'be9= ',be9_rf_lengthscale
2756 write(unit=message(11),fmt=write_fmt) 'be10= ',be10_rf_lengthscale
2757 call da_message(message(7:11))
2759 !#if (WRF_CHEM == 1)
2760 ! if ( chem_cv_options >= 10 ) then
2761 ! do i=1,num_cv_3d_chem
2762 ! write(unit=message(i+6),fmt=write_fmt) 'be12 for ichem ',(i+5),'= ',be12_rf_lengthscale(i,:)
2764 ! call da_message(message(i+6:num_cv_3d_chem+6))
2767 if ( use_cv_w ) then
2768 write(unit=message(12),fmt=write_fmt) 'be11= ',be11_rf_lengthscale
2769 call da_message(message(12:12))
2771 end if ! print_detail_be
2774 !================== for interpolating CV5 =======================================
2775 ! 3.3 Interpolate the CV5 BE to the model resolution
2777 if (interpolate_stats) then
2779 ! 3.3.1 Compute the Vertical covariance matrix arrays for input CV5 BE:
2781 ! 3.3.1.1 Allocate the covariance arrays for input CV5 BE
2783 allocate (covm1_be(1:nk,1:nk))
2784 allocate (covm2_be(1:nk,1:nk))
2785 allocate (covm3_be(1:nk,1:nk))
2786 allocate (covm4_be(1:nk,1:nk))
2787 ! 3.3.1.2 Compute the vertical covariance matrix from Input CV5 BE
2788 ! eigenvector/eigenvalue:
2789 call da_Eigen_to_covmatrix(nk, be1_evec_glo, be1_eval_glo, covm1_be)
2790 call da_Eigen_to_covmatrix(nk, be2_evec_glo, be2_eval_glo, covm2_be)
2791 call da_Eigen_to_covmatrix(nk, be3_evec_glo, be3_eval_glo, covm3_be)
2792 call da_Eigen_to_covmatrix(nk, be4_evec_glo, be4_eval_glo, covm4_be)
2793 ! Deallocate the input CV5 BE Global eigenvector/eigenvalue:
2794 DEALLOCATE ( be1_eval_glo )
2795 DEALLOCATE ( be2_eval_glo )
2796 DEALLOCATE ( be3_eval_glo )
2797 DEALLOCATE ( be4_eval_glo )
2799 DEALLOCATE ( be1_evec_glo )
2800 DEALLOCATE ( be2_evec_glo )
2801 DEALLOCATE ( be3_evec_glo )
2802 DEALLOCATE ( be4_evec_glo )
2804 ! Allocate the model CV5 BE Global eigenvector/eigenvalue:
2805 ALLOCATE ( be1_eval_glo(1:kz) )
2806 ALLOCATE ( be2_eval_glo(1:kz) )
2807 ALLOCATE ( be3_eval_glo(1:kz) )
2808 ALLOCATE ( be4_eval_glo(1:kz) )
2810 ALLOCATE ( be1_evec_glo(1:kz,1:kz) )
2811 ALLOCATE ( be2_evec_glo(1:kz,1:kz) )
2812 ALLOCATE ( be3_evec_glo(1:kz,1:kz) )
2813 ALLOCATE ( be4_evec_glo(1:kz,1:kz) )
2815 ! 3.3.2 Convert the Vertical resolution from input CV5 BE to Model:
2817 ! 3.3.2.1 Allocate the Covariance matrix arrays for model
2819 allocate (covm1(1:kz,1:kz))
2820 allocate (covm2(1:kz,1:kz))
2821 allocate (covm3(1:kz,1:kz))
2822 allocate (covm4(1:kz,1:kz))
2824 ! 3.3.2.2 Allocate the regression coeff. arrays for model BE
2826 allocate (reg_psi_ps (1:kz))
2827 allocate (reg_psi_chi(1:kz))
2828 allocate (reg_psi_t (1:kz,1:kz))
2829 ! 3.3.2 Vertical resolution conversion from input BE(nk) to model(kz) BE:
2830 call da_chg_be_vres(kz, nk, xb%sigmah, eta_be,&
2831 reg_psi_chi_be,reg_psi_ps_be,reg_psi_t_be, &
2832 reg_psi_chi ,reg_psi_ps ,reg_psi_t , &
2833 covm1_be, covm2_be, covm3_be, covm4_be, &
2834 covm1 , covm2 , covm3 , covm4 , &
2835 rfls1_be, rfls2_be, rfls3_be, rfls4_be, &
2836 be1_rf_lengthscale, be2_rf_lengthscale, &
2837 be3_rf_lengthscale, be4_rf_lengthscale)
2839 ! 3.3.3 Deallocate the arrays for input CV5 BE:
2840 deallocate (reg_psi_ps_be )
2841 deallocate (reg_psi_chi_be)
2842 deallocate (reg_psi_t_be )
2844 ! 3.3.4 Assign the Regression coefficients for model BE:
2846 ! 3.3.4.1 Ps and Chi regression coefficients
2849 be%reg_psi_ps(j,k) = reg_psi_ps(k)
2850 be%reg_psi_chi (j,k)= reg_psi_chi(k)
2853 ! write(6,*)'be%reg_psi_ps(10,10)=',be%reg_psi_ps(10,10)
2854 ! write(6,*)'be%reg_psi_chi(10,10)=',be%reg_psi_chi(10,10)
2855 ! 3.3.4.2 Temp. regression coefficients
2859 be%reg_psi_t(j,k,m) = reg_psi_t(k,m)
2863 ! write(6,*)'be%reg_psi_t(10,10,10)=',be%reg_psi_t(10,10,10)
2864 ! 3.3.4.3 RWite out the Interpolated BE: Regression coefficients
2866 write(be_out_unit) reg_psi_chi
2867 write(be_out_unit) reg_psi_ps
2868 write(be_out_unit) reg_psi_t
2870 ! 3.3.4.4 Deallocate the domain-averaged Reg. Coeff. arrays:
2872 deallocate (reg_psi_ps )
2873 deallocate (reg_psi_chi)
2874 deallocate (reg_psi_t )
2875 ! 3.3.5 Re-compute the Eigenvector/eigenvalue from the model covariance matrix
2876 call da_gen_eigen(kz, covm1, be1_evec_glo, be1_eval_glo)
2877 call da_gen_eigen(kz, covm2, be2_evec_glo, be2_eval_glo)
2878 call da_gen_eigen(kz, covm3, be3_evec_glo, be3_eval_glo)
2879 call da_gen_eigen(kz, covm4, be4_evec_glo, be4_eval_glo)
2885 deallocate (covm1_be)
2886 deallocate (covm2_be)
2887 deallocate (covm3_be)
2888 deallocate (covm4_be)
2890 ! 3.3.6 Write out the interpolated CV5 BE
2892 ! 3.3.6.1 Eigenvector/eigenvalue:
2893 variable = be % v1 % name
2895 write(be_out_unit) variable
2896 write(be_out_unit) kz, num_bins2d_out
2897 write(be_out_unit) be1_evec_glo
2898 write(be_out_unit) be1_eval_glo
2899 ! - Because num_bins2d = 1, be1_evec_loc = be1_evec_glo:
2900 write(be_out_unit) be1_evec_glo
2901 write(be_out_unit) be1_eval_glo
2903 variable = be % v2 % name
2905 write(be_out_unit) variable
2906 write(be_out_unit) kz, num_bins2d_out
2907 write(be_out_unit) be2_evec_glo
2908 write(be_out_unit) be2_eval_glo
2909 ! - Because num_bins2d = 1, be2_evec_loc = be2_evec_glo:
2910 write(be_out_unit) be2_evec_glo
2911 write(be_out_unit) be2_eval_glo
2913 variable = be % v3 % name
2915 write(be_out_unit) variable
2916 write(be_out_unit) kz, num_bins2d_out
2917 write(be_out_unit) be3_evec_glo
2918 write(be_out_unit) be3_eval_glo
2919 ! - Because num_bins2d = 1, be3_evec_loc = be3_evec_glo:
2920 write(be_out_unit) be3_evec_glo
2921 write(be_out_unit) be3_eval_glo
2923 variable = be % v4 % name
2925 write(be_out_unit) variable
2926 write(be_out_unit) kz, num_bins2d_out
2927 write(be_out_unit) be4_evec_glo
2928 write(be_out_unit) be4_eval_glo
2929 ! - Because num_bins2d = 1, be4_evec_loc = be4_evec_glo:
2930 write(be_out_unit) be4_evec_glo
2931 write(be_out_unit) be4_eval_glo
2933 variable = be % v5 % name
2935 write(be_out_unit) variable
2936 write(be_out_unit) nk_2d, num_bins2d_out
2937 write(be_out_unit) be5_evec_glo
2938 write(be_out_unit) be5_eval_glo
2939 ! - Because num_bins2d = 1, be5_evec_loc = be5_evec_glo:
2940 write(be_out_unit) be5_evec_glo
2941 write(be_out_unit) be5_eval_glo
2944 ! 3.3.6.2 Scale-length
2945 variable = be % v1 % name
2947 write(be_out_unit) variable
2948 write(be_out_unit) be1_rf_lengthscale
2950 variable = be % v2 % name
2952 write(be_out_unit) variable
2953 write(be_out_unit) be2_rf_lengthscale
2955 variable = be % v3 % name
2957 write(be_out_unit) variable
2958 write(be_out_unit) be3_rf_lengthscale
2960 variable = be % v4 % name
2962 write(be_out_unit) variable
2963 write(be_out_unit) be4_rf_lengthscale
2965 variable = be % v5 % name
2967 write(be_out_unit) variable
2968 write(be_out_unit) be5_rf_lengthscale
2970 ! - Close the output unit:
2973 ! 3.3.7 Deallocate the arrays for reading the input CV5 BE:
2975 DEALLOCATE ( be1_eval_loc )
2976 DEALLOCATE ( be2_eval_loc )
2977 DEALLOCATE ( be3_eval_loc )
2978 DEALLOCATE ( be4_eval_loc )
2979 DEALLOCATE ( be5_eval_loc )
2980 DEALLOCATE ( be1_evec_loc )
2981 DEALLOCATE ( be2_evec_loc )
2982 DEALLOCATE ( be3_evec_loc )
2983 DEALLOCATE ( be4_evec_loc )
2984 DEALLOCATE ( be5_evec_loc )
2986 ! Allocate the arrays for Model local BE:
2987 ALLOCATE ( be1_eval_loc (1:jy,1:kz) )
2988 ALLOCATE ( be2_eval_loc (1:jy,1:kz) )
2989 ALLOCATE ( be3_eval_loc (1:jy,1:kz) )
2990 ALLOCATE ( be4_eval_loc (1:jy,1:kz) )
2991 ALLOCATE ( be5_eval_loc (1:jy,1:1) )
2992 ALLOCATE ( be1_evec_loc(1:jy,1:kz,1:kz) )
2993 ALLOCATE ( be2_evec_loc(1:jy,1:kz,1:kz) )
2994 ALLOCATE ( be3_evec_loc(1:jy,1:kz,1:kz) )
2995 ALLOCATE ( be4_evec_loc(1:jy,1:kz,1:kz) )
2996 ALLOCATE ( be5_evec_loc(1:jy,1:1,1:1) )
2998 endif ! if interpolate_stats
3001 deallocate ( rfls1_be )
3002 deallocate ( rfls2_be )
3003 deallocate ( rfls3_be )
3004 deallocate ( rfls4_be )
3007 ! 4.0 Check and get the truncated number of the vertical modes
3008 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3010 if (vert_corr == vert_corr_2) then
3012 ! 4.1 Perform checks on eigenvectors:
3014 if (test_statistics) then
3015 call da_check_eof_decomposition(be1_eval_glo(:), be1_evec_glo(:,:), be % v1 % name)
3016 call da_check_eof_decomposition(be2_eval_glo(:), be2_evec_glo(:,:), be % v2 % name)
3017 call da_check_eof_decomposition(be3_eval_glo(:), be3_evec_glo(:,:), be % v3 % name)
3018 call da_check_eof_decomposition(be4_eval_glo(:), be4_evec_glo(:,:), be % v4 % name)
3020 if ( cloud_cv_options == 2 ) then
3021 call da_check_eof_decomposition(be6_eval_glo(:), be6_evec_glo(:,:), be % v6 % name)
3022 call da_check_eof_decomposition(be7_eval_glo(:), be7_evec_glo(:,:), be % v7 % name)
3023 call da_check_eof_decomposition(be8_eval_glo(:), be8_evec_glo(:,:), be % v8 % name)
3024 call da_check_eof_decomposition(be9_eval_glo(:), be9_evec_glo(:,:), be % v9 % name)
3025 call da_check_eof_decomposition(be10_eval_glo(:), be10_evec_glo(:,:), be % v10 % name)
3029 if ( chem_cv_options >= 10 ) then
3030 do i=1,num_cv_3d_chem
3031 call da_check_eof_decomposition(be12_eval_glo(i,:), be12_evec_glo(i,:,:), be % v12(i) % name)
3036 if ( use_cv_w ) then
3037 call da_check_eof_decomposition(be11_eval_glo(:), be11_evec_glo(:,:), be % v11 % name)
3042 ! 4.2 Truncate in vertical:
3044 call da_get_vertical_truncation(max_vert_var1, be1_eval_glo(:), be % v1)
3045 call da_get_vertical_truncation(max_vert_var2, be2_eval_glo(:), be % v2)
3046 call da_get_vertical_truncation(max_vert_var3, be3_eval_glo(:), be % v3)
3047 call da_get_vertical_truncation(max_vert_var4, be4_eval_glo(:), be % v4)
3049 if ( cloud_cv_options == 2 ) then
3050 call da_get_vertical_truncation(max_vert_var6, be6_eval_glo(:), be % v6)
3051 call da_get_vertical_truncation(max_vert_var7, be7_eval_glo(:), be % v7)
3052 call da_get_vertical_truncation(max_vert_var8, be8_eval_glo(:), be % v8)
3053 call da_get_vertical_truncation(max_vert_var9, be9_eval_glo(:), be % v9)
3054 call da_get_vertical_truncation(max_vert_var10,be10_eval_glo(:),be % v10)
3056 if ( jb_factor > 0.0 ) then
3057 be % v6 % mz = xb % mkz
3058 be % v7 % mz = xb % mkz
3059 be % v8 % mz = xb % mkz
3060 be % v9 % mz = xb % mkz
3061 be % v10 % mz = xb % mkz
3072 if ( chem_cv_options >= 10 ) then
3073 do i=1,num_cv_3d_chem
3074 call da_get_vertical_truncation(max_vert_var12(i), be12_eval_glo(i,:), be % v12(i))
3077 if ( jb_factor > 0.0 ) then
3078 be % v12(:) % mz = xb % mkz
3080 be % v12(:) % mz = 0
3085 if ( use_cv_w ) then
3086 call da_get_vertical_truncation(max_vert_var11,be11_eval_glo(:),be % v11)
3088 if ( jb_factor > 0.0 ) then
3089 be % v11 % mz = xb % mkz
3096 if (max_vert_var5 == 0.0) then
3102 write (unit=stdout,fmt=*) ' '
3108 be % v1 % mz = xb % mkz
3109 be % v2 % mz = xb % mkz
3110 be % v3 % mz = xb % mkz
3111 be % v4 % mz = xb % mkz
3112 be % v5 % mz = xb % mkz
3114 be % v6 % mz = xb % mkz
3115 be % v7 % mz = xb % mkz
3116 be % v8 % mz = xb % mkz
3117 be % v9 % mz = xb % mkz
3118 be % v10% mz = xb % mkz
3119 be % v11% mz = xb % mkz
3122 if ( chem_cv_options >= 10 ) then
3123 be % v12(:) % mz = xb % mkz
3129 ! 5.0 Initialise control variable space components of header:
3130 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3132 ! 5.1 Compute the size of the control variables
3137 ! 5.2 Transfer errors to error structure:
3139 call da_allocate_background_errors(jy, kz, be1_eval_glo, be1_evec_glo, be1_eval_loc, &
3140 be1_evec_loc, be % v1)
3141 call da_allocate_background_errors(jy, kz, be2_eval_glo, be2_evec_glo, be2_eval_loc, &
3142 be2_evec_loc, be % v2)
3143 call da_allocate_background_errors(jy, kz, be3_eval_glo, be3_evec_glo, be3_eval_loc, &
3144 be3_evec_loc, be % v3)
3145 call da_allocate_background_errors(jy, kz, be4_eval_glo, be4_evec_glo, be4_eval_loc, &
3146 be4_evec_loc, be % v4)
3148 ! 5.2.1 transfer the ps_u variance to be % v5:
3150 call da_allocate_background_errors(jy, 1, be5_eval_glo, be5_evec_glo, be5_eval_loc, &
3151 be5_evec_loc, be % v5)
3153 if ( cloud_cv_options >=2 ) then
3154 call da_allocate_background_errors(jy, kz, be6_eval_glo, be6_evec_glo, be6_eval_loc, &
3155 be6_evec_loc, be % v6)
3156 call da_allocate_background_errors(jy, kz, be7_eval_glo, be7_evec_glo, be7_eval_loc, &
3157 be7_evec_loc, be % v7)
3158 call da_allocate_background_errors(jy, kz, be8_eval_glo, be8_evec_glo, be8_eval_loc, &
3159 be8_evec_loc, be % v8)
3160 call da_allocate_background_errors(jy, kz, be9_eval_glo, be9_evec_glo, be9_eval_loc, &
3161 be9_evec_loc, be % v9)
3162 call da_allocate_background_errors(jy, kz, be10_eval_glo, be10_evec_glo, be10_eval_loc, &
3163 be10_evec_loc, be % v10)
3166 if ( chem_cv_options >=10 ) then
3167 do i=1,num_cv_3d_chem
3168 call da_allocate_background_errors(jy, kz, be12_eval_glo(i,:), be12_evec_glo(i,:,:), be12_eval_loc(i,:,:), &
3169 be12_evec_loc(i,:,:,:), be % v12(i))
3173 if ( use_cv_w ) then
3174 call da_allocate_background_errors(jy, kz, be11_eval_glo, be11_evec_glo, be11_eval_loc, &
3175 be11_evec_loc, be % v11)
3178 if (print_detail_be) then
3179 write (unit=stdout,fmt='(3x,a,i10)') "b) Finished eigenvector processing!"
3182 if( use_rf )then ! use recursive filters:
3184 ! 5.3 Convert the scale lengths in the real distance (meter)
3186 be1_rf_lengthscale(1:kz) = be1_rf_lengthscale(1:kz) * xb%ds
3187 be2_rf_lengthscale(1:kz) = be2_rf_lengthscale(1:kz) * xb%ds
3188 be3_rf_lengthscale(1:kz) = be3_rf_lengthscale(1:kz) * xb%ds
3189 be4_rf_lengthscale(1:kz) = be4_rf_lengthscale(1:kz) * xb%ds
3190 be5_rf_lengthscale(1:1) = be5_rf_lengthscale(1:1) * xb%ds
3192 if ( cloud_cv_options >= 2 ) then
3193 be6_rf_lengthscale(1:kz) = be6_rf_lengthscale(1:kz) * xb%ds
3194 be7_rf_lengthscale(1:kz) = be7_rf_lengthscale(1:kz) * xb%ds
3195 be8_rf_lengthscale(1:kz) = be8_rf_lengthscale(1:kz) * xb%ds
3196 be9_rf_lengthscale(1:kz) = be9_rf_lengthscale(1:kz) * xb%ds
3197 be10_rf_lengthscale(1:kz)= be10_rf_lengthscale(1:kz) * xb%ds
3200 if ( chem_cv_options >= 10 ) then
3201 do i=1,num_cv_3d_chem
3202 be12_rf_lengthscale(i,1:kz) = be12_rf_lengthscale(i,1:kz) * xb%ds
3206 if ( use_cv_w ) then
3207 be11_rf_lengthscale(1:kz)= be11_rf_lengthscale(1:kz) * xb%ds
3210 else ! use wavelets:
3211 ! kzs and mzs are used for wavelets
3212 kzs=(/kz,kz,kz,kz,1/)
3213 mzs=(/be%v1%mz,be%v2%mz,be%v3%mz,be%v4%mz,be%v5%mz/)
3215 read(be_unit)k ! trimmed string length
3216 if( k>len(variable) )then
3217 write(message(1),'(i0,">",i0," for use_rf=.false.")')k,len(variable)
3218 call da_error(__FILE__,__LINE__,message(1:1))
3220 read(be_unit)variable(1:k)
3221 if( variable(1:k) /= 'wavelet' )then
3222 write(message(1),'(A,"/=''wavelet''")')variable(1:k)
3223 call da_error(__FILE__,__LINE__,message(1:1))
3225 b = 0 ! pointer to variable*mode
3226 do m=1,5 ! variables loop:
3228 if( k>len(variable) )then
3229 write(message(1),'(i0,">",i0," for ",A)')k,len(variable),namv(m)
3230 call da_error(__FILE__,__LINE__,message(1:1))
3231 elseif( nk /= kzs(m) )then
3232 write(message(1),'(i0,"=nk/=kzs(",i0,")=",i0," for ",A)')nk,m,kzs(m),namv(m)
3233 call da_error(__FILE__,__LINE__,message(1:1))
3235 read(be_unit)variable(1:k)
3236 if( variable(1:k) /= trim(namv(m)) )then
3237 write(message(1),'(A,"/=",A)')variable(1:k),trim(namv(m))
3238 call da_error(__FILE__,__LINE__,message(1:1))
3241 ! Possibly reassign namelist do_normalize value:
3242 read(be_unit)do_normalize,namw,lf,nb
3243 allocate(nij(0:nb,0:1,0:2))
3244 read(be_unit)nij ! wavelet indexes
3245 write(*,'(A,": ")',advance="no")__FILE__
3246 do i=0,nb ! wavelet-band loop:
3247 write(*,'(i2,"{",2(i3,","),i3,";",2(i3,","),i3,"}")',advance="no")&
3248 i,transpose(nij(i,:,:))
3250 allocate(be%wsd(nij(0,1,2),nij(0,0,2),sum(mzs)), &
3251 !____________________max of {,i}dwtai wavelet scratch workspace sizes:
3252 ws(max(maxval(nij(0,:,2)), &
3253 2*floor(.5*(real(maxval(nij(0,:,0)))+lf))+lf-2)))
3254 if( do_normalize )allocate(be%sd(nij(0,1,0),nij(0,0,0),sum(mzs)))
3257 !___________mode-k field & wavelet-coefficient std. devs.:
3258 read(be_unit)be%wsd(:,:,b+k)
3259 if( do_normalize )read(be_unit)be%sd(:,:,b+k)
3260 enddo ! mode-k loop.
3261 do k=mzs(m)+1,kzs(m) ! read and discard truncated modes:
3262 read(be_unit)(junk,j=1,nij(0,1,2)*nij(0,0,2))
3263 if( do_normalize )read(be_unit)(junk,j=1,nij(0,1,0)*nij(0,0,0))
3264 enddo ! mode-k loop.
3265 write(*,'(A,": |wsd[",A,"]|=",es9.3)')__FILE__,namv(m),sqrt(sum(be%wsd(:,:,b+1:b+mzs(m))**2))
3266 if( do_normalize )write(*,'(A,": | sd[",A,"]|=",es9.3)')__FILE__,namv(m),sqrt(sum(be%sd(:,:,b+1:b+mzs(m))**2))
3267 b = b+mzs(m) ! point to next variable.
3268 enddo ! variables loop
3269 endif ! if( use_rf )
3271 ! 6.0 Perform checks on eigenvectors with be data structure:
3272 if (jb_factor > 0.0 .and. test_statistics) then
3273 call da_check_eof_decomposition(be%v1%val_g(:), be%v1%evec_g(:,:),&
3275 call da_check_eof_decomposition(be%v2%val_g(:), be%v2%evec_g(:,:),&
3277 call da_check_eof_decomposition(be%v3%val_g(:), be%v3%evec_g(:,:),&
3279 call da_check_eof_decomposition(be%v4%val_g(:), be%v4%evec_g(:,:),&
3282 if ( cloud_cv_options >= 2 ) then
3283 call da_check_eof_decomposition(be%v6%val_g(:), be%v6%evec_g(:,:),&
3285 call da_check_eof_decomposition(be%v7%val_g(:), be%v7%evec_g(:,:),&
3287 call da_check_eof_decomposition(be%v8%val_g(:), be%v8%evec_g(:,:),&
3289 call da_check_eof_decomposition(be%v9%val_g(:), be%v9%evec_g(:,:),&
3291 call da_check_eof_decomposition(be%v10%val_g(:), be%v10%evec_g(:,:),&
3295 if ( chem_cv_options >= 10 ) then
3296 do i=1,num_cv_3d_chem
3297 call da_check_eof_decomposition(be%v12(i)%val_g(:), be%v12(i)%evec_g(:,:),&
3302 if ( use_cv_w ) then
3303 call da_check_eof_decomposition(be%v11%val_g(:), be%v11%evec_g(:,:),&
3309 ! 6.1 Close the be unit
3312 call da_free_unit(be_unit)
3315 ! 6.2 Keep the original be % v1, be % v2,...., and lengthscale in the first loop
3316 ! for the rescaling in the later loops:
3320 if (max_ext_its > 1 .and. jb_factor > 0.0) then
3322 if ( rootproc ) then
3323 write(unit=message(1),fmt='(A,I4)') '>>> Save the variances and scale-lengths in outer-loop', it
3324 call da_message(message(1:1))
3325 write(be_rf_unit) kz, jy, ix, be % v1 % mz, be % v2 % mz, be% v3 % mz, &
3326 be % v4 % mz, be % v5 % mz, xb % ds
3327 write(be_rf_unit) be % v1 % val, be % v2 % val, be% v3 % val, &
3328 be % v4 % val, be % v5 % val, &
3329 be1_rf_lengthscale, be2_rf_lengthscale, be3_rf_lengthscale, &
3330 be4_rf_lengthscale, be5_rf_lengthscale
3331 if ( cloud_cv_options >= 2 ) then
3332 write(be_rf_unit) be%v6%val, be%v7%val, be%v8%val, be%v9%val, be%v10%val
3333 write(be_rf_unit) be6_rf_lengthscale, be7_rf_lengthscale, be8_rf_lengthscale, &
3334 be9_rf_lengthscale, be10_rf_lengthscale
3337 if ( chem_cv_options >= 10 ) then
3338 do i=1, num_cv_3d_chem
3339 write(be_rf_unit) be % v12(i) % val
3341 do i=1, num_cv_3d_chem
3342 write(be_rf_unit) be12_rf_lengthscale(i,:)
3346 if ( use_cv_w ) then
3347 write(be_rf_unit) be%v11%val
3348 write(be_rf_unit) be11_rf_lengthscale
3352 if (print_detail_be ) then
3353 write(be_print_unit,'("it=",i2,2x,"kz=",i3,2x,"jy=",i4,2x,"ix=",i4,2x,"ds=",e12.5)') &
3354 it, kz, jy, ix, xb % ds
3355 write(be_print_unit,'("Original val and rf, and mz:",5i5)') &
3356 be % v1 % mz, be % v2 % mz, be% v3 % mz, be % v4 % mz, be % v5 % mz
3357 write(be_print_unit,'("mz=",i3,2x,"be%v1%val:"/(10e12.5))') be%v1%mz, be%v1%val(1,:)
3358 write(be_print_unit,'("mz=",i3,2x,"be%v2%val:"/(10e12.5))') be%v2%mz, be%v2%val(1,:)
3359 write(be_print_unit,'("mz=",i3,2x,"be%v3%val:"/(10e12.5))') be%v3%mz, be%v3%val(1,:)
3360 write(be_print_unit,'("mz=",i3,2x,"be%v4%val:"/(10e12.5))') be%v4%mz, be%v4%val(1,:)
3361 write(be_print_unit,'("mz=",i3,2x,"be%v5%val:"/(10e12.5))') be%v5%mz, be%v5%val(1,:)
3362 write(be_print_unit,'(/"scale-length: kz=",i3)') kz
3365 write(be_print_unit,'(i3,2x,5e15.5)') i,be1_rf_lengthscale(i), &
3366 be2_rf_lengthscale(i), be3_rf_lengthscale(i), be4_rf_lengthscale(i), &
3367 be5_rf_lengthscale(i)
3369 write(be_print_unit,'(i3,2x,5e15.5)') i,be1_rf_lengthscale(i), &
3370 be2_rf_lengthscale(i), be3_rf_lengthscale(i), be4_rf_lengthscale(i)
3378 ! 7.0 Apply empirical and recursive filter rescaling factor:
3379 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3381 call da_rescale_background_errors(var_scaling1(1), len_scaling1(1), &
3382 xb % ds, be1_rf_lengthscale, be % v1)
3383 call da_rescale_background_errors(var_scaling2(1), len_scaling2(1), &
3384 xb % ds, be2_rf_lengthscale, be % v2)
3385 call da_rescale_background_errors(var_scaling3(1), len_scaling3(1), &
3386 xb % ds, be3_rf_lengthscale, be % v3)
3387 call da_rescale_background_errors(var_scaling4(1), len_scaling4(1), &
3388 xb % ds, be4_rf_lengthscale, be % v4)
3389 call da_rescale_background_errors(var_scaling5(1), len_scaling5(1), &
3390 xb % ds, be5_rf_lengthscale, be % v5)
3391 if ( cloud_cv_options >= 2 ) then
3392 call da_rescale_background_errors(var_scaling6(1), len_scaling6(1), &
3393 xb % ds, be6_rf_lengthscale, be % v6)
3394 call da_rescale_background_errors(var_scaling7(1), len_scaling7(1), &
3395 xb % ds, be7_rf_lengthscale, be % v7)
3396 call da_rescale_background_errors(var_scaling8(1), len_scaling8(1), &
3397 xb % ds, be8_rf_lengthscale, be % v8)
3398 call da_rescale_background_errors(var_scaling9(1), len_scaling9(1), &
3399 xb % ds, be9_rf_lengthscale, be % v9)
3400 call da_rescale_background_errors(var_scaling10(1), len_scaling10(1), &
3401 xb % ds, be10_rf_lengthscale, be % v10)
3404 if ( chem_cv_options >= 10 ) then
3405 do i=1,num_cv_3d_chem
3406 call da_rescale_background_errors(var_scaling12(i), len_scaling12(i), &
3407 xb % ds, be12_rf_lengthscale(i,:), be % v12(i))
3411 if ( use_cv_w ) then
3412 call da_rescale_background_errors(var_scaling11(1), len_scaling11(1), &
3413 xb % ds, be11_rf_lengthscale, be % v11)
3418 if (print_detail_be .and. jb_factor > 0.0) then
3419 write(be_print_unit,'(/"============================================================")')
3420 write(be_print_unit,'("For outer loop ",i2)') it
3421 write(be_print_unit,'("it=",i2,2x,"kz=",i3,2x,"jy=",i4,2x,"ix=",i4,2x,"ds=",e12.5)') &
3422 it, kz, jy, ix, xb % ds
3423 write(be_print_unit,'("Namelist options specified for this iteration:")')
3424 write(be_print_unit,'("var_scaling1(it) = ",e12.5,2x,"len_scaling1(it) = "e12.5)')var_scaling1(it),len_scaling1(it)
3425 write(be_print_unit,'("var_scaling2(it) = ",e12.5,2x,"len_scaling2(it) = "e12.5)')var_scaling2(it),len_scaling2(it)
3426 write(be_print_unit,'("var_scaling3(it) = ",e12.5,2x,"len_scaling3(it) = "e12.5)')var_scaling3(it),len_scaling3(it)
3427 write(be_print_unit,'("var_scaling4(it) = ",e12.5,2x,"len_scaling4(it) = "e12.5)')var_scaling4(it),len_scaling4(it)
3428 write(be_print_unit,'("var_scaling5(it) = ",e12.5,2x,"len_scaling5(it) = "e12.5)')var_scaling5(it),len_scaling5(it)
3429 write(be_print_unit,'("Background error statistics for this iteration:")')
3430 write(be_print_unit,'("mz=",i3,2x,"be%v1%val:"/(10e12.5))') be%v1%mz, be%v1%val(1,:)
3431 write(be_print_unit,'("mz=",i3,2x,"be%v2%val:"/(10e12.5))') be%v2%mz, be%v2%val(1,:)
3432 write(be_print_unit,'("mz=",i3,2x,"be%v3%val:"/(10e12.5))') be%v3%mz, be%v3%val(1,:)
3433 write(be_print_unit,'("mz=",i3,2x,"be%v4%val:"/(10e12.5))') be%v4%mz, be%v4%val(1,:)
3434 write(be_print_unit,'("mz=",i3,2x,"be%v5%val:"/(10e12.5))') be%v5%mz, be%v5%val(1,:)
3436 if ( cloud_cv_options >= 2 ) then
3437 write(be_print_unit,'("mz=",i3,2x,"be%v6%val:"/(10e12.5))') be%v6%mz, be%v6%val(1,:)
3438 write(be_print_unit,'("mz=",i3,2x,"be%v7%val:"/(10e12.5))') be%v7%mz, be%v7%val(1,:)
3439 write(be_print_unit,'("mz=",i3,2x,"be%v8%val:"/(10e12.5))') be%v8%mz, be%v8%val(1,:)
3440 write(be_print_unit,'("mz=",i3,2x,"be%v9%val:"/(10e12.5))') be%v9%mz, be%v9%val(1,:)
3441 write(be_print_unit,'("mz=",i3,2x,"be%v10%val:"/(10e12.5))') be%v10%mz, be%v10%val(1,:)
3444 if ( chem_cv_options >= 10 ) then
3445 do i=1,num_cv_3d_chem
3446 write(be_print_unit,'("mz=",i3,2x,"be%v12%val:"/(10e12.5))') be%v12(i)%mz, be%v12(i)%val(1,:)
3450 if ( use_cv_w ) then
3451 write(be_print_unit,'("mz=",i3,2x,"be%v11%val:"/(10e12.5))') be%v11%mz, be%v11%val(1,:)
3454 write(be_print_unit,'(/"scale-length: kz=",i3)') kz
3455 write(be_print_unit,'("be%v1%rf_alpha:"/(10e12.5))') be % v1 % rf_alpha(:)
3456 write(be_print_unit,'("be%v2%rf_alpha:"/(10e12.5))') be % v2 % rf_alpha(:)
3457 write(be_print_unit,'("be%v3%rf_alpha:"/(10e12.5))') be % v3 % rf_alpha(:)
3458 write(be_print_unit,'("be%v4%rf_alpha:"/(10e12.5))') be % v4 % rf_alpha(:)
3459 write(be_print_unit,'("be%v5%rf_alpha:"/(10e12.5))') be % v5 % rf_alpha(:)
3461 if ( cloud_cv_options >= 2 ) then
3462 write(be_print_unit,'("be%v6%rf_alpha:"/(10e12.5))') be % v6 % rf_alpha(:)
3463 write(be_print_unit,'("be%v7%rf_alpha:"/(10e12.5))') be % v7 % rf_alpha(:)
3464 write(be_print_unit,'("be%v8%rf_alpha:"/(10e12.5))') be % v8 % rf_alpha(:)
3465 write(be_print_unit,'("be%v9%rf_alpha:"/(10e12.5))') be % v9 % rf_alpha(:)
3466 write(be_print_unit,'("be%v10%rf_alpha:"/(10e12.5))') be % v10 % rf_alpha(:)
3469 if ( chem_cv_options >= 10 ) then
3470 do i=1,num_cv_3d_chem
3471 write(be_print_unit,'("be%v12%rf_alpha:"/(10e12.5))') be % v12(i) % rf_alpha(:)
3475 if ( use_cv_w ) then
3476 write(be_print_unit,'("be%v11%rf_alpha:"/(10e12.5))') be % v11 % rf_alpha(:)
3479 write(be_print_unit,'(/"scale-length: kz=",i3)') kz
3482 write(be_print_unit,'(i3,2x,5e15.5)') i, be1_rf_lengthscale(i), be2_rf_lengthscale(i), &
3483 be3_rf_lengthscale(i), be4_rf_lengthscale(i), be5_rf_lengthscale(i)
3485 write(be_print_unit,'(i3,2x,4e15.5)') i, be1_rf_lengthscale(i), be2_rf_lengthscale(i), &
3486 be3_rf_lengthscale(i), be4_rf_lengthscale(i)
3489 if ( cloud_cv_options >= 2 ) then
3491 write(be_print_unit,'(i3,2x,5e15.5)') i, be6_rf_lengthscale(i), be7_rf_lengthscale(i), &
3492 be8_rf_lengthscale(i), be9_rf_lengthscale(i), be10_rf_lengthscale(i)
3495 !#if (WRF_CHEM == 1)
3496 ! if ( chem_cv_options >= 10 ) then
3498 ! write(be_print_unit,'(i3,2x,22e15.5)') i, be12_rf_lengthscale(ic,i)
3503 endif ! print_detail_be
3506 close(be_print_unit)
3507 call da_free_unit(be_rf_unit)
3508 call da_free_unit(be_print_unit)
3510 ! 8.0 deallocate input model state:
3511 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3513 deallocate (be1_eval_loc)
3514 deallocate (be2_eval_loc)
3515 deallocate (be3_eval_loc)
3516 deallocate (be4_eval_loc)
3517 deallocate (be5_eval_loc)
3519 if ( cloud_cv_options >= 2 ) then
3520 deallocate (be6_eval_loc)
3521 deallocate (be7_eval_loc)
3522 deallocate (be8_eval_loc)
3523 deallocate (be9_eval_loc)
3524 deallocate (be10_eval_loc)
3527 if ( chem_cv_options >= 10 ) then
3528 deallocate (be12_eval_loc)
3531 if ( use_cv_w ) then
3532 deallocate (be11_eval_loc)
3536 deallocate (be1_rf_lengthscale)
3537 deallocate (be2_rf_lengthscale)
3538 deallocate (be3_rf_lengthscale)
3539 deallocate (be4_rf_lengthscale)
3540 deallocate (be5_rf_lengthscale)
3542 if ( cloud_cv_options >= 2 ) then
3543 deallocate (be6_rf_lengthscale)
3544 deallocate (be7_rf_lengthscale)
3545 deallocate (be8_rf_lengthscale)
3546 deallocate (be9_rf_lengthscale)
3547 deallocate (be10_rf_lengthscale)
3550 if ( chem_cv_options >= 10 ) then
3551 deallocate (be12_rf_lengthscale)
3554 if ( use_cv_w ) then
3555 deallocate (be11_rf_lengthscale)
3559 if (vert_corr == vert_corr_2) then
3560 deallocate (be1_eval_glo)
3561 deallocate (be2_eval_glo)
3562 deallocate (be3_eval_glo)
3563 deallocate (be4_eval_glo)
3564 deallocate (be5_eval_glo)
3566 if ( cloud_cv_options >= 2 ) then
3567 deallocate (be6_eval_glo)
3568 deallocate (be7_eval_glo)
3569 deallocate (be8_eval_glo)
3570 deallocate (be9_eval_glo)
3571 deallocate (be10_eval_glo)
3574 if ( chem_cv_options >= 10 ) then
3575 deallocate (be12_eval_glo)
3578 if ( use_cv_w ) then
3579 deallocate (be11_eval_glo)
3582 deallocate (be1_evec_loc)
3583 deallocate (be2_evec_loc)
3584 deallocate (be3_evec_loc)
3585 deallocate (be4_evec_loc)
3586 deallocate (be5_evec_loc)
3588 if ( cloud_cv_options >= 2 ) then
3589 deallocate (be6_evec_loc)
3590 deallocate (be7_evec_loc)
3591 deallocate (be8_evec_loc)
3592 deallocate (be9_evec_loc)
3593 deallocate (be10_evec_loc)
3596 if ( chem_cv_options >= 10 ) then
3597 deallocate (be12_evec_loc)
3600 if ( use_cv_w ) then
3601 deallocate (be11_evec_loc)
3604 deallocate (be1_evec_glo)
3605 deallocate (be2_evec_glo)
3606 deallocate (be3_evec_glo)
3607 deallocate (be4_evec_glo)
3608 deallocate (be5_evec_glo)
3610 if ( cloud_cv_options >= 2 ) then
3611 deallocate (be6_evec_glo)
3612 deallocate (be7_evec_glo)
3613 deallocate (be8_evec_glo)
3614 deallocate (be9_evec_glo)
3615 deallocate (be10_evec_glo)
3618 if ( chem_cv_options >= 10 ) then
3619 deallocate (be12_evec_glo)
3622 if ( use_cv_w ) then
3623 deallocate (be11_evec_glo)
3631 else ! jb_factor <= 0.0
3646 end if ! jb_factor > 0.0
3648 if (be % ne > 0) then
3649 be % alpha % name = 'alpha'
3650 allocate (alpha_val(1:nk)) ! Not using jy dimension yet.
3651 allocate (alpha_evec(1:nk,1:nk)) ! Not using jy dimension yet.
3653 if ( alpha_vertloc_opt > 0 ) then ! Use vertical localization:
3654 if ( rootproc ) then
3655 call da_get_alpha_vertloc(xb, alpha_val, alpha_evec)
3657 call wrf_dm_bcast_real(alpha_val, nk)
3658 call wrf_dm_bcast_real(alpha_evec, nk*nk)
3659 be % alpha % mz = nk
3660 call da_get_vertical_truncation(max_vert_var_alpha, alpha_val, be % alpha)
3662 be % alpha % mz = 1 ! No vertical localization.
3664 alpha_val(2:kz) = 0.0
3665 alpha_evec(:,:) = 1.0
3667 mz = be % alpha % mz
3669 ! Alpha eigenvalues and eigenvectors:
3670 allocate (be % alpha % val(1:jy,1:mz)) ! Not using jy dimension but here for consistency.
3671 allocate (be % alpha % evec(1:nj,1:nk,1:mz))
3673 if ( anal_type_hybrid_dual_res ) then
3674 deallocate(be % alpha % val, be % alpha % evec)
3675 allocate (be % alpha % val(jds_int:jde_int,1:mz))
3676 allocate (be % alpha % evec(jds_int:jde_int,1:nk,1:mz))
3681 be % alpha % val(:,m) = sigma_alpha * alpha_val(m)
3683 be % alpha % evec(:,k,m) = alpha_evec(k,m)
3687 ! Alpha RF lengthscales and variance scaling factors:
3688 allocate (alpha_rf_lengthscale(1:mz))
3689 allocate (be % alpha % rf_alpha(1:mz))
3690 allocate (alpha_rf_scale_factor(1:mz))
3693 if ( anal_type_hybrid_dual_res ) then
3694 alpha_rf_lengthscale(1:mz) = 1000.0 * alpha_corr_scale / (grid%intermediate_grid % dx )
3696 alpha_rf_lengthscale(1:mz) = 1000.0 * alpha_corr_scale / xb % ds ! Convert km to grid spacings.
3700 call da_calculate_rf_factors( alpha_rf_lengthscale(:), be % alpha % rf_alpha(:), &
3701 alpha_rf_scale_factor(:) )
3703 be % alpha % val(:,m) = alpha_rf_scale_factor(m) * be % alpha % val(:,m)
3706 if( .not. use_rf ) then
3707 allocate(be%alpha%wsd(nij(0,1,2),nij(0,0,2),mz))
3708 call random_number(be%alpha%wsd) ! need to parallelize
3709 if( do_normalize )then
3710 allocate(be%alpha%sd(nij(0,1,0),nij(0,0,0),mz))
3711 call random_number(be%alpha%sd) ! need to parallelize
3715 deallocate(alpha_val)
3716 deallocate(alpha_evec)
3717 deallocate(alpha_rf_lengthscale)
3718 deallocate(alpha_rf_scale_factor)
3724 be%cv_mz(1) = be%v1%mz
3725 be%cv_mz(2) = be%v2%mz
3726 be%cv_mz(3) = be%v3%mz
3727 be%cv_mz(4) = be%v4%mz
3728 be%cv_mz(5) = be%v5%mz
3729 if ( cloud_cv_options >= 2 ) then
3730 be%cv_mz(6) = be%v6%mz
3731 be%cv_mz(7) = be%v7%mz
3732 be%cv_mz(8) = be%v8%mz
3733 be%cv_mz(9) = be%v9%mz
3734 be%cv_mz(10) = be%v10%mz
3737 if ( chem_cv_options >= 10 ) then
3738 be % ncv_mz_chemic = num_cv_3d_chem
3739 allocate ( be%cv_mz_chemic(1:be%ncv_mz_chemic) )
3740 be%cv_mz_chemic(:) = 0 ! initialize
3742 do i=1,num_cv_3d_chem
3743 be%cv_mz_chemic(i) = be%v12(i)%mz
3747 if ( use_cv_w ) then
3748 if (be%ncv_mz ==8 .or. be%ncv_mz ==13 ) then
3749 be%cv_mz(be%ncv_mz-2) = be%v11%mz
3751 be%cv_mz(num_cv_3d_basic+num_cv_3d_extra+num_cv_2d) = be%v11%mz
3753 !be%cv_mz(num_cv_3d_basic+num_cv_3d_extra+num_cv_2d) = be%v11%mz ! This is a bug. (Soyoung on Aug-2021)
3755 be%cv_mz(be%ncv_mz-1) = be%alpha%mz
3756 be%cv_mz(be%ncv_mz) = be%ne
3758 if (trace_use) call da_trace_exit("da_setup_be_regional")
3760 end subroutine da_setup_be_regional