31 use sfc_input_data,
only : lsoil_input, &
32 read_fv3_grid_data_netcdf, &
33 landsea_mask_input_grid
35 use utilities,
only : error_handler
40 type(esmf_field),
public :: c_d_input_grid
41 type(esmf_field),
public :: c_0_input_grid
42 type(esmf_field),
public :: d_conv_input_grid
43 type(esmf_field),
public :: dt_cool_input_grid
44 type(esmf_field),
public :: ifd_input_grid
47 type(esmf_field),
public :: qrain_input_grid
48 type(esmf_field),
public :: tref_input_grid
49 type(esmf_field),
public :: w_d_input_grid
50 type(esmf_field),
public :: w_0_input_grid
51 type(esmf_field),
public :: xs_input_grid
52 type(esmf_field),
public :: xt_input_grid
53 type(esmf_field),
public :: xu_input_grid
54 type(esmf_field),
public :: xv_input_grid
55 type(esmf_field),
public :: xz_input_grid
56 type(esmf_field),
public :: xtts_input_grid
57 type(esmf_field),
public :: xzts_input_grid
58 type(esmf_field),
public :: z_c_input_grid
59 type(esmf_field),
public :: zm_input_grid
61 public :: read_input_nst_data
62 public :: cleanup_input_nst_data
69 subroutine read_input_nst_data(localpet)
73 integer,
intent(in) :: localpet
77 print*,
"- READ INPUT GRID NST DATA." 79 print*,
"- CALL FieldCreate FOR INPUT GRID C_D." 80 c_d_input_grid = esmf_fieldcreate(
input_grid, &
81 typekind=esmf_typekind_r8, &
82 staggerloc=esmf_staggerloc_center, rc=rc)
83 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
84 call error_handler(
"IN FieldCreate", rc)
86 print*,
"- CALL FieldCreate FOR INPUT GRID C_0." 87 c_0_input_grid = esmf_fieldcreate(
input_grid, &
88 typekind=esmf_typekind_r8, &
89 staggerloc=esmf_staggerloc_center, rc=rc)
90 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
91 call error_handler(
"IN FieldCreate", rc)
93 print*,
"- CALL FieldCreate FOR INPUT GRID D_CONV." 94 d_conv_input_grid = esmf_fieldcreate(
input_grid, &
95 typekind=esmf_typekind_r8, &
96 staggerloc=esmf_staggerloc_center, rc=rc)
97 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
98 call error_handler(
"IN FieldCreate", rc)
100 print*,
"- CALL FieldCreate FOR INPUT GRID DT_COOL." 101 dt_cool_input_grid = esmf_fieldcreate(
input_grid, &
102 typekind=esmf_typekind_r8, &
103 staggerloc=esmf_staggerloc_center, rc=rc)
104 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
105 call error_handler(
"IN FieldCreate", rc)
107 print*,
"- CALL FieldCreate FOR INPUT GRID IFD." 108 ifd_input_grid = esmf_fieldcreate(
input_grid, &
109 typekind=esmf_typekind_r8, &
110 staggerloc=esmf_staggerloc_center, rc=rc)
111 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
112 call error_handler(
"IN FieldCreate", rc)
114 print*,
"- CALL FieldCreate FOR INPUT GRID QRAIN." 115 qrain_input_grid = esmf_fieldcreate(
input_grid, &
116 typekind=esmf_typekind_r8, &
117 staggerloc=esmf_staggerloc_center, rc=rc)
118 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
119 call error_handler(
"IN FieldCreate", rc)
121 print*,
"- CALL FieldCreate FOR INPUT GRID TREF." 122 tref_input_grid = esmf_fieldcreate(
input_grid, &
123 typekind=esmf_typekind_r8, &
124 staggerloc=esmf_staggerloc_center, rc=rc)
125 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
126 call error_handler(
"IN FieldCreate", rc)
128 print*,
"- CALL FieldCreate FOR INPUT GRID W_D." 129 w_d_input_grid = esmf_fieldcreate(
input_grid, &
130 typekind=esmf_typekind_r8, &
131 staggerloc=esmf_staggerloc_center, rc=rc)
132 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
133 call error_handler(
"IN FieldCreate", rc)
135 print*,
"- CALL FieldCreate FOR INPUT GRID W_0." 136 w_0_input_grid = esmf_fieldcreate(
input_grid, &
137 typekind=esmf_typekind_r8, &
138 staggerloc=esmf_staggerloc_center, rc=rc)
139 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
140 call error_handler(
"IN FieldCreate", rc)
142 print*,
"- CALL FieldCreate FOR INPUT GRID XS." 143 xs_input_grid = esmf_fieldcreate(
input_grid, &
144 typekind=esmf_typekind_r8, &
145 staggerloc=esmf_staggerloc_center, rc=rc)
146 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
147 call error_handler(
"IN FieldCreate", rc)
149 print*,
"- CALL FieldCreate FOR INPUT GRID XT." 150 xt_input_grid = esmf_fieldcreate(
input_grid, &
151 typekind=esmf_typekind_r8, &
152 staggerloc=esmf_staggerloc_center, rc=rc)
153 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
154 call error_handler(
"IN FieldCreate", rc)
156 print*,
"- CALL FieldCreate FOR INPUT GRID XU." 157 xu_input_grid = esmf_fieldcreate(
input_grid, &
158 typekind=esmf_typekind_r8, &
159 staggerloc=esmf_staggerloc_center, rc=rc)
160 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
161 call error_handler(
"IN FieldCreate", rc)
163 print*,
"- CALL FieldCreate FOR INPUT GRID XV." 164 xv_input_grid = esmf_fieldcreate(
input_grid, &
165 typekind=esmf_typekind_r8, &
166 staggerloc=esmf_staggerloc_center, rc=rc)
167 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
168 call error_handler(
"IN FieldCreate", rc)
170 print*,
"- CALL FieldCreate FOR INPUT GRID XZ." 171 xz_input_grid = esmf_fieldcreate(
input_grid, &
172 typekind=esmf_typekind_r8, &
173 staggerloc=esmf_staggerloc_center, rc=rc)
174 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
175 call error_handler(
"IN FieldCreate", rc)
177 print*,
"- CALL FieldCreate FOR INPUT GRID XTTS." 178 xtts_input_grid = esmf_fieldcreate(
input_grid, &
179 typekind=esmf_typekind_r8, &
180 staggerloc=esmf_staggerloc_center, rc=rc)
181 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
182 call error_handler(
"IN FieldCreate", rc)
184 print*,
"- CALL FieldCreate FOR INPUT GRID XZTS." 185 xzts_input_grid = esmf_fieldcreate(
input_grid, &
186 typekind=esmf_typekind_r8, &
187 staggerloc=esmf_staggerloc_center, rc=rc)
188 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
189 call error_handler(
"IN FieldCreate", rc)
191 print*,
"- CALL FieldCreate FOR INPUT GRID Z_C." 192 z_c_input_grid = esmf_fieldcreate(
input_grid, &
193 typekind=esmf_typekind_r8, &
194 staggerloc=esmf_staggerloc_center, rc=rc)
195 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
196 call error_handler(
"IN FieldCreate", rc)
198 print*,
"- CALL FieldCreate FOR INPUT GRID ZM." 199 zm_input_grid = esmf_fieldcreate(
input_grid, &
200 typekind=esmf_typekind_r8, &
201 staggerloc=esmf_staggerloc_center, rc=rc)
202 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
203 call error_handler(
"IN FieldCreate", rc)
213 call read_input_nst_nemsio_file(localpet)
222 call read_input_nst_netcdf_file(localpet)
227 call read_input_nst_netcdf_file(localpet)
231 end subroutine read_input_nst_data
238 subroutine read_input_nst_netcdf_file(localpet)
242 integer,
intent(in) :: localpet
244 character(len=10) :: field
248 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
250 if (localpet == 0)
then 253 allocate(data_one_tile(0,0))
260 if (localpet == 0)
then 266 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
267 lsoil_input, sfcdata=data_one_tile)
270 print*,
"- CALL FieldScatter FOR INPUT C_D" 271 call esmf_fieldscatter(c_d_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
272 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
273 call error_handler(
"IN FieldScatter", rc)
277 if (localpet == 0)
then 283 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
284 lsoil_input, sfcdata=data_one_tile)
287 print*,
"- CALL FieldScatter FOR INPUT C_0" 288 call esmf_fieldscatter(c_0_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
289 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
290 call error_handler(
"IN FieldScatter", rc)
294 if (localpet == 0)
then 300 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
301 lsoil_input, sfcdata=data_one_tile)
304 print*,
"- CALL FieldScatter FOR INPUT D_CONV." 305 call esmf_fieldscatter(d_conv_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
306 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
307 call error_handler(
"IN FieldScatter", rc)
311 if (localpet == 0)
then 317 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
318 lsoil_input, sfcdata=data_one_tile)
321 print*,
"- CALL FieldScatter FOR INPUT DT_COOL." 322 call esmf_fieldscatter(dt_cool_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
323 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
324 call error_handler(
"IN FieldScatter", rc)
328 if (localpet == 0)
then 332 print*,
"- CALL FieldScatter FOR INPUT IFD." 333 call esmf_fieldscatter(ifd_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
334 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
335 call error_handler(
"IN FieldScatter", rc)
339 if (localpet == 0)
then 341 lsoil_input, sfcdata=data_one_tile)
344 print*,
"- CALL FieldScatter FOR INPUT QRAIN." 345 call esmf_fieldscatter(qrain_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
346 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
347 call error_handler(
"IN FieldScatter", rc)
351 if (localpet == 0)
then 353 lsoil_input, sfcdata=data_one_tile)
356 print*,
"- CALL FieldScatter FOR INPUT TREF" 357 call esmf_fieldscatter(tref_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
358 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
359 call error_handler(
"IN FieldScatter", rc)
363 if (localpet == 0)
then 369 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
370 lsoil_input, sfcdata=data_one_tile)
373 print*,
"- CALL FieldScatter FOR INPUT W_D" 374 call esmf_fieldscatter(w_d_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
375 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
376 call error_handler(
"IN FieldScatter", rc)
380 if (localpet == 0)
then 386 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
387 lsoil_input, sfcdata=data_one_tile)
390 print*,
"- CALL FieldScatter FOR INPUT W_0" 391 call esmf_fieldscatter(w_0_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
392 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
393 call error_handler(
"IN FieldScatter", rc)
397 if (localpet == 0)
then 399 lsoil_input, sfcdata=data_one_tile)
402 print*,
"- CALL FieldScatter FOR INPUT XS" 403 call esmf_fieldscatter(xs_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
404 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
405 call error_handler(
"IN FieldScatter", rc)
409 if (localpet == 0)
then 411 lsoil_input, sfcdata=data_one_tile)
414 print*,
"- CALL FieldScatter FOR INPUT XT" 415 call esmf_fieldscatter(xt_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
416 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
417 call error_handler(
"IN FieldScatter", rc)
421 if (localpet == 0)
then 423 lsoil_input, sfcdata=data_one_tile)
426 print*,
"- CALL FieldScatter FOR INPUT XU" 427 call esmf_fieldscatter(xu_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
428 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
429 call error_handler(
"IN FieldScatter", rc)
433 if (localpet == 0)
then 435 lsoil_input, sfcdata=data_one_tile)
438 print*,
"- CALL FieldScatter FOR INPUT XV" 439 call esmf_fieldscatter(xv_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
440 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
441 call error_handler(
"IN FieldScatter", rc)
445 if (localpet == 0)
then 447 lsoil_input, sfcdata=data_one_tile)
450 print*,
"- CALL FieldScatter FOR INPUT XZ" 451 call esmf_fieldscatter(xz_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
452 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
453 call error_handler(
"IN FieldScatter", rc)
457 if (localpet == 0)
then 459 lsoil_input, sfcdata=data_one_tile)
462 print*,
"- CALL FieldScatter FOR INPUT XTTS" 463 call esmf_fieldscatter(xtts_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
464 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
465 call error_handler(
"IN FieldScatter", rc)
469 if (localpet == 0)
then 471 lsoil_input, sfcdata=data_one_tile)
474 print*,
"- CALL FieldScatter FOR INPUT XZTS" 475 call esmf_fieldscatter(xzts_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
476 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
477 call error_handler(
"IN FieldScatter", rc)
481 if (localpet == 0)
then 487 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
488 lsoil_input, sfcdata=data_one_tile)
491 print*,
"- CALL FieldScatter FOR INPUT Z_C" 492 call esmf_fieldscatter(z_c_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
493 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
494 call error_handler(
"IN FieldScatter", rc)
498 if (localpet == 0)
then 502 print*,
"- CALL FieldScatter FOR INPUT ZM" 503 call esmf_fieldscatter(zm_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
504 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
505 call error_handler(
"IN FieldScatter", rc)
509 deallocate(data_one_tile)
511 end subroutine read_input_nst_netcdf_file
524 subroutine read_input_nst_nemsio_file(localpet)
528 integer,
intent(in) :: localpet
530 character(len=300) :: the_file
534 real(nemsio_realkind),
allocatable :: dummy(:)
535 real(esmf_kind_r8),
allocatable :: dummy2d(:,:)
537 type(nemsio_gfile) :: gfile
539 if (trim(
input_type) ==
"gfs_gaussian_nemsio")
then 546 print*,
"- READ NST DATA FROM: ", trim(the_file)
548 if (localpet == 0)
then 551 call nemsio_open(gfile, the_file,
"read", iret=rc)
554 allocate(dummy2d(0,0))
557 if (localpet == 0)
then 559 call nemsio_readrecv(gfile,
"tref",
"sfc", 1, dummy, 0, iret=rc)
560 if (rc /= 0)
call error_handler(
"READING TREF.", rc)
562 print*,
'tref ',maxval(dummy2d),minval(dummy2d)
565 print*,
"- CALL FieldScatter FOR INPUT TREF." 566 call esmf_fieldscatter(tref_input_grid, dummy2d, rootpet=0, rc=rc)
567 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
568 call error_handler(
"IN FieldScatter", rc)
570 if (localpet == 0)
then 572 call nemsio_readrecv(gfile,
"cd",
"sfc", 1, dummy, 0, iret=rc)
573 if (rc /= 0)
call error_handler(
"READING CD.", rc)
575 print*,
'cd ',maxval(dummy2d),minval(dummy2d)
578 print*,
"- CALL FieldScatter FOR INPUT C_D." 579 call esmf_fieldscatter(c_d_input_grid, dummy2d, rootpet=0, rc=rc)
580 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
581 call error_handler(
"IN FieldScatter", rc)
583 if (localpet == 0)
then 585 call nemsio_readrecv(gfile,
"c0",
"sfc", 1, dummy, 0, iret=rc)
586 if (rc /= 0)
call error_handler(
"READING C0.", rc)
588 print*,
'c0 ',maxval(dummy2d),minval(dummy2d)
591 print*,
"- CALL FieldScatter FOR INPUT C_0." 592 call esmf_fieldscatter(c_0_input_grid, dummy2d, rootpet=0, rc=rc)
593 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
594 call error_handler(
"IN FieldScatter", rc)
596 if (localpet == 0)
then 597 print*,
"- READ DCONV" 598 call nemsio_readrecv(gfile,
"dconv",
"sfc", 1, dummy, 0, iret=rc)
599 if (rc /= 0)
call error_handler(
"READING DCONV.", rc)
601 print*,
'dconv ',maxval(dummy2d),minval(dummy2d)
604 print*,
"- CALL FieldScatter FOR INPUT D_CONV." 605 call esmf_fieldscatter(d_conv_input_grid, dummy2d, rootpet=0, rc=rc)
606 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
607 call error_handler(
"IN FieldScatter", rc)
609 if (localpet == 0)
then 610 print*,
"- READ DTCOOL" 611 call nemsio_readrecv(gfile,
"dtcool",
"sfc", 1, dummy, 0, iret=rc)
612 if (rc /= 0)
call error_handler(
"READING DTCOOL.", rc)
614 print*,
'dtcool ',maxval(dummy2d),minval(dummy2d)
617 print*,
"- CALL FieldScatter FOR INPUT DT_COOL." 618 call esmf_fieldscatter(dt_cool_input_grid, dummy2d, rootpet=0, rc=rc)
619 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
620 call error_handler(
"IN FieldScatter", rc)
622 if (localpet == 0)
then 626 print*,
"- CALL FieldScatter FOR INPUT IFD." 627 call esmf_fieldscatter(ifd_input_grid, dummy2d, rootpet=0, rc=rc)
628 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
629 call error_handler(
"IN FieldScatter", rc)
631 if (localpet == 0)
then 632 print*,
"- READ QRAIN" 633 call nemsio_readrecv(gfile,
"qrain",
"sfc", 1, dummy, 0, iret=rc)
634 if (rc /= 0)
call error_handler(
"READING QRAIN.", rc)
636 print*,
'qrain ',maxval(dummy2d),minval(dummy2d)
639 print*,
"- CALL FieldScatter FOR INPUT QRAIN." 640 call esmf_fieldscatter(qrain_input_grid, dummy2d, rootpet=0, rc=rc)
641 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
642 call error_handler(
"IN FieldScatter", rc)
644 if (localpet == 0)
then 646 call nemsio_readrecv(gfile,
"wd",
"sfc", 1, dummy, 0, iret=rc)
647 if (rc /= 0)
call error_handler(
"READING WD.", rc)
649 print*,
'wd ',maxval(dummy2d),minval(dummy2d)
652 print*,
"- CALL FieldScatter FOR INPUT WD." 653 call esmf_fieldscatter(w_d_input_grid, dummy2d, rootpet=0, rc=rc)
654 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
655 call error_handler(
"IN FieldScatter", rc)
657 if (localpet == 0)
then 659 call nemsio_readrecv(gfile,
"w0",
"sfc", 1, dummy, 0, iret=rc)
660 if (rc /= 0)
call error_handler(
"READING W0.", rc)
662 print*,
'w0 ',maxval(dummy2d),minval(dummy2d)
665 print*,
"- CALL FieldScatter FOR INPUT W0." 666 call esmf_fieldscatter(w_0_input_grid, dummy2d, rootpet=0, rc=rc)
667 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
668 call error_handler(
"IN FieldScatter", rc)
670 if (localpet == 0)
then 672 call nemsio_readrecv(gfile,
"xs",
"sfc", 1, dummy, 0, iret=rc)
673 if (rc /= 0)
call error_handler(
"READING XS.", rc)
675 print*,
'xs ',maxval(dummy2d),minval(dummy2d)
678 print*,
"- CALL FieldScatter FOR INPUT XS." 679 call esmf_fieldscatter(xs_input_grid, dummy2d, rootpet=0, rc=rc)
680 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
681 call error_handler(
"IN FieldScatter", rc)
683 if (localpet == 0)
then 685 call nemsio_readrecv(gfile,
"xt",
"sfc", 1, dummy, 0, iret=rc)
686 if (rc /= 0)
call error_handler(
"READING XT.", rc)
688 print*,
'xt ',maxval(dummy2d),minval(dummy2d)
691 print*,
"- CALL FieldScatter FOR INPUT XT." 692 call esmf_fieldscatter(xt_input_grid, dummy2d, rootpet=0, rc=rc)
693 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
694 call error_handler(
"IN FieldScatter", rc)
696 if (localpet == 0)
then 698 call nemsio_readrecv(gfile,
"xu",
"sfc", 1, dummy, 0, iret=rc)
699 if (rc /= 0)
call error_handler(
"READING XU.", rc)
701 print*,
'xu ',maxval(dummy2d),minval(dummy2d)
704 print*,
"- CALL FieldScatter FOR INPUT XU." 705 call esmf_fieldscatter(xu_input_grid, dummy2d, rootpet=0, rc=rc)
706 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
707 call error_handler(
"IN FieldScatter", rc)
709 if (localpet == 0)
then 711 call nemsio_readrecv(gfile,
"xv",
"sfc", 1, dummy, 0, iret=rc)
712 if (rc /= 0)
call error_handler(
"READING XV.", rc)
714 print*,
'xv ',maxval(dummy2d),minval(dummy2d)
717 print*,
"- CALL FieldScatter FOR INPUT XV." 718 call esmf_fieldscatter(xv_input_grid, dummy2d, rootpet=0, rc=rc)
719 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
720 call error_handler(
"IN FieldScatter", rc)
722 if (localpet == 0)
then 724 call nemsio_readrecv(gfile,
"xz",
"sfc", 1, dummy, 0, iret=rc)
725 if (rc /= 0)
call error_handler(
"READING XZ.", rc)
727 print*,
'xz ',maxval(dummy2d),minval(dummy2d)
730 print*,
"- CALL FieldScatter FOR INPUT XZ." 731 call esmf_fieldscatter(xz_input_grid, dummy2d, rootpet=0, rc=rc)
732 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
733 call error_handler(
"IN FieldScatter", rc)
735 if (localpet == 0)
then 737 call nemsio_readrecv(gfile,
"xtts",
"sfc", 1, dummy, 0, iret=rc)
738 if (rc /= 0)
call error_handler(
"READING XTTS.", rc)
740 print*,
'xtts ',maxval(dummy2d),minval(dummy2d)
743 print*,
"- CALL FieldScatter FOR INPUT XTTS." 744 call esmf_fieldscatter(xtts_input_grid, dummy2d, rootpet=0, rc=rc)
745 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
746 call error_handler(
"IN FieldScatter", rc)
748 if (localpet == 0)
then 750 call nemsio_readrecv(gfile,
"xzts",
"sfc", 1, dummy, 0, iret=rc)
751 if (rc /= 0)
call error_handler(
"READING XZTS.", rc)
753 print*,
'xzts ',maxval(dummy2d),minval(dummy2d)
756 print*,
"- CALL FieldScatter FOR INPUT XZTS." 757 call esmf_fieldscatter(xzts_input_grid, dummy2d, rootpet=0, rc=rc)
758 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
759 call error_handler(
"IN FieldScatter", rc)
761 if (localpet == 0)
then 763 call nemsio_readrecv(gfile,
"zc",
"sfc", 1, dummy, 0, iret=rc)
764 if (rc /= 0)
call error_handler(
"READING ZC.", rc)
766 print*,
'zc ',maxval(dummy2d),minval(dummy2d)
769 print*,
"- CALL FieldScatter FOR INPUT Z_C." 770 call esmf_fieldscatter(z_c_input_grid, dummy2d, rootpet=0, rc=rc)
771 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
772 call error_handler(
"IN FieldScatter", rc)
774 if (localpet == 0)
then 778 print*,
"- CALL FieldScatter FOR INPUT ZM." 779 call esmf_fieldscatter(zm_input_grid, dummy2d, rootpet=0, rc=rc)
780 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
781 call error_handler(
"IN FieldScatter", rc)
783 deallocate(dummy, dummy2d)
785 if (localpet == 0)
call nemsio_close(gfile)
787 end subroutine read_input_nst_nemsio_file
794 subroutine cleanup_input_nst_data
800 print*,
'- DESTROY NST INPUT DATA.' 802 call esmf_fielddestroy(landsea_mask_input_grid, rc=rc)
803 call esmf_fielddestroy(c_d_input_grid, rc=rc)
804 call esmf_fielddestroy(c_0_input_grid, rc=rc)
805 call esmf_fielddestroy(d_conv_input_grid, rc=rc)
806 call esmf_fielddestroy(dt_cool_input_grid, rc=rc)
807 call esmf_fielddestroy(ifd_input_grid, rc=rc)
808 call esmf_fielddestroy(qrain_input_grid, rc=rc)
809 call esmf_fielddestroy(tref_input_grid, rc=rc)
810 call esmf_fielddestroy(w_d_input_grid, rc=rc)
811 call esmf_fielddestroy(w_0_input_grid, rc=rc)
812 call esmf_fielddestroy(xs_input_grid, rc=rc)
813 call esmf_fielddestroy(xt_input_grid, rc=rc)
814 call esmf_fielddestroy(xu_input_grid, rc=rc)
815 call esmf_fielddestroy(xv_input_grid, rc=rc)
816 call esmf_fielddestroy(xz_input_grid, rc=rc)
817 call esmf_fielddestroy(xtts_input_grid, rc=rc)
818 call esmf_fielddestroy(xzts_input_grid, rc=rc)
819 call esmf_fielddestroy(z_c_input_grid, rc=rc)
820 call esmf_fielddestroy(zm_input_grid, rc=rc)
822 end subroutine cleanup_input_nst_data
824 end module nst_input_data
This module contains code to read the setup namelist file, handle the varmap file for GRIB2 data...
character(len=500), public nst_files_input_grid
File name of input nst data.
integer, public ip1_input
i_input plus 1
integer, public j_input
j-dimension of input grid (or of each global tile)
integer, public jp1_input
j_input plus 1
Sets up the ESMF grid objects for the input data grid and target FV3 grid.
integer, public num_tiles_input_grid
Number of tiles, input grid.
type(esmf_grid), public input_grid
input grid esmf grid object
character(len=500), public data_dir_input_grid
Directory containing input atm or sfc files.
character(len=25), public input_type
Input data type:
character(len=500), dimension(6), public sfc_files_input_grid
File names containing input surface data.
integer, public i_input
i-dimension of input grid (or of each global tile)