22 real(kind_real),
parameter ::
var_min = 1.0e-24_kind_real
31 real(kind_real),
allocatable :: m2(:,:)
32 real(kind_real),
allocatable :: m4(:,:)
33 real(kind_real),
allocatable :: m2flt(:)
34 real(kind_real),
allocatable :: nc1a(:,:,:)
35 real(kind_real),
allocatable :: m11(:,:,:)
36 real(kind_real),
allocatable :: m11m11(:,:,:,:,:)
37 real(kind_real),
allocatable :: m2m2(:,:,:,:,:)
38 real(kind_real),
allocatable :: m22(:,:,:,:)
39 real(kind_real),
allocatable :: nc1a_cor(:,:,:)
40 real(kind_real),
allocatable :: cor(:,:,:)
41 real(kind_real),
allocatable :: m11asysq(:,:,:)
42 real(kind_real),
allocatable :: m2m2asy(:,:,:)
43 real(kind_real),
allocatable :: m22asy(:,:,:)
44 real(kind_real),
allocatable :: m11sq(:,:,:)
45 real(kind_real),
allocatable :: m11sta(:,:,:)
46 real(kind_real),
allocatable :: stasq(:,:,:)
47 real(kind_real),
allocatable :: m11lrm11sub(:,:,:,:,:)
48 real(kind_real),
allocatable :: m11lrm11(:,:,:)
49 real(kind_real),
allocatable :: m11lrm11asy(:,:,:)
69 subroutine avg_blk_alloc(avg_blk,nam,geom,bpar,ic2,ib,ne,nsub)
74 class(avg_blk_type),
intent(inout) :: avg_blk
75 type(nam_type),
intent(in) :: nam
76 type(geom_type),
intent(in) :: geom
77 type(bpar_type),
intent(in) :: bpar
78 integer,
intent(in) :: ne
79 integer,
intent(in) :: nsub
80 integer,
intent(in) :: ic2
81 integer,
intent(in) :: ib
90 if (.not.
allocated(avg_blk%nc1a))
then 91 if ((ic2==0).or.(nam%var_diag))
then 92 allocate(avg_blk%m2(geom%nl0,avg_blk%nsub))
93 if (nam%var_filter)
then 94 if (.not.nam%gau_approx)
allocate(avg_blk%m4(geom%nl0,avg_blk%nsub))
95 allocate(avg_blk%m2flt(geom%nl0))
98 if ((ic2==0).or.(nam%local_diag))
then 99 allocate(avg_blk%nc1a(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
100 allocate(avg_blk%m11(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
101 allocate(avg_blk%m11m11(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0,avg_blk%nsub,avg_blk%nsub))
102 allocate(avg_blk%m2m2(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0,avg_blk%nsub,avg_blk%nsub))
103 if (.not.nam%gau_approx)
allocate(avg_blk%m22(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0,avg_blk%nsub))
104 allocate(avg_blk%nc1a_cor(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
105 allocate(avg_blk%cor(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
106 allocate(avg_blk%m11asysq(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
107 allocate(avg_blk%m2m2asy(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
108 if (.not.nam%gau_approx)
allocate(avg_blk%m22asy(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
109 allocate(avg_blk%m11sq(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
110 select case (trim(nam%method))
111 case (
'hyb-avg',
'hyb-rnd')
112 allocate(avg_blk%m11sta(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
113 allocate(avg_blk%stasq(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
115 allocate(avg_blk%m11lrm11sub(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0,avg_blk%nsub,avg_blk%nsub))
116 allocate(avg_blk%m11lrm11(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
117 allocate(avg_blk%m11lrm11asy(bpar%nc3(ib),bpar%nl0r(ib),geom%nl0))
123 if ((ic2==0).or.(nam%var_diag))
then 125 if (nam%var_filter)
then 126 if (.not.nam%gau_approx)
call msr(avg_blk%m4)
127 call msr(avg_blk%m2flt)
130 if ((ic2==0).or.(nam%local_diag))
then 131 call msr(avg_blk%nc1a)
132 call msr(avg_blk%m11)
133 call msr(avg_blk%m11m11)
134 call msr(avg_blk%m2m2)
135 if (.not.nam%gau_approx)
call msr(avg_blk%m22)
136 call msr(avg_blk%nc1a_cor)
137 call msr(avg_blk%cor)
138 call msr(avg_blk%m11asysq)
139 call msr(avg_blk%m2m2asy)
140 if (.not.nam%gau_approx)
call msr(avg_blk%m22asy)
141 call msr(avg_blk%m11sq)
142 select case (trim(nam%method))
143 case (
'hyb-avg_blk',
'hyb-rnd')
144 call msr(avg_blk%m11sta)
145 call msr(avg_blk%stasq)
147 call msr(avg_blk%m11lrm11sub)
148 call msr(avg_blk%m11lrm11)
149 call msr(avg_blk%m11lrm11asy)
164 class(avg_blk_type),
intent(inout) :: avg_blk
167 if (
allocated(avg_blk%m2))
deallocate(avg_blk%m2)
168 if (
allocated(avg_blk%m4))
deallocate(avg_blk%m4)
169 if (
allocated(avg_blk%m2flt))
deallocate(avg_blk%m2flt)
170 if (
allocated(avg_blk%nc1a))
deallocate(avg_blk%nc1a)
171 if (
allocated(avg_blk%m11))
deallocate(avg_blk%m11)
172 if (
allocated(avg_blk%m11m11))
deallocate(avg_blk%m11m11)
173 if (
allocated(avg_blk%m2m2))
deallocate(avg_blk%m2m2)
174 if (
allocated(avg_blk%nc1a_cor))
deallocate(avg_blk%nc1a_cor)
175 if (
allocated(avg_blk%cor))
deallocate(avg_blk%cor)
176 if (
allocated(avg_blk%m11asysq))
deallocate(avg_blk%m11asysq)
177 if (
allocated(avg_blk%m2m2asy))
deallocate(avg_blk%m2m2asy)
178 if (
allocated(avg_blk%m11sq))
deallocate(avg_blk%m11sq)
179 if (
allocated(avg_blk%m11sta))
deallocate(avg_blk%m11sta)
180 if (
allocated(avg_blk%stasq))
deallocate(avg_blk%stasq)
181 if (
allocated(avg_blk%m11lrm11sub))
deallocate(avg_blk%m11lrm11sub)
182 if (
allocated(avg_blk%m11lrm11))
deallocate(avg_blk%m11lrm11)
183 if (
allocated(avg_blk%m11lrm11asy))
deallocate(avg_blk%m11lrm11asy)
191 type(avg_blk_type) function avg_blk_copy(avg_blk,nam,geom,bpar)
202 call avg_blk_copy%dealloc
205 call avg_blk_copy%alloc(nam,geom,bpar,avg_blk%ic2,avg_blk%ib,avg_blk%ne,avg_blk%nsub)
208 if ((avg_blk%ic2==0).or.(nam%var_diag))
then 209 avg_blk_copy%m2 = avg_blk%m2
210 if (nam%var_filter)
then 211 if (.not.nam%gau_approx) avg_blk_copy%m4 = avg_blk%m4
212 avg_blk_copy%m2flt = avg_blk%m2flt
215 if ((avg_blk%ic2==0).or.(nam%local_diag))
then 216 avg_blk_copy%nc1a = avg_blk%nc1a
217 avg_blk_copy%m11 = avg_blk%m11
218 avg_blk_copy%m11m11 = avg_blk%m11m11
219 avg_blk_copy%m2m2 = avg_blk%m2m2
220 if (.not.nam%gau_approx) avg_blk_copy%m22 = avg_blk%m22
221 avg_blk_copy%nc1a_cor = avg_blk%nc1a_cor
222 avg_blk_copy%cor = avg_blk%cor
223 avg_blk_copy%m11asysq = avg_blk%m11asysq
224 avg_blk_copy%m2m2asy = avg_blk%m2m2asy
225 if (.not.nam%gau_approx) avg_blk_copy%m22asy = avg_blk%m22asy
226 avg_blk_copy%m11sq = avg_blk%m11sq
227 select case (trim(nam%method))
228 case (
'hyb-avg_blk',
'hyb-rnd')
229 avg_blk_copy%m11sta = avg_blk%m11sta
230 avg_blk_copy%stasq = avg_blk%stasq
232 avg_blk_copy%m11lrm11sub = avg_blk%m11lrm11sub
233 avg_blk_copy%m11lrm11sub = avg_blk%m11lrm11sub
234 avg_blk_copy%m11lrm11asy = avg_blk%m11lrm11asy
249 class(avg_blk_type),
intent(inout) :: avg_blk
250 type(nam_type),
intent(in) :: nam
251 type(geom_type),
intent(in) :: geom
252 type(bpar_type),
intent(in) :: bpar
253 type(samp_type),
intent(in) :: samp
254 type(mom_blk_type),
intent(in) :: mom_blk
257 integer :: il0,jl0,jl0r,jc3,isub,jsub,ic1a,ic1,nc1amax,nc1a
258 real(kind_real) :: m2_1,m2_2
259 real(kind_real),
allocatable :: list_m11(:),list_m11m11(:,:,:),list_m2m2(:,:,:),list_m22(:,:),list_cor(:)
260 logical :: involved,valid
263 associate(ic2=>avg_blk%ic2,ib=>avg_blk%ib)
265 if ((ic2==0).or.(nam%var_diag))
then 268 do isub=1,avg_blk%nsub
270 jl0r = bpar%il0rz(il0,ib)
271 avg_blk%m2(il0,isub) = sum(mom_blk%m2_1(:,1,il0,isub))/
real(nam%nc1,kind_real)
272 if (nam%var_filter.and.(.not.nam%gau_approx)) avg_blk%m4(il0,isub) = sum(mom_blk%m22(:,1,jl0r,il0,isub)) &
273 & /
real(nam%nc1,kind_real)
278 if (nam%var_filter.and.(.not.nam%gau_approx)) avg_blk%m4 = 0.0
280 ic1 = samp%c1a_to_c1(ic1a)
281 if (ic1==samp%c2_to_c1(ic2))
then 282 do isub=1,avg_blk%nsub
284 jl0r = bpar%il0rz(il0,ib)
285 avg_blk%m2(il0,isub) = mom_blk%m2_1(ic1a,1,il0,isub)
286 if (nam%var_filter.and.(.not.nam%gau_approx)) avg_blk%m4(il0,isub) = mom_blk%m22(ic1a,1,jl0r,il0,isub)
294 if ((ic2==0).or.(nam%local_diag))
then 297 involved = any(samp%local_mask(samp%c1a_to_c1,ic2))
307 do jl0r=1,bpar%nl0r(ib)
308 jl0 = bpar%l0rl0b_to_l0(jl0r,il0,ib)
312 nc1amax = count(samp%local_mask(samp%c1a_to_c1,ic2))
316 allocate(list_m11(nc1amax))
317 allocate(list_m11m11(nc1amax,avg_blk%nsub,avg_blk%nsub))
318 allocate(list_m2m2(nc1amax,avg_blk%nsub,avg_blk%nsub))
319 allocate(list_m22(nc1amax,avg_blk%nsub))
320 allocate(list_cor(nc1amax))
322 do jc3=1,bpar%nc3(ib)
327 ic1 = samp%c1a_to_c1(ic1a)
330 valid = samp%c1l0_log(ic1,il0).and.samp%c1c3l0_log(ic1,jc3,jl0)
331 if (ic2>0) valid = valid.and.samp%local_mask(ic1,ic2)
338 list_m11(nc1a) = sum(mom_blk%m11(ic1a,jc3,jl0r,il0,:))/
real(avg_blk%nsub,kind_real)
339 do isub=1,avg_blk%nsub
340 do jsub=1,avg_blk%nsub
341 list_m11m11(nc1a,jsub,isub) = mom_blk%m11(ic1a,jc3,jl0r,il0,isub)*mom_blk%m11(ic1a,jc3,jl0r,il0,jsub)
342 list_m2m2(nc1a,jsub,isub) = mom_blk%m2_1(ic1a,jc3,il0,isub)*mom_blk%m2_2(ic1a,jc3,jl0,jsub)
344 if (.not.nam%gau_approx) list_m22(nc1a,isub) = mom_blk%m22(ic1a,jc3,jl0r,il0,isub)
348 m2_1 = sum(mom_blk%m2_1(ic1a,jc3,il0,:))/
real(avg_blk%nsub,kind_real)
349 m2_2 = sum(mom_blk%m2_2(ic1a,jc3,jl0,:))/
real(avg_blk%nsub,kind_real)
351 list_cor(nc1a) = list_m11(nc1a)/sqrt(m2_1*m2_2)
352 if (sup(abs(list_cor(nc1a)),1.0_kind_real))
call msr(list_cor(nc1a))
354 call msr(list_cor(nc1a))
360 avg_blk%nc1a(jc3,jl0r,il0) =
real(nc1a,kind_real)
362 avg_blk%m11(jc3,jl0r,il0) = sum(list_m11(1:nc1a))
363 do isub=1,avg_blk%nsub
364 do jsub=1,avg_blk%nsub
365 avg_blk%m11m11(jc3,jl0r,il0,jsub,isub) = sum(list_m11m11(1:nc1a,jsub,isub))
366 avg_blk%m2m2(jc3,jl0r,il0,jsub,isub) = sum(list_m2m2(1:nc1a,jsub,isub))
368 if (.not.nam%gau_approx) avg_blk%m22(jc3,jl0r,il0,isub) = sum(list_m22(1:nc1a,isub))
370 avg_blk%nc1a_cor(jc3,jl0r,il0) =
real(count(isnotmsr(list_cor(1:nc1a))),kind_real)
371 if (avg_blk%nc1a_cor(jc3,jl0r,il0)>0.0)
then 372 avg_blk%cor(jc3,jl0r,il0) = sum(list_cor(1:nc1a),mask=isnotmsr(list_cor(1:nc1a)))
374 call msr(avg_blk%cor(jc3,jl0r,il0))
377 avg_blk%m11(jc3,jl0r,il0) = 0.0
378 do isub=1,avg_blk%nsub
379 do jsub=1,avg_blk%nsub
380 avg_blk%m11m11(jc3,jl0r,il0,jsub,isub) = 0.0
381 avg_blk%m2m2(jc3,jl0r,il0,jsub,isub) = 0.0
383 if (.not.nam%gau_approx) avg_blk%m22(jc3,jl0r,il0,isub) = 0.0
385 avg_blk%nc1a_cor(jc3,jl0r,il0) = 0.0
386 avg_blk%cor(jc3,jl0r,il0) = 0.0
392 deallocate(list_m11m11)
393 deallocate(list_m2m2)
405 if (.not.nam%gau_approx) avg_blk%m22 = 0.0
406 avg_blk%nc1a_cor = 0.0
425 class(avg_blk_type),
intent(inout) :: avg_blk
426 type(nam_type),
intent(in) :: nam
427 type(geom_type),
intent(in) :: geom
428 type(bpar_type),
intent(in) :: bpar
429 integer,
intent(in) :: ne
432 integer :: il0,jl0r,jc3,isub,jsub,n
433 real(kind_real) :: P1,P3,P4,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17
434 real(kind_real),
allocatable :: m11asysq(:,:),m2m2asy(:,:),m22asy(:)
437 associate(ic2=>avg_blk%ic2,ib=>avg_blk%ib)
439 if ((ic2==0).or.(nam%local_diag))
then 442 p1 = 1.0/
real(n,kind_real)
443 p3 = 1.0/
real(n*(n-1),kind_real)
444 p4 = 1.0/
real(n-1,kind_real)
445 p14 =
real(n**2-2*n+2,kind_real)/
real(n*(n-1),kind_real)
446 p16 =
real(n,kind_real)/
real(n-1,kind_real)
449 n = avg_blk%ne/avg_blk%nsub
450 p7 =
real((n-1)*(n**2-3*n+1),kind_real)/
real(n*(n-2)*(n-3),kind_real)
451 p8 =
real(n-1,kind_real)/
real(n*(n-2)*(n-3),kind_real)
452 p9 = -
real(n,kind_real)/
real((n-2)*(n-3),kind_real)
453 p10 = -
real((n-1)*(2*n-3),kind_real)/
real(n*(n-2)*(n-3),kind_real)
454 p11 =
real(n*(n**2-2*n+3),kind_real)/
real((n-1)*(n-2)*(n-3),kind_real)
455 p12 =
real(n*(n-1),kind_real)/
real((n-2)*(n+1),kind_real)
456 p13 = -
real(n-1,kind_real)/
real((n-2)*(n+1),kind_real)
457 p15 =
real((n-1)**2,kind_real)/
real(n*(n-3),kind_real)
458 p17 =
real((n-1)**2,kind_real)/
real((n-2)*(n+1),kind_real)
463 do jl0r=1,bpar%nl0r(ib)
464 do jc3=1,bpar%nc3(ib)
465 if (avg_blk%nc1a_cor(jc3,jl0r,il0)>
nc1a_cor_th*avg_blk%nc1a(jc3,jl0r,il0))
then 467 allocate(m11asysq(avg_blk%nsub,avg_blk%nsub))
468 allocate(m2m2asy(avg_blk%nsub,avg_blk%nsub))
469 allocate(m22asy(avg_blk%nsub))
472 do isub=1,avg_blk%nsub
473 do jsub=1,avg_blk%nsub
476 if (nam%gau_approx)
then 478 m11asysq(jsub,isub) = p17*avg_blk%m11m11(jc3,jl0r,il0,jsub,isub) &
479 & +p13*avg_blk%m2m2(jc3,jl0r,il0,jsub,isub)
480 m2m2asy(jsub,isub) = 2.0*p13*avg_blk%m11m11(jc3,jl0r,il0,jsub,isub) &
481 & +p12*avg_blk%m2m2(jc3,jl0r,il0,jsub,isub)
484 m11asysq(jsub,isub) = p15*avg_blk%m11m11(jc3,jl0r,il0,jsub,isub) &
485 & +p8*avg_blk%m2m2(jc3,jl0r,il0,jsub,isub)+p9*avg_blk%m22(jc3,jl0r,il0,jsub)
486 m2m2asy(jsub,isub) = 2.0*p8*avg_blk%m11m11(jc3,jl0r,il0,jsub,isub) &
487 & +p7*avg_blk%m2m2(jc3,jl0r,il0,jsub,isub)+p9*avg_blk%m22(jc3,jl0r,il0,jsub)
488 m22asy(jsub) = p10*(2.0*avg_blk%m11m11(jc3,jl0r,il0,jsub,isub)+avg_blk%m2m2(jc3,jl0r,il0,jsub,isub)) &
489 & +p11*avg_blk%m22(jc3,jl0r,il0,jsub)
493 m11asysq(jsub,isub) = avg_blk%m11m11(jc3,jl0r,il0,jsub,isub)
494 m2m2asy(jsub,isub) = avg_blk%m2m2(jc3,jl0r,il0,jsub,isub)
500 avg_blk%m11asysq(jc3,jl0r,il0) = sum(m11asysq)/
real(avg_blk%nsub**2,kind_real)
501 avg_blk%m2m2asy(jc3,jl0r,il0) = sum(m2m2asy)/
real(avg_blk%nsub**2,kind_real)
502 if (.not.nam%gau_approx) avg_blk%m22asy(jc3,jl0r,il0) = sum(m22asy)/
real(avg_blk%nsub,kind_real)
505 if (avg_blk%m11asysq(jc3,jl0r,il0)<0.0)
call msr(avg_blk%m11asysq(jc3,jl0r,il0))
506 if (avg_blk%m2m2asy(jc3,jl0r,il0)<0.0)
call msr(avg_blk%m2m2asy(jc3,jl0r,il0))
507 if (.not.nam%gau_approx)
then 508 if (avg_blk%m22asy(jc3,jl0r,il0)<0.0)
call msr(avg_blk%m22asy(jc3,jl0r,il0))
512 if (nam%gau_approx)
then 514 if (isnotmsr(avg_blk%m11asysq(jc3,jl0r,il0)).and.isnotmsr(avg_blk%m2m2asy(jc3,jl0r,il0))) &
515 & avg_blk%m11sq(jc3,jl0r,il0) = p16*avg_blk%m11asysq(jc3,jl0r,il0)+p4*avg_blk%m2m2asy(jc3,jl0r,il0)
518 if (isnotmsr(avg_blk%m22asy(jc3,jl0r,il0)).and.isnotmsr(avg_blk%m11asysq(jc3,jl0r,il0)) &
519 & .and.isnotmsr(avg_blk%m2m2asy(jc3,jl0r,il0))) &
520 & avg_blk%m11sq(jc3,jl0r,il0) = p1*avg_blk%m22asy(jc3,jl0r,il0)+p14*avg_blk%m11asysq(jc3,jl0r,il0) &
521 & +p3*avg_blk%m2m2asy(jc3,jl0r,il0)
525 if (ismsr(avg_blk%m11sq(jc3,jl0r,il0)))
then 526 if (inf(avg_blk%m11sq(jc3,jl0r,il0),avg_blk%m11asysq(jc3,jl0r,il0)))
call msr(avg_blk%m11sq(jc3,jl0r,il0))
527 if (inf(avg_blk%m11sq(jc3,jl0r,il0),avg_blk%m11(jc3,jl0r,il0)**2))
call msr(avg_blk%m11sq(jc3,jl0r,il0))
555 class(avg_blk_type),
intent(inout) :: avg_blk_lr
556 type(mpl_type),
intent(in) :: mpl
557 type(nam_type),
intent(in) :: nam
558 type(geom_type),
intent(in) :: geom
559 type(bpar_type),
intent(in) :: bpar
560 type(samp_type),
intent(in) :: samp
561 type(mom_blk_type),
intent(in) :: mom_blk
562 type(mom_blk_type),
intent(in) :: mom_lr_blk
565 integer :: il0,jl0,jl0r,jc3,isub,jsub,ic1a,ic1,nc1amax,nc1a
566 real(kind_real),
allocatable :: list_m11lrm11(:,:,:)
570 associate(ic2=>avg_blk_lr%ic2,ib=>avg_blk_lr%ib)
572 if ((ic2==0).or.(nam%local_diag))
then 574 if (avg_blk_lr%nsub/=avg_blk_lr%nsub)
call mpl%abort(
'different number of sub-ensembles')
579 do jl0r=1,bpar%nl0r(ib)
580 jl0 = bpar%l0rl0b_to_l0(jl0r,il0,ib)
584 nc1amax = count(samp%local_mask(samp%c1a_to_c1,ic2))
588 allocate(list_m11lrm11(nc1amax,avg_blk_lr%nsub,avg_blk_lr%nsub))
590 do jc3=1,bpar%nc3(ib)
595 ic1 = samp%c1a_to_c1(ic1a)
598 valid = samp%c1l0_log(ic1,il0).and.samp%c1c3l0_log(ic1,jc3,jl0)
599 if (ic2>0) valid = valid.and.samp%local_mask(ic1,ic2)
606 do isub=1,avg_blk_lr%nsub
607 do jsub=1,avg_blk_lr%nsub
608 list_m11lrm11(nc1a,jsub,isub) = mom_blk%m11(ic1a,jc3,jl0r,il0,isub)*mom_lr_blk%m11(ic1a,jc3,jl0r,il0,jsub)
615 avg_blk_lr%nc1a(jc3,jl0r,il0) =
real(nc1a,kind_real)
616 do isub=1,avg_blk_lr%nsub
617 do jsub=1,avg_blk_lr%nsub
618 avg_blk_lr%m11lrm11sub(jc3,jl0r,il0,jsub,isub) = sum(list_m11lrm11(1:nc1a,jsub,isub))
624 deallocate(list_m11lrm11)
644 class(avg_blk_type),
intent(inout) :: avg_blk_lr
645 type(nam_type),
intent(in) :: nam
646 type(geom_type),
intent(in) :: geom
647 type(bpar_type),
intent(in) :: bpar
650 integer :: il0,jl0r,jc3,isub,jsub
653 associate(ic2=>avg_blk_lr%ic2,ib=>avg_blk_lr%ib)
655 if ((ic2==0).or.(nam%local_diag))
then 659 do jl0r=1,bpar%nl0r(ib)
660 do jc3=1,bpar%nc3(ib)
661 if (avg_blk_lr%nc1a(jc3,jl0r,il0)>0.0)
then 662 do isub=1,avg_blk_lr%nsub
663 do jsub=1,avg_blk_lr%nsub
664 avg_blk_lr%m11lrm11sub(jc3,jl0r,il0,jsub,isub) = avg_blk_lr%m11lrm11sub(jc3,jl0r,il0,jsub,isub) &
665 & /avg_blk_lr%nc1a(jc3,jl0r,il0)
677 do jl0r=1,bpar%nl0r(ib)
678 do jc3=1,bpar%nc3(ib)
679 if (isanynotmsr(avg_blk_lr%m11lrm11sub(jc3,jl0r,il0,:,:)))
then 680 avg_blk_lr%m11lrm11(jc3,jl0r,il0) = sum(avg_blk_lr%m11lrm11sub(jc3,jl0r,il0,:,:), &
681 & mask=isnotmsr(avg_blk_lr%m11lrm11sub(jc3,jl0r,il0,:,:))) &
682 & /
real(count(isnotmsr(avg_blk_lr%m11lrm11sub(jc3,jl0r,il0,:,:))),kind_real)
690 avg_blk_lr%m11lrm11asy = avg_blk_lr%m11lrm11
subroutine avg_blk_compute(avg_blk, nam, geom, bpar, samp, mom_blk)
subroutine avg_blk_compute_asy(avg_blk, nam, geom, bpar, ne)
type(avg_blk_type) function avg_blk_copy(avg_blk, nam, geom, bpar)
subroutine, public copy(self, rhs)
subroutine avg_blk_compute_asy_lr(avg_blk_lr, nam, geom, bpar)
subroutine avg_blk_compute_lr(avg_blk_lr, mpl, nam, geom, bpar, samp, mom_blk, mom_lr_blk)
real(kind_real), parameter var_min
real(kind_real), parameter nc1a_cor_th
subroutine avg_blk_alloc(avg_blk, nam, geom, bpar, ic2, ib, ne, nsub)
subroutine avg_blk_dealloc(avg_blk)
integer, parameter, public kind_real