10 use fckit_mpi_module,
only: fckit_mpi_sum,fckit_mpi_status
61 class(lct_type),
intent(inout) :: lct
62 type(nam_type),
intent(in) :: nam
63 type(geom_type),
intent(in) :: geom
64 type(bpar_type),
intent(in) :: bpar
70 allocate(lct%blk(bpar%nb))
72 call lct%blk(ib)%alloc(nam,geom,bpar,lct%samp,ib)
76 lct%allocated = .true.
89 class(lct_type),
intent(inout) :: lct
90 type(bpar_type),
intent(in) :: bpar
96 if (
allocated(lct%blk))
then 98 call lct%blk(ib)%dealloc
104 lct%allocated = .false.
112 subroutine lct_run_lct(lct,mpl,rng,nam,geom,bpar,io,ens)
117 class(lct_type),
intent(inout) :: lct
118 type(mpl_type),
intent(inout) :: mpl
119 type(rng_type),
intent(inout) :: rng
120 type(nam_type),
intent(inout) :: nam
121 type(geom_type),
intent(in) :: geom
122 type(bpar_type),
intent(in) :: bpar
123 type(io_type),
intent(in) :: io
124 type(ens_type),
intent(in) :: ens
127 write(mpl%info,
'(a)')
'-------------------------------------------------------------------' 128 write(mpl%info,
'(a,i5,a)')
'--- Setup sampling (nc1 = ',nam%nc1,
')' 132 nam%local_rad = 1.0e-12
135 call lct%samp%setup_sampling(mpl,rng,nam,geom,bpar,io,ens)
138 write(mpl%info,
'(a)')
'-------------------------------------------------------------------' 139 write(mpl%info,
'(a)')
'--- Compute MPI distribution, halos A' 141 call lct%samp%compute_mpi_a(mpl,nam,geom)
144 write(mpl%info,
'(a)')
'-------------------------------------------------------------------' 145 write(mpl%info,
'(a)')
'--- Compute MPI distribution, halos A-B' 147 call lct%samp%compute_mpi_ab(mpl,nam,geom)
150 write(mpl%info,
'(a)')
'-------------------------------------------------------------------' 151 write(mpl%info,
'(a)')
'--- Compute MPI distribution, halo C' 153 call lct%samp%compute_mpi_c(mpl,nam,geom)
155 if (nam%diag_rhflt>0.0)
then 157 write(mpl%info,
'(a)')
'-------------------------------------------------------------------' 158 write(mpl%info,
'(a)')
'--- Compute MPI distribution, halo F' 160 call lct%samp%compute_mpi_f(mpl,nam,geom)
164 write(mpl%info,
'(a)')
'-------------------------------------------------------------------' 165 write(mpl%info,
'(a)')
'--- Compute sample moments' 167 call lct%mom%compute(mpl,nam,geom,bpar,lct%samp,ens)
170 write(mpl%info,
'(a)')
'-------------------------------------------------------------------' 171 write(mpl%info,
'(a)')
'--- Compute LCT' 173 call lct%compute(mpl,nam,geom,bpar)
176 write(mpl%info,
'(a)')
'-------------------------------------------------------------------' 177 write(mpl%info,
'(a)')
'--- Filter LCT' 179 call lct%filter(mpl,nam,geom,bpar)
182 write(mpl%info,
'(a)')
'-------------------------------------------------------------------' 183 write(mpl%info,
'(a)')
'--- LCT RMSE' 185 call lct%rmse(mpl,nam,geom,bpar)
188 write(mpl%info,
'(a)')
'-------------------------------------------------------------------' 189 write(mpl%info,
'(a)')
'--- Write LCT' 191 call lct%write(mpl,nam,geom,bpar,io)
195 write(mpl%info,
'(a)')
'-------------------------------------------------------------------' 196 write(mpl%info,
'(a)')
'--- Write correlation and LCT fit' 198 call lct%write_cor(mpl,nam,geom,bpar,io)
212 class(lct_type),
intent(inout) :: lct
213 type(mpl_type),
intent(inout) :: mpl
214 type(nam_type),
intent(in) :: nam
215 type(geom_type),
intent(in) :: geom
216 type(bpar_type),
intent(in) :: bpar
222 call lct%alloc(nam,geom,bpar)
225 write(mpl%info,
'(a7,a,a)')
'',
'Block: ',trim(bpar%blockname(ib))
229 write(mpl%info,
'(a10,a)')
'',
'Compute correlation' 231 call lct%blk(ib)%correlation(nam,geom,bpar,lct%samp,lct%mom%blk(ib))
234 write(mpl%info,
'(a10,a)')
'',
'Compute LCT fit' 236 call lct%blk(ib)%fitting(mpl,nam,geom,bpar,lct%samp)
250 class(lct_type),
intent(inout) :: lct
251 type(mpl_type),
intent(inout) :: mpl
252 type(nam_type),
intent(in) :: nam
253 type(geom_type),
intent(in) :: geom
254 type(bpar_type),
intent(in) :: bpar
257 integer :: ib,il0,jl0,jl0r,ic1a,ic1,ic0,jc3,jc0,icomp,iscales,nmsr,nmsr_tot
258 real(kind_real),
allocatable :: fld_c1a(:),fld_filt_c1a(:),dx(:,:),dy(:,:),dz(:,:)
260 logical,
allocatable :: mask_c1a(:,:),dmask(:,:)
263 allocate(fld_c1a(lct%samp%nc1a))
264 allocate(mask_c1a(lct%samp%nc1a,geom%nl0))
265 if (nam%diag_rhflt>0)
allocate(fld_filt_c1a(lct%samp%nc1a))
269 do ic1a=1,lct%samp%nc1a
270 ic1 = lct%samp%c1a_to_c1(ic1a)
271 mask_c1a(ic1a,il0) = lct%samp%c1l0_log(ic1,il0)
276 write(mpl%info,
'(a7,a,a)')
'',
'Block: ',trim(bpar%blockname(ib))
280 if (nam%diag_rhflt>0)
then 281 allocate(dx(nam%nc3,bpar%nl0r(ib)))
282 allocate(dy(nam%nc3,bpar%nl0r(ib)))
283 allocate(dz(nam%nc3,bpar%nl0r(ib)))
284 allocate(dmask(nam%nc3,bpar%nl0r(ib)))
290 do ic1a=1,lct%samp%nc1a
291 if (mask_c1a(ic1a,il0).and.(.not.(all(
isnotmsr(lct%blk(ib)%coef(:,ic1a,il0))) &
292 & .and.all(
isnotmsr(lct%blk(ib)%coef(:,ic1a,il0)))))) nmsr = nmsr+1
294 call mpl%f_comm%allreduce(nmsr,nmsr_tot,fckit_mpi_sum())
295 write(mpl%info,
'(a10,a,i3,a,i8,a)',advance=
'no')
'',
'Level',nam%levs(il0),
': ',nmsr_tot,
' missing points' 297 do iscales=1,lct%blk(ib)%nscales
301 fld_c1a = lct%blk(ib)%D(icomp,iscales,:,il0)
303 fld_c1a = lct%blk(ib)%coef(iscales,:,il0)
306 if (nam%diag_rhflt>0)
then 308 fld_filt_c1a = fld_c1a
311 call lct%samp%diag_filter(mpl,nam,geom,il0,
'median',nam%diag_rhflt,fld_filt_c1a)
312 call lct%samp%diag_filter(mpl,nam,geom,il0,
'gc99',nam%diag_rhflt,fld_filt_c1a)
317 call lct%samp%diag_fill(mpl,nam,geom,il0,fld_c1a)
318 if (nam%diag_rhflt>0)
call lct%samp%diag_fill(mpl,nam,geom,il0,fld_filt_c1a)
324 lct%blk(ib)%D(icomp,iscales,:,il0) = fld_c1a
325 if (nam%diag_rhflt>0) lct%blk(ib)%D_filt(icomp,iscales,:,il0) = fld_filt_c1a
327 lct%blk(ib)%coef(iscales,:,il0) = fld_c1a
328 if (nam%diag_rhflt>0) lct%blk(ib)%coef_filt(iscales,:,il0) = fld_filt_c1a
335 do ic1a=1,lct%samp%nc1a
336 if (mask_c1a(ic1a,il0).and.(.not.(all(
isnotmsr(lct%blk(ib)%coef(:,ic1a,il0))) &
337 & .and.all(
isnotmsr(lct%blk(ib)%coef(:,ic1a,il0)))))) nmsr = nmsr+1
339 call mpl%f_comm%allreduce(nmsr,nmsr_tot,fckit_mpi_sum())
340 write(mpl%info,
'(a,i8,a)',advance=
'no')
' ~> ',nmsr_tot,
' missing points' 341 if (nam%diag_rhflt>0)
then 342 write(mpl%info,
'(a,f10.2,a)')
', filtering at ',nam%diag_rhflt*
reqkm,
' km' 344 write(mpl%info,
'(a,f10.2,a)')
', no filtering' 347 if (nam%diag_rhflt>0)
then 348 do ic1a=1,lct%samp%nc1a
350 ic1 = lct%samp%c1a_to_c1(ic1a)
352 if (lct%samp%c1l0_log(ic1,il0))
then 354 ic0 = lct%samp%c1_to_c0(ic1)
355 do jl0r=1,bpar%nl0r(ib)
356 jl0 = bpar%l0rl0b_to_l0(jl0r,il0,ib)
358 dmask(jc3,jl0r) = lct%samp%c1l0_log(ic1,il0).and.lct%samp%c1c3l0_log(ic1,jc3,jl0)
359 if (dmask(jc3,jl0r))
then 360 jc0 = lct%samp%c1c3_to_c0(ic1,jc3)
361 call geom%compute_deltas(ic0,il0,jc0,jl0,dx(jc3,jl0r),dy(jc3,jl0r),dz(jc3,jl0r))
368 do iscales=1,lct%blk(ib)%nscales
370 call check_cond(lct%blk(ib)%D_filt(1,iscales,ic1a,il0),lct%blk(ib)%D_filt(2,iscales,ic1a,il0), &
371 & lct%blk(ib)%D_filt(4,iscales,ic1a,il0),valid)
372 if (bpar%nl0r(ib)>1) valid = valid.and.(lct%blk(ib)%D_filt(3,iscales,ic1a,il0)>0.0)
373 valid = valid.and.(lct%blk(ib)%coef_filt(iscales,ic1a,il0)>0.0)
374 if (lct%blk(ib)%nscales>1) valid = valid.and.(lct%blk(ib)%coef_filt(iscales,ic1a,il0)<1.0)
379 call fit_lct(mpl,nam%nc3,bpar%nl0r(ib),dx,dy,dz,dmask,lct%blk(ib)%nscales, &
380 & lct%blk(ib)%D_filt(:,:,ic1a,il0),lct%blk(ib)%coef_filt(:,ic1a,il0),lct%blk(ib)%fit_filt(:,:,ic1a,il0))
383 call msr(lct%blk(ib)%fit_filt(:,:,ic1a,il0))
391 if (nam%diag_rhflt>0)
then 405 subroutine lct_rmse(lct,mpl,nam,geom,bpar)
410 class(lct_type),
intent(in) :: lct
411 type(mpl_type),
intent(in) :: mpl
412 type(nam_type),
intent(in) :: nam
413 type(geom_type),
intent(in) :: geom
414 type(bpar_type),
intent(in) :: bpar
417 integer :: ib,il0,jl0r,jl0,ic1a,ic1,jc3
418 real(kind_real) :: rmse,norm,rmse_tot,norm_tot
419 real(kind_real) :: rmse_filt,norm_filt,rmse_filt_tot,norm_filt_tot
422 write(mpl%info,
'(a7,a,a)')
'',
'Block: ',trim(bpar%blockname(ib))
428 if (nam%diag_rhflt>0)
then 433 do ic1a=1,lct%samp%nc1a
434 ic1 = lct%samp%c1a_to_c1(ic1a)
435 do jl0r=1,bpar%nl0r(ib)
436 jl0 = bpar%l0rl0b_to_l0(jl0r,il0,ib)
438 if (lct%samp%c1l0_log(ic1,il0).and.lct%samp%c1c3l0_log(ic1,jc3,jl0))
then 439 if (
isnotmsr(lct%blk(ib)%fit(jc3,jl0r,ic1a,il0)))
then 440 rmse = rmse+(lct%blk(ib)%fit(jc3,jl0r,ic1a,il0)-lct%blk(ib)%raw(jc3,jl0r,ic1a,il0))**2
443 if (nam%diag_rhflt>0)
then 444 if (
isnotmsr(lct%blk(ib)%fit_filt(jc3,jl0r,ic1a,il0)))
then 445 rmse_filt = rmse_filt+(lct%blk(ib)%fit_filt(jc3,jl0r,ic1a,il0)-lct%blk(ib)%raw(jc3,jl0r,ic1a,il0))**2
446 norm_filt = norm_filt+1.0
454 call mpl%f_comm%allreduce(rmse,rmse_tot,fckit_mpi_sum())
455 call mpl%f_comm%allreduce(norm,norm_tot,fckit_mpi_sum())
456 if (norm_tot>0.0) rmse_tot = sqrt(rmse_tot/norm_tot)
457 write(mpl%info,
'(a10,a,e15.8,a,i8,a)')
'',
'LCT fit RMSE: ',rmse_tot,
' for ',int(norm_tot),
' diagnostic points' 459 if (nam%diag_rhflt>0)
then 460 call mpl%f_comm%allreduce(rmse_filt,rmse_filt_tot,fckit_mpi_sum())
461 call mpl%f_comm%allreduce(norm_filt,norm_filt_tot,fckit_mpi_sum())
462 if (norm_filt_tot>0.0) rmse_filt_tot = sqrt(rmse_filt_tot/norm_filt_tot)
463 write(mpl%info,
'(a10,a,e15.8,a,i8,a)')
'',
'LCT filtered fit RMSE: ',rmse_filt_tot,
' for ',int(norm_tot),
' diagnostic points' 474 subroutine lct_write(lct,mpl,nam,geom,bpar,io)
479 class(lct_type),
intent(inout) :: lct
480 type(mpl_type),
intent(inout) :: mpl
481 type(nam_type),
intent(in) :: nam
482 type(geom_type),
intent(in) :: geom
483 type(bpar_type),
intent(in) :: bpar
484 type(io_type),
intent(in) :: io
487 integer :: ib,iv,il0,il0i,ic1a,ic1,icomp,ic0a,iscales
488 real(kind_real) :: det,Lavg_tot,norm_tot
489 real(kind_real),
allocatable :: D(:,:,:,:),coef(:,:,:),fld_c1a(:,:,:),fld_c1b(:,:),fld(:,:,:)
490 logical :: mask_c1a(lct%samp%nc1a,geom%nl0)
491 character(len=1) :: iscaleschar
492 character(len=1024) :: filename
496 do ic1a=1,lct%samp%nc1a
497 ic1 = lct%samp%c1a_to_c1(ic1a)
498 mask_c1a(ic1a,il0) = lct%samp%c1l0_log(ic1,il0)
503 write(mpl%info,
'(a7,a,a)')
'',
'Block: ',trim(bpar%blockname(ib))
507 allocate(d(4,lct%blk(ib)%nscales,lct%samp%nc1a,geom%nl0))
508 allocate(coef(lct%blk(ib)%nscales,lct%samp%nc1a,geom%nl0))
511 if (nam%diag_rhflt>0)
then 512 d = lct%blk(ib)%D_filt
513 coef = lct%blk(ib)%coef_filt
516 coef = lct%blk(ib)%coef
519 do iscales=1,lct%blk(ib)%nscales
520 write(mpl%info,
'(a10,a,i2)')
'',
'Scale: ',iscales
523 allocate(fld_c1a(lct%samp%nc1a,geom%nl0,2*4+1))
524 allocate(fld_c1b(lct%samp%nc2b,geom%nl0))
525 allocate(fld(geom%nc0a,geom%nl0,2*4+2))
532 write(mpl%info,
'(a13,a)')
'',
'Copy and inverse diffusion tensor' 535 do ic1a=1,lct%samp%nc1a
536 ic1 = lct%samp%c1a_to_c1(ic1a)
537 if (mask_c1a(ic1a,il0))
then 539 d(1,iscales,ic1a,il0) =
max(
dmin,d(1,iscales,ic1a,il0))
540 d(2,iscales,ic1a,il0) =
max(
dmin,d(2,iscales,ic1a,il0))
541 if (bpar%nl0r(ib)>1) d(3,iscales,ic1a,il0) =
max(
dmin,d(3,iscales,ic1a,il0))
542 d(4,iscales,ic1a,il0) =
max(-1.0_kind_real+
dmin,
min(d(4,iscales,ic1a,il0),1.0_kind_real-
dmin))
545 fld_c1a(ic1a,il0,1) = d(1,iscales,ic1a,il0)
546 fld_c1a(ic1a,il0,2) = d(2,iscales,ic1a,il0)
547 fld_c1a(ic1a,il0,3) = d(3,iscales,ic1a,il0)
548 fld_c1a(ic1a,il0,4) = sqrt(d(1,iscales,ic1a,il0)*d(2,iscales,ic1a,il0))*d(4,iscales,ic1a,il0)
551 call lct_d2h(mpl,fld_c1a(ic1a,il0,1),fld_c1a(ic1a,il0,2),fld_c1a(ic1a,il0,3),fld_c1a(ic1a,il0,4), &
552 & fld_c1a(ic1a,il0,4+1),fld_c1a(ic1a,il0,4+2),fld_c1a(ic1a,il0,4+3),fld_c1a(ic1a,il0,4+4))
555 fld_c1a(ic1a,il0,2*4+1) = coef(iscales,ic1a,il0)
561 write(mpl%info,
'(a13,a)')
'',
'Interpolate components' 564 call lct%samp%com_AB%ext(mpl,geom%nl0,fld_c1a(:,:,icomp),fld_c1b)
566 il0i =
min(il0,geom%nl0i)
567 call lct%samp%h(il0i)%apply(mpl,fld_c1b(:,il0),fld(:,il0,icomp))
572 write(mpl%info,
'(a13,a)')
'',
'Compute horizontal length-scale and equivalent support radius:' 576 if (geom%mask_c0a(ic0a,il0))
then 578 det = fld(ic0a,il0,1)*fld(ic0a,il0,2)-fld(ic0a,il0,4)**2
580 fld(ic0a,il0,2*4+2) = sqrt(sqrt(det))
582 call mpl%abort(
'non-valid horizontal diffusion tensor determinant, grid c0')
586 call mpl%f_comm%allreduce(sum(fld(:,il0,2*4+2),
isnotmsr(fld(:,il0,2*3+2))),lavg_tot,fckit_mpi_sum())
587 call mpl%f_comm%allreduce(
real(count(isnotmsr(fld(:,il0,2*4+2))),kind_real),norm_tot,fckit_mpi_sum())
588 if (norm_tot>0.0)
write(mpl%info,
'(a16,a,i3,a,f10.2,a,f10.2,a)')
'',
'Level',nam%levs(il0),
' ~> ', &
595 if (geom%mask_c0a(ic0a,il0))
then 596 lct%blk(ib)%D11(ic0a,il0,iscales) = fld(ic0a,il0,1)
597 lct%blk(ib)%D22(ic0a,il0,iscales) = fld(ic0a,il0,2)
598 lct%blk(ib)%D33(ic0a,il0,iscales) = fld(ic0a,il0,3)
599 lct%blk(ib)%D12(ic0a,il0,iscales) = fld(ic0a,il0,4)
600 lct%blk(ib)%H11(ic0a,il0,iscales) = fld(ic0a,il0,4+1)
601 lct%blk(ib)%H22(ic0a,il0,iscales) = fld(ic0a,il0,4+2)
602 lct%blk(ib)%H33(ic0a,il0,iscales) = fld(ic0a,il0,4+3)
603 lct%blk(ib)%H12(ic0a,il0,iscales) = fld(ic0a,il0,4+4)
604 lct%blk(ib)%Dcoef(ic0a,il0,iscales) = fld(ic0a,il0,2*4+1)
605 lct%blk(ib)%DLh(ic0a,il0,iscales) = fld(ic0a,il0,2*4+2)
611 write(mpl%info,
'(a13,a)')
'',
'Write LCT' 613 filename = trim(nam%prefix)//
'_lct' 614 iv = bpar%b_to_v2(ib)
615 write(iscaleschar,
'(i1)') iscales
616 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_D11_'//iscaleschar,lct%blk(ib)%D11(:,:,iscales))
617 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_D22_'//iscaleschar,lct%blk(ib)%D22(:,:,iscales))
618 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_D33_'//iscaleschar,lct%blk(ib)%D33(:,:,iscales))
619 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_D12_'//iscaleschar,lct%blk(ib)%D12(:,:,iscales))
620 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_H11_'//iscaleschar,lct%blk(ib)%H11(:,:,iscales))
621 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_H22_'//iscaleschar,lct%blk(ib)%H22(:,:,iscales))
622 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_H33_'//iscaleschar,lct%blk(ib)%H33(:,:,iscales))
623 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_H12_'//iscaleschar,lct%blk(ib)%H12(:,:,iscales))
624 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_coef_'//iscaleschar,lct%blk(ib)%Dcoef(:,:,iscales))
625 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_Lh_'//iscaleschar,lct%blk(ib)%DLh(:,:,iscales))
649 class(lct_type),
intent(in) :: lct
650 type(mpl_type),
intent(inout) :: mpl
651 type(nam_type),
intent(in) :: nam
652 type(geom_type),
intent(in) :: geom
653 type(bpar_type),
intent(in) :: bpar
654 type(io_type),
intent(in) :: io
657 integer :: ib,iv,il0,jl0r,jl0,ic1a,ic1,jc3,i,iproc,ic0,nf
658 real(kind_real),
allocatable :: fld_c0a(:,:,:),fld_c0(:,:,:),sbuf(:),rbuf(:)
660 logical :: free(geom%nc0,geom%nl0)
661 character(len=1024) :: filename
662 type(fckit_mpi_status) :: status
665 if (nam%diag_rhflt>0)
then 672 allocate(fld_c0a(geom%nc0a,geom%nl0,nf))
675 write(mpl%info,
'(a7,a,a)')
'',
'Block: ',trim(bpar%blockname(ib))
679 if (mpl%main)
allocate(rbuf(nam%nc3*bpar%nl0r(ib)*nf))
680 allocate(fld_c0(geom%nc0,geom%nl0,nf))
686 if (mpl%main)
call msr(fld_c0)
691 do jl0r=1,bpar%nl0r(ib)
692 jl0 = bpar%l0rl0b_to_l0(jl0r,il0,ib)
694 if (valid.and.lct%samp%c1l0_log(ic1,il0).and.lct%samp%c1c3l0_log(ic1,jc3,jl0)) &
695 & valid = valid.and.free(lct%samp%c1c3_to_c0(ic1,jc3),jl0)
701 do jl0r=1,bpar%nl0r(ib)
702 jl0 = bpar%l0rl0b_to_l0(jl0r,il0,ib)
704 free(lct%samp%c1c3_to_c0(ic1,jc3),jl0) = .false.
709 iproc = lct%samp%c2_to_proc(ic1)
710 if (iproc==mpl%myproc)
then 712 allocate(sbuf(nam%nc3*bpar%nl0r(ib)*nf))
716 ic1a = lct%samp%c1_to_c1a(ic1)
718 do jl0r=1,bpar%nl0r(ib)
719 jl0 = bpar%l0rl0b_to_l0(jl0r,il0,ib)
721 if (lct%samp%c1l0_log(ic1,il0).and.lct%samp%c1c3l0_log(ic1,jc3,jl0))
then 722 sbuf(i) = lct%blk(ib)%raw(jc3,jl0r,ic1a,il0)
723 sbuf(i+1) = lct%blk(ib)%fit(jc3,jl0r,ic1a,il0)
724 if (nf==3) sbuf(i+2) = lct%blk(ib)%fit_filt(jc3,jl0r,ic1a,il0)
732 if (iproc==mpl%ioproc)
then 737 call mpl%f_comm%receive(rbuf,iproc-1,mpl%tag,status)
742 do jl0r=1,bpar%nl0r(ib)
743 jl0 = bpar%l0rl0b_to_l0(jl0r,il0,ib)
745 if (lct%samp%c1l0_log(ic1,il0).and.lct%samp%c1c3l0_log(ic1,jc3,jl0))
then 746 ic0 = lct%samp%c1c3_to_c0(ic1,jc3)
747 fld_c0(ic0,jl0,1) = rbuf(i)
748 fld_c0(ic0,jl0,2) = rbuf(i+1)
749 if (nf==3) fld_c0(ic0,jl0,3) = rbuf(i+2)
756 if (iproc==mpl%myproc)
call mpl%f_comm%send(sbuf,mpl%ioproc-1,mpl%tag)
758 call mpl%update_tag(1)
761 if (iproc==mpl%myproc)
deallocate(sbuf)
766 call mpl%glb_to_loc(geom%nl0,geom%nc0,geom%c0_to_proc,geom%c0_to_c0a,fld_c0(:,:,1),geom%nc0a,fld_c0a(:,:,1))
767 call mpl%glb_to_loc(geom%nl0,geom%nc0,geom%c0_to_proc,geom%c0_to_c0a,fld_c0(:,:,2),geom%nc0a,fld_c0a(:,:,2))
768 if (nf==3)
call mpl%glb_to_loc(geom%nl0,geom%nc0,geom%c0_to_proc,geom%c0_to_c0a,fld_c0(:,:,3),geom%nc0a,fld_c0a(:,:,3))
771 write(mpl%info,
'(a10,a)')
'',
'Write LCT diagnostics' 773 filename = trim(nam%prefix)//
'_lct' 774 iv = bpar%b_to_v2(ib)
775 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_raw',fld_c0a(:,:,1))
776 call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_fit',fld_c0a(:,:,2))
777 if (nf==3)
call io%fld_write(mpl,nam,geom,filename,trim(nam%varname(iv))//
'_fit_filt',fld_c0a(:,:,3))
780 if (mpl%main)
deallocate(rbuf)
subroutine lct_rmse(lct, mpl, nam, geom, bpar)
subroutine lct_alloc(lct, nam, geom, bpar)
subroutine lct_write_cor(lct, mpl, nam, geom, bpar, io)
subroutine lct_dealloc(lct, bpar)
subroutine lct_filter(lct, mpl, nam, geom, bpar)
subroutine lct_compute(lct, mpl, nam, geom, bpar)
integer, parameter, public kind_real
logical, parameter write_cor
subroutine lct_write(lct, mpl, nam, geom, bpar, io)
subroutine lct_run_lct(lct, mpl, rng, nam, geom, bpar, io, ens)
real(fp), parameter, public pi