36 latitude_s_target_grid, &
37 longitude_s_target_grid, &
38 latitude_w_target_grid, &
39 longitude_w_target_grid, &
44 cycle_year, cycle_mon, &
45 cycle_day, cycle_hour, &
47 tracers, num_tracers, &
54 qnifa_climo_input_grid, &
55 qnwfa_climo_input_grid, &
56 thomp_pres_climo_input_grid, &
63 integer,
public :: lev_target
64 integer,
public :: levp1_target
65 integer,
public :: nvcoord_target
67 real(esmf_kind_r8),
allocatable,
public :: vcoord_target(:,:)
69 type(esmf_field
),
public :: delp_target_grid
70 type(esmf_field),
public :: dzdt_target_grid
71 type(esmf_field) :: dzdt_b4adj_target_grid
72 type(esmf_field),
allocatable,
public :: tracers_target_grid(:)
73 type(esmf_field),
allocatable :: tracers_b4adj_target_grid(:)
74 type(esmf_field),
public :: ps_target_grid
75 type(esmf_field) :: ps_b4adj_target_grid
76 type(esmf_field) :: pres_target_grid
77 type(esmf_field) :: pres_b4adj_target_grid
78 type(esmf_field),
public :: temp_target_grid
79 type(esmf_field) :: temp_b4adj_target_grid
80 type(esmf_field) :: terrain_interp_to_target_grid
81 type(esmf_field),
public :: u_s_target_grid
82 type(esmf_field),
public :: v_s_target_grid
83 type(esmf_field) :: wind_target_grid
84 type(esmf_field) :: wind_b4adj_target_grid
85 type(esmf_field) :: wind_s_target_grid
86 type(esmf_field),
public :: u_w_target_grid
87 type(esmf_field),
public :: v_w_target_grid
88 type(esmf_field) :: wind_w_target_grid
89 type(esmf_field),
public :: zh_target_grid
93 type(esmf_field
) :: qnifa_climo_b4adj_target_grid
95 type(esmf_field),
public :: qnifa_climo_target_grid
98 type(esmf_field) :: qnwfa_climo_b4adj_target_grid
100 type(esmf_field),
public :: qnwfa_climo_target_grid
103 type(esmf_field) :: thomp_pres_climo_b4adj_target_grid
120 integer,
intent(in) :: localpet
122 integer :: isrctermprocessing
125 type(esmf_regridmethod_flag
) :: method
126 type(esmf_routehandle
) :: regrid_bl
128 real(esmf_kind_r8),
parameter :: p0=101325.0
129 real(esmf_kind_r8),
parameter :: rd = 287.058
130 real(esmf_kind_r8),
parameter :: grav = 9.81
131 real(esmf_kind_r8),
parameter :: lapse = -6.5e-03
133 real(esmf_kind_r8),
parameter :: exponent = rd*lapse/grav
134 real(esmf_kind_r8),
parameter :: one_over_exponent = 1.0 / exponent
136 real(esmf_kind_r8),
pointer :: psptr(:,:), tempptr(:,:,:)
160 isrctermprocessing = 1
162 if (trim(atm_weight_file) /=
"NULL")
then
164 print*,
"- CALL FieldSMMStore FOR ATMOSPHERIC FIELDS."
166 call esmf_fieldsmmstore(temp_input_grid, &
167 temp_b4adj_target_grid, &
169 routehandle=regrid_bl, &
170 srctermprocessing=isrctermprocessing, rc=rc)
171 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
176 print*,
"- CALL FieldRegridStore FOR ATMOSPHERIC FIELDS."
178 method=esmf_regridmethod_bilinear
180 call esmf_fieldregridstore(temp_input_grid, &
181 temp_b4adj_target_grid, &
182 polemethod=esmf_polemethod_allavg, &
183 srctermprocessing=isrctermprocessing, &
184 routehandle=regrid_bl, &
185 regridmethod=method, rc=rc)
186 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
191 print*,
"- CALL Field_Regrid FOR TEMPERATURE."
192 call esmf_fieldregrid(temp_input_grid, &
193 temp_b4adj_target_grid, &
194 routehandle=regrid_bl, &
195 termorderflag=esmf_termorder_srcseq, &
197 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
200 print*,
"- CALL Field_Regrid FOR PRESSURE."
201 call esmf_fieldregrid(pres_input_grid, &
202 pres_b4adj_target_grid, &
203 routehandle=regrid_bl, &
204 termorderflag=esmf_termorder_srcseq, &
206 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
209 do n = 1, num_tracers_input
210 print*,
"- CALL Field_Regrid FOR TRACER ", trim(tracers(n))
211 call esmf_fieldregrid(tracers_input_grid(n), &
212 tracers_b4adj_target_grid(n), &
213 routehandle=regrid_bl, &
214 termorderflag=esmf_termorder_srcseq, rc=rc)
215 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
220 print*,
"- CALL Field_Regrid FOR VERTICAL VELOCITY."
221 call esmf_fieldregrid(dzdt_input_grid, &
222 dzdt_b4adj_target_grid, &
223 routehandle=regrid_bl, &
224 termorderflag=esmf_termorder_srcseq, rc=rc)
225 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
229 print*,
"- CALL FieldGet FOR INPUT GRID VERTICAL VEL."
230 call esmf_fieldget(dzdt_input_grid, &
231 farrayptr=tempptr, rc=rc)
232 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
235 print*,
"MIN MAX W INPUT = ", minval(tempptr), maxval(tempptr)
238 print*,
"- CALL FieldGet FOR VERTICAL VEL B4ADJ."
239 call esmf_fieldget(dzdt_b4adj_target_grid, &
240 farrayptr=tempptr, rc=rc)
241 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
244 print*,
"MIN MAX W B4ADJ = ", minval(tempptr), maxval(tempptr)
247 print*,
"- CALL FieldGet FOR INPUT SURFACE PRESSURE."
248 call esmf_fieldget(ps_input_grid, &
249 farrayptr=psptr, rc=rc)
250 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
257 psptr = (psptr/p0)**exponent
259 print*,
"- CALL Field_Regrid FOR SURFACE PRESSURE."
260 call esmf_fieldregrid(ps_input_grid, &
261 ps_b4adj_target_grid, &
262 routehandle=regrid_bl, &
263 termorderflag=esmf_termorder_srcseq, &
265 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
269 print*,
"- CALL FieldGet FOR INPUT SURFACE PRESSURE B4ADJ."
270 call esmf_fieldget(ps_b4adj_target_grid, &
271 farrayptr=psptr, rc=rc)
272 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
275 psptr = p0 * psptr**one_over_exponent
277 print*,
"- CALL Field_Regrid FOR TERRAIN."
278 call esmf_fieldregrid(terrain_input_grid, &
279 terrain_interp_to_target_grid, &
280 routehandle=regrid_bl, &
281 termorderflag=esmf_termorder_srcseq, &
283 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
286 print*,
"- CALL Field_Regrid FOR 3-D WIND."
287 call esmf_fieldregrid(wind_input_grid, &
288 wind_b4adj_target_grid, &
289 routehandle=regrid_bl, &
290 termorderflag=esmf_termorder_srcseq, rc=rc)
291 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
294 print*,
"- CALL FieldRegridRelease."
295 call esmf_fieldregridrelease(routehandle=regrid_bl, rc=rc)
296 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
329 if( wam_cold_start )
then
330 call
vintg_wam(cycle_year,cycle_mon,cycle_day,cycle_hour)
349 isrctermprocessing = 1
350 method=esmf_regridmethod_bilinear
352 print*,
"- CALL FieldRegridStore FOR 3D-WIND WEST EDGE."
353 call esmf_fieldregridstore(wind_target_grid, &
354 wind_w_target_grid, &
355 polemethod=esmf_polemethod_allavg, &
356 srctermprocessing=isrctermprocessing, &
357 routehandle=regrid_bl, &
358 extrapmethod=esmf_extrapmethod_nearest_stod, &
359 regridmethod=method, rc=rc)
360 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
363 print*,
"- CALL Field_Regrid FOR 3-D WIND WEST EDGE."
364 call esmf_fieldregrid(wind_target_grid, &
365 wind_w_target_grid, &
366 routehandle=regrid_bl, &
367 termorderflag=esmf_termorder_srcseq, rc=rc)
368 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
371 print*,
"- CALL FieldRegridRelease."
372 call esmf_fieldregridrelease(routehandle=regrid_bl, rc=rc)
373 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
376 isrctermprocessing = 1
377 method=esmf_regridmethod_bilinear
379 print*,
"- CALL FieldRegridStore FOR 3D-WIND SOUTH EDGE."
380 call esmf_fieldregridstore(wind_target_grid, &
381 wind_s_target_grid, &
382 polemethod=esmf_polemethod_allavg, &
383 srctermprocessing=isrctermprocessing, &
384 routehandle=regrid_bl, &
385 extrapmethod=esmf_extrapmethod_nearest_stod, &
386 regridmethod=method, rc=rc)
387 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
390 print*,
"- CALL Field_Regrid FOR 3-D WIND SOUTH EDGE."
391 call esmf_fieldregrid(wind_target_grid, &
392 wind_s_target_grid, &
393 routehandle=regrid_bl, &
394 termorderflag=esmf_termorder_srcseq, rc=rc)
395 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
398 print*,
"- CALL FieldRegridRelease."
399 call esmf_fieldregridrelease(routehandle=regrid_bl, rc=rc)
400 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
413 if (use_thomp_mp_climo)
then
446 allocate(tracers_b4adj_target_grid(num_tracers_input))
448 do n = 1, num_tracers_input
449 print*,
"- CALL FieldCreate FOR TARGET GRID TRACER BEFORE ADJUSTMENT ", trim(tracers(n))
450 tracers_b4adj_target_grid(n) = esmf_fieldcreate(target_grid, &
451 typekind=esmf_typekind_r8, &
452 staggerloc=esmf_staggerloc_center, &
453 ungriddedlbound=(/1/), &
454 ungriddedubound=(/lev_input/), rc=rc)
455 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
459 print*,
"- CALL FieldCreate FOR TARGET GRID TEMPERATURE BEFORE ADJUSTMENT."
460 temp_b4adj_target_grid = esmf_fieldcreate(target_grid, &
461 typekind=esmf_typekind_r8, &
462 staggerloc=esmf_staggerloc_center, &
463 ungriddedlbound=(/1/), &
464 ungriddedubound=(/lev_input/), rc=rc)
465 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
468 print*,
"- CALL FieldCreate FOR TARGET GRID PRESSURE BEFORE ADJUSTMENT."
469 pres_b4adj_target_grid = esmf_fieldcreate(target_grid, &
470 typekind=esmf_typekind_r8, &
471 staggerloc=esmf_staggerloc_center, &
472 ungriddedlbound=(/1/), &
473 ungriddedubound=(/lev_input/), rc=rc)
474 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
477 print*,
"- CALL FieldCreate FOR TARGET GRID VERTICAL VELOCITY BEFORE ADJUSTMENT."
478 dzdt_b4adj_target_grid = esmf_fieldcreate(target_grid, &
479 typekind=esmf_typekind_r8, &
480 staggerloc=esmf_staggerloc_center, &
481 ungriddedlbound=(/1/), &
482 ungriddedubound=(/lev_input/), rc=rc)
483 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
486 print*,
"- CALL FieldCreate FOR TARGET GRID UNSTAGGERED WINDS BEFORE ADJUSTMENT."
487 wind_b4adj_target_grid = esmf_fieldcreate(target_grid, &
488 typekind=esmf_typekind_r8, &
489 staggerloc=esmf_staggerloc_center, &
490 ungriddedlbound=(/1,1/), &
491 ungriddedubound=(/lev_input,3/), rc=rc)
492 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
495 print*,
"- CALL FieldCreate FOR TARGET TERRAIN."
496 terrain_interp_to_target_grid = esmf_fieldcreate(target_grid, &
497 typekind=esmf_typekind_r8, &
498 staggerloc=esmf_staggerloc_center, rc=rc)
499 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
502 print*,
"- CALL FieldCreate FOR TARGET SURFACE PRESSURE BEFORE ADJUSTMENT."
503 ps_b4adj_target_grid = esmf_fieldcreate(target_grid, &
504 typekind=esmf_typekind_r8, &
505 staggerloc=esmf_staggerloc_center, rc=rc)
506 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
520 allocate(tracers_target_grid(num_tracers))
522 do n = 1, num_tracers
523 print*,
"- CALL FieldCreate FOR TARGET GRID TRACERS ", trim(tracers(n))
524 tracers_target_grid(n) = esmf_fieldcreate(target_grid, &
525 typekind=esmf_typekind_r8, &
526 staggerloc=esmf_staggerloc_center, &
527 ungriddedlbound=(/1/), &
528 ungriddedubound=(/lev_target/), rc=rc)
529 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
533 print*,
"- CALL FieldCreate FOR TARGET GRID TEMPERATURE."
534 temp_target_grid = esmf_fieldcreate(target_grid, &
535 typekind=esmf_typekind_r8, &
536 staggerloc=esmf_staggerloc_center, &
537 ungriddedlbound=(/1/), &
538 ungriddedubound=(/lev_target/), rc=rc)
539 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
542 print*,
"- CALL FieldCreate FOR TARGET GRID PRESSURE."
543 pres_target_grid = esmf_fieldcreate(target_grid, &
544 typekind=esmf_typekind_r8, &
545 staggerloc=esmf_staggerloc_center, &
546 ungriddedlbound=(/1/), &
547 ungriddedubound=(/lev_target/), rc=rc)
548 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
551 print*,
"- CALL FieldCreate FOR TARGET GRID VERTICAL VELOCITY."
552 dzdt_target_grid = esmf_fieldcreate(target_grid, &
553 typekind=esmf_typekind_r8, &
554 staggerloc=esmf_staggerloc_center, &
555 ungriddedlbound=(/1/), &
556 ungriddedubound=(/lev_target/), rc=rc)
557 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
560 print*,
"- CALL FieldCreate FOR TARGET GRID DELP."
561 delp_target_grid = esmf_fieldcreate(target_grid, &
562 typekind=esmf_typekind_r8, &
563 staggerloc=esmf_staggerloc_center, &
564 ungriddedlbound=(/1/), &
565 ungriddedubound=(/lev_target/), rc=rc)
566 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
569 print*,
"- CALL FieldCreate FOR TARGET HEIGHT."
570 zh_target_grid = esmf_fieldcreate(target_grid, &
571 typekind=esmf_typekind_r8, &
572 staggerloc=esmf_staggerloc_center, &
573 ungriddedlbound=(/1/), &
574 ungriddedubound=(/levp1_target/), rc=rc)
575 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
578 print*,
"- CALL FieldCreate FOR TARGET UNSTAGGERED 3D-WIND."
579 wind_target_grid = esmf_fieldcreate(target_grid, &
580 typekind=esmf_typekind_r8, &
581 staggerloc=esmf_staggerloc_center, &
582 ungriddedlbound=(/1,1/), &
583 ungriddedubound=(/lev_target,3/), rc=rc)
584 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
587 print*,
"- CALL FieldCreate FOR TARGET U_S."
588 u_s_target_grid = esmf_fieldcreate(target_grid, &
589 typekind=esmf_typekind_r8, &
590 staggerloc=esmf_staggerloc_edge2, &
591 ungriddedlbound=(/1/), &
592 ungriddedubound=(/lev_target/), rc=rc)
593 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
596 print*,
"- CALL FieldCreate FOR TARGET V_S."
597 v_s_target_grid = esmf_fieldcreate(target_grid, &
598 typekind=esmf_typekind_r8, &
599 staggerloc=esmf_staggerloc_edge2, &
600 ungriddedlbound=(/1/), &
601 ungriddedubound=(/lev_target/), rc=rc)
602 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
605 print*,
"- CALL FieldCreate FOR TARGET 3D-WIND_S."
606 wind_s_target_grid = esmf_fieldcreate(target_grid, &
607 typekind=esmf_typekind_r8, &
608 staggerloc=esmf_staggerloc_edge2, &
609 ungriddedlbound=(/1,1/), &
610 ungriddedubound=(/lev_target,3/), rc=rc)
611 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
614 print*,
"- CALL FieldCreate FOR TARGET U_W."
615 u_w_target_grid = esmf_fieldcreate(target_grid, &
616 typekind=esmf_typekind_r8, &
617 staggerloc=esmf_staggerloc_edge1, &
618 ungriddedlbound=(/1/), &
619 ungriddedubound=(/lev_target/), rc=rc)
620 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
623 print*,
"- CALL FieldCreate FOR TARGET V_W."
624 v_w_target_grid = esmf_fieldcreate(target_grid, &
625 typekind=esmf_typekind_r8, &
626 staggerloc=esmf_staggerloc_edge1, &
627 ungriddedlbound=(/1/), &
628 ungriddedubound=(/lev_target/), rc=rc)
629 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
632 print*,
"- CALL FieldCreate FOR TARGET 3D-WIND_W."
633 wind_w_target_grid = esmf_fieldcreate(target_grid, &
634 typekind=esmf_typekind_r8, &
635 staggerloc=esmf_staggerloc_edge1, &
636 ungriddedlbound=(/1,1/), &
637 ungriddedubound=(/lev_target,3/), rc=rc)
638 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
641 print*,
"- CALL FieldCreate FOR TARGET SURFACE PRESSURE."
642 ps_target_grid = esmf_fieldcreate(target_grid, &
643 typekind=esmf_typekind_r8, &
644 staggerloc=esmf_staggerloc_center, rc=rc)
645 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
657 integer :: clb(4), cub(4)
658 integer :: i, j, k, rc
660 real(esmf_kind_r8),
pointer :: latptr(:,:)
661 real(esmf_kind_r8),
pointer :: lonptr(:,:)
662 real(esmf_kind_r8),
pointer :: uptr(:,:,:)
663 real(esmf_kind_r8),
pointer :: vptr(:,:,:)
664 real(esmf_kind_r8),
pointer :: windptr(:,:,:,:)
665 real(esmf_kind_r8) :: latrad, lonrad
671 print*,
'- CONVERT WINDS.'
673 print*,
"- CALL FieldGet FOR 3-D WIND_S."
674 call esmf_fieldget(wind_s_target_grid, &
675 computationallbound=clb, &
676 computationalubound=cub, &
677 farrayptr=windptr, rc=rc)
678 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
681 print*,
"- CALL FieldGet FOR U_S."
682 call esmf_fieldget(u_s_target_grid, &
683 farrayptr=uptr, rc=rc)
684 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
687 print*,
"- CALL FieldGet FOR V_S."
688 call esmf_fieldget(v_s_target_grid, &
689 farrayptr=vptr, rc=rc)
690 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
693 print*,
"- CALL FieldGet FOR LATITUDE_S."
694 call esmf_fieldget(latitude_s_target_grid, &
695 farrayptr=latptr, rc=rc)
696 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
699 print*,
"- CALL FieldGet FOR LONGITUDE_S."
700 call esmf_fieldget(longitude_s_target_grid, &
701 farrayptr=lonptr, rc=rc)
702 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
705 do i = clb(1), cub(1)
706 do j = clb(2), cub(2)
707 latrad = latptr(i,j) * acos(-1.) / 180.0
708 lonrad = lonptr(i,j) * acos(-1.) / 180.0
709 do k = clb(3), cub(3)
710 uptr(i,j,k) = windptr(i,j,k,1) * cos(lonrad) + windptr(i,j,k,2) * sin(lonrad)
711 vptr(i,j,k) = -windptr(i,j,k,1) * sin(latrad) * sin(lonrad) + &
712 windptr(i,j,k,2) * sin(latrad) * cos(lonrad) + &
713 windptr(i,j,k,3) * cos(latrad)
719 print*,
"- CALL FieldGet FOR 3-D WIND_W."
720 call esmf_fieldget(wind_w_target_grid, &
721 computationallbound=clb, &
722 computationalubound=cub, &
723 farrayptr=windptr, rc=rc)
724 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
727 print*,
"- CALL FieldGet FOR U_W."
728 call esmf_fieldget(u_w_target_grid, &
729 farrayptr=uptr, rc=rc)
730 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
733 print*,
"- CALL FieldGet FOR V_W."
734 call esmf_fieldget(v_w_target_grid, &
735 farrayptr=vptr, rc=rc)
736 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
739 print*,
"- CALL FieldGet FOR LATITUDE_W."
740 call esmf_fieldget(latitude_w_target_grid, &
741 farrayptr=latptr, rc=rc)
742 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
745 print*,
"- CALL FieldGet FOR LONGITUDE_W."
746 call esmf_fieldget(longitude_w_target_grid, &
747 farrayptr=lonptr, rc=rc)
748 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
751 do i = clb(1), cub(1)
752 do j = clb(2), cub(2)
753 latrad = latptr(i,j) * acos(-1.) / 180.0
754 lonrad = lonptr(i,j) * acos(-1.) / 180.0
755 do k = clb(3), cub(3)
756 uptr(i,j,k) = windptr(i,j,k,1) * cos(lonrad) + windptr(i,j,k,2) * sin(lonrad)
757 vptr(i,j,k) = -windptr(i,j,k,1) * sin(latrad) * sin(lonrad) + &
758 windptr(i,j,k,2) * sin(latrad) * cos(lonrad) + &
759 windptr(i,j,k,3) * cos(latrad)
800 integer,
intent(in) :: localpet
802 integer :: idsl, idvc, rc
803 integer :: i, j, k, clb(3), cub(3)
805 real(esmf_kind_r8),
parameter :: rd=287.05
806 real(esmf_kind_r8),
parameter :: cp=1004.6
807 real(esmf_kind_r8),
parameter :: rocp=rd/cp
808 real(esmf_kind_r8),
parameter :: rocp1=rocp+1
809 real(esmf_kind_r8),
parameter :: rocpr=1/rocp
811 real(esmf_kind_r8),
pointer :: delp_ptr(:,:,:)
812 real(esmf_kind_r8),
pointer :: pptr(:,:,:)
813 real(esmf_kind_r8),
pointer :: psptr(:,:)
814 real(esmf_kind_r8) :: ak, bk
815 real(esmf_kind_r8),
allocatable :: pi(:,:,:)
817 print*,
"COMPUTE 3-D PRESSURE FROM ADJUSTED SURFACE PRESSURE."
822 print*,
"- CALL FieldGet FOR 3-D PRES."
823 call esmf_fieldget(pres_target_grid, &
824 computationallbound=clb, &
825 computationalubound=cub, &
826 farrayptr=pptr, rc=rc)
827 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
830 print*,
"- CALL FieldGet FOR DELP."
831 call esmf_fieldget(delp_target_grid, &
832 computationallbound=clb, &
833 computationalubound=cub, &
834 farrayptr=delp_ptr, rc=rc)
835 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
838 print*,
"- CALL FieldGet FOR SURFACE PRESSURE AFTER ADJUSTMENT"
839 call esmf_fieldget(ps_target_grid, &
840 farrayptr=psptr, rc=rc)
841 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
844 allocate(pi(clb(1):cub(1),clb(2):cub(2),1:levp1_target))
848 ak = vcoord_target(k,1)
849 bk = vcoord_target(k,2)
852 pi(i,j,k) = ak + bk*psptr(i,j)
859 delp_ptr(i,j,k) = pi(i,j,k) - pi(i,j,k+1)
871 pptr(i,j,k) = (pi(i,j,k)+pi(i,j,k+1))/2.0
879 pptr(i,j,k) = ((pi(i,j,k)**rocp1-pi(i,j,k+1)**rocp1)/ &
880 (rocp1*(pi(i,j,k)-pi(i,j,k+1))))**rocpr
888 if (localpet == 0)
then
889 print*,
'new pres ',pptr(clb(1),clb(2),:)
890 print*,
'delp ',delp_ptr(clb(1),clb(2),:)
912 integer,
intent(in) :: localpet
913 integer :: i, j, k, ii
914 integer :: clb(3), cub(3), ls, rc
916 real(esmf_kind_r8),
pointer :: pptr(:,:,:)
917 real(esmf_kind_r8),
pointer :: psptr(:,:)
918 real(esmf_kind_r8),
pointer :: psnewptr(:,:)
919 real(esmf_kind_r8),
pointer :: tptr(:,:,:)
920 real(esmf_kind_r8),
pointer :: qptr(:,:,:)
921 real(esmf_kind_r8),
pointer :: zsptr(:,:)
922 real(esmf_kind_r8),
pointer :: zsnewptr(:,:)
923 real(esmf_kind_r8),
allocatable :: zu(:,:)
924 real(esmf_kind_r8),
parameter :: beta=-6.5e-3
925 real(esmf_kind_r8),
parameter :: epsilon=1.e-9
926 real(esmf_kind_r8),
parameter :: g=9.80665
927 real(esmf_kind_r8),
parameter :: rd=287.05
928 real(esmf_kind_r8),
parameter :: rv=461.50
929 real(esmf_kind_r8),
parameter :: gor=g/rd
930 real(esmf_kind_r8),
parameter :: fv=rv/rd-1.
931 real(esmf_kind_r8) :: ftv, fgam, apu, fz0
932 real(esmf_kind_r8) :: atvu, atv, fz1, fp0
933 real(esmf_kind_r8) :: apd, azd, agam, azu
934 real(esmf_kind_r8) :: atvd, fp1, gamma, pu
935 real(esmf_kind_r8) :: tvu, pd, tvd
936 real(esmf_kind_r8) :: at, aq, ap, az
938 ftv(at,aq)=at*(1+fv*aq)
939 fgam(apu,atvu,apd,atvd)=-gor*log(atvd/atvu)/log(apd/apu)
940 fz0(ap,atv,azd,apd)=azd+atv/gor*log(apd/ap)
941 fz1(ap,atv,azd,apd,agam)=azd-atv/agam*((apd/ap)**(-agam/gor)-1)
942 fp0(az,azu,apu,atvu)=apu*exp(-gor/atvu*(az-azu))
943 fp1(az,azu,apu,atvu,agam)=apu*(1+agam/atvu*(az-azu))**(-gor/agam)
945 print*,
"- ADJUST SURFACE PRESSURE FOR NEW TERRAIN."
947 print*,
"- CALL FieldGet FOR 3-D PRES."
948 call esmf_fieldget(pres_b4adj_target_grid, &
949 computationallbound=clb, &
950 computationalubound=cub, &
951 farrayptr=pptr, rc=rc)
952 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
956 print*,
'old pres ',pptr(clb(1),clb(2),:)
959 print*,
"- CALL FieldGet FOR TEMPERATURE"
960 call esmf_fieldget(temp_b4adj_target_grid, &
961 farrayptr=tptr, rc=rc)
962 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
967 do ii = 1, num_tracers
968 if (trim(tracers(ii)) ==
"sphum")
exit
971 print*,
"- CALL FieldGet FOR SPECIFIC HUMIDITY"
972 call esmf_fieldget(tracers_b4adj_target_grid(ii), &
973 farrayptr=qptr, rc=rc)
974 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
977 print*,
"- CALL FieldGet FOR SURFACE PRESSURE BEFORE ADJUSTMENT"
978 call esmf_fieldget(ps_b4adj_target_grid, &
979 farrayptr=psptr, rc=rc)
980 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
983 print*,
"- CALL FieldGet FOR SURFACE PRESSURE AFTER ADJUSTMENT"
984 call esmf_fieldget(ps_target_grid, &
985 farrayptr=psnewptr, rc=rc)
986 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
989 print*,
"- CALL FieldGet FOR OLD TERRAIN"
990 call esmf_fieldget(terrain_interp_to_target_grid, &
991 farrayptr=zsptr, rc=rc)
992 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
995 print*,
"- CALL FieldGet FOR NEW TERRAIN"
996 call esmf_fieldget(terrain_target_grid, &
997 farrayptr=zsnewptr, rc=rc)
998 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1001 allocate(zu(clb(1):cub(1),clb(2):cub(2)))
1018 tvu=ftv(tptr(i,j,k),qptr(i,j,k))
1019 zu(i,j)=fz1(pu,tvu,zsptr(i,j),psptr(i,j),gamma)
1020 if(zsnewptr(i,j).le.zu(i,j))
then
1022 tvu=ftv(tptr(i,j,k),qptr(i,j,k))
1023 if(abs(gamma).gt.epsilon)
then
1024 psnewptr(i,j)=fp1(zsnewptr(i,j),zu(i,j),pu,tvu,gamma)
1026 psnewptr(i,j)=fp0(zsnewptr(i,j),zu(i,j),pu,tvu)
1043 if(psnewptr(i,j).eq.0)
then
1045 tvu=ftv(tptr(i,j,k),qptr(i,j,k))
1047 tvd=ftv(tptr(i,j,k-1),qptr(i,j,k-1))
1048 gamma=fgam(pu,tvu,pd,tvd)
1049 if(abs(gamma).gt.epsilon)
then
1050 zu(i,j)=fz1(pu,tvu,zu(i,j),pd,gamma)
1052 zu(i,j)=fz0(pu,tvu,zu(i,j),pd)
1054 if(zsnewptr(i,j).le.zu(i,j))
then
1055 if(abs(gamma).gt.epsilon)
then
1056 psnewptr(i,j)=fp1(zsnewptr(i,j),zu(i,j),pu,tvu,gamma)
1058 psnewptr(i,j)=fp0(zsnewptr(i,j),zu(i,j),pu,tvu)
1078 if(psnewptr(i,j).eq.0)
then
1080 tvu=ftv(tptr(i,j,k),qptr(i,j,k))
1081 psnewptr(i,j)=fp0(zsnewptr(i,j),zu(i,j),pu,tvu)
1089 if (localpet == 0)
then
1094 print*,
'sfcp adjust ',(zsnewptr(i,j)-zsptr(i,j)), psptr(i,j),psnewptr(i,j)
1099 end subroutine newps
1108 integer :: istat, n, k
1111 print*,
"OPEN VERTICAL COORD FILE: ", trim(vcoord_file_target_grid)
1112 open(14, file=trim(vcoord_file_target_grid), form=
'formatted', iostat=istat)
1113 if (istat /= 0)
then
1117 read(14, *, iostat=istat) nvcoord_target, lev_target
1118 if (istat /= 0)
then
1122 levp1_target = lev_target + 1
1124 allocate(vcoord_target(levp1_target, nvcoord_target))
1125 read(14, *, iostat=istat) ((vcoord_target(n,k), k=1,nvcoord_target), n=1,levp1_target)
1126 if (istat /= 0)
then
1144 integer :: isrctermprocessing, rc
1146 type(esmf_regridmethod_flag
) :: method
1147 type(esmf_routehandle
) :: regrid_bl
1149 isrctermprocessing=1
1151 print*,
"- CALL FieldCreate FOR TARGET GRID THOMP CLIMO QNIFA BEFORE ADJUSTMENT."
1152 qnifa_climo_b4adj_target_grid = esmf_fieldcreate(target_grid, &
1153 typekind=esmf_typekind_r8, &
1154 staggerloc=esmf_staggerloc_center, &
1155 ungriddedlbound=(/1/), &
1156 ungriddedubound=(/lev_thomp_mp_climo/), rc=rc)
1157 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1160 print*,
"- CALL FieldCreate FOR TARGET GRID THOMP CLIMO QNWFA BEFORE ADJUSTMENT."
1161 qnwfa_climo_b4adj_target_grid = esmf_fieldcreate(target_grid, &
1162 typekind=esmf_typekind_r8, &
1163 staggerloc=esmf_staggerloc_center, &
1164 ungriddedlbound=(/1/), &
1165 ungriddedubound=(/lev_thomp_mp_climo/), rc=rc)
1166 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1169 print*,
"- CALL FieldCreate FOR TARGET GRID THOMP CLIMO PRESSURE BEFORE ADJUSTMENT."
1170 thomp_pres_climo_b4adj_target_grid = esmf_fieldcreate(target_grid, &
1171 typekind=esmf_typekind_r8, &
1172 staggerloc=esmf_staggerloc_center, &
1173 ungriddedlbound=(/1/), &
1174 ungriddedubound=(/lev_thomp_mp_climo/), rc=rc)
1175 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1178 print*,
"- CALL FieldCreate FOR TARGET GRID THOMP CLIMO QNIFA."
1179 qnifa_climo_target_grid = esmf_fieldcreate(target_grid, &
1180 typekind=esmf_typekind_r8, &
1181 staggerloc=esmf_staggerloc_center, &
1182 ungriddedlbound=(/1/), &
1183 ungriddedubound=(/lev_target/), rc=rc)
1184 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1187 print*,
"- CALL FieldCreate FOR TARGET GRID THOMP CLIMO QNWFA."
1188 qnwfa_climo_target_grid = esmf_fieldcreate(target_grid, &
1189 typekind=esmf_typekind_r8, &
1190 staggerloc=esmf_staggerloc_center, &
1191 ungriddedlbound=(/1/), &
1192 ungriddedubound=(/lev_target/), rc=rc)
1193 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1196 print*,
"- CALL FieldRegridStore FOR THOMPSON CLIMO FIELDS."
1198 method=esmf_regridmethod_bilinear
1200 call esmf_fieldregridstore(qnifa_climo_input_grid, &
1201 qnifa_climo_b4adj_target_grid, &
1202 polemethod=esmf_polemethod_allavg, &
1203 srctermprocessing=isrctermprocessing, &
1204 routehandle=regrid_bl, &
1205 regridmethod=method, rc=rc)
1206 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1209 print*,
"- CALL Field_Regrid FOR THOMP CLIMO QNIFA."
1210 call esmf_fieldregrid(qnifa_climo_input_grid, &
1211 qnifa_climo_b4adj_target_grid, &
1212 routehandle=regrid_bl, &
1213 termorderflag=esmf_termorder_srcseq, rc=rc)
1214 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1217 print*,
"- CALL Field_Regrid FOR THOMP CLIMO QNWFA."
1218 call esmf_fieldregrid(qnwfa_climo_input_grid, &
1219 qnwfa_climo_b4adj_target_grid, &
1220 routehandle=regrid_bl, &
1221 termorderflag=esmf_termorder_srcseq, rc=rc)
1222 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1225 print*,
"- CALL Field_Regrid FOR THOMP PRESSURE."
1226 call esmf_fieldregrid(thomp_pres_climo_input_grid, &
1227 thomp_pres_climo_b4adj_target_grid, &
1228 routehandle=regrid_bl, &
1229 termorderflag=esmf_termorder_srcseq, rc=rc)
1230 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1233 print*,
"- CALL FieldRegridRelease."
1234 call esmf_fieldregridrelease(routehandle=regrid_bl, rc=rc)
1235 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1256 INTEGER :: clb(3), cub(3), rc
1257 INTEGER :: im, km1, km2, nt
1260 REAL(ESMF_KIND_R8),
ALLOCATABLE :: z1(:,:,:), z2(:,:,:)
1261 REAL(ESMF_KIND_R8),
ALLOCATABLE :: c1(:,:,:,:),c2(:,:,:,:)
1263 REAL(ESMF_KIND_R8),
POINTER :: qnifa1ptr(:,:,:)
1264 REAL(ESMF_KIND_R8),
POINTER :: qnifa2ptr(:,:,:)
1265 REAL(ESMF_KIND_R8),
POINTER :: qnwfa1ptr(:,:,:)
1266 REAL(ESMF_KIND_R8),
POINTER :: qnwfa2ptr(:,:,:)
1267 REAL(ESMF_KIND_R8),
POINTER :: p1ptr(:,:,:)
1268 REAL(ESMF_KIND_R8),
POINTER :: p2ptr(:,:,:)
1270 print*,
"- VERTICALY INTERPOLATE THOMP MP CLIMO TRACERS."
1272 print*,
"- CALL FieldGet FOR 3-D THOMP PRES."
1273 call esmf_fieldget(thomp_pres_climo_b4adj_target_grid, &
1274 computationallbound=clb, &
1275 computationalubound=cub, &
1276 farrayptr=p1ptr, rc=rc)
1277 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1286 ALLOCATE(z1(clb(1):cub(1),clb(2):cub(2),lev_thomp_mp_climo))
1287 ALLOCATE(z2(clb(1):cub(1),clb(2):cub(2),lev_target))
1288 ALLOCATE(c1(clb(1):cub(1),clb(2):cub(2),lev_thomp_mp_climo,nt))
1289 ALLOCATE(c2(clb(1):cub(1),clb(2):cub(2),lev_target,nt))
1293 print*,
"- CALL FieldGet FOR 3-D ADJUSTED PRESS"
1294 call esmf_fieldget(pres_target_grid, &
1295 farrayptr=p2ptr, rc=rc)
1296 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1304 print*,
"- CALL FieldGet FOR qnifa before vertical adjustment."
1305 call esmf_fieldget(qnifa_climo_b4adj_target_grid, &
1306 farrayptr=qnifa1ptr, rc=rc)
1307 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1310 c1(:,:,:,1) = qnifa1ptr(:,:,:)
1312 print*,
"- CALL FieldGet FOR qnwfa before vertical adjustment."
1313 call esmf_fieldget(qnwfa_climo_b4adj_target_grid, &
1314 farrayptr=qnwfa1ptr, rc=rc)
1315 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1318 c1(:,:,:,2) = qnwfa1ptr(:,:,:)
1326 im = (cub(1)-clb(1)+1) * (cub(2)-clb(2)+1)
1327 km1= lev_thomp_mp_climo
1330 CALL
terp3(im,1,1,1,1,nt,(im*km1),(im*km2), &
1331 km1,im,im,z1,c1,km2,im,im,z2,c2)
1333 print*,
"- CALL FieldGet FOR ADJUSTED climo qnifa."
1334 call esmf_fieldget(qnifa_climo_target_grid, &
1335 farrayptr=qnifa2ptr, rc=rc)
1336 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1339 print*,
"- CALL FieldGet FOR ADJUSTED climo qnwfa."
1340 call esmf_fieldget(qnwfa_climo_target_grid, &
1341 farrayptr=qnwfa2ptr, rc=rc)
1342 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1348 qnifa2ptr(i,j,k) = c2(i,j,k,1)
1349 qnwfa2ptr(i,j,k) = c2(i,j,k,2)
1354 DEALLOCATE (z1, z2, c1, c2)
1356 call esmf_fielddestroy(qnifa_climo_b4adj_target_grid, rc=rc)
1357 call esmf_fielddestroy(qnwfa_climo_b4adj_target_grid, rc=rc)
1358 call esmf_fielddestroy(thomp_pres_climo_b4adj_target_grid, rc=rc)
1381 INTEGER,
INTENT(IN) :: year,month,day,hour
1383 REAL(ESMF_KIND_R8),
PARAMETER :: amo = 15.9994
1384 REAL(ESMF_KIND_R8),
PARAMETER :: amo2 = 31.999
1385 REAL(ESMF_KIND_R8),
PARAMETER :: amn2 = 28.013
1387 REAL(ESMF_KIND_R8) :: coe,wfun(10),deglat,hold
1388 REAL(ESMF_KIND_R8) :: summass,qvmass,o3mass
1389 INTEGER :: i, j, k, ii, clb(3), cub(3), rc, kref
1390 INTEGER :: idat(8),jdow,jday,icday
1392 REAL(ESMF_KIND_R8),
ALLOCATABLE :: temp(:),on(:),o2n(:),n2n(:),prmb(:)
1394 REAL(ESMF_KIND_R8),
POINTER :: latptr(:,:)
1395 REAL(ESMF_KIND_R8),
POINTER :: p1ptr(:,:,:)
1396 REAL(ESMF_KIND_R8),
POINTER :: p2ptr(:,:,:)
1397 REAL(ESMF_KIND_R8),
POINTER :: dzdt2ptr(:,:,:)
1398 REAL(ESMF_KIND_R8),
POINTER :: t2ptr(:,:,:)
1399 REAL(ESMF_KIND_R8),
POINTER :: q2ptr(:,:,:)
1400 REAL(ESMF_KIND_R8),
POINTER :: qvptr(:,:,:)
1401 REAL(ESMF_KIND_R8),
POINTER :: qoptr(:,:,:)
1402 REAL(ESMF_KIND_R8),
POINTER :: o2ptr(:,:,:)
1403 REAL(ESMF_KIND_R8),
POINTER :: o3ptr(:,:,:)
1404 REAL(ESMF_KIND_R8),
POINTER :: wind2ptr(:,:,:,:)
1408 print*,
"VINTG_WAM:- VERTICALY EXTEND FIELDS FOR WAM COLD START."
1419 CALL w3doxdat(idat,jdow,icday,jday)
1420 print *,
"VINTG_WAM: WAM START DATE FOR ICDAY=",icday
1424 wfun(k) = (k-1.0) / 9.0
1427 ALLOCATE(temp(lev_target))
1428 ALLOCATE(prmb(lev_target))
1429 ALLOCATE( on(lev_target))
1430 ALLOCATE( o2n(lev_target))
1431 ALLOCATE( n2n(lev_target))
1434 print*,
"VINTG_WAM:- CALL FieldGet FOR 3-D PRES."
1435 call esmf_fieldget(pres_b4adj_target_grid, &
1436 computationallbound=clb, &
1437 computationalubound=cub, &
1438 farrayptr=p1ptr, rc=rc)
1439 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1444 print*,
"VINTG_WAM:- CALL FieldGet FOR 3-D ADJUSTED PRESS"
1445 call esmf_fieldget(pres_target_grid, &
1446 farrayptr=p2ptr, rc=rc)
1447 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1452 print*,
"VINTG_WAM - CALL FieldGet FOR LATITUDE_S."
1453 call esmf_fieldget(latitude_s_target_grid, &
1454 farrayptr=latptr, rc=rc)
1455 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1460 print*,
"VINTG_WAM:- CALL FieldGet FOR 3-D ADJUSTED TEMP."
1461 call esmf_fieldget(temp_target_grid, &
1462 farrayptr=t2ptr, rc=rc)
1463 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1467 print*,
"VINTG_WAM:- CALL FieldGet FOR ADJUSTED VERTICAL VELOCITY."
1468 call esmf_fieldget(dzdt_target_grid, &
1469 farrayptr=dzdt2ptr, rc=rc)
1470 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1474 print*,
"VINTG_WAM:- CALL FieldGet FOR 3-D ADJUSTED WIND."
1475 call esmf_fieldget(wind_target_grid, &
1476 farrayptr=wind2ptr, rc=rc)
1477 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1487 IF(p2ptr(i,j,k).le.p1ptr(i,j,lev_input))
THEN
1495 DO k=kref,lev_target
1496 coe = p2ptr(i,j,k) / p2ptr(i,j,kref)
1497 wind2ptr(i,j,k,1) = coe*wind2ptr(i,j,k,1)
1498 wind2ptr(i,j,k,2) = coe*wind2ptr(i,j,k,2)
1499 wind2ptr(i,j,k,3) = coe*wind2ptr(i,j,k,3)
1500 dzdt2ptr(i,j,k) = coe*dzdt2ptr(i,j,k)
1509 DO ii = 1, num_tracers
1511 print*,
"VINTG_WAM:- CALL FieldGet FOR 3-D TRACER ", trim(tracers(ii))
1512 call esmf_fieldget(tracers_target_grid(ii), &
1513 farrayptr=q2ptr, rc=rc)
1514 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1520 IF(p2ptr(i,j,k).le.p1ptr(i,j,lev_input))
THEN
1527 DO k=kref,lev_target
1528 coe = min(1.0, p2ptr(i,j,k) / p2ptr(i,j,kref) )
1529 q2ptr(i,j,k) = coe * q2ptr(i,j,k)
1534 IF (trim(tracers(ii)) ==
"sphum") qvptr => q2ptr
1535 IF (trim(tracers(ii)) ==
"spo" ) qoptr => q2ptr
1536 IF (trim(tracers(ii)) ==
"spo2" ) o2ptr => q2ptr
1537 IF (trim(tracers(ii)) ==
"spo3" ) o3ptr => q2ptr
1547 deglat = latptr(i,j)
1549 prmb(k) = p2ptr(i,j,k) * 0.01
1551 CALL
gettemp(icday,1,deglat,1,prmb,lev_target,temp,on,o2n,n2n)
1554 summass = on(k)*amo+o2n(k)*amo2+n2n(k)*amn2
1555 qvmass = summass*qvptr(i,j,k)/(1.-qvptr(i,j,k))
1556 summass = summass+qvmass
1557 o3mass = summass*o3ptr(i,j,k)
1558 summass = summass+o3mass
1559 hold = 1.0 / summass
1560 qoptr(i,j,k) = on(k)*amo *hold
1561 o2ptr(i,j,k) = o2n(k)*amo2*hold
1562 o3ptr(i,j,k) = o3mass * hold
1563 qvptr(i,j,k) = qvmass * hold
1567 IF(p2ptr(i,j,k).le.p1ptr(i,j,lev_input))
THEN
1574 DO k=kref,lev_target
1575 t2ptr(i,j,k) = temp(k)
1578 t2ptr(i,j,k) = wfun(k-kref+11) * temp(k) + &
1579 (1.- wfun(k-kref+11)) * t2ptr(i,j,k)
1584 DEALLOCATE (temp, prmb, on, o2n, n2n)
1606 REAL(ESMF_KIND_R8),
PARAMETER :: dltdz=-6.5e-3*287.05/9.80665
1607 REAL(ESMF_KIND_R8),
PARAMETER :: dlpvdrt=-2.5e6/461.50
1608 REAL(ESMF_KIND_R8),
PARAMETER :: one = 1.0_esmf_kind_r8
1610 INTEGER :: i, j, k, clb(3), cub(3), rc
1611 INTEGER :: im, km1, km2, nt, ii
1613 REAL(ESMF_KIND_R8) :: dz
1614 REAL(ESMF_KIND_R8),
ALLOCATABLE :: z1(:,:,:), z2(:,:,:)
1615 REAL(ESMF_KIND_R8),
ALLOCATABLE :: c1(:,:,:,:),c2(:,:,:,:)
1617 REAL(ESMF_KIND_R8),
POINTER :: p1ptr(:,:,:)
1618 REAL(ESMF_KIND_R8),
POINTER :: p2ptr(:,:,:)
1619 REAL(ESMF_KIND_R8),
POINTER :: dzdt1ptr(:,:,:)
1620 REAL(ESMF_KIND_R8),
POINTER :: dzdt2ptr(:,:,:)
1621 REAL(ESMF_KIND_R8),
POINTER :: t1ptr(:,:,:)
1622 REAL(ESMF_KIND_R8),
POINTER :: t2ptr(:,:,:)
1623 REAL(ESMF_KIND_R8),
POINTER :: q1ptr(:,:,:)
1624 REAL(ESMF_KIND_R8),
POINTER :: q2ptr(:,:,:)
1625 REAL(ESMF_KIND_R8),
POINTER :: wind1ptr(:,:,:,:)
1626 REAL(ESMF_KIND_R8),
POINTER :: wind2ptr(:,:,:,:)
1633 print*,
"- VERTICALY INTERPOLATE FIELDS."
1635 print*,
"- CALL FieldGet FOR 3-D PRES."
1636 call esmf_fieldget(pres_b4adj_target_grid, &
1637 computationallbound=clb, &
1638 computationalubound=cub, &
1639 farrayptr=p1ptr, rc=rc)
1640 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1649 ALLOCATE(z1(clb(1):cub(1),clb(2):cub(2),lev_input))
1650 ALLOCATE(z2(clb(1):cub(1),clb(2):cub(2),lev_target))
1651 ALLOCATE(c1(clb(1):cub(1),clb(2):cub(2),lev_input,num_tracers_input+5))
1652 ALLOCATE(c2(clb(1):cub(1),clb(2):cub(2),lev_target,num_tracers_input+5))
1656 print*,
"- CALL FieldGet FOR 3-D ADJUSTED PRESS"
1657 call esmf_fieldget(pres_target_grid, &
1658 farrayptr=p2ptr, rc=rc)
1659 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1664 print*,
"- CALL FieldGet FOR 3-D WIND."
1665 call esmf_fieldget(wind_b4adj_target_grid, &
1666 farrayptr=wind1ptr, rc=rc)
1667 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1670 c1(:,:,:,1) = wind1ptr(:,:,:,1)
1671 c1(:,:,:,2) = wind1ptr(:,:,:,2)
1672 c1(:,:,:,3) = wind1ptr(:,:,:,3)
1674 print*,
"- CALL FieldGet FOR VERTICAL VELOCITY."
1675 call esmf_fieldget(dzdt_b4adj_target_grid, &
1676 farrayptr=dzdt1ptr, rc=rc)
1677 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1680 c1(:,:,:,4) = dzdt1ptr(:,:,:)
1681 print*,
"MIN MAX W TARGETB4 IN VINTG = ", minval(dzdt1ptr(:,:,:)), maxval(dzdt1ptr(:,:,:))
1683 print*,
"- CALL FieldGet FOR 3-D TEMP."
1684 call esmf_fieldget(temp_b4adj_target_grid, &
1685 farrayptr=t1ptr, rc=rc)
1686 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1689 c1(:,:,:,5) = t1ptr(:,:,:)
1691 DO i = 1, num_tracers_input
1693 print*,
"- CALL FieldGet FOR 3-D TRACERS ", trim(tracers(i))
1694 call esmf_fieldget(tracers_b4adj_target_grid(i), &
1695 farrayptr=q1ptr, rc=rc)
1696 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1699 c1(:,:,:,5+i) = q1ptr(:,:,:)
1709 im = (cub(1)-clb(1)+1) * (cub(2)-clb(2)+1)
1712 nt= num_tracers_input + 1
1714 CALL
terp3(im,1,1,1,1,4+nt,(im*km1),(im*km2), &
1715 km1,im,im,z1,c1,km2,im,im,z2,c2)
1722 print*,
"- CALL FieldGet FOR 3-D ADJUSTED TEMP."
1723 call esmf_fieldget(temp_target_grid, &
1724 farrayptr=t2ptr, rc=rc)
1725 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1728 print*,
"- CALL FieldGet FOR ADJUSTED VERTICAL VELOCITY."
1729 call esmf_fieldget(dzdt_target_grid, &
1730 farrayptr=dzdt2ptr, rc=rc)
1731 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1734 print*,
"- CALL FieldGet FOR 3-D ADJUSTED WIND."
1735 call esmf_fieldget(wind_target_grid, &
1736 farrayptr=wind2ptr, rc=rc)
1737 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1743 wind2ptr(i,j,k,1)=c2(i,j,k,1)
1744 wind2ptr(i,j,k,2)=c2(i,j,k,2)
1745 wind2ptr(i,j,k,3)=c2(i,j,k,3)
1746 dzdt2ptr(i,j,k)=c2(i,j,k,4)
1747 dz=z2(i,j,k)-z1(i,j,1)
1749 t2ptr(i,j,k)=c2(i,j,k,5)
1751 t2ptr(i,j,k)=c1(i,j,1,5)*exp(dltdz*dz)
1757 DO ii = 1, num_tracers_input
1759 print*,
"- CALL FieldGet FOR 3-D TRACER ", trim(tracers(ii))
1760 call esmf_fieldget(tracers_target_grid(ii), &
1761 farrayptr=q2ptr, rc=rc)
1762 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1765 IF (trim(tracers(ii)) ==
"sphum")
THEN
1770 dz=z2(i,j,k)-z1(i,j,1)
1772 q2ptr(i,j,k) = c2(i,j,k,5+ii)
1774 q2ptr(i,j,k) = c1(i,j,1,5+ii)*exp(dlpvdrt*(one/t2ptr(i,j,k)-one/t1ptr(i,j,1))-dz)
1785 q2ptr(i,j,k) = c2(i,j,k,5+ii)
1794 DEALLOCATE (z1, z2, c1, c2)
1796 END SUBROUTINE vintg
1834 SUBROUTINE terp3(IM,IXZ1,IXQ1,IXZ2,IXQ2,NM,NXQ1,NXQ2, &
1835 km1,kxz1,kxq1,z1,q1,km2,kxz2,kxq2,z2,q2)
1837 INTEGER im,ixz1,ixq1,ixz2,ixq2,nm,nxq1,nxq2
1838 INTEGER km1,kxz1,kxq1,km2,kxz2,kxq2
1841 REAL(ESMF_KIND_R8),
PARAMETER :: one = 1.0_esmf_kind_r8
1842 REAL(ESMF_KIND_R8) :: z1(1+(im-1)*ixz1+(km1-1)*kxz1)
1843 REAL(ESMF_KIND_R8) :: q1(1+(im-1)*ixq1+(km1-1)*kxq1+(nm-1)*nxq1)
1844 REAL(ESMF_KIND_R8) :: z2(1+(im-1)*ixz2+(km2-1)*kxz2)
1845 REAL(ESMF_KIND_R8) :: q2(1+(im-1)*ixq2+(km2-1)*kxq2+(nm-1)*nxq2)
1847 REAL(ESMF_KIND_R8) :: ffa(im),ffb(im),ffc(im),ffd(im)
1848 REAL(ESMF_KIND_R8) :: gga(im),ggb(im),ggc(im),ggd(im)
1849 REAL(ESMF_KIND_R8) :: z1a,z1b,z1c,z1d,q1a,q1b,q1c,q1d,z2s,q2s
1854 CALL
rsearch(im,km1,ixz1,kxz1,z1,km2,ixz2,kxz2,z2,1,im,k1s)
1868 IF(k1.EQ.1.OR.k1.EQ.km1-1)
THEN
1869 z2s=z2(1+(i-1)*ixz2+(k2-1)*kxz2)
1870 z1a=z1(1+(i-1)*ixz1+(k1-1)*kxz1)
1871 z1b=z1(1+(i-1)*ixz1+(k1+0)*kxz1)
1872 ffa(i)=(z2s-z1b)/(z1a-z1b)
1873 ffb(i)=(z2s-z1a)/(z1b-z1a)
1874 gga(i)=one/(z1a-z1b)
1875 ggb(i)=one/(z1b-z1a)
1876 ELSEIF(k1.GT.1.AND.k1.LT.km1-1)
THEN
1877 z2s=z2(1+(i-1)*ixz2+(k2-1)*kxz2)
1878 z1a=z1(1+(i-1)*ixz1+(k1-2)*kxz1)
1879 z1b=z1(1+(i-1)*ixz1+(k1-1)*kxz1)
1880 z1c=z1(1+(i-1)*ixz1+(k1+0)*kxz1)
1881 z1d=z1(1+(i-1)*ixz1+(k1+1)*kxz1)
1882 ffa(i)=(z2s-z1b)/(z1a-z1b)* &
1883 (z2s-z1c)/(z1a-z1c)* &
1885 ffb(i)=(z2s-z1a)/(z1b-z1a)* &
1886 (z2s-z1c)/(z1b-z1c)* &
1888 ffc(i)=(z2s-z1a)/(z1c-z1a)* &
1889 (z2s-z1b)/(z1c-z1b)* &
1891 ffd(i)=(z2s-z1a)/(z1d-z1a)* &
1892 (z2s-z1b)/(z1d-z1b)* &
1894 gga(i)= one/(z1a-z1b)* &
1895 (z2s-z1c)/(z1a-z1c)* &
1896 (z2s-z1d)/(z1a-z1d)+ &
1897 (z2s-z1b)/(z1a-z1b)* &
1899 (z2s-z1d)/(z1a-z1d)+ &
1900 (z2s-z1b)/(z1a-z1b)* &
1901 (z2s-z1c)/(z1a-z1c)* &
1903 ggb(i)= one/(z1b-z1a)* &
1904 (z2s-z1c)/(z1b-z1c)* &
1905 (z2s-z1d)/(z1b-z1d)+ &
1906 (z2s-z1a)/(z1b-z1a)* &
1908 (z2s-z1d)/(z1b-z1d)+ &
1909 (z2s-z1a)/(z1b-z1a)* &
1910 (z2s-z1c)/(z1b-z1c)* &
1912 ggc(i)= one/(z1c-z1a)* &
1913 (z2s-z1b)/(z1c-z1b)* &
1914 (z2s-z1d)/(z1c-z1d)+ &
1915 (z2s-z1a)/(z1c-z1a)* &
1917 (z2s-z1d)/(z1c-z1d)+ &
1918 (z2s-z1a)/(z1c-z1a)* &
1919 (z2s-z1b)/(z1c-z1b)* &
1921 ggd(i)= one/(z1d-z1a)* &
1922 (z2s-z1b)/(z1d-z1b)* &
1923 (z2s-z1c)/(z1d-z1c)+ &
1924 (z2s-z1a)/(z1d-z1a)* &
1926 (z2s-z1c)/(z1d-z1c)+ &
1927 (z2s-z1a)/(z1d-z1a)* &
1928 (z2s-z1b)/(z1d-z1b)* &
1938 q2s=q1(1+(i-1)*ixq1+(n-1)*nxq1)
1940 ELSEIF(k1.EQ.km1)
THEN
1941 q2s=q1(1+(i-1)*ixq1+(km1-1)*kxq1+(n-1)*nxq1)
1943 ELSEIF(k1.EQ.1.OR.k1.EQ.km1-1)
THEN
1944 q1a=q1(1+(i-1)*ixq1+(k1-1)*kxq1+(n-1)*nxq1)
1945 q1b=q1(1+(i-1)*ixq1+(k1+0)*kxq1+(n-1)*nxq1)
1946 q2s=ffa(i)*q1a+ffb(i)*q1b
1949 q1a=q1(1+(i-1)*ixq1+(k1-2)*kxq1+(n-1)*nxq1)
1950 q1b=q1(1+(i-1)*ixq1+(k1-1)*kxq1+(n-1)*nxq1)
1951 q1c=q1(1+(i-1)*ixq1+(k1+0)*kxq1+(n-1)*nxq1)
1952 q1d=q1(1+(i-1)*ixq1+(k1+1)*kxq1+(n-1)*nxq1)
1953 q2s=ffa(i)*q1a+ffb(i)*q1b+ffc(i)*q1c+ffd(i)*q1d
1955 IF(q2s.LT.min(q1b,q1c))
THEN
1958 ELSEIF(q2s.GT.max(q1b,q1c))
THEN
1963 q2(1+(i-1)*ixq2+(k2-1)*kxq2+(n-1)*nxq2)=q2s
1970 END SUBROUTINE terp3
2028 SUBROUTINE rsearch(IM,KM1,IXZ1,KXZ1,Z1,KM2,IXZ2,KXZ2,Z2,IXL2,KXL2,L2)
2031 INTEGER,
INTENT(IN) :: im,km1,ixz1,kxz1,km2,ixz2,kxz2,ixl2,kxl2
2032 INTEGER,
INTENT(OUT) :: l2(1+(im-1)*ixl2+(km2-1)*kxl2)
2034 REAL(ESMF_KIND_R8),
INTENT(IN) :: z1(1+(im-1)*ixz1+(km1-1)*kxz1)
2035 REAL(ESMF_KIND_R8),
INTENT(IN) :: z2(1+(im-1)*ixz2+(km2-1)*kxz2)
2039 REAL(ESMF_KIND_R8) :: z
2045 IF (z1(1+(i-1)*ixz1).LE.z1(1+(i-1)*ixz1+(km1-1)*kxz1))
THEN
2048 z=z2(1+(i-1)*ixz2+(k2-1)*kxz2)
2051 IF(z.LT.z1(1+(i-1)*ixz1+l*kxz1))
EXIT
2055 l2(1+(i-1)*ixl2+(k2-1)*kxl2)=l
2060 z=z2(1+(i-1)*ixz2+(k2-1)*kxz2)
2063 IF(z.GT.z1(1+(i-1)*ixz1+l*kxz1))
EXIT
2067 l2(1+(i-1)*ixl2+(k2-1)*kxl2)=l
2080 integer :: i,ii, j,k, rc, clb(2), cub(2)
2082 real(esmf_kind_r8),
allocatable :: pe0(:), pn0(:)
2083 real(esmf_kind_r8),
pointer :: psptr(:,:)
2084 real(esmf_kind_r8),
pointer :: zhsfcptr(:,:)
2085 real(esmf_kind_r8),
pointer :: zhptr(:,:,:)
2086 real(esmf_kind_r8),
pointer :: tptr(:,:,:)
2087 real(esmf_kind_r8),
pointer :: qptr(:,:,:)
2088 real(esmf_kind_r8) :: ak, bk, zvir, grd
2089 real(esmf_kind_r8),
parameter :: grav = 9.80665
2090 real(esmf_kind_r8),
parameter :: rdgas = 287.05
2091 real(esmf_kind_r8),
parameter :: rvgas = 461.50
2093 print*,
"- COMPUTE HEIGHT"
2095 print*,
"- CALL FieldGet FOR SURFACE PRESSURE"
2096 call esmf_fieldget(ps_target_grid, &
2097 computationallbound=clb, &
2098 computationalubound=cub, &
2099 farrayptr=psptr, rc=rc)
2100 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2103 print*,
"- CALL FieldGet FOR TERRAIN HEIGHT"
2104 call esmf_fieldget(terrain_target_grid, &
2105 farrayptr=zhsfcptr, rc=rc)
2106 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2109 print*,
"- CALL FieldGet FOR HEIGHT"
2110 call esmf_fieldget(zh_target_grid, &
2111 farrayptr=zhptr, rc=rc)
2112 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2115 print*,
"- CALL FieldGet FOR TEMPERATURE"
2116 call esmf_fieldget(temp_target_grid, &
2117 farrayptr=tptr, rc=rc)
2118 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2121 do ii = 1, num_tracers
2122 if (trim(tracers(ii)) ==
"sphum")
exit
2125 print*,
"- CALL FieldGet FOR SPECIFIC HUMIDITY"
2126 call esmf_fieldget(tracers_target_grid(ii), &
2127 farrayptr=qptr, rc=rc)
2128 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2132 zvir = rvgas/rdgas - 1.0_esmf_kind_r8
2134 allocate(pe0(levp1_target))
2135 allocate(pn0(levp1_target))
2137 do j = clb(2), cub(2)
2138 do i = clb(1), cub(1)
2140 do k = 1, levp1_target
2141 ak = vcoord_target(k,1)
2143 bk = vcoord_target(k,2)
2145 pe0(k) = ak + bk*psptr(i,j)
2146 pn0(k) = log(pe0(k))
2149 zhptr(i,j,1) = zhsfcptr(i,j)
2151 do k = 2, levp1_target
2152 zhptr(i,j,k) = zhptr(i,j,k-1)+tptr(i,j,k-1)*(1.+zvir*qptr(i,j,k-1))* &
2153 (pn0(k-1)-pn0(k))/grd
2159 deallocate(pe0, pn0)
2172 print*,
"- DESTROY TARGET GRID ATMOSPHERIC BEFORE ADJUSTMENT FIELDS."
2174 call esmf_fielddestroy(wind_b4adj_target_grid, rc=rc)
2175 call esmf_fielddestroy(dzdt_b4adj_target_grid, rc=rc)
2176 call esmf_fielddestroy(ps_b4adj_target_grid, rc=rc)
2177 call esmf_fielddestroy(pres_b4adj_target_grid, rc=rc)
2178 call esmf_fielddestroy(temp_b4adj_target_grid, rc=rc)
2179 call esmf_fielddestroy(terrain_interp_to_target_grid, rc=rc)
2181 do i = 1, num_tracers_input
2182 call esmf_fielddestroy(tracers_b4adj_target_grid(i), rc=rc)
2185 deallocate(tracers_b4adj_target_grid)
2197 print*,
"- DESTROY TARGET GRID ATMOSPHERIC FIELDS."
2199 call esmf_fielddestroy(delp_target_grid, rc=rc)
2200 call esmf_fielddestroy(dzdt_target_grid, rc=rc)
2201 call esmf_fielddestroy(ps_target_grid, rc=rc)
2202 call esmf_fielddestroy(pres_target_grid, rc=rc)
2203 call esmf_fielddestroy(temp_target_grid, rc=rc)
2204 call esmf_fielddestroy(u_s_target_grid, rc=rc)
2205 call esmf_fielddestroy(v_s_target_grid, rc=rc)
2206 call esmf_fielddestroy(wind_target_grid, rc=rc)
2207 call esmf_fielddestroy(wind_s_target_grid, rc=rc)
2208 call esmf_fielddestroy(wind_w_target_grid, rc=rc)
2209 call esmf_fielddestroy(u_w_target_grid, rc=rc)
2210 call esmf_fielddestroy(v_w_target_grid, rc=rc)
2211 call esmf_fielddestroy(zh_target_grid, rc=rc)
2213 do i = 1, num_tracers
2214 call esmf_fielddestroy(tracers_target_grid(i), rc=rc)
2217 deallocate(tracers_target_grid)
2219 if (esmf_fieldiscreated(qnifa_climo_target_grid))
then
2220 call esmf_fielddestroy(qnifa_climo_target_grid, rc=rc)
2223 if (esmf_fieldiscreated(qnwfa_climo_target_grid))
then
2224 call esmf_fielddestroy(qnwfa_climo_target_grid, rc=rc)
subroutine write_fv3_atm_bndy_data_netcdf(localpet)
Writes atmospheric fields along the lateral boundary.
subroutine cleanup_target_atm_b4adj_data
Cleanup atmospheric field (before adjustment) objects.
subroutine vintg
Vertically interpolate upper-air fields.
subroutine vintg_wam(YEAR, MONTH, DAY, HOUR)
Vertically extend model top into thermosphere for whole atmosphere model.
subroutine vintg_thomp_mp_climo
Vertically interpolate atmospheric fields to target FV3 grid.
subroutine newps(localpet)
Computes adjusted surface pressure given a new terrain height.
subroutine create_atm_b4adj_esmf_fields
Create target grid field objects to hold data before vertical interpolation.
subroutine read_vcoord_info
Reads model vertical coordinate definition file (as specified by namelist variable vcoord_file_target...
Sets up the ESMF grid objects for the input data grid and target FV3 grid.
Process atmospheric fields.
subroutine, public cleanup_thomp_mp_climo_input_data
Free up memory associated with this module.
subroutine terp3(IM, IXZ1, IXQ1, IXZ2, IXQ2, NM, NXQ1, NXQ2, KM1, KXZ1, KXQ1, Z1, Q1, KM2, KXZ2, KXQ2, Z2, Q2)
Cubically interpolate in one dimension.
subroutine, public atmosphere_driver(localpet)
Driver routine to process for atmospheric fields.
Module to read the Thompson climatological MP data file and set up the associated esmf field and grid...
subroutine write_fv3_atm_data_netcdf(localpet)
Write atmospheric coldstart files (netcdf format).
subroutine, public read_thomp_mp_climo_data
Read Thompson climatological MP data file and time interpolate data to current cycle time...
subroutine create_atm_esmf_fields
Create target grid field objects.
subroutine write_fv3_atm_header_netcdf(localpet)
Writes atmospheric header file in netcdf format.
subroutine error_handler(string, rc)
General error handler.
subroutine rsearch(IM, KM1, IXZ1, KXZ1, Z1, KM2, IXZ2, KXZ2, Z2, IXL2, KXL2, L2)
Search for a surrounding real interval.
subroutine horiz_interp_thomp_mp_climo
Horizontally interpolate thompson microphysics data to the target model grid.
This module contains code to read the setup namelist file, handle the varmap file for GRIB2 data...
subroutine gettemp(iday, nday, xlat, nlat, pr, np, temp, n_o, n_o2, n_n2)
Entry routine to get WAM needed temperature and composition profiles.
subroutine compute_zh
Compute vertical level height.
subroutine newpr1(localpet)
Computes 3-D pressure given an adjusted surface pressure.
subroutine convert_winds
Convert 3-d component winds to u and v.
subroutine cleanup_target_atm_data
Cleanup target grid atmospheric field objects.