48 logical :: close_listing
80 subroutine bump_setup_online(bump,nmga,nl0,nv,nts,lon,lat,area,vunit,lmask,ens1_ne,ens1_nsub,ens2_ne,ens2_nsub, &
81 & nobs,lonobs,latobs,namelname,lunit)
86 class(bump_type),
intent(inout) :: bump
87 integer,
intent(in) :: nmga
88 integer,
intent(in) :: nl0
89 integer,
intent(in) :: nv
90 integer,
intent(in) :: nts
91 real(kind_real),
intent(in) :: lon(nmga)
92 real(kind_real),
intent(in) :: lat(nmga)
93 real(kind_real),
intent(in) :: area(nmga)
94 real(kind_real),
intent(in) :: vunit(nmga,nl0)
95 logical,
intent(in) :: lmask(nmga,nl0)
96 integer,
intent(in),
optional :: ens1_ne
97 integer,
intent(in),
optional :: ens1_nsub
98 integer,
intent(in),
optional :: ens2_ne
99 integer,
intent(in),
optional :: ens2_nsub
100 integer,
intent(in),
optional :: nobs
101 real(kind_real),
intent(in),
optional :: lonobs(:)
102 real(kind_real),
intent(in),
optional :: latobs(:)
103 character(len=*),
intent(in),
optional :: namelname
104 integer,
intent(in),
optional :: lunit
107 integer :: lens1_ne,lens1_nsub,lens2_ne,lens2_nsub
112 if (
present(namelname))
then 114 call bump%nam%read(bump%mpl,namelname)
115 call bump%nam%bcast(bump%mpl)
123 if (
present(ens1_ne)) lens1_ne = ens1_ne
124 if (
present(ens1_nsub)) lens1_nsub = ens1_nsub
125 if (
present(ens2_ne)) lens2_ne = ens2_ne
126 if (
present(ens2_ne)) lens2_nsub = ens2_nsub
127 call bump%nam%setup_internal(nl0,nv,nts,lens1_ne,lens1_nsub,lens2_ne,lens2_nsub)
130 if (
present(lunit))
then 131 call bump%mpl%init_listing(bump%nam%prefix,bump%nam%model,bump%nam%colorlog,bump%nam%logpres,lunit)
132 bump%close_listing = .false.
134 call bump%mpl%init_listing(bump%nam%prefix,bump%nam%model,bump%nam%colorlog,bump%nam%logpres)
135 bump%close_listing = (trim(bump%nam%model)==
'online').and.(.not.
present(nobs))
139 call bump%setup_generic
142 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 143 write(bump%mpl%info,
'(a)')
'--- Initialize geometry' 144 call flush(bump%mpl%info)
145 call bump%geom%setup_online(bump%mpl,bump%rng,bump%nam,nmga,nl0,lon,lat,area,vunit,lmask)
146 call bump%geom%init(bump%mpl,bump%rng,bump%nam)
148 if (bump%nam%grid_output)
then 150 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 151 write(bump%mpl%info,
'(a)')
'--- Initialize fields regridding' 152 call flush(bump%mpl%info)
153 call bump%io%grid_init(bump%mpl,bump%rng,bump%nam,bump%geom)
157 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 158 write(bump%mpl%info,
'(a)')
'--- Initialize block parameters' 159 call bump%bpar%alloc(bump%nam,bump%geom)
162 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 163 write(bump%mpl%info,
'(a)')
'--- Initialize ensemble 1' 164 call bump%ens1%alloc(bump%nam,bump%geom,bump%nam%ens1_ne,bump%nam%ens1_nsub)
167 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 168 write(bump%mpl%info,
'(a)')
'--- Initialize ensemble 2' 169 call bump%ens2%alloc(bump%nam,bump%geom,bump%nam%ens2_ne,bump%nam%ens2_nsub)
171 if (
present(nobs))
then 173 if ((.not.
present(lonobs)).or.(.not.
present(latobs)))
call bump%mpl%abort(
'lonobs and latobs are missing')
176 if (
size(lonobs)/=nobs)
call bump%mpl%abort(
'wrong size for lonobs')
177 if (
size(latobs)/=nobs)
call bump%mpl%abort(
'wrong size for latobs')
180 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 181 write(bump%mpl%info,
'(a)')
'--- Initialize observations locations' 182 call flush(bump%mpl%info)
183 call bump%obsop%from(nobs,lonobs,latobs)
186 if ((bump%nam%ens1_ne>0).or.(bump%nam%ens2_ne>0))
then 187 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 188 write(bump%mpl%info,
'(a)')
'--- Add members to BUMP ensembles' 202 class(bump_type),
intent(inout) :: bump
205 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 206 write(bump%mpl%info,
'(a)')
'--- You are running BUMP ------------------------------------------' 207 write(bump%mpl%info,
'(a)')
'--- Author: Benjamin Menetrier ------------------------------------' 208 write(bump%mpl%info,
'(a)')
'--- Copyright © 2015-... UCAR, CERFACS, METEO-FRANCE and IRIT -----' 209 call flush(bump%mpl%info)
212 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 213 write(bump%mpl%info,
'(a)')
'--- Check namelist parameters' 214 call flush(bump%mpl%info)
215 call bump%nam%check(bump%mpl)
218 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 219 write(bump%mpl%info,
'(a,i3,a,i2,a)')
'--- Parallelization with ',bump%mpl%nproc,
' MPI tasks and ', &
220 & bump%mpl%nthread,
' OpenMP threads' 221 call flush(bump%mpl%info)
224 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 225 write(bump%mpl%info,
'(a)')
'--- Initialize random number generator' 226 call flush(bump%mpl%info)
227 call bump%rng%init(bump%mpl,bump%nam)
230 bump%cmat%allocated = .false.
231 bump%lct%allocated = .false.
232 bump%nicas%allocated = .false.
245 class(bump_type),
intent(inout) :: bump
248 if (bump%nam%default_seed)
call bump%rng%reseed(bump%mpl)
251 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 252 write(bump%mpl%info,
'(a)')
'--- Finalize ensemble 1' 253 call flush(bump%mpl%info)
254 call bump%ens1%remove_mean
257 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 258 write(bump%mpl%info,
'(a)')
'--- Finalize ensemble 2' 259 call flush(bump%mpl%info)
260 call bump%ens2%remove_mean
262 if (bump%nam%new_vbal)
then 264 if (bump%nam%default_seed)
call bump%rng%reseed(bump%mpl)
267 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 268 write(bump%mpl%info,
'(a)')
'--- Run vertical balance driver' 269 call flush(bump%mpl%info)
270 call bump%vbal%run_vbal(bump%mpl,bump%rng,bump%nam,bump%geom,bump%bpar,bump%io,bump%ens1,bump%ens1u)
271 elseif (bump%nam%load_vbal)
then 273 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 274 write(bump%mpl%info,
'(a)')
'--- Read vertical balance' 275 call flush(bump%mpl%info)
276 call bump%vbal%read(bump%mpl,bump%nam,bump%geom,bump%bpar)
279 if (bump%nam%check_vbal)
then 281 if (bump%nam%default_seed)
call bump%rng%reseed(bump%mpl)
284 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 285 write(bump%mpl%info,
'(a)')
'--- Run vertical balance tests driver' 286 call flush(bump%mpl%info)
287 call bump%vbal%run_vbal_tests(bump%mpl,bump%rng,bump%nam,bump%geom,bump%bpar)
290 if (bump%nam%new_hdiag)
then 292 if (bump%nam%default_seed)
call bump%rng%reseed(bump%mpl)
295 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 296 write(bump%mpl%info,
'(a)')
'--- Run HDIAG driver' 297 call flush(bump%mpl%info)
298 if ((trim(bump%nam%method)==
'hyb-rnd').or.(trim(bump%nam%method)==
'dual-ens'))
then 299 call bump%hdiag%run_hdiag(bump%mpl,bump%rng,bump%nam,bump%geom,bump%bpar,bump%io,bump%ens1,bump%ens2)
301 call bump%hdiag%run_hdiag(bump%mpl,bump%rng,bump%nam,bump%geom,bump%bpar,bump%io,bump%ens1)
305 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 306 write(bump%mpl%info,
'(a)')
'--- Copy HDIAG into C matrix' 307 call flush(bump%mpl%info)
308 call bump%cmat%from_hdiag(bump%mpl,bump%nam,bump%geom,bump%bpar,bump%hdiag)
311 if (bump%nam%new_lct)
then 313 if (bump%nam%default_seed)
call bump%rng%reseed(bump%mpl)
316 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 317 write(bump%mpl%info,
'(a)')
'--- Run LCT driver' 318 call flush(bump%mpl%info)
319 call bump%lct%run_lct(bump%mpl,bump%rng,bump%nam,bump%geom,bump%bpar,bump%io,bump%ens1)
322 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 323 write(bump%mpl%info,
'(a)')
'--- Copy LCT into C matrix' 324 call flush(bump%mpl%info)
325 call bump%cmat%from_lct(bump%mpl,bump%nam,bump%geom,bump%bpar,bump%lct)
328 if (bump%nam%load_cmat)
then 330 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 331 write(bump%mpl%info,
'(a)')
'--- Read C matrix' 332 call flush(bump%mpl%info)
333 call bump%cmat%read(bump%mpl,bump%nam,bump%geom,bump%bpar,bump%io)
335 if (bump%nam%forced_radii)
then 337 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 338 write(bump%mpl%info,
'(a)')
'--- Copy namelist support radii into C matrix' 339 call flush(bump%mpl%info)
340 call bump%cmat%from_nam(bump%mpl,bump%nam,bump%geom,bump%bpar)
344 if (
allocated(bump%cmat%blk))
then 346 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 347 write(bump%mpl%info,
'(a)')
'--- Get C matrix from OOPS' 348 call bump%cmat%from_oops(bump%mpl,bump%geom,bump%bpar)
351 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 352 write(bump%mpl%info,
'(a)')
'--- Setup C matrix sampling' 353 call bump%cmat%setup_sampling(bump%nam,bump%geom,bump%bpar)
356 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 357 write(bump%mpl%info,
'(a)')
'--- Write C matrix' 358 call flush(bump%mpl%info)
359 call bump%cmat%write(bump%mpl,bump%nam,bump%geom,bump%bpar,bump%io)
362 if (bump%nam%new_nicas)
then 364 if (bump%nam%default_seed)
call bump%rng%reseed(bump%mpl)
367 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 368 write(bump%mpl%info,
'(a)')
'--- Run NICAS driver' 369 call flush(bump%mpl%info)
370 call bump%nicas%run_nicas(bump%mpl,bump%rng,bump%nam,bump%geom,bump%bpar,bump%cmat)
371 elseif (bump%nam%load_nicas)
then 373 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 374 write(bump%mpl%info,
'(a)')
'--- Read NICAS parameters' 375 call flush(bump%mpl%info)
376 call bump%nicas%read(bump%mpl,bump%nam,bump%geom,bump%bpar)
379 if (bump%nam%check_adjoints.or.bump%nam%check_pos_def.or.bump%nam%check_sqrt.or.bump%nam%check_dirac.or. &
380 & bump%nam%check_randomization.or.bump%nam%check_consistency.or.bump%nam%check_optimality)
then 382 if (bump%nam%default_seed)
call bump%rng%reseed(bump%mpl)
385 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 386 write(bump%mpl%info,
'(a)')
'--- Run NICAS tests driver' 387 call flush(bump%mpl%info)
388 call bump%nicas%run_nicas_tests(bump%mpl,bump%rng,bump%nam,bump%geom,bump%bpar,bump%io,bump%cmat,bump%ens1)
391 if (bump%nam%new_obsop)
then 393 if (bump%nam%default_seed)
call bump%rng%reseed(bump%mpl)
396 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 397 write(bump%mpl%info,
'(a)')
'--- Run observation operator driver' 398 call flush(bump%mpl%info)
399 call bump%obsop%run_obsop(bump%mpl,bump%rng,bump%nam,bump%geom)
400 elseif (bump%nam%load_obsop)
then 402 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 403 write(bump%mpl%info,
'(a)')
'--- Read observation operator' 404 call flush(bump%mpl%info)
405 call bump%obsop%read(bump%mpl,bump%nam)
408 if (bump%nam%check_obsop)
then 410 if (bump%nam%default_seed)
call bump%rng%reseed(bump%mpl)
413 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 414 write(bump%mpl%info,
'(a)')
'--- Run observation operator tests driver' 415 call flush(bump%mpl%info)
416 call bump%obsop%run_obsop_tests(bump%mpl,bump%rng,bump%geom)
419 if (bump%close_listing)
then 421 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 422 write(bump%mpl%info,
'(a)')
'--- Close listings' 423 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------' 424 call flush(bump%mpl%info)
425 close(unit=bump%mpl%info)
426 call flush(bump%mpl%test)
427 close(unit=bump%mpl%test)
441 class(bump_type),
intent(inout) :: bump
442 real(kind_real),
intent(inout) :: fld_mga(bump%geom%nmga,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
443 integer,
intent(in) :: ie
444 integer,
intent(in) :: iens
447 integer :: its,iv,nnonzero,nzero,nmask
448 real(kind_real) :: norm,fld_c0a(bump%geom%nc0a,bump%geom%nl0)
451 write(bump%mpl%info,
'(a7,a,i3,a,i1)')
'',
'Member ',ie,
' added to ensemble ',iens
452 do its=1,bump%nam%nts
455 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga(:,:,iv,its),fld_c0a)
459 bump%ens1%fld(:,:,iv,its,ie) = fld_c0a
460 elseif (iens==2)
then 461 bump%ens2%fld(:,:,iv,its,ie) = fld_c0a
463 call bump%mpl%abort(
'wrong ensemble number')
467 norm = sum(fld_c0a**2,mask=bump%geom%mask_c0a)
468 write(bump%mpl%info,
'(a10,a,i2,a,i2,a,e9.2)')
'',
'Local norm for variable ',iv,
' and timeslot ',its,
': ',norm
469 nnonzero = count((abs(fld_c0a)>0.0).and.bump%geom%mask_c0a)
470 nzero = count((.not.(abs(fld_c0a)>0.0)).and.bump%geom%mask_c0a)
471 nmask = count(.not.bump%geom%mask_c0a)
472 write(bump%mpl%info,
'(a10,a,i8,a,i8,a,i8,a,i8)')
'',
'Total / non-zero / zero / masked points: ',bump%geom%nc0a,
' / ', &
473 & nnonzero,
' / ',nzero,
' / ',nmask
488 class(bump_type),
intent(in) :: bump
489 real(kind_real),
intent(inout) :: fld_mga(bump%geom%nmga,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
493 real(kind_real) :: fld_c0a(bump%geom%nc0a,bump%geom%nl0,bump%nam%nv)
495 do its=1,bump%nam%nts
496 if (bump%geom%nc0==bump%geom%nmg)
then 498 call bump%vbal%apply(bump%nam,bump%geom,bump%bpar,fld_mga(:,:,:,its))
502 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga(:,:,iv,its),fld_c0a(:,:,iv))
506 call bump%vbal%apply(bump%nam,bump%geom,bump%bpar,fld_c0a)
510 call bump%geom%copy_c0a_to_mga(bump%mpl,fld_c0a(:,:,iv),fld_mga(:,:,iv,its))
526 class(bump_type),
intent(in) :: bump
527 real(kind_real),
intent(inout) :: fld_mga(bump%geom%nmga,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
531 real(kind_real) :: fld_c0a(bump%geom%nc0a,bump%geom%nl0,bump%nam%nv)
533 do its=1,bump%nam%nts
534 if (bump%geom%nc0==bump%geom%nmg)
then 536 call bump%vbal%apply_inv(bump%nam,bump%geom,bump%bpar,fld_mga(:,:,:,its))
540 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga(:,:,iv,its),fld_c0a(:,:,iv))
544 call bump%vbal%apply_inv(bump%nam,bump%geom,bump%bpar,fld_c0a)
548 call bump%geom%copy_c0a_to_mga(bump%mpl,fld_c0a(:,:,iv),fld_mga(:,:,iv,its))
564 class(bump_type),
intent(in) :: bump
565 real(kind_real),
intent(inout) :: fld_mga(bump%geom%nmga,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
569 real(kind_real) :: fld_c0a(bump%geom%nc0a,bump%geom%nl0,bump%nam%nv)
571 do its=1,bump%nam%nts
572 if (bump%geom%nc0==bump%geom%nmg)
then 574 call bump%vbal%apply_ad(bump%nam,bump%geom,bump%bpar,fld_mga(:,:,:,its))
578 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga(:,:,iv,its),fld_c0a(:,:,iv))
582 call bump%vbal%apply_ad(bump%nam,bump%geom,bump%bpar,fld_c0a)
586 call bump%geom%copy_c0a_to_mga(bump%mpl,fld_c0a(:,:,iv),fld_mga(:,:,iv,its))
602 class(bump_type),
intent(in) :: bump
603 real(kind_real),
intent(inout) :: fld_mga(bump%geom%nmga,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
607 real(kind_real) :: fld_c0a(bump%geom%nc0a,bump%geom%nl0,bump%nam%nv)
609 do its=1,bump%nam%nts
610 if (bump%geom%nc0==bump%geom%nmg)
then 612 call bump%vbal%apply_inv_ad(bump%nam,bump%geom,bump%bpar,fld_mga(:,:,:,its))
616 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga(:,:,iv,its),fld_c0a(:,:,iv))
620 call bump%vbal%apply_inv_ad(bump%nam,bump%geom,bump%bpar,fld_c0a)
624 call bump%geom%copy_c0a_to_mga(bump%mpl,fld_c0a(:,:,iv),fld_mga(:,:,iv,its))
640 class(bump_type),
intent(in) :: bump
641 real(kind_real),
intent(inout) :: fld_mga(bump%geom%nmga,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
645 real(kind_real) :: fld_c0a(bump%geom%nc0a,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
647 if (bump%geom%nc0==bump%geom%nmg)
then 649 if (bump%nam%lsqrt)
then 650 call bump%nicas%apply_from_sqrt(bump%mpl,bump%nam,bump%geom,bump%bpar,fld_mga)
652 call bump%nicas%apply(bump%mpl,bump%nam,bump%geom,bump%bpar,fld_mga)
656 do its=1,bump%nam%nts
658 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga(:,:,iv,its),fld_c0a(:,:,iv,its))
663 if (bump%nam%lsqrt)
then 664 call bump%nicas%apply_from_sqrt(bump%mpl,bump%nam,bump%geom,bump%bpar,fld_c0a)
666 call bump%nicas%apply(bump%mpl,bump%nam,bump%geom,bump%bpar,fld_c0a)
670 do its=1,bump%nam%nts
672 call bump%geom%copy_c0a_to_mga(bump%mpl,fld_c0a(:,:,iv,its),fld_mga(:,:,iv,its))
688 class(bump_type),
intent(in) :: bump
689 integer,
intent(out) :: n
695 call bump%nicas%alloc_cv(bump%bpar,cv,getsizeonly=.true.)
711 class(bump_type),
intent(in) :: bump
712 real(kind_real),
intent(in) :: pcv(:)
713 real(kind_real),
intent(inout) :: fld_mga(bump%geom%nmga,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
717 real(kind_real) :: fld_c0a(bump%geom%nc0a,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
721 call bump%nicas%alloc_cv(bump%bpar,cv)
724 if (
size(pcv)==cv%n)
then 728 call bump%mpl%abort(
'wrong control variable size in bump_apply_nicas_sqrt')
731 if (bump%geom%nc0==bump%geom%nmg)
then 733 call bump%nicas%apply_sqrt(bump%mpl,bump%nam,bump%geom,bump%bpar,cv,fld_mga)
736 call bump%nicas%apply_sqrt(bump%mpl,bump%nam,bump%geom,bump%bpar,cv,fld_c0a)
739 do its=1,bump%nam%nts
741 call bump%geom%copy_c0a_to_mga(bump%mpl,fld_c0a(:,:,iv,its),fld_mga(:,:,iv,its))
757 class(bump_type),
intent(in) :: bump
758 real(kind_real),
intent(in) :: fld_mga(bump%geom%nmga,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
759 real(kind_real),
intent(inout) :: pcv(:)
763 real(kind_real) :: fld_c0a(bump%geom%nc0a,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
766 if (bump%geom%nc0==bump%geom%nmg)
then 768 call bump%nicas%apply_sqrt_ad(bump%mpl,bump%nam,bump%geom,bump%bpar,fld_mga,cv)
771 do its=1,bump%nam%nts
773 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga(:,:,iv,its),fld_c0a(:,:,iv,its))
778 call bump%nicas%apply_sqrt_ad(bump%mpl,bump%nam,bump%geom,bump%bpar,fld_c0a,cv)
782 if (
size(pcv)==cv%n)
then 786 call bump%mpl%abort(
'wrong control variable size in bump_apply_nicas_sqrt_ad')
800 class(bump_type),
intent(in) :: bump
801 real(kind_real),
intent(in) :: fld_mga(bump%geom%nmga,bump%geom%nl0)
802 real(kind_real),
intent(out) :: obs(bump%obsop%nobsa,bump%geom%nl0)
805 real(kind_real) :: fld_c0a(bump%geom%nc0a,bump%geom%nl0)
807 if (bump%geom%nc0==bump%geom%nmg)
then 809 call bump%obsop%apply(bump%mpl,bump%geom,fld_mga,obs)
812 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga,fld_c0a)
815 call bump%obsop%apply(bump%mpl,bump%geom,fld_c0a,obs)
829 class(bump_type),
intent(in) :: bump
830 real(kind_real),
intent(in) :: obs(bump%obsop%nobsa,bump%geom%nl0)
831 real(kind_real),
intent(out) :: fld_mga(bump%geom%nmga,bump%geom%nl0)
834 real(kind_real) :: fld_c0a(bump%geom%nc0a,bump%geom%nl0)
836 if (bump%geom%nc0==bump%geom%nmg)
then 838 call bump%obsop%apply_ad(bump%mpl,bump%geom,obs,fld_mga)
841 call bump%obsop%apply_ad(bump%mpl,bump%geom,obs,fld_c0a)
844 call bump%geom%copy_c0a_to_mga(bump%mpl,fld_c0a,fld_mga)
858 class(bump_type),
intent(in) :: bump
859 character(len=*),
intent(in) :: param
860 real(kind_real),
intent(out) :: fld_mga(bump%geom%nmga,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
863 integer :: ib,iv,jv,its,jts
865 select case (trim(param))
866 case (
'var',
'cor_rh',
'cor_rv',
'cor_rv_rfac',
'cor_rv_coef',
'loc_coef',
'loc_rh',
'loc_rv',
'hyb_coef')
867 select case (trim(bump%nam%strategy))
868 case (
'specific_univariate',
'specific_multivariate')
871 iv = bump%bpar%b_to_v1(ib)
872 jv = bump%bpar%b_to_v2(ib)
873 its = bump%bpar%b_to_ts1(ib)
874 jts = bump%bpar%b_to_ts2(ib)
877 if ((iv==jv).and.(its==jts))
call bump%copy_to_field(param,ib,fld_mga(:,:,iv,its))
879 case (
'common',
'common_univariate',
'common_weighted')
883 do its=1,bump%nam%nts
886 call bump%copy_to_field(param,ib,fld_mga(:,:,iv,its))
893 iv = bump%bpar%b_to_v1(ib)
894 jv = bump%bpar%b_to_v2(ib)
895 its = bump%bpar%b_to_ts1(ib)
896 jts = bump%bpar%b_to_ts2(ib)
899 if ((iv==jv).and.(its==jts))
call bump%copy_to_field(param,ib,fld_mga(:,:,iv,its))
914 class(bump_type),
intent(in) :: bump
915 character(len=*),
intent(in) :: param
916 integer,
intent(in) :: ib
917 real(kind_real),
intent(out) :: fld_mga(bump%geom%nmga,bump%geom%nl0)
920 integer :: iscales,ie,iv,its
923 select case (trim(param))
925 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%cmat%blk(ib)%coef_ens,fld_mga)
927 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%cmat%blk(ib)%rh,fld_mga)
928 fld_mga = fld_mga*
req 930 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%cmat%blk(ib)%rv,fld_mga)
932 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%cmat%blk(ib)%rv_rfac,fld_mga)
934 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%cmat%blk(ib)%rv_coef,fld_mga)
936 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%cmat%blk(ib)%coef_ens,fld_mga)
938 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%cmat%blk(ib)%rh,fld_mga)
939 fld_mga = fld_mga*
req 941 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%cmat%blk(ib)%rv,fld_mga)
943 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%cmat%blk(ib)%coef_sta,fld_mga)
945 select case (param(1:4))
947 read(param(5:5),
'(i1)') iscales
948 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%lct%blk(ib)%D11(:,:,iscales),fld_mga)
949 fld_mga = fld_mga*
req**2
951 read(param(5:5),
'(i1)') iscales
952 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%lct%blk(ib)%D22(:,:,iscales),fld_mga)
953 fld_mga = fld_mga*
req**2
955 read(param(5:5),
'(i1)') iscales
956 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%lct%blk(ib)%D33(:,:,iscales),fld_mga)
958 read(param(5:5),
'(i1)') iscales
959 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%lct%blk(ib)%D12(:,:,iscales),fld_mga)
960 fld_mga = fld_mga*
req**2
962 read(param(7:7),
'(i1)') iscales
963 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%lct%blk(ib)%Dcoef(:,:,iscales),fld_mga)
965 read(param(5:5),
'(i1)') iscales
966 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%lct%blk(ib)%DLh(:,:,iscales),fld_mga)
967 fld_mga = fld_mga*
req 969 if (param(1:6)==
'ens1u_')
then 970 read(param(7:10),
'(i4.4)') ie
971 iv = bump%bpar%b_to_v1(ib)
972 its = bump%bpar%b_to_ts1(ib)
973 call bump%geom%copy_c0a_to_mga(bump%mpl,bump%ens1u%fld(:,:,iv,its,ie),fld_mga)
975 call bump%mpl%abort(
'parameter '//trim(param)//
' not yet implemented in get_parameter')
991 class(bump_type),
intent(inout) :: bump
992 character(len=*),
intent(in) :: param
993 real(kind_real),
intent(in) :: fld_mga(bump%geom%nmga,bump%geom%nl0,bump%nam%nv,bump%nam%nts)
996 integer :: ib,iv,jv,its,jts
998 select case (trim(param))
999 case (
'var',
'cor_rh',
'cor_rv',
'cor_rv_rfac',
'cor_rv_coef',
'loc_coef',
'loc_rh',
'loc_rv',
'hyb_coef')
1000 select case (trim(bump%nam%strategy))
1001 case (
'specific_univariate',
'specific_multivariate')
1002 do ib=1,bump%bpar%nb
1004 iv = bump%bpar%b_to_v1(ib)
1005 jv = bump%bpar%b_to_v2(ib)
1006 its = bump%bpar%b_to_ts1(ib)
1007 jts = bump%bpar%b_to_ts2(ib)
1010 if ((iv==jv).and.(its==jts))
call bump%copy_from_field(param,ib,fld_mga(:,:,iv,its))
1012 case (
'common',
'common_univariate',
'common_weighted')
1016 do its=1,bump%nam%nts
1019 call bump%copy_from_field(param,ib,fld_mga(:,:,iv,its))
1024 do ib=1,bump%bpar%nb
1026 iv = bump%bpar%b_to_v1(ib)
1027 jv = bump%bpar%b_to_v2(ib)
1028 its = bump%bpar%b_to_ts1(ib)
1029 jts = bump%bpar%b_to_ts2(ib)
1032 if ((iv==jv).and.(its==jts))
call bump%copy_from_field(param,ib,fld_mga(:,:,iv,its))
1047 class(bump_type),
intent(inout) :: bump
1048 character(len=*),
intent(in) :: param
1049 integer,
intent(in) :: ib
1050 real(kind_real),
intent(in) :: fld_mga(bump%geom%nmga,bump%geom%nl0)
1053 if (.not.
allocated(bump%cmat%blk))
allocate(bump%cmat%blk(bump%bpar%nbe))
1056 select case (trim(param))
1058 if (.not.
allocated(bump%cmat%blk(ib)%oops_coef_ens))
allocate(bump%cmat%blk(ib)%oops_coef_ens(bump%geom%nc0a,bump%geom%nl0))
1059 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga,bump%cmat%blk(ib)%oops_coef_ens)
1061 if (.not.
allocated(bump%cmat%blk(ib)%oops_rh))
allocate(bump%cmat%blk(ib)%oops_rh(bump%geom%nc0a,bump%geom%nl0))
1062 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga,bump%cmat%blk(ib)%oops_rh)
1063 bump%cmat%blk(ib)%oops_rh = bump%cmat%blk(ib)%oops_rh/
req 1065 if (.not.
allocated(bump%cmat%blk(ib)%oops_rv))
allocate(bump%cmat%blk(ib)%oops_rv(bump%geom%nc0a,bump%geom%nl0))
1066 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga,bump%cmat%blk(ib)%oops_rv)
1067 case (
'cor_rv_rfac')
1068 if (.not.
allocated(bump%cmat%blk(ib)%oops_rv_rfac))
allocate(bump%cmat%blk(ib)%oops_rv_rfac(bump%geom%nc0a,bump%geom%nl0))
1069 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga,bump%cmat%blk(ib)%oops_rv_rfac)
1070 case (
'cor_rv_coef')
1071 if (.not.
allocated(bump%cmat%blk(ib)%oops_rv_coef))
allocate(bump%cmat%blk(ib)%oops_rv_coef(bump%geom%nc0a,bump%geom%nl0))
1072 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga,bump%cmat%blk(ib)%oops_rv_coef)
1074 if (.not.
allocated(bump%cmat%blk(ib)%oops_coef_ens))
allocate(bump%cmat%blk(ib)%oops_coef_ens(bump%geom%nc0a,bump%geom%nl0))
1075 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga,bump%cmat%blk(ib)%oops_coef_ens)
1077 if (.not.
allocated(bump%cmat%blk(ib)%oops_rh))
allocate(bump%cmat%blk(ib)%oops_rh(bump%geom%nc0a,bump%geom%nl0))
1078 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga,bump%cmat%blk(ib)%oops_rh)
1079 bump%cmat%blk(ib)%oops_rh = bump%cmat%blk(ib)%oops_rh/
req 1081 if (.not.
allocated(bump%cmat%blk(ib)%oops_rv))
allocate(bump%cmat%blk(ib)%oops_rv(bump%geom%nc0a,bump%geom%nl0))
1082 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga,bump%cmat%blk(ib)%oops_rv)
1084 if (.not.
allocated(bump%cmat%blk(ib)%oops_coef_sta))
allocate(bump%cmat%blk(ib)%oops_coef_sta(bump%geom%nc0a,bump%geom%nl0))
1085 call bump%geom%copy_mga_to_c0a(bump%mpl,fld_mga,bump%cmat%blk(ib)%oops_coef_sta)
1087 call bump%mpl%abort(
'parameter '//trim(param)//
' not yet implemented in set_parameter')
1101 class(bump_type),
intent(inout) :: bump
1104 call bump%cmat%dealloc(bump%bpar)
1105 call bump%ens1%dealloc
1106 call bump%ens1u%dealloc
1107 call bump%ens2%dealloc
1108 call bump%io%dealloc
1109 call bump%lct%dealloc(bump%bpar)
1110 call bump%nicas%dealloc(bump%nam,bump%geom,bump%bpar)
1111 call bump%obsop%dealloc
1112 call bump%vbal%dealloc(bump%nam)
1115 call bump%bpar%dealloc
1116 call bump%geom%dealloc
subroutine bump_setup_generic(bump)
subroutine bump_run_drivers(bump)
subroutine bump_apply_vbal_ad(bump, fld_mga)
subroutine bump_dealloc(bump)
subroutine bump_copy_to_field(bump, param, ib, fld_mga)
subroutine bump_set_parameter(bump, param, fld_mga)
subroutine bump_apply_obsop_ad(bump, obs, fld_mga)
subroutine bump_apply_vbal(bump, fld_mga)
subroutine bump_copy_from_field(bump, param, ib, fld_mga)
subroutine bump_apply_nicas(bump, fld_mga)
real(kind=kind_real), parameter req
Earth radius at equator (m)
subroutine bump_apply_nicas_sqrt_ad(bump, fld_mga, pcv)
subroutine bump_add_member(bump, fld_mga, ie, iens)
subroutine bump_apply_vbal_inv(bump, fld_mga)
subroutine bump_setup_online(bump, nmga, nl0, nv, nts, lon, lat, area, vunit, lmask, ens1_ne, ens1_nsub, ens2_ne, ens2_nsub, nobs, lonobs, latobs, namelname, lunit)
integer, parameter, public kind_real
subroutine bump_apply_obsop(bump, fld_mga, obs)
subroutine bump_apply_nicas_sqrt(bump, pcv, fld_mga)
subroutine bump_get_parameter(bump, param, fld_mga)
subroutine bump_apply_vbal_inv_ad(bump, fld_mga)
subroutine bump_get_cv_size(bump, n)