118 use constants_mod
, only: pi=>pi_8, kappa, radius, grav, rdgas
119 use field_manager_mod
, only: model_atmos
120 use fms_mod
, only: write_version_number, open_namelist_file, &
121 check_nml_error, close_file, file_exist
122 use fms_io_mod
, only: set_domain
123 use mpp_mod
, only: fatal, mpp_error, mpp_pe, stdlog, &
124 mpp_npes, mpp_get_current_pelist, &
125 input_nml_file, get_unit, warning, &
126 read_ascii_file, input_str_length
127 use mpp_domains_mod
, only: mpp_get_data_domain, mpp_get_compute_domain, mpp_get_tile_id
128 use tracer_manager_mod
, only: tm_get_number_tracers => get_number_tracers, &
129 tm_get_tracer_index => get_tracer_index, &
130 tm_get_tracer_indices => get_tracer_indices, &
131 tm_set_tracer_profile => set_tracer_profile, &
132 tm_get_tracer_names => get_tracer_names, &
133 tm_check_if_prognostic=> check_if_prognostic,&
134 tm_register_tracers => register_tracers
143 use fv_mp_mod, only: mp_start, domain_decomp, mp_assign_gid, global_nest_domain
144 use fv_mp_mod, only: broadcast_domains, mp_barrier, is_master, setup_master, grids_master_procs, tile_fine
145 use fv_mp_mod, only: max_nnest, max_ntile
148 use mpp_domains_mod
, only: domain2d
149 use mpp_domains_mod
, only: mpp_define_nest_domains, nest_domain_type, mpp_get_global_domain
150 use mpp_domains_mod
, only: mpp_get_c2f_index, mpp_get_f2c_index
151 use mpp_domains_mod
, only: center, corner, north, east, west, south
152 use mpp_mod
, only: mpp_send, mpp_sync, mpp_transmit, mpp_set_current_pelist, &
153 mpp_declare_pelist, mpp_root_pe, mpp_recv, mpp_sync_self, read_input_nml, &
158 use constants_mod
, only: rvgas, cp_air
182 #include<file_version.h> 188 subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split)
190 type(
fv_atmos_type),
allocatable,
intent(inout),
target :: Atm(:)
191 real,
intent(in) :: dt_atmos
192 integer,
intent(OUT) :: this_grid
193 logical,
allocatable,
intent(OUT) :: grids_on_this_pe(:)
195 integer,
intent(INOUT) :: p_split
196 character(100) :: pe_list_name, errstring
197 integer :: n, npes, pecounter, i, num_family, ntiles_nest_all
198 integer,
allocatable :: global_pelist(:)
199 integer,
dimension(MAX_NNEST) :: grid_pes = 0
200 integer,
dimension(MAX_NNEST) :: grid_coarse = -1
201 integer,
dimension(MAX_NNEST) :: nest_refine = 3
202 integer,
dimension(MAX_NNEST) :: nest_ioffsets = -999, nest_joffsets = -999
203 integer,
dimension(MAX_NNEST) :: all_npx = 0
204 integer,
dimension(MAX_NNEST) :: all_npy = 0
205 integer,
dimension(MAX_NNEST) :: all_npz = 0
206 integer,
dimension(MAX_NNEST) :: all_ntiles = 0
207 integer,
dimension(MAX_NNEST) :: all_twowaynest = 0
209 integer,
dimension(MAX_NNEST) :: icount_coarse = 1
210 integer,
dimension(MAX_NNEST) :: jcount_coarse = 1
211 integer,
dimension(MAX_NNEST) :: nest_level = 0
212 integer,
dimension(MAX_NNEST) :: tile_coarse = 0
213 integer,
dimension(MAX_NTILE) :: npes_nest_tile = 0
216 integer :: unit, ens_root_pe, tile_id(1)
225 character(len=80) ,
pointer :: grid_name
226 character(len=120),
pointer :: grid_file
227 integer,
pointer :: grid_type
228 integer ,
pointer :: hord_mt
229 integer ,
pointer :: kord_mt
230 integer ,
pointer :: kord_wz
231 integer ,
pointer :: hord_vt
232 integer ,
pointer :: hord_tm
233 integer ,
pointer :: hord_dp
234 integer ,
pointer :: kord_tm
235 integer ,
pointer :: hord_tr
236 integer ,
pointer :: kord_tr
237 real ,
pointer :: scale_z
238 real ,
pointer :: w_max
239 real ,
pointer :: z_min
240 real ,
pointer :: lim_fac
242 integer ,
pointer :: nord
243 integer ,
pointer :: nord_tr
244 real ,
pointer :: dddmp
245 real ,
pointer :: d2_bg
246 real ,
pointer :: d4_bg
247 real ,
pointer :: vtdm4
248 real ,
pointer :: trdm2
249 real ,
pointer :: d2_bg_k1
250 real ,
pointer :: d2_bg_k2
251 real ,
pointer :: d2_divg_max_k1
252 real ,
pointer :: d2_divg_max_k2
253 real ,
pointer :: damp_k_k1
254 real ,
pointer :: damp_k_k2
255 integer ,
pointer :: n_zs_filter
256 integer ,
pointer :: nord_zs_filter
257 logical ,
pointer :: full_zs_filter
259 logical ,
pointer :: RF_fast
260 logical ,
pointer :: consv_am
261 logical ,
pointer :: do_sat_adj
262 logical ,
pointer :: do_f3d
263 logical ,
pointer :: no_dycore
264 logical ,
pointer :: convert_ke
265 logical ,
pointer :: do_vort_damp
266 logical ,
pointer :: use_old_omega
268 real ,
pointer :: beta
269 integer ,
pointer :: n_sponge
270 real ,
pointer :: d_ext
271 integer ,
pointer :: nwat
272 logical ,
pointer :: warm_start
273 logical ,
pointer :: inline_q
274 real ,
pointer :: shift_fac
275 logical ,
pointer :: do_schmidt, do_cube_transform
276 real(kind=R_GRID) ,
pointer :: stretch_fac
277 real(kind=R_GRID) ,
pointer :: target_lat
278 real(kind=R_GRID) ,
pointer :: target_lon
280 logical ,
pointer :: reset_eta
281 real ,
pointer :: p_fac
282 real ,
pointer :: a_imp
283 integer ,
pointer :: n_split
284 real ,
pointer :: fac_n_spl
285 real ,
pointer :: fhouri
287 integer ,
pointer :: m_split
288 integer ,
pointer :: k_split
289 logical ,
pointer :: use_logp
291 integer ,
pointer :: q_split
292 integer ,
pointer :: print_freq
293 logical ,
pointer :: write_3d_diags
295 integer ,
pointer :: npx
296 integer ,
pointer :: npy
297 integer ,
pointer :: npz
298 character(len=24),
pointer :: npz_type
299 integer ,
pointer :: npz_rst
301 integer ,
pointer :: ncnst
302 integer ,
pointer :: pnats
303 integer ,
pointer :: dnats
304 integer ,
pointer :: dnrts
305 integer ,
pointer :: ntiles
306 integer ,
pointer :: nf_omega
307 integer ,
pointer :: fv_sg_adj
308 real ,
pointer :: sg_cutoff
310 integer ,
pointer :: na_init
311 logical ,
pointer :: nudge_dz
312 real ,
pointer :: p_ref
313 real ,
pointer :: dry_mass
314 integer ,
pointer :: nt_prog
315 integer ,
pointer :: nt_phys
316 real ,
pointer :: tau_h2o
318 real ,
pointer :: delt_max
319 real ,
pointer :: d_con
320 real ,
pointer :: ke_bg
321 real ,
pointer :: consv_te
322 real ,
pointer :: tau
323 real ,
pointer :: rf_cutoff
324 logical ,
pointer :: filter_phys
325 logical ,
pointer :: dwind_2d
326 logical ,
pointer :: breed_vortex_inline
327 logical ,
pointer :: range_warn
328 logical ,
pointer :: fill
329 logical ,
pointer :: fill_dp
330 logical ,
pointer :: fill_wz
331 logical ,
pointer :: fill_gfs
332 logical ,
pointer :: check_negative
333 logical ,
pointer :: non_ortho
334 logical ,
pointer :: adiabatic
335 logical ,
pointer :: moist_phys
336 logical ,
pointer :: do_Held_Suarez
337 logical ,
pointer :: do_reed_physics
338 logical ,
pointer :: reed_cond_only
339 logical ,
pointer :: reproduce_sum
340 logical ,
pointer :: adjust_dry_mass
341 logical ,
pointer :: fv_debug
342 logical ,
pointer :: srf_init
343 logical ,
pointer :: mountain
344 logical ,
pointer :: remap_t
345 logical ,
pointer :: z_tracer
347 logical ,
pointer :: old_divg_damp
348 logical ,
pointer :: fv_land
349 logical ,
pointer :: nudge
350 logical ,
pointer :: nudge_ic
351 logical ,
pointer :: ncep_ic
352 logical ,
pointer :: nggps_ic
353 logical ,
pointer :: ecmwf_ic
354 logical ,
pointer :: gfs_phil
355 logical ,
pointer :: agrid_vel_rst
356 logical ,
pointer :: use_new_ncep
357 logical ,
pointer :: use_ncep_phy
358 logical ,
pointer :: fv_diag_ic
359 logical ,
pointer :: external_ic
360 logical ,
pointer :: external_eta
361 logical ,
pointer :: read_increment
362 logical ,
pointer :: hydrostatic
363 logical ,
pointer :: phys_hydrostatic
364 logical ,
pointer :: use_hydro_pressure
365 logical ,
pointer :: do_uni_zfull
366 logical ,
pointer :: adj_mass_vmr
367 logical ,
pointer :: hybrid_z
368 logical ,
pointer :: Make_NH
369 logical ,
pointer :: make_hybrid_z
370 logical ,
pointer :: nudge_qv
371 real,
pointer :: add_noise
372 logical ,
pointer :: butterfly_effect
374 integer ,
pointer :: a2b_ord
375 integer ,
pointer :: c2l_ord
377 integer,
pointer :: ndims
379 real(kind=R_GRID),
pointer :: dx_const
380 real(kind=R_GRID),
pointer :: dy_const
381 real(kind=R_GRID),
pointer :: deglon_start, deglon_stop, &
382 deglat_start, deglat_stop
383 real(kind=R_GRID),
pointer :: deglat
385 logical,
pointer :: nested, twowaynest
386 logical,
pointer :: regional
387 integer,
pointer :: bc_update_interval
388 integer,
pointer :: nrows_blend
389 logical,
pointer :: regional_bcs_from_gsi
390 logical,
pointer :: write_restart_with_bcs
391 integer,
pointer :: parent_tile, refinement, nestbctype, nestupdate, nsponge, ioffset, joffset
392 real,
pointer :: s_weight, update_blend
394 integer,
pointer :: layout(:), io_layout(:)
400 ens_root_pe = mpp_root_pe()
410 if (grid_coarse(n) <= 0)
then 418 allocate(global_pelist(npes))
422 allocate(grids_master_procs(
ngrids))
424 allocate(grids_on_this_pe(
ngrids))
425 grids_on_this_pe(:) = .false.
429 if (
ngrids == 1 .or. grid_pes(n) == 0)
then 430 grid_pes(n) = npes - sum(grid_pes)
431 if (grid_pes(n) == 0)
then 433 call mpp_error(fatal,
'Only one zero entry in grid_pes permitted.')
440 allocate(atm(n)%pelist(grid_pes(n)))
441 grids_master_procs(n) = pecounter
443 if (pecounter >= npes)
then 444 if (mpp_pe() == 0)
then 445 print*,
'ngrids = ',
ngrids,
', grid_pes = ', grid_pes(1:
ngrids)
447 call mpp_error(fatal,
'grid_pes assigns more PEs than are available.')
449 atm(n)%pelist(i) = pecounter + ens_root_pe
450 pecounter = pecounter + 1
451 atm(n)%npes_this_grid = grid_pes(n)
453 atm(n)%grid_number = n
460 write(pe_list_name,
'(A4, I2.2)')
'nest', n
462 call mpp_declare_pelist(atm(n)%pelist, pe_list_name)
465 atm(n)%nml_filename =
'input_'//trim(pe_list_name)//
'.nml' 467 atm(n)%nml_filename =
'input.nml' 469 if (.not. file_exist(atm(n)%nml_filename))
then 470 call mpp_error(fatal,
"Could not find nested grid namelist "//atm(n)%nml_filename)
476 if (any(mpp_pe() == atm(n)%pelist))
then 477 if (this_grid > 0)
then 478 print*, mpp_pe(), this_grid, n
479 call mpp_error(fatal,
" Grid assigned to multiple pes")
481 call mpp_set_current_pelist(atm(n)%pelist)
482 call setup_master(atm(n)%pelist)
484 grids_on_this_pe(n) = .true.
486 atm(n)%neststruct%nested = ( grid_coarse(n) > 0 )
488 if (atm(n)%neststruct%nested)
then 489 if ( grid_coarse(n) >
ngrids .or. grid_coarse(n) == n .or. grid_coarse(n) < 1)
then 490 write(errstring,
'(2(A,I3))')
"Could not find parent grid #", grid_coarse(n),
' for grid #', n
491 call mpp_error(fatal, errstring)
493 atm(n)%parent_grid => atm(grid_coarse(n))
495 atm(n)%neststruct%ioffset = nest_ioffsets(n)
496 atm(n)%neststruct%joffset = nest_joffsets(n)
497 atm(n)%neststruct%parent_tile = tile_coarse(n)
498 atm(n)%neststruct%refinement = nest_refine(n)
502 atm(n)%neststruct%ioffset = -999
503 atm(n)%neststruct%joffset = -999
504 atm(n)%neststruct%parent_tile = -1
505 atm(n)%neststruct%refinement = -1
511 if (pecounter /= npes)
then 512 if (mpp_pe() == 0)
then 513 print*,
'npes = ', npes,
', grid_pes = ', grid_pes(1:
ngrids)
514 call mpp_error(fatal,
'grid_pes in fv_nest_Nml does not assign all of the available PEs')
526 #ifdef INTERNAL_FILE_NML 527 if (this_grid .gt. 1)
then 528 write(atm(this_grid)%nml_filename,
'(A4, I2.2)')
'nest', this_grid
529 if (.not. file_exist(
'input_'//trim(atm(this_grid)%nml_filename)//
'.nml'))
then 530 call mpp_error(fatal,
"Could not find nested grid namelist "//
'input_'//trim(atm(this_grid)%nml_filename)//
'.nml')
533 atm(this_grid)%nml_filename =
'' 535 call read_input_nml(atm(this_grid)%nml_filename)
538 call read_namelist_fv_core_nml(atm(this_grid))
541 atm(this_grid)%flagstruct%ncnst, atm(this_grid)%flagstruct%nwat)
544 call mpp_get_current_pelist(atm(this_grid)%pelist,
commid=
commid)
550 if (atm(this_grid)%neststruct%nested)
then 552 if ( atm(this_grid)%flagstruct%consv_te > 0.)
then 553 call mpp_error(fatal,
'The global energy fixer cannot be used on a nested grid. consv_te must be set to 0.')
556 if (mod(atm(this_grid)%flagstruct%npx-1 , atm(this_grid)%neststruct%refinement) /= 0 .or. &
557 mod(atm(this_grid)%flagstruct%npy-1, atm(this_grid)%neststruct%refinement) /= 0)
then 558 call mpp_error(fatal,
'npx or npy not an even refinement of its coarse grid.')
563 if (atm(this_grid)%flagstruct%regional)
then 564 if ( atm(this_grid)%flagstruct%consv_te > 0.)
then 565 call mpp_error(fatal,
'The global energy fixer cannot be used on a regional grid. consv_te must be set to 0.')
574 all_ntiles(this_grid) = ntiles
575 call mpp_max(all_ntiles,
ngrids, global_pelist)
577 all_npx(this_grid) = npx
578 call mpp_max(all_npx,
ngrids, global_pelist)
580 all_npy(this_grid) = npy
581 call mpp_max(all_npy,
ngrids, global_pelist)
583 all_npz(this_grid) = npz
584 call mpp_max(all_npz,
ngrids, global_pelist)
586 if (atm(this_grid)%neststruct%twowaynest) all_twowaynest(this_grid) = 1
587 call mpp_max(all_twowaynest,
ngrids, global_pelist)
590 if (n/=this_grid)
then 591 atm(n)%flagstruct%npx = all_npx(n)
592 atm(n)%flagstruct%npy = all_npy(n)
593 atm(n)%flagstruct%npz = all_npz(n)
594 atm(n)%flagstruct%ntiles = all_ntiles(n)
595 atm(n)%neststruct%twowaynest = (all_twowaynest(n) > 0)
597 npes_nest_tile(ntiles_nest_all+1:ntiles_nest_all+all_ntiles(n)) = &
598 atm(n)%npes_this_grid / all_ntiles(n)
599 ntiles_nest_all = ntiles_nest_all + all_ntiles(n)
602 tile_fine(n) = all_ntiles(n) + tile_fine(n-1)
603 if (tile_coarse(n) < 1)
then 604 tile_coarse(n) = tile_fine(grid_coarse(n))
606 icount_coarse(n) = all_npx(n)/nest_refine(n)
607 jcount_coarse(n) = all_npy(n)/nest_refine(n)
608 nest_level(n) = nest_level(grid_coarse(n)) + 1
610 tile_fine(n) = all_ntiles(n)
615 if (mpp_pe() == 0 .and.
ngrids > 1)
then 616 print*,
' NESTING TREE' 618 write(*,
'(12i4)') n, nest_level(n), nest_ioffsets(n), nest_joffsets(n), icount_coarse(n), jcount_coarse(n), tile_fine(n), tile_coarse(n), nest_refine(n), all_ntiles(n), all_npx(n), all_npy(n)
621 print*, npes_nest_tile(1:ntiles_nest_all)
626 call domain_decomp(atm(this_grid)%flagstruct%npx,atm(this_grid)%flagstruct%npy,atm(this_grid)%flagstruct%ntiles,&
627 atm(this_grid)%flagstruct%grid_type,atm(this_grid)%neststruct%nested, &
628 atm(this_grid)%layout,atm(this_grid)%io_layout,atm(this_grid)%bd,atm(this_grid)%tile_of_mosaic, &
629 atm(this_grid)%gridstruct%square_domain,atm(this_grid)%npes_per_tile,atm(this_grid)%domain, &
630 atm(this_grid)%domain_for_coupler,atm(this_grid)%num_contact,atm(this_grid)%pelist)
631 call set_domain(atm(this_grid)%domain)
632 call broadcast_domains(atm,atm(this_grid)%pelist,
size(atm(this_grid)%pelist))
634 tile_id = mpp_get_tile_id(atm(n)%domain)
635 atm(n)%global_tile = tile_id(1)
636 atm(n)%npes_per_tile =
size(atm(n)%pelist)/atm(n)%flagstruct%ntiles
640 call tm_register_tracers (model_atmos, atm(this_grid)%flagstruct%ncnst, atm(this_grid)%flagstruct%nt_prog, &
641 atm(this_grid)%flagstruct%pnats, num_family)
643 write(*,*)
'ncnst=', ncnst,
' num_prog=',atm(this_grid)%flagstruct%nt_prog,
' pnats=',atm(this_grid)%flagstruct%pnats,
' dnats=',dnats,&
644 ' num_family=',num_family
647 if (dnrts < 0) dnrts = dnats
653 atm(n)%bd%isd, atm(n)%bd%ied, &
654 atm(n)%bd%jsd, atm(n)%bd%jed, &
655 atm(n)%bd%isc, atm(n)%bd%iec, &
656 atm(n)%bd%jsc, atm(n)%bd%jec, &
657 atm(n)%flagstruct%npx, atm(n)%flagstruct%npy, atm(n)%flagstruct%npz, &
658 atm(n)%flagstruct%ndims, atm(n)%flagstruct%ncnst, atm(n)%flagstruct%ncnst-atm(n)%flagstruct%pnats, &
659 n/=this_grid, n==this_grid,
ngrids)
661 if ( (atm(this_grid)%bd%iec-atm(this_grid)%bd%isc+1).lt.4 .or. (atm(this_grid)%bd%jec-atm(this_grid)%bd%jsc+1).lt.4 )
then 662 if (is_master())
write(*,
'(6I6)') atm(this_grid)%bd%isc, atm(this_grid)%bd%iec, atm(this_grid)%bd%jsc, atm(this_grid)%bd%jec, this_grid
663 call mpp_error(fatal,
'Domain Decomposition: Cubed Sphere compute domain has a & 664 &minium requirement of 4 points in X and Y, respectively')
672 call mpp_set_current_pelist( global_pelist )
674 call mpp_define_nest_domains(global_nest_domain, atm(this_grid)%domain, &
676 istart_coarse=nest_ioffsets(2:
ngrids), jstart_coarse=nest_joffsets(2:
ngrids), &
677 icount_coarse=icount_coarse(2:
ngrids), jcount_coarse=jcount_coarse(2:
ngrids), &
678 npes_nest_tile=npes_nest_tile(1:ntiles_nest_all), &
679 tile_fine=tile_fine(2:
ngrids), tile_coarse=tile_coarse(2:
ngrids), &
680 x_refine=nest_refine(2:
ngrids), y_refine=nest_refine(2:
ngrids), name=
"global_nest_domain")
681 call mpp_set_current_pelist(atm(this_grid)%pelist)
685 allocate(atm(this_grid)%neststruct%child_grids(
ngrids))
687 atm(this_grid)%neststruct%child_grids(n) = (grid_coarse(n) == this_grid)
688 allocate(atm(n)%neststruct%do_remap_bc(
ngrids))
689 atm(n)%neststruct%do_remap_bc(:) = .false.
691 atm(this_grid)%neststruct%parent_proc = any(atm(this_grid)%neststruct%child_grids)
692 atm(this_grid)%neststruct%child_proc =
ASSOCIATED(atm(this_grid)%parent_grid)
695 if (atm(this_grid)%neststruct%nestbctype > 1)
then 696 call mpp_error(fatal,
'nestbctype > 1 not yet implemented')
697 atm(this_grid)%neststruct%upoff = 0
700 if (atm(this_grid)%gridstruct%bounded_domain .and. is_master()) print*, &
701 ' Bounded domain: nested = ', atm(this_grid)%neststruct%nested,
', regional = ', atm(this_grid)%flagstruct%regional
704 call init_grid(atm(this_grid), atm(this_grid)%flagstruct%grid_name, atm(this_grid)%flagstruct%grid_file, &
705 atm(this_grid)%flagstruct%npx, atm(this_grid)%flagstruct%npy, atm(this_grid)%flagstruct%npz, atm(this_grid)%flagstruct%ndims, atm(this_grid)%flagstruct%ntiles, atm(this_grid)%ng, tile_coarse)
710 call grid_utils_init(atm(this_grid), atm(this_grid)%flagstruct%npx, atm(this_grid)%flagstruct%npy, atm(this_grid)%flagstruct%npz, atm(this_grid)%flagstruct%non_ortho, atm(this_grid)%flagstruct%grid_type, atm(this_grid)%flagstruct%c2l_ord)
714 if ( is_master() )
then 715 sdt = dt_atmos/
real(atm(this_grid)%flagstruct%n_split*atm(this_grid)%flagstruct%k_split*abs(p_split))
717 write(*,*)
'Divergence damping Coefficients' 718 write(*,*)
'For small dt=', sdt
719 write(*,*)
'External mode del-2 (m**2/s)=', atm(this_grid)%flagstruct%d_ext*atm(this_grid)%gridstruct%da_min_c/sdt
720 write(*,*)
'Internal mode del-2 SMAG dimensionless coeff=', atm(this_grid)%flagstruct%dddmp
721 write(*,*)
'Internal mode del-2 background diff=', atm(this_grid)%flagstruct%d2_bg*atm(this_grid)%gridstruct%da_min_c/sdt
724 write(*,*)
'Internal mode del-4 background diff=', atm(this_grid)%flagstruct%d4_bg
725 write(*,*)
'Vorticity del-4 (m**4/s)=', (atm(this_grid)%flagstruct%vtdm4*atm(this_grid)%gridstruct%da_min)**2/sdt*1.e-6
727 if (atm(this_grid)%flagstruct%nord==2)
write(*,*)
'Internal mode del-6 background diff=', atm(this_grid)%flagstruct%d4_bg
728 if (atm(this_grid)%flagstruct%nord==3)
write(*,*)
'Internal mode del-8 background diff=', atm(this_grid)%flagstruct%d4_bg
729 write(*,*)
'tracer del-2 diff=', atm(this_grid)%flagstruct%trdm2
731 write(*,*)
'Vorticity del-4 (m**4/s)=', (atm(this_grid)%flagstruct%vtdm4*atm(this_grid)%gridstruct%da_min)**2/sdt*1.e-6
732 write(*,*)
'beta=', atm(this_grid)%flagstruct%beta
766 grid_type => atm%flagstruct%grid_type
767 grid_name => atm%flagstruct%grid_name
768 grid_file => atm%flagstruct%grid_file
769 hord_mt => atm%flagstruct%hord_mt
770 kord_mt => atm%flagstruct%kord_mt
771 kord_wz => atm%flagstruct%kord_wz
772 hord_vt => atm%flagstruct%hord_vt
773 hord_tm => atm%flagstruct%hord_tm
774 hord_dp => atm%flagstruct%hord_dp
775 kord_tm => atm%flagstruct%kord_tm
776 hord_tr => atm%flagstruct%hord_tr
777 kord_tr => atm%flagstruct%kord_tr
778 scale_z => atm%flagstruct%scale_z
779 w_max => atm%flagstruct%w_max
780 z_min => atm%flagstruct%z_min
781 lim_fac => atm%flagstruct%lim_fac
782 nord => atm%flagstruct%nord
783 nord_tr => atm%flagstruct%nord_tr
784 dddmp => atm%flagstruct%dddmp
785 d2_bg => atm%flagstruct%d2_bg
786 d4_bg => atm%flagstruct%d4_bg
787 vtdm4 => atm%flagstruct%vtdm4
788 trdm2 => atm%flagstruct%trdm2
789 d2_bg_k1 => atm%flagstruct%d2_bg_k1
790 d2_bg_k2 => atm%flagstruct%d2_bg_k2
791 d2_divg_max_k1 => atm%flagstruct%d2_divg_max_k1
792 d2_divg_max_k2 => atm%flagstruct%d2_divg_max_k2
793 damp_k_k1 => atm%flagstruct%damp_k_k1
794 damp_k_k2 => atm%flagstruct%damp_k_k2
795 n_zs_filter => atm%flagstruct%n_zs_filter
796 nord_zs_filter => atm%flagstruct%nord_zs_filter
797 full_zs_filter => atm%flagstruct%full_zs_filter
798 rf_fast => atm%flagstruct%RF_fast
799 consv_am => atm%flagstruct%consv_am
800 do_sat_adj => atm%flagstruct%do_sat_adj
801 do_f3d => atm%flagstruct%do_f3d
802 no_dycore => atm%flagstruct%no_dycore
803 convert_ke => atm%flagstruct%convert_ke
804 do_vort_damp => atm%flagstruct%do_vort_damp
805 use_old_omega => atm%flagstruct%use_old_omega
806 beta => atm%flagstruct%beta
807 n_sponge => atm%flagstruct%n_sponge
808 d_ext => atm%flagstruct%d_ext
809 nwat => atm%flagstruct%nwat
810 use_logp => atm%flagstruct%use_logp
811 warm_start => atm%flagstruct%warm_start
812 inline_q => atm%flagstruct%inline_q
813 shift_fac => atm%flagstruct%shift_fac
814 do_schmidt => atm%flagstruct%do_schmidt
815 do_cube_transform => atm%flagstruct%do_cube_transform
816 stretch_fac => atm%flagstruct%stretch_fac
817 target_lat => atm%flagstruct%target_lat
818 target_lon => atm%flagstruct%target_lon
819 regional => atm%flagstruct%regional
820 bc_update_interval => atm%flagstruct%bc_update_interval
821 nrows_blend => atm%flagstruct%nrows_blend
822 regional_bcs_from_gsi => atm%flagstruct%regional_bcs_from_gsi
823 write_restart_with_bcs => atm%flagstruct%write_restart_with_bcs
824 reset_eta => atm%flagstruct%reset_eta
825 p_fac => atm%flagstruct%p_fac
826 a_imp => atm%flagstruct%a_imp
827 n_split => atm%flagstruct%n_split
828 fac_n_spl => atm%flagstruct%fac_n_spl
829 fhouri => atm%flagstruct%fhouri
830 m_split => atm%flagstruct%m_split
831 k_split => atm%flagstruct%k_split
832 use_logp => atm%flagstruct%use_logp
833 q_split => atm%flagstruct%q_split
834 print_freq => atm%flagstruct%print_freq
835 write_3d_diags => atm%flagstruct%write_3d_diags
836 npx => atm%flagstruct%npx
837 npy => atm%flagstruct%npy
838 npz => atm%flagstruct%npz
839 npz_type => atm%flagstruct%npz_type
840 npz_rst => atm%flagstruct%npz_rst
841 ncnst => atm%flagstruct%ncnst
842 pnats => atm%flagstruct%pnats
843 dnats => atm%flagstruct%dnats
844 dnrts => atm%flagstruct%dnrts
845 ntiles => atm%flagstruct%ntiles
846 nf_omega => atm%flagstruct%nf_omega
847 fv_sg_adj => atm%flagstruct%fv_sg_adj
848 sg_cutoff => atm%flagstruct%sg_cutoff
849 na_init => atm%flagstruct%na_init
850 nudge_dz => atm%flagstruct%nudge_dz
851 p_ref => atm%flagstruct%p_ref
852 dry_mass => atm%flagstruct%dry_mass
853 nt_prog => atm%flagstruct%nt_prog
854 nt_phys => atm%flagstruct%nt_phys
855 tau_h2o => atm%flagstruct%tau_h2o
856 delt_max => atm%flagstruct%delt_max
857 d_con => atm%flagstruct%d_con
858 ke_bg => atm%flagstruct%ke_bg
859 consv_te => atm%flagstruct%consv_te
860 tau => atm%flagstruct%tau
861 rf_cutoff => atm%flagstruct%rf_cutoff
862 filter_phys => atm%flagstruct%filter_phys
863 dwind_2d => atm%flagstruct%dwind_2d
864 breed_vortex_inline => atm%flagstruct%breed_vortex_inline
865 range_warn => atm%flagstruct%range_warn
866 fill => atm%flagstruct%fill
867 fill_dp => atm%flagstruct%fill_dp
868 fill_wz => atm%flagstruct%fill_wz
869 fill_gfs => atm%flagstruct%fill_gfs
870 check_negative => atm%flagstruct%check_negative
871 non_ortho => atm%flagstruct%non_ortho
872 adiabatic => atm%flagstruct%adiabatic
873 moist_phys => atm%flagstruct%moist_phys
874 do_held_suarez => atm%flagstruct%do_Held_Suarez
875 do_reed_physics => atm%flagstruct%do_reed_physics
876 reed_cond_only => atm%flagstruct%reed_cond_only
877 reproduce_sum => atm%flagstruct%reproduce_sum
878 adjust_dry_mass => atm%flagstruct%adjust_dry_mass
879 fv_debug => atm%flagstruct%fv_debug
880 srf_init => atm%flagstruct%srf_init
881 mountain => atm%flagstruct%mountain
882 remap_t => atm%flagstruct%remap_t
883 z_tracer => atm%flagstruct%z_tracer
884 old_divg_damp => atm%flagstruct%old_divg_damp
885 fv_land => atm%flagstruct%fv_land
886 nudge => atm%flagstruct%nudge
887 nudge_ic => atm%flagstruct%nudge_ic
888 ncep_ic => atm%flagstruct%ncep_ic
889 nggps_ic => atm%flagstruct%nggps_ic
890 ecmwf_ic => atm%flagstruct%ecmwf_ic
891 gfs_phil => atm%flagstruct%gfs_phil
892 agrid_vel_rst => atm%flagstruct%agrid_vel_rst
893 use_new_ncep => atm%flagstruct%use_new_ncep
894 use_ncep_phy => atm%flagstruct%use_ncep_phy
895 fv_diag_ic => atm%flagstruct%fv_diag_ic
896 external_ic => atm%flagstruct%external_ic
897 external_eta => atm%flagstruct%external_eta
898 read_increment => atm%flagstruct%read_increment
900 hydrostatic => atm%flagstruct%hydrostatic
901 phys_hydrostatic => atm%flagstruct%phys_hydrostatic
902 use_hydro_pressure => atm%flagstruct%use_hydro_pressure
903 do_uni_zfull => atm%flagstruct%do_uni_zfull
904 adj_mass_vmr => atm%flagstruct%adj_mass_vmr
905 hybrid_z => atm%flagstruct%hybrid_z
906 make_nh => atm%flagstruct%Make_NH
907 make_hybrid_z => atm%flagstruct%make_hybrid_z
908 nudge_qv => atm%flagstruct%nudge_qv
909 add_noise => atm%flagstruct%add_noise
910 butterfly_effect => atm%flagstruct%butterfly_effect
911 a2b_ord => atm%flagstruct%a2b_ord
912 c2l_ord => atm%flagstruct%c2l_ord
913 ndims => atm%flagstruct%ndims
915 dx_const => atm%flagstruct%dx_const
916 dy_const => atm%flagstruct%dy_const
917 deglon_start => atm%flagstruct%deglon_start
918 deglon_stop => atm%flagstruct%deglon_stop
919 deglat_start => atm%flagstruct%deglat_start
920 deglat_stop => atm%flagstruct%deglat_stop
922 deglat => atm%flagstruct%deglat
924 nested => atm%neststruct%nested
925 twowaynest => atm%neststruct%twowaynest
926 parent_tile => atm%neststruct%parent_tile
927 refinement => atm%neststruct%refinement
928 nestbctype => atm%neststruct%nestbctype
929 nestupdate => atm%neststruct%nestupdate
930 nsponge => atm%neststruct%nsponge
931 s_weight => atm%neststruct%s_weight
932 ioffset => atm%neststruct%ioffset
933 joffset => atm%neststruct%joffset
934 update_blend => atm%neststruct%update_blend
937 io_layout => atm%io_layout
943 integer :: f_unit, ios, ierr, dum
944 namelist /nest_nml/ dum
946 #ifdef INTERNAL_FILE_NML 947 read (input_nml_file,nest_nml,iostat=ios)
948 ierr = check_nml_error(ios,
'nest_nml')
950 f_unit=open_namelist_file()
952 read (f_unit,nest_nml,iostat=ios)
953 ierr = check_nml_error(ios,
'nest_nml')
954 call close_file(f_unit)
957 call mpp_error(fatal,
" &nest_nml is depreciated. Please use &fv_nest_nml instead.")
964 integer :: f_unit, ios, ierr
965 namelist /fv_nest_nml/ grid_pes, grid_coarse, tile_coarse, nest_refine, &
966 nest_ioffsets, nest_joffsets, p_split
968 #ifdef INTERNAL_FILE_NML 969 read (input_nml_file,fv_nest_nml,iostat=ios)
970 ierr = check_nml_error(ios,
'fv_nest_nml')
972 f_unit=open_namelist_file()
974 read (f_unit,fv_nest_nml,iostat=ios)
975 ierr = check_nml_error(ios,
'fv_nest_nml')
976 call close_file(f_unit)
983 integer :: f_unit, ios, ierr
985 character(len=80) :: grid_name =
'' 986 character(len=120) :: grid_file =
'' 987 namelist /fv_grid_nml/ grid_name, grid_file
989 #ifdef INTERNAL_FILE_NML 991 read (input_nml_file,fv_grid_nml,iostat=ios)
992 ierr = check_nml_error(ios,
'fv_grid_nml')
994 f_unit=open_namelist_file()
997 read (f_unit,fv_grid_nml,iostat=ios)
998 ierr = check_nml_error(ios,
'fv_grid_nml')
999 call close_file (f_unit)
1001 call write_version_number (
'FV_CONTROL_MOD', version )
1003 write(unit, nml=fv_grid_nml)
1006 if (len_trim(grid_file) /= 0) atm(this_grid)%flagstruct%grid_file = grid_file
1007 if (len_trim(grid_name) /= 0) atm(this_grid)%flagstruct%grid_name = grid_name
1012 subroutine read_namelist_fv_core_nml(Atm)
1015 integer :: f_unit, ios, ierr
1019 real :: dimx, dl, dp, dxmin, dymin, d_fac
1025 character(len=128) :: res_latlon_dynamics =
'' 1026 character(len=128) :: res_latlon_tracers =
'' 1423 namelist /fv_core_nml/npx, npy, ntiles, npz, npz_type, npz_rst, layout, io_layout, ncnst, nwat, &
1424 use_logp, p_fac, a_imp, k_split, n_split, m_split, q_split, print_freq, write_3d_diags, &
1425 do_schmidt, do_cube_transform, &
1426 hord_mt, hord_vt, hord_tm, hord_dp, hord_tr, shift_fac, stretch_fac, target_lat, target_lon, &
1427 kord_mt, kord_wz, kord_tm, kord_tr, fv_debug, fv_land, nudge, do_sat_adj, do_f3d, &
1428 external_ic, read_increment, ncep_ic, nggps_ic, ecmwf_ic, use_new_ncep, use_ncep_phy, fv_diag_ic, &
1429 external_eta, res_latlon_dynamics, res_latlon_tracers, scale_z, w_max, z_min, lim_fac, &
1430 dddmp, d2_bg, d4_bg, vtdm4, trdm2, d_ext, delt_max, beta, non_ortho, n_sponge, &
1431 warm_start, adjust_dry_mass, mountain, d_con, ke_bg, nord, nord_tr, convert_ke, use_old_omega, &
1432 dry_mass, grid_type, do_held_suarez, do_reed_physics, reed_cond_only, &
1433 consv_te, fill, filter_phys, fill_dp, fill_wz, fill_gfs, consv_am, rf_fast, &
1434 range_warn, dwind_2d, inline_q, z_tracer, reproduce_sum, adiabatic, do_vort_damp, no_dycore, &
1435 tau, tau_h2o, rf_cutoff, nf_omega, hydrostatic, fv_sg_adj, sg_cutoff, breed_vortex_inline, &
1436 na_init, nudge_dz, hybrid_z, make_nh, n_zs_filter, nord_zs_filter, full_zs_filter, reset_eta, &
1437 pnats, dnats, dnrts, a2b_ord, remap_t, p_ref, d2_bg_k1, d2_bg_k2, &
1438 c2l_ord, dx_const, dy_const, umax, deglat, &
1439 deglon_start, deglon_stop, deglat_start, deglat_stop, &
1440 phys_hydrostatic, use_hydro_pressure, make_hybrid_z, old_divg_damp, add_noise, butterfly_effect, &
1441 nested, twowaynest, nudge_qv, &
1442 nestbctype, nestupdate, nsponge, s_weight, &
1444 do_uni_zfull, adj_mass_vmr, fac_n_spl, fhouri, update_blend, regional, bc_update_interval, &
1445 regional_bcs_from_gsi, write_restart_with_bcs, nrows_blend
1447 #ifdef INTERNAL_FILE_NML 1449 read (input_nml_file,fv_core_nml,iostat=ios)
1450 ierr = check_nml_error(ios,
'fv_core_nml')
1454 f_unit = open_namelist_file(atm%nml_filename)
1456 read (f_unit,fv_core_nml,iostat=ios)
1457 ierr = check_nml_error(ios,
'fv_core_nml')
1458 call close_file(f_unit)
1460 call write_version_number (
'FV_CONTROL_MOD', version )
1462 write(unit, nml=fv_core_nml)
1464 if (len_trim(res_latlon_dynamics) /= 0) atm%flagstruct%res_latlon_dynamics = res_latlon_dynamics
1465 if (len_trim(res_latlon_tracers) /= 0) atm%flagstruct%res_latlon_tracers = res_latlon_tracers
1468 if (grid_type>3)
then 1474 if (.not. (nested .or. regional)) atm%neststruct%npx_global = npx
1479 if ( hydrostatic )
then 1480 if ( npx >= 120 ) ns0 = 6
1482 if ( npx <= 45 )
then 1484 elseif ( npx <=90 )
then 1491 dimx = max( npx, 2*(npy-1) )
1494 if (grid_type < 4)
then 1495 n0split = nint( ns0*abs(dt_atmos)*dimx/(dt0*dim0) + 0.49 )
1496 elseif (grid_type == 4 .or. grid_type == 7)
then 1497 n0split = nint( 2.*umax*dt_atmos/sqrt(dx_const**2 + dy_const**2) + 0.49 )
1498 elseif (grid_type == 5 .or. grid_type == 6)
then 1499 if (grid_type == 6)
then 1500 deglon_start = 0.; deglon_stop = 360.
1502 dl = (deglon_stop-deglon_start)*pi/(180.*(npx-1))
1503 dp = (deglat_stop-deglat_start)*pi/(180.*(npy-1))
1505 dxmin=dl*radius*min(cos(deglat_start*pi/180.-atm%bd%ng*dp), &
1506 cos(deglat_stop *pi/180.+atm%bd%ng*dp))
1508 n0split = nint( 2.*umax*dt_atmos/sqrt(dxmin**2 + dymin**2) + 0.49 )
1510 n0split = max( 1, n0split )
1512 if ( n_split == 0 )
then 1513 n_split = nint(
real(n0split)/
real(k_split*abs(p_split)) * stretch_fac + 0.5 )
1514 if(is_master())
write(*,*)
'For k_split (remapping)=', k_split
1515 if(is_master())
write(*,198)
'n_split is set to ', n_split,
' for resolution-dt=',npx,npy,ntiles,dt_atmos
1517 if(is_master())
write(*,199)
'Using n_split from the namelist: ', n_split
1519 if (is_master() .and. n == 1 .and. abs(p_split) > 1)
then 1520 write(*,199)
'Using p_split = ', p_split
1523 if (old_divg_damp)
then 1524 if (is_master())
write(*,*)
" fv_control: using AM2/AM3 damping methods " 1527 d2_divg_max_k1 = 0.02
1528 d2_divg_max_k2 = 0.01
1531 elseif (n_sponge == 0 )
then 1532 if ( d2_bg_k1 > 1. ) d2_bg_k1 = 0.20
1533 if ( d2_bg_k2 > 1. ) d2_bg_k2 = 0.015
1536 if ( .not.hydrostatic )
then 1537 if ( m_split==0 )
then 1538 m_split = 1. + abs(dt_atmos)/
real(k_split*n_split*abs(p_split))
1539 if (abs(a_imp) < 0.5)
then 1540 if(is_master())
write(*,199)
'm_split is set to ', m_split
1543 if(is_master())
then 1544 write(*,*)
'Off center implicit scheme param=', a_imp
1545 write(*,*)
' p_fac=', p_fac
1549 if(is_master())
then 1550 if (n_sponge >= 0)
write(*,199)
'Using n_sponge : ', n_sponge
1551 write(*,197)
'Using non_ortho : ', non_ortho
1555 198
format(a,i2.2,a,i4.4,
'x',i4.4,
'x',i1.1,
'-',f9.3)
1563 target_lon = target_lon * pi/180.
1564 target_lat = target_lat * pi/180.
1566 end subroutine read_namelist_fv_core_nml
1570 integer :: isu, ieu, jsu, jeu
1571 integer :: isc, jsc, iec, jec
1574 isc = atm(this_grid)%bd%isc
1575 jsc = atm(this_grid)%bd%jsc
1576 iec = atm(this_grid)%bd%iec
1577 jec = atm(this_grid)%bd%jec
1579 upoff = atm(this_grid)%neststruct%upoff
1582 if (tile_coarse(n) == atm(this_grid)%global_tile)
then 1584 isu = nest_ioffsets(n)
1585 ieu = isu + icount_coarse(n) - 1
1586 jsu = nest_joffsets(n)
1587 jeu = jsu + jcount_coarse(n) - 1
1602 if (isu > iec .or. ieu < isc .or. &
1603 jsu > jec .or. jeu < jsc )
then 1604 isu = -999 ; jsu = -999 ; ieu = -1000 ; jeu = -1000
1606 isu = max(isu,isc) ; jsu = max(jsu,jsc)
1607 ieu = min(ieu,iec) ; jeu = min(jeu,jec)
1614 atm(n)%neststruct%isu = isu
1615 atm(n)%neststruct%ieu = ieu
1616 atm(n)%neststruct%jsu = jsu
1617 atm(n)%neststruct%jeu = jeu
1629 subroutine fv_end(Atm, this_grid, restart_endfcst)
1632 integer,
intent(IN) :: this_grid
1633 logical,
intent(in) :: restart_endfcst
subroutine allocate_fv_atmos_type(Atm, isd_in, ied_in, jsd_in, jed_in, is_in, ie_in, js_in, je_in, npx_in, npy_in, npz_in, ndims_in, ncnst_in, nq_in, dummy, alloc_2d, ngrids_in)
The subroutine 'allocate_fv_atmos_type' allocates the fv_atmos_type.
subroutine setup_update_regions
The module 'fv_mp_mod' is a single program multiple data (SPMD) parallel decompostion/communication m...
subroutine timing_off(blk_name)
The subroutine 'timing_off' stops a timer.
The module 'multi_gases' peforms multi constitutents computations.
subroutine read_namelist_fv_grid_nml
subroutine read_namelist_fv_nest_nml
subroutine set_namelist_pointers(Atm)
The subroutine 'setup_namelist_pointers' associates the MODULE flag pointers with the ARRAY flag vari...
subroutine, public read_namelist_multi_gases_nml(nml_filename, ncnst, nwat)
The module 'fv_io' contains restart facilities for FV core.
integer, parameter, public r_grid
subroutine, public fv_diag_init_gn(Atm)
The module 'fv_timing' contains FV3 timers.
subroutine, public fv_restart_init()
real, parameter, public ptop_min
The module 'fv_arrays' contains the 'fv_atmos_type' and associated datatypes.
subroutine read_namelist_nest_nml
subroutine, public set_eta(km, ks, ptop, ak, bk, npz_type)
The module 'fv_eta' contains routine to set up the reference (Eulerian) pressure coordinate.
subroutine, public read_namelist_test_case_nml(nml_filename)
subroutine, public fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split)
subroutine, public fv_io_exit
Close the fv core restart facilities.
subroutine, public multi_gases_init(ngas, nwat)
subroutine, public grid_utils_init(Atm, npx, npy, npz, non_ortho, grid_type, c2l_order)
subroutine timing_on(blk_name)
The subroutine 'timing_on' starts a timer.
subroutine, public fv_end(Atm, this_grid, restart_endfcst)
The subroutine 'fv_end' terminates FV3, deallocates memory, saves restart files, and stops I/O...
subroutine timing_prt(gid)
The subroutine 'timing_prt' prints all timers.
@ The module 'fv_diagnostics' contains routines to compute diagnosic fields.
The module 'fv_grid_utils' contains routines for setting up and computing grid-related quantities...
subroutine timing_init
The subroutine 'timing_init' initializes timers.
subroutine, public grid_utils_end
The module 'FV3_control' is for initialization and termination of the model, and controls namelist pa...
subroutine, public fv_restart_end(Atm, restart_endfcst)
The subroutine 'fv_restart_end' writes ending restart files, terminates I/O, and prints out diagnosti...
subroutine deallocate_fv_atmos_type(Atm)
The subroutine 'deallocate_fv_atmos_type' deallocates the fv_atmos_type.