73 use mom_domains, only : to_north, to_south, to_east, to_west
74 use mom_domains, only : mom_define_domain, mom_define_io_domain
81 use mom_io, only : corner, north_face, east_face
83 use mpp_domains_mod
, only : mpp_get_domain_extents, mpp_deallocate_domain
85 implicit none ;
private 89 type,
public ::
gps ;
private 95 real :: lat_enhance_factor
96 real :: lat_eq_enhance
98 logical :: equator_reference
99 integer :: niglobal, njglobal
123 #include "version_variable.h" 125 character(len=256) :: config
127 call calltree_enter(
"set_grid_metrics(), MOM_grid_initialize.F90")
128 call log_version(param_file,
"MOM_grid_init", version,
"")
129 call get_param(param_file,
"MOM_grid_init",
"GRID_CONFIG", config, &
130 "A character string that determines the method for \n"//&
131 "defining the horizontal grid. Current options are: \n"//&
132 " \t mosaic - read the grid from a mosaic (supergrid) \n"//&
133 " \t file set by GRID_FILE.\n"//&
134 " \t cartesian - use a (flat) Cartesian grid.\n"//&
135 " \t spherical - use a simple spherical grid.\n"//&
136 " \t mercator - use a Mercator spherical grid.", &
137 fail_if_missing=.true.)
138 call get_param(param_file,
"MOM_grid_init",
"DEBUG", debug, &
139 "If true, write out verbose debugging data.", default=.false.)
142 g%x_axis_units =
"degrees_E" ; g%y_axis_units =
"degrees_N" 143 select case (trim(config))
148 case (
"file");
call mom_error(fatal,
"MOM_grid_init: set_grid_metrics "//&
149 'GRID_CONFIG "file" is no longer a supported option. Use a '//&
150 'mosaic file ("mosaic") or one of the analytic forms instead.')
151 case default ;
call mom_error(fatal,
"MOM_grid_init: set_grid_metrics "//&
152 "Unrecognized grid configuration "//trim(config))
156 call calltree_enter(
"set_derived_metrics(), MOM_grid_initialize.F90")
170 character(len=*),
intent(in) :: parent
175 halo = min(g%ied-g%iec, g%jed-g%jec, 1)
178 g%dxT, g%dyT, g%HI, haloshift=halo)
180 call uvchksum(trim(parent)//
': dxC[uv]', g%dxCu, g%dyCv, g%HI, haloshift=halo)
182 call uvchksum(trim(parent)//
': dxC[uv]', &
183 g%dyCu, g%dxCv, g%HI, haloshift=halo)
186 g%dxBu, g%dyBu, g%HI, haloshift=halo)
189 g%IdxT, g%IdyT, g%HI, haloshift=halo)
191 call uvchksum(trim(parent)//
': Id[xy]C[uv]', &
192 g%IdxCu, g%IdyCv, g%HI, haloshift=halo)
194 call uvchksum(trim(parent)//
': Id[xy]C[uv]', &
195 g%IdyCu, g%IdxCv, g%HI, haloshift=halo)
198 g%IdxBu, g%IdyBu, g%HI, haloshift=halo)
200 call hchksum(g%areaT, trim(parent)//
': areaT',g%HI, haloshift=halo)
201 call bchksum(g%areaBu, trim(parent)//
': areaBu',g%HI, haloshift=halo)
203 call hchksum(g%IareaT, trim(parent)//
': IareaT',g%HI, haloshift=halo)
204 call bchksum(g%IareaBu, trim(parent)//
': IareaBu',g%HI, haloshift=halo)
206 call hchksum(g%geoLonT,trim(parent)//
': geoLonT',g%HI, haloshift=halo)
207 call hchksum(g%geoLatT,trim(parent)//
': geoLatT',g%HI, haloshift=halo)
209 call bchksum(g%geoLonBu, trim(parent)//
': geoLonBu',g%HI, haloshift=halo)
210 call bchksum(g%geoLatBu, trim(parent)//
': geoLatBu',g%HI, haloshift=halo)
212 call uvchksum(trim(parent)//
': geoLonC[uv]', &
213 g%geoLonCu, g%geoLonCv, g%HI, haloshift=halo)
215 call uvchksum(trim(parent)//
': geoLatC[uv]', &
216 g%geoLatCu, g%geoLatCv, g%HI, haloshift=halo)
233 real,
dimension(G%isd :G%ied ,G%jsd :G%jed ) :: tempH1, tempH2, tempH3, tempH4
234 real,
dimension(G%IsdB:G%IedB,G%JsdB:G%JedB) :: tempQ1, tempQ2, tempQ3, tempQ4
235 real,
dimension(G%IsdB:G%IedB,G%jsd :G%jed ) :: tempE1, tempE2
236 real,
dimension(G%isd :G%ied ,G%JsdB:G%JedB) :: tempN1, tempN2
239 real,
dimension(G%isd :G%ied ,G%jsd :G%jed ) :: dxT, dyT, areaT
240 real,
dimension(G%IsdB:G%IedB,G%jsd :G%jed ) :: dxCu, dyCu
241 real,
dimension(G%isd :G%ied ,G%JsdB:G%JedB) :: dxCv, dyCv
242 real,
dimension(G%IsdB:G%IedB,G%JsdB:G%JedB) :: dxBu, dyBu, areaBu
244 real,
dimension(2*G%isd-2:2*G%ied+1,2*G%jsd-2:2*G%jed+1) :: tmpT
245 real,
dimension(2*G%isd-3:2*G%ied+1,2*G%jsd-2:2*G%jed+1) :: tmpU
246 real,
dimension(2*G%isd-2:2*G%ied+1,2*G%jsd-3:2*G%jed+1) :: tmpV
247 real,
dimension(2*G%isd-3:2*G%ied+1,2*G%jsd-3:2*G%jed+1) :: tmpZ
248 real,
dimension(:,:),
allocatable :: tmpGlbl
249 character(len=200) :: filename, grid_file, inputdir
250 character(len=64) :: mdl =
"MOM_grid_init set_grid_metrics_from_mosaic" 251 integer :: err=0, ni, nj, global_indices(4)
253 integer :: i, j, i2, j2
255 integer,
dimension(:),
allocatable :: exni,exnj
256 integer :: start(4), nread(4)
258 call calltree_enter(
"set_grid_metrics_from_mosaic(), MOM_grid_initialize.F90")
260 call get_param(param_file, mdl,
"GRID_FILE", grid_file, &
261 "Name of the file from which to read horizontal grid data.", &
262 fail_if_missing=.true.)
263 call get_param(param_file, mdl,
"INPUTDIR", inputdir, default=
".")
264 inputdir = slasher(inputdir)
265 filename = trim(adjustl(inputdir)) // trim(adjustl(grid_file))
266 call log_param(param_file, mdl,
"INPUTDIR/GRID_FILE", filename)
268 call mom_error(fatal,
" set_grid_metrics_from_mosaic: Unable to open "//&
272 dxcu(:,:) = 0.0 ; dycu(:,:) = 0.0
273 dxcv(:,:) = 0.0 ; dycv(:,:) = 0.0
274 dxbu(:,:) = 0.0 ; dybu(:,:) = 0.0 ; areabu(:,:) = 0.0
277 ni = 2*(g%iec-g%isc+1)
278 nj = 2*(g%jec-g%jsc+1)
281 npei = g%domain%layout(1) ; npej = g%domain%layout(2)
282 allocate(exni(npei)) ;
allocate(exnj(npej))
283 call mpp_get_domain_extents(g%domain%mpp_domain, exni, exnj)
284 allocate(sgdom%mpp_domain)
285 sgdom%nihalo = 2*g%domain%nihalo+1
286 sgdom%njhalo = 2*g%domain%njhalo+1
287 sgdom%niglobal = 2*g%domain%niglobal
288 sgdom%njglobal = 2*g%domain%njglobal
289 sgdom%layout(:) = g%domain%layout(:)
290 sgdom%use_io_layout = g%domain%use_io_layout
291 sgdom%io_layout(:) = g%domain%io_layout(:)
292 global_indices(1) = 1+sgdom%nihalo
293 global_indices(2) = sgdom%niglobal+sgdom%nihalo
294 global_indices(3) = 1+sgdom%njhalo
295 global_indices(4) = sgdom%njglobal+sgdom%njhalo
296 exni(:) = 2*exni(:) ; exnj(:) = 2*exnj(:)
297 if(
ASSOCIATED(g%domain%maskmap))
then 298 call mom_define_domain(global_indices, sgdom%layout, sgdom%mpp_domain, &
299 xflags=g%domain%X_FLAGS, yflags=g%domain%Y_FLAGS, &
300 xhalo=sgdom%nihalo, yhalo=sgdom%njhalo, &
301 xextent=exni,yextent=exnj, &
302 symmetry=.true., name=
"MOM_MOSAIC", maskmap=g%domain%maskmap)
304 call mom_define_domain(global_indices, sgdom%layout, sgdom%mpp_domain, &
305 xflags=g%domain%X_FLAGS, yflags=g%domain%Y_FLAGS, &
306 xhalo=sgdom%nihalo, yhalo=sgdom%njhalo, &
307 xextent=exni,yextent=exnj, &
308 symmetry=.true., name=
"MOM_MOSAIC")
311 if (sgdom%use_io_layout) &
312 call mom_define_io_domain(sgdom%mpp_domain, sgdom%io_layout)
318 call read_data(filename,
'x', tmpz, domain=sgdom%mpp_domain, position=corner)
320 call pass_var(tmpz, sgdom, position=corner)
322 do j=g%jsd,g%jed ;
do i=g%isd,g%ied ; i2 = 2*i ; j2 = 2*j
323 g%geoLonT(i,j) = tmpz(i2-1,j2-1)
325 do j=g%JsdB,g%JedB ;
do i=g%IsdB,g%IedB ; i2 = 2*i ; j2 = 2*j
326 g%geoLonBu(i,j) = tmpz(i2,j2)
328 do j=g%jsd,g%jed ;
do i=g%IsdB,g%IedB ; i2 = 2*i ; j2 = 2*j
329 g%geoLonCu(i,j) = tmpz(i2,j2-1)
331 do j=g%JsdB,g%JedB ;
do i=g%isd,g%ied ; i2 = 2*i ; j2 = 2*j
332 g%geoLonCv(i,j) = tmpz(i2-1,j2)
339 call read_data(filename,
'y', tmpz, domain=sgdom%mpp_domain, position=corner)
341 call pass_var(tmpz, sgdom, position=corner)
343 do j=g%jsd,g%jed ;
do i=g%isd,g%ied ; i2 = 2*i ; j2 = 2*j
344 g%geoLatT(i,j) = tmpz(i2-1,j2-1)
346 do j=g%JsdB,g%JedB ;
do i=g%IsdB,g%IedB ; i2 = 2*i ; j2 = 2*j
347 g%geoLatBu(i,j) = tmpz(i2,j2)
349 do j=g%jsd,g%jed ;
do i=g%IsdB,g%IedB ; i2 = 2*i ; j2 = 2*j
350 g%geoLatCu(i,j) = tmpz(i2,j2-1)
352 do j=g%JsdB,g%JedB ;
do i=g%isd,g%ied ; i2 = 2*i ; j2 = 2*j
353 g%geoLatCv(i,j) = tmpz(i2-1,j2)
357 tmpu(:,:) = 0. ; tmpv(:,:) = 0.
358 call read_data(filename,
'dx',tmpv,domain=sgdom%mpp_domain,position=north_face)
359 call read_data(filename,
'dy',tmpu,domain=sgdom%mpp_domain,position=east_face)
360 call pass_vector(tmpu, tmpv, sgdom, to_all+scalar_pair, cgrid_ne)
364 do j=g%jsd,g%jed ;
do i=g%isd,g%ied ; i2 = 2*i ; j2 = 2*j
365 dxt(i,j) = tmpv(i2-1,j2-1) + tmpv(i2,j2-1)
366 dyt(i,j) = tmpu(i2-1,j2-1) + tmpu(i2-1,j2)
369 do j=g%jsd,g%jed ;
do i=g%IsdB,g%IedB ; i2 = 2*i ; j2 = 2*j
370 dxcu(i,j) = tmpv(i2,j2-1) + tmpv(i2+1,j2-1)
371 dycu(i,j) = tmpu(i2,j2-1) + tmpu(i2,j2)
374 do j=g%JsdB,g%JedB ;
do i=g%isd,g%ied ; i2 = 2*i ; j2 = 2*j
375 dxcv(i,j) = tmpv(i2-1,j2) + tmpv(i2,j2)
376 dycv(i,j) = tmpu(i2-1,j2) + tmpu(i2-1,j2+1)
379 do j=g%JsdB,g%JedB ;
do i=g%IsdB,g%IedB ; i2 = 2*i ; j2 = 2*j
380 dxbu(i,j) = tmpv(i2,j2) + tmpv(i2+1,j2)
381 dybu(i,j) = tmpu(i2,j2) + tmpu(i2,j2+1)
386 call read_data(filename,
'area', tmpt, domain=sgdom%mpp_domain)
390 do j=g%jsd,g%jed ;
do i=g%isd,g%ied ; i2 = 2*i ; j2 = 2*j
391 areat(i,j) = (tmpt(i2-1,j2-1) + tmpt(i2,j2)) + &
392 (tmpt(i2-1,j2) + tmpt(i2,j2-1))
394 do j=g%JsdB,g%JedB ;
do i=g%IsdB,g%IedB ; i2 = 2*i ; j2 = 2*j
395 areabu(i,j) = (tmpt(i2,j2) + tmpt(i2+1,j2+1)) + &
396 (tmpt(i2,j2+1) + tmpt(i2+1,j2))
401 call mpp_deallocate_domain(sgdom%mpp_domain)
402 deallocate(sgdom%mpp_domain)
404 call pass_vector(dycu, dxcv, g%Domain, to_all+scalar_pair, cgrid_ne)
405 call pass_vector(dxcu, dycv, g%Domain, to_all+scalar_pair, cgrid_ne)
406 call pass_vector(dxbu, dybu, g%Domain, to_all+scalar_pair, bgrid_ne)
408 call pass_var(areabu, g%Domain, position=corner)
410 do i=g%isd,g%ied ;
do j=g%jsd,g%jed
411 g%dxT(i,j) = dxt(i,j) ; g%dyT(i,j) = dyt(i,j) ; g%areaT(i,j) = areat(i,j)
413 do i=g%IsdB,g%IedB ;
do j=g%jsd,g%jed
414 g%dxCu(i,j) = dxcu(i,j) ; g%dyCu(i,j) = dycu(i,j)
416 do i=g%isd,g%ied ;
do j=g%JsdB,g%JedB
417 g%dxCv(i,j) = dxcv(i,j) ; g%dyCv(i,j) = dycv(i,j)
419 do i=g%IsdB,g%IedB ;
do j=g%JsdB,g%JedB
420 g%dxBu(i,j) = dxbu(i,j) ; g%dyBu(i,j) = dybu(i,j) ; g%areaBu(i,j) = areabu(i,j)
425 start(:) = 1 ; nread(:) = 1
426 start(2) = 2 ; nread(1) = ni+1 ; nread(2) = 2
427 allocate( tmpglbl(ni+1,2) )
429 call read_data(filename,
"x", tmpglbl, start, nread, no_domain=.true.)
430 call broadcast(tmpglbl, 2*(ni+1), root_pe())
434 g%gridLonT(i) = tmpglbl(2*(i-g%isg)+2,2)
439 g%gridLonB(i) = tmpglbl(2*(i-g%isg)+3,1)
441 deallocate( tmpglbl )
443 allocate( tmpglbl(1, nj+1) )
444 start(:) = 1 ; nread(:) = 1
445 start(1) = int(ni/4)+1 ; nread(2) = nj+1
447 call read_data(filename,
"y", tmpglbl, start, nread, no_domain=.true.)
448 call broadcast(tmpglbl, nj+1, root_pe())
451 g%gridLatT(j) = tmpglbl(1,2*(j-g%jsg)+2)
454 g%gridLatB(j) = tmpglbl(1,2*(j-g%jsg)+3)
456 deallocate( tmpglbl )
479 integer :: i, j, isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB, I1off, J1off
480 integer :: niglobal, njglobal
481 real :: grid_latT(g%jsd:g%jed), grid_latB(g%jsdb:g%jedb)
482 real :: grid_lonT(g%isd:g%ied), grid_lonB(g%isdb:g%iedb)
483 real :: dx_everywhere, dy_everywhere
486 character(len=80) :: units_temp
487 character(len=48) :: mdl =
"MOM_grid_init set_grid_metrics_cartesian" 489 niglobal = g%Domain%niglobal ; njglobal = g%Domain%njglobal
490 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
491 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
492 i1off = g%idg_offset ; j1off = g%jdg_offset
494 call calltree_enter(
"set_grid_metrics_cartesian(), MOM_grid_initialize.F90")
498 call get_param(param_file, mdl,
"AXIS_UNITS", units_temp, &
499 "The units for the Cartesian axes. Valid entries are: \n"//&
500 " \t degrees - degrees of latitude and longitude \n"//&
501 " \t m - meters \n \t k - kilometers", default=
"degrees")
502 call get_param(param_file, mdl,
"SOUTHLAT", g%south_lat, &
503 "The southern latitude of the domain or the equivalent \n"//&
504 "starting value for the y-axis.", units=units_temp, &
505 fail_if_missing=.true.)
506 call get_param(param_file, mdl,
"LENLAT", g%len_lat, &
507 "The latitudinal or y-direction length of the domain.", &
508 units=units_temp, fail_if_missing=.true.)
509 call get_param(param_file, mdl,
"WESTLON", g%west_lon, &
510 "The western longitude of the domain or the equivalent \n"//&
511 "starting value for the x-axis.", units=units_temp, &
513 call get_param(param_file, mdl,
"LENLON", g%len_lon, &
514 "The longitudinal or x-direction length of the domain.", &
515 units=units_temp, fail_if_missing=.true.)
516 call get_param(param_file, mdl,
"RAD_EARTH", g%Rad_Earth, &
517 "The radius of the Earth.", units=
"m", default=6.378e6)
519 if (units_temp(1:1) ==
'k')
then 520 g%x_axis_units =
"kilometers" ; g%y_axis_units =
"kilometers" 521 elseif (units_temp(1:1) ==
'm')
then 522 g%x_axis_units =
"meters" ; g%y_axis_units =
"meters" 524 call log_param(param_file, mdl,
"explicit AXIS_UNITS", g%x_axis_units)
529 g%gridLatB(j) = g%south_lat + g%len_lat*
REAL(j-(g%jsg-1))/
REAL(njglobal)
532 g%gridLatT(j) = g%south_lat + g%len_lat*(
REAL(j-g%jsg)+0.5)/
REAL(njglobal)
535 g%gridLonB(i) = g%west_lon + g%len_lon*
REAL(i-(g%isg-1))/
REAL(niglobal)
538 g%gridLonT(i) = g%west_lon + g%len_lon*(
REAL(i-g%isg)+0.5)/
REAL(niglobal)
542 grid_latb(j) = g%south_lat + g%len_lat*
REAL(j+j1off-(g%jsg-1))/
REAL(njglobal)
545 grid_latt(j) = g%south_lat + g%len_lat*(
REAL(j+j1off-g%jsg)+0.5)/
REAL(njglobal)
548 grid_lonb(i) = g%west_lon + g%len_lon*
REAL(i+i1off-(g%isg-1))/
REAL(niglobal)
551 grid_lont(i) = g%west_lon + g%len_lon*(
REAL(i+i1off-g%isg)+0.5)/
REAL(niglobal)
554 if (units_temp(1:1) ==
'k')
then 555 dx_everywhere = 1000.0 * g%len_lon / (
REAL(niglobal))
556 dy_everywhere = 1000.0 * g%len_lat / (
REAL(njglobal))
557 else if (units_temp(1:1) ==
'm')
then 558 dx_everywhere = g%len_lon / (
REAL(niglobal))
559 dy_everywhere = g%len_lat / (
REAL(njglobal))
561 dx_everywhere = g%Rad_Earth * g%len_lon * pi / (180.0 * niglobal)
562 dy_everywhere = g%Rad_Earth * g%len_lat * pi / (180.0 * njglobal)
565 i_dx = 1.0 / dx_everywhere ; i_dy = 1.0 / dy_everywhere
567 do j=jsdb,jedb ;
do i=isdb,iedb
568 g%geoLonBu(i,j) = grid_lonb(i) ; g%geoLatBu(i,j) = grid_latb(j)
570 g%dxBu(i,j) = dx_everywhere ; g%IdxBu(i,j) = i_dx
571 g%dyBu(i,j) = dy_everywhere ; g%IdyBu(i,j) = i_dy
572 g%areaBu(i,j) = dx_everywhere * dy_everywhere ; g%IareaBu(i,j) = i_dx * i_dy
575 do j=jsd,jed ;
do i=isd,ied
576 g%geoLonT(i,j) = grid_lont(i) ; g%geoLatT(i,j) = grid_latt(j)
577 g%dxT(i,j) = dx_everywhere ; g%IdxT(i,j) = i_dx
578 g%dyT(i,j) = dy_everywhere ; g%IdyT(i,j) = i_dy
579 g%areaT(i,j) = dx_everywhere * dy_everywhere ; g%IareaT(i,j) = i_dx * i_dy
582 do j=jsd,jed ;
do i=isdb,iedb
583 g%geoLonCu(i,j) = grid_lonb(i) ; g%geoLatCu(i,j) = grid_latt(j)
585 g%dxCu(i,j) = dx_everywhere ; g%IdxCu(i,j) = i_dx
586 g%dyCu(i,j) = dy_everywhere ; g%IdyCu(i,j) = i_dy
589 do j=jsdb,jedb ;
do i=isd,ied
590 g%geoLonCv(i,j) = grid_lont(i) ; g%geoLatCv(i,j) = grid_latb(j)
592 g%dxCv(i,j) = dx_everywhere ; g%IdxCv(i,j) = i_dx
593 g%dyCv(i,j) = dy_everywhere ; g%IdyCv(i,j) = i_dy
617 integer :: i, j, isd, ied, jsd, jed
618 integer :: is, ie, js, je, Isq, Ieq, Jsq, Jeq, IsdB, IedB, JsdB, JedB
619 integer :: i_offset, j_offset
620 real :: grid_latT(g%jsd:g%jed), grid_latB(g%jsdb:g%jedb)
621 real :: grid_lonT(g%isd:g%ied), grid_lonB(g%isdb:g%iedb)
622 real :: dLon,dLat,latitude,longitude,dL_di
623 character(len=48) :: mdl =
"MOM_grid_init set_grid_metrics_spherical" 625 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
626 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
627 isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
628 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
629 i_offset = g%idg_offset ; j_offset = g%jdg_offset
631 call calltree_enter(
"set_grid_metrics_spherical(), MOM_grid_initialize.F90")
635 pi = 4.0*atan(1.0); pi_180 = atan(1.0)/45.
637 call get_param(param_file, mdl,
"SOUTHLAT", g%south_lat, &
638 "The southern latitude of the domain.", units=
"degrees", &
639 fail_if_missing=.true.)
640 call get_param(param_file, mdl,
"LENLAT", g%len_lat, &
641 "The latitudinal length of the domain.", units=
"degrees", &
642 fail_if_missing=.true.)
643 call get_param(param_file, mdl,
"WESTLON", g%west_lon, &
644 "The western longitude of the domain.", units=
"degrees", &
646 call get_param(param_file, mdl,
"LENLON", g%len_lon, &
647 "The longitudinal length of the domain.", units=
"degrees", &
648 fail_if_missing=.true.)
649 call get_param(param_file, mdl,
"RAD_EARTH", g%Rad_Earth, &
650 "The radius of the Earth.", units=
"m", default=6.378e6)
652 dlon = g%len_lon/g%Domain%niglobal
653 dlat = g%len_lat/g%Domain%njglobal
658 latitude = g%south_lat + dlat*(
REAL(j-(g%jsg-1)))
659 g%gridLatB(j) = min(max(latitude,-90.),90.)
662 latitude = g%south_lat + dlat*(
REAL(j-g%jsg)+0.5)
663 g%gridLatT(j) = min(max(latitude,-90.),90.)
666 g%gridLonB(i) = g%west_lon + dlon*(
REAL(i-(g%isg-1)))
669 g%gridLonT(i) = g%west_lon + dlon*(
REAL(i-g%isg)+0.5)
673 latitude = g%south_lat + dlat*
REAL(j+j_offset-(g%jsg-1))
674 grid_latb(j) = min(max(latitude,-90.),90.)
677 latitude = g%south_lat + dlat*(
REAL(j+j_offset-g%jsg)+0.5)
678 grid_latt(j) = min(max(latitude,-90.),90.)
681 grid_lonb(i) = g%west_lon + dlon*
REAL(i+i_offset-(g%isg-1))
684 grid_lont(i) = g%west_lon + dlon*(
REAL(i+i_offset-g%isg)+0.5)
687 dl_di = (g%len_lon * 4.0*atan(1.0)) / (180.0 * g%Domain%niglobal)
688 do j=jsdb,jedb ;
do i=isdb,iedb
689 g%geoLonBu(i,j) = grid_lonb(i)
690 g%geoLatBu(i,j) = grid_latb(j)
694 g%dxBu(i,j) = g%Rad_Earth * cos( g%geoLatBu(i,j)*pi_180 ) * dl_di
696 g%dyBu(i,j) = g%Rad_Earth * dlat*pi_180
697 g%areaBu(i,j) = g%dxBu(i,j) * g%dyBu(i,j)
700 do j=jsdb,jedb ;
do i=isd,ied
701 g%geoLonCv(i,j) = grid_lont(i)
702 g%geoLatCv(i,j) = grid_latb(j)
706 g%dxCv(i,j) = g%Rad_Earth * cos( g%geoLatCv(i,j)*pi_180 ) * dl_di
708 g%dyCv(i,j) = g%Rad_Earth * dlat*pi_180
711 do j=jsd,jed ;
do i=isdb,iedb
712 g%geoLonCu(i,j) = grid_lonb(i)
713 g%geoLatCu(i,j) = grid_latt(j)
717 g%dxCu(i,j) = g%Rad_Earth * cos( g%geoLatCu(i,j)*pi_180 ) * dl_di
719 g%dyCu(i,j) = g%Rad_Earth * dlat*pi_180
722 do j=jsd,jed ;
do i=isd,ied
723 g%geoLonT(i,j) = grid_lont(i)
724 g%geoLatT(i,j) = grid_latt(j)
728 g%dxT(i,j) = g%Rad_Earth * cos( g%geoLatT(i,j)*pi_180 ) * dl_di
730 g%dyT(i,j) = g%Rad_Earth * dlat*pi_180
735 g%areaT(i,j) = g%dxT(i,j) * g%dyT(i,j)
738 call calltree_leave(
"set_grid_metrics_spherical()")
744 type(dyn_horgrid_type),
intent(inout) :: G
745 type(param_file_type),
intent(in) :: param_file
758 integer :: i, j, isd, ied, jsd, jed
759 integer :: I_off, J_off
761 character(len=128) :: warnmesg
762 character(len=48) :: mdl =
"MOM_grid_init set_grid_metrics_mercator" 771 real :: y_q, y_h, jd, x_q, x_h, id
772 real,
dimension(G%isd:G%ied,G%jsd:G%jed) :: &
774 real,
dimension(G%IsdB:G%IedB,G%jsd:G%jed) :: &
776 real,
dimension(G%isd:G%ied,G%JsdB:G%JedB) :: &
778 real,
dimension(G%IsdB:G%IedB,G%JsdB:G%JedB) :: &
783 integer :: itt1, itt2
784 logical :: debug = .false., simple_area = .true.
785 integer :: is, ie, js, je, Isq, Ieq, Jsq, Jeq, IsdB, IedB, JsdB, JedB
787 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
788 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
789 isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
790 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
791 i_off = g%idg_offset ; j_off = g%jdg_offset
793 gp%niglobal = g%Domain%niglobal
794 gp%njglobal = g%Domain%njglobal
796 call calltree_enter(
"set_grid_metrics_mercator(), MOM_grid_initialize.F90")
800 pi = 4.0*atan(1.0) ; pi_2 = 0.5*pi
802 call get_param(param_file, mdl,
"SOUTHLAT", gp%south_lat, &
803 "The southern latitude of the domain.", units=
"degrees", &
804 fail_if_missing=.true.)
805 call get_param(param_file, mdl,
"LENLAT", gp%len_lat, &
806 "The latitudinal length of the domain.", units=
"degrees", &
807 fail_if_missing=.true.)
808 call get_param(param_file, mdl,
"WESTLON", gp%west_lon, &
809 "The western longitude of the domain.", units=
"degrees", &
811 call get_param(param_file, mdl,
"LENLON", gp%len_lon, &
812 "The longitudinal length of the domain.", units=
"degrees", &
813 fail_if_missing=.true.)
814 call get_param(param_file, mdl,
"RAD_EARTH", gp%Rad_Earth, &
815 "The radius of the Earth.", units=
"m", default=6.378e6)
816 g%south_lat = gp%south_lat ; g%len_lat = gp%len_lat
817 g%west_lon = gp%west_lon ; g%len_lon = gp%len_lon
818 g%Rad_Earth = gp%Rad_Earth
819 call get_param(param_file, mdl,
"ISOTROPIC", gp%isotropic, &
820 "If true, an isotropic grid on a sphere (also known as \n"//&
821 "a Mercator grid) is used. With an isotropic grid, the \n"//&
822 "meridional extent of the domain (LENLAT), the zonal \n"//&
823 "extent (LENLON), and the number of grid points in each \n"//&
824 "direction are _not_ independent. In MOM the meridional \n"//&
825 "extent is determined to fit the zonal extent and the \n"//&
826 "number of grid points, while grid is perfectly isotropic.", &
828 call get_param(param_file, mdl,
"EQUATOR_REFERENCE", gp%equator_reference, &
829 "If true, the grid is defined to have the equator at the \n"//&
830 "nearest q- or h- grid point to (-LOWLAT*NJGLOBAL/LENLAT).", &
832 call get_param(param_file, mdl,
"LAT_ENHANCE_FACTOR", gp%Lat_enhance_factor, &
833 "The amount by which the meridional resolution is \n"//&
834 "enhanced within LAT_EQ_ENHANCE of the equator.", &
835 units=
"nondim", default=1.0)
836 call get_param(param_file, mdl,
"LAT_EQ_ENHANCE", gp%Lat_eq_enhance, &
837 "The latitude range to the north and south of the equator \n"//&
838 "over which the resolution is enhanced.", units=
"degrees", &
846 if (gp%equator_reference)
then 850 jref = (g%jsg-1) + 0.5*floor(gp%njglobal*((-1.0*gp%south_lat*2.0)/gp%len_lat)+0.5)
855 fnref =
int_dj_dy((gp%south_lat*pi/180.0), gp)
864 jd = fnref + (j - jref)
866 g%gridLatB(j) = y_q*180.0/pi
871 jd = fnref + (j - jref) - 0.5
873 g%gridLatT(j) = y_h*180.0/pi
877 do j=jsdb+j_off,jedb+j_off
878 jd = fnref + (j - jref)
880 do i=isdb,iedb ; yq(i,j-j_off) = y_q ;
enddo 881 do i=isd,ied ; yv(i,j-j_off) = y_q ;
enddo 883 do j=jsd+j_off,jed+j_off
884 jd = fnref + (j - jref) - 0.5
886 if ((j >= jsd+j_off) .and. (j <= jed+j_off))
then 887 do i=isd,ied ; yh(i,j-j_off) = y_h ;
enddo 888 do i=isdb,iedb ; yu(i,j-j_off) = y_h ;
enddo 895 iref = (g%isg-1) + gp%niglobal
896 fnref =
int_di_dx(((gp%west_lon+gp%len_lon)*pi/180.0), gp)
902 id = fnref + (i - iref)
904 g%gridLonB(i) = x_q*180.0/pi
907 id = fnref + (i - iref) - 0.5
909 g%gridLonT(i) = x_h*180.0/pi
911 do i=isdb+i_off,iedb+i_off
912 id = fnref + (i - iref)
914 do j=jsdb,jedb ; xq(i-i_off,j) = x_q ;
enddo 915 do j=jsd,jed ; xu(i-i_off,j) = x_q ;
enddo 917 do i=isd+i_off,ied+i_off
918 id = fnref + (i - iref) - 0.5
920 do j=jsd,jed ; xh(i-i_off,j) = x_h ;
enddo 921 do j=jsdb,jedb ; xv(i-i_off,j) = x_h ;
enddo 924 do j=jsdb,jedb ;
do i=isdb,iedb
925 g%geoLonBu(i,j) = xq(i,j)*180.0/pi
926 g%geoLatBu(i,j) = yq(i,j)*180.0/pi
927 g%dxBu(i,j) =
ds_di(xq(i,j), yq(i,j), gp)
928 g%dyBu(i,j) =
ds_dj(xq(i,j), yq(i,j), gp)
930 g%areaBu(i,j) = g%dxBu(i,j) * g%dyBu(i,j)
931 g%IareaBu(i,j) = 1.0 / g%areaBu(i,j)
934 do j=jsd,jed ;
do i=isd,ied
935 g%geoLonT(i,j) = xh(i,j)*180.0/pi
936 g%geoLatT(i,j) = yh(i,j)*180.0/pi
937 g%dxT(i,j) =
ds_di(xh(i,j), yh(i,j), gp)
938 g%dyT(i,j) =
ds_dj(xh(i,j), yh(i,j), gp)
940 g%areaT(i,j) = g%dxT(i,j)*g%dyT(i,j)
941 g%IareaT(i,j) = 1.0 / g%areaT(i,j)
944 do j=jsd,jed ;
do i=isdb,iedb
945 g%geoLonCu(i,j) = xu(i,j)*180.0/pi
946 g%geoLatCu(i,j) = yu(i,j)*180.0/pi
947 g%dxCu(i,j) =
ds_di(xu(i,j), yu(i,j), gp)
948 g%dyCu(i,j) =
ds_dj(xu(i,j), yu(i,j), gp)
951 do j=jsdb,jedb ;
do i=isd,ied
952 g%geoLonCv(i,j) = xv(i,j)*180.0/pi
953 g%geoLatCv(i,j) = yv(i,j)*180.0/pi
954 g%dxCv(i,j) =
ds_di(xv(i,j), yv(i,j), gp)
955 g%dyCv(i,j) =
ds_dj(xv(i,j), yv(i,j), gp)
958 if (.not.simple_area)
then 959 do j=jsdb+1,jed ;
do i=isdb+1,ied
960 g%areaT(i,j) = gp%Rad_Earth**2 * &
961 (
dl(xq(i-1,j-1),xq(i-1,j),yq(i-1,j-1),yq(i-1,j)) + &
962 (
dl(xq(i-1,j),xq(i,j),yq(i-1,j),yq(i,j)) + &
963 (
dl(xq(i,j),xq(i,j-1),yq(i,j),yq(i,j-1)) + &
964 dl(xq(i,j-1),xq(i-1,j-1),yq(i,j-1),yq(i-1,j-1)))))
966 if ((isdb == isd) .or. (jsdb == jsq))
then 970 g%areaT(isd+1,jsd) = g%areaT(isd+1,jsd+1)
971 do j=jsd,jed ; g%areaT(isd,j) = g%areaT(isd+1,j) ;
enddo 972 do i=isd,ied ; g%areaT(i,jsd) = g%areaT(i,jsd+1) ;
enddo 974 call pass_var(g%areaT,g%Domain)
976 do j=jsd,jed ;
do i=isd,ied
977 g%IareaT(i,j) = 1.0 / g%areaT(i,j)
981 call calltree_leave(
"set_grid_metrics_mercator()")
985 function ds_di(x, y, GP)
986 real,
intent(in) :: x, y
987 type(
gps),
intent(in) :: GP
992 ds_di = gp%Rad_Earth * cos(y) *
dx_di(x,gp)
998 function ds_dj(x, y, GP)
999 real,
intent(in) :: x, y
1000 type(
gps),
intent(in) :: GP
1005 ds_dj = gp%Rad_Earth *
dy_dj(y,gp)
1012 function dl(x1, x2, y1, y2)
1013 real,
intent(in) :: x1, x2, y1, y2
1027 if (abs(dy) > 2.5e-8)
then 1028 r = ((1.0 - cos(dy))*cos(y1) + sin(dy)*sin(y1)) / dy
1030 r = (0.5*dy*cos(y1) + sin(y1))
1036 function find_root( fn, dy_df, GP, fnval, y1, ymin, ymax, ittmax)
1038 real,
external :: fn, dy_df
1039 type(
gps),
intent(in) :: GP
1040 real,
intent(in) :: fnval, y1, ymin, ymax
1041 integer,
intent(out) :: ittmax
1047 real :: ybot, ytop, fnbot, fntop
1049 character(len=256) :: warnmesg
1051 real :: dy_dfn, dy, fny
1057 fnbot = fn(ybot,gp) - fnval ; itt = 0
1058 do while (fnbot > 0.0)
1059 if ((ybot - 2.0*dy_df(ybot,gp)) < (0.5*(ybot+ymin)))
then 1061 ybot = ybot - 2.0*dy_df(ybot,gp)
1063 ybot = 0.5*(ybot+ymin) ; itt = itt + 1
1065 fnbot = fn(ybot,gp) - fnval
1067 if ((itt > 50) .and. (fnbot > 0.0))
then 1068 write(warnmesg,
'("PE ",I2," unable to find bottom bound for grid function. & 1069 &x = ",ES10.4,", xmax = ",ES10.4,", fn = ",ES10.4,", dfn_dx = ",ES10.4,& 1070 &", seeking fn = ",ES10.4," - fn = ",ES10.4,".")') &
1071 pe_here(),ybot,ymin,fn(ybot,gp),dy_df(ybot,gp),fnval, fnbot
1072 call mom_error(fatal,warnmesg)
1077 fntop = fn(ytop,gp) - fnval ; itt = 0
1078 do while (fntop < 0.0)
1079 if ((ytop + 2.0*dy_df(ytop,gp)) < (0.5*(ytop+ymax)))
then 1081 ytop = ytop + 2.0*dy_df(ytop,gp)
1083 ytop = 0.5*(ytop+ymax) ; itt = itt + 1
1085 fntop = fn(ytop,gp) - fnval
1087 if ((itt > 50) .and. (fntop < 0.0))
then 1088 write(warnmesg,
'("PE ",I2," unable to find top bound for grid function. & 1089 &x = ",ES10.4,", xmax = ",ES10.4,", fn = ",ES10.4,", dfn_dx = ",ES10.4, & 1090 &", seeking fn = ",ES10.4," - fn = ",ES10.4,".")') &
1091 pe_here(),ytop,ymax,fn(ytop,gp),dy_df(ytop,gp),fnval,fntop
1092 call mom_error(fatal,warnmesg)
1098 if ((fntop < 0.0) .or. (fnbot > 0.0) .or. (ytop < ybot))
then 1099 write(warnmesg,
'("PE ",I2," find_root failed to bracket function. y = ",& 1100 &2ES10.4,", fn = ",2ES10.4,".")') pe_here(),ybot,ytop,fnbot,fntop
1101 call mom_error(fatal, warnmesg)
1104 if (fntop == 0.0)
then ; y = ytop ; fny = fntop
1105 elseif (fnbot == 0.0)
then ; y = ybot ; fny = fnbot
1107 y = (ybot*fntop - ytop*fnbot) / (fntop - fnbot)
1108 fny = fn(y,gp) - fnval
1109 if (fny < 0.0)
then ; fnbot = fny ; ybot = y
1110 else ; fntop = fny ; ytop = y ;
endif 1114 dy_dfn = dy_df(y,gp)
1116 dy = -1.0* fny * dy_dfn
1118 if ((y_next >= ytop) .or. (y_next <= ybot))
then 1123 if (abs(fntop - fnbot) > epsilon(y) * (abs(fntop) + abs(fnbot))) &
1124 y_next = (ybot*fntop - ytop*fnbot) / (fntop - fnbot)
1128 if (abs(dy) < (2.0*epsilon(y)*(abs(y) + abs(y_next)) + 1.0e-20))
then 1133 fny = fn(y,gp) - fnval
1134 if (fny > 0.0)
then ; ytop = y ; fntop = fny
1135 elseif (fny < 0.0)
then ; ybot = y ; fnbot = fny
1139 if (abs(y) < 1e-12) y = 0.0
1145 function dx_di(x, GP)
1146 real,
intent(in) :: x
1147 type(
gps),
intent(in) :: GP
1153 dx_di = (gp%len_lon * 4.0*atan(1.0)) / (180.0 * gp%niglobal)
1158 real,
intent(in) :: x
1159 type(
gps),
intent(in) :: GP
1164 int_di_dx = x * ((180.0 * gp%niglobal) / (gp%len_lon * 4.0*atan(1.0)))
1168 function dy_dj(y, GP)
1169 real,
intent(in) :: y
1170 type(
gps),
intent(in) :: GP
1178 real :: y_eq_enhance
1181 if (gp%isotropic)
then 1182 c0 = (gp%len_lon * pi) / (180.0 * gp%niglobal)
1183 y_eq_enhance = pi*abs(gp%lat_eq_enhance)/180.0
1184 if (abs(y) < y_eq_enhance)
then 1185 dy_dj = c0 * (cos(y) / (1.0 + 0.5*cos(y) * (gp%lat_enhance_factor - 1.0) * &
1186 (1.0+cos(pi*y/y_eq_enhance)) ))
1191 c0 = (gp%len_lat * pi) / (180.0 * gp%njglobal)
1198 real,
intent(in) :: y
1199 type(
gps),
intent(in) :: GP
1207 real :: y_eq_enhance
1214 if (gp%isotropic)
then 1215 i_c0 = (180.0 * gp%niglobal) / (gp%len_lon * pi)
1216 y_eq_enhance = pi*abs(gp%lat_eq_enhance)/180.0
1219 r = i_c0 * log((1.0 + sin(y))/cos(y))
1221 r = -1.0 * i_c0 * log((1.0 - sin(y))/cos(y))
1224 if (y >= y_eq_enhance)
then 1225 r = r + i_c0*0.5*(gp%lat_enhance_factor - 1.0)*y_eq_enhance
1226 else if (y <= -y_eq_enhance)
then 1227 r = r - i_c0*0.5*(gp%lat_enhance_factor - 1.0)*y_eq_enhance
1229 r = r + i_c0*0.5*(gp%lat_enhance_factor - 1.0) * &
1230 (y + (y_eq_enhance/pi)*sin(pi*y/y_eq_enhance))
1233 i_c0 = (180.0 * gp%njglobal) / (gp%len_lat * pi)
1246 real,
dimension(:,:),
intent(inout) :: var
1247 integer,
intent(in) :: jh
1248 real,
optional,
intent(in) :: missing
1252 badval = 0.0 ;
if (
present(missing)) badval = missing
1255 do j=lbound(var,2)+jh,lbound(var,2),-1 ;
do i=lbound(var,1),ubound(var,1)
1256 if (var(i,j)==badval) var(i,j) = 2.0*var(i,j+1)-var(i,j+2)
1260 do j=ubound(var,2)-jh,ubound(var,2) ;
do i=lbound(var,1),ubound(var,1)
1261 if (var(i,j)==badval) var(i,j) = 2.0*var(i,j-1)-var(i,j-2)
1265 do j=lbound(var,2),ubound(var,2) ;
do i=lbound(var,1)+jh,lbound(var,1),-1
1266 if (var(i,j)==badval) var(i,j) = 2.0*var(i+1,j)-var(i+2,j)
1270 do j=lbound(var,2),ubound(var,2) ;
do i=ubound(var,1)-jh,ubound(var,1)
1271 if (var(i,j)==badval) var(i,j) = 2.0*var(i-1,j)-var(i-2,j)
1279 real,
intent(in) :: val
1283 if (val /= 0.0) i_val = 1.0/val
1289 type(dyn_horgrid_type),
intent(inout) :: G
1290 type(param_file_type),
intent(in) :: PF
1299 real :: Dmin, min_depth, mask_depth
1300 character(len=40) :: mdl =
"MOM_grid_init initialize_masks" 1303 call calltree_enter(
"initialize_masks(), MOM_grid_initialize.F90")
1304 call get_param(pf, mdl,
"MINIMUM_DEPTH", min_depth, &
1305 "If MASKING_DEPTH is unspecified, then anything shallower than\n"//&
1306 "MINIMUM_DEPTH is assumed to be land and all fluxes are masked out.\n"//&
1307 "If MASKING_DEPTH is specified, then all depths shallower than\n"//&
1308 "MINIMUM_DEPTH but deeper than MASKING_DEPTH are rounded to MINIMUM_DEPTH.", &
1309 units=
"m", default=0.0)
1310 call get_param(pf, mdl,
"MASKING_DEPTH", mask_depth, &
1311 "The depth below which to mask points as land points, for which all\n"//&
1312 "fluxes are zeroed out. MASKING_DEPTH is ignored if negative.", &
1313 units=
"m", default=-9999.0)
1316 if (mask_depth>=0.) dmin = mask_depth
1318 g%mask2dCu(:,:) = 0.0 ; g%mask2dCv(:,:) = 0.0 ; g%mask2dBu(:,:) = 0.0
1321 do j=g%jsd,g%jed ;
do i=g%isd,g%ied
1322 if (g%bathyT(i,j) <= dmin)
then 1323 g%mask2dT(i,j) = 0.0
1325 g%mask2dT(i,j) = 1.0
1329 do j=g%jsd,g%jed ;
do i=g%isd,g%ied-1
1330 if ((g%bathyT(i,j) <= dmin) .or. (g%bathyT(i+1,j) <= dmin))
then 1331 g%mask2dCu(i,j) = 0.0
1333 g%mask2dCu(i,j) = 1.0
1337 do j=g%jsd,g%jed-1 ;
do i=g%isd,g%ied
1338 if ((g%bathyT(i,j) <= dmin) .or. (g%bathyT(i,j+1) <= dmin))
then 1339 g%mask2dCv(i,j) = 0.0
1341 g%mask2dCv(i,j) = 1.0
1345 do j=g%jsd,g%jed-1 ;
do i=g%isd,g%ied-1
1346 if ((g%bathyT(i+1,j) <= dmin) .or. (g%bathyT(i+1,j+1) <= dmin) .or. &
1347 (g%bathyT(i,j) <= dmin) .or. (g%bathyT(i,j+1) <= dmin))
then 1348 g%mask2dBu(i,j) = 0.0
1350 g%mask2dBu(i,j) = 1.0
1354 call pass_var(g%mask2dBu, g%Domain, position=corner)
1355 call pass_vector(g%mask2dCu, g%mask2dCv, g%Domain, to_all+scalar_pair, cgrid_ne)
1357 do j=g%jsd,g%jed ;
do i=g%IsdB,g%IedB
1358 g%dy_Cu(i,j) = g%mask2dCu(i,j) * g%dyCu(i,j)
1359 g%dy_Cu_obc(i,j) = g%mask2dCu(i,j) * g%dyCu(i,j)
1360 g%areaCu(i,j) = g%dxCu(i,j) * g%dy_Cu(i,j)
1364 do j=g%JsdB,g%JedB ;
do i=g%isd,g%ied
1365 g%dx_Cv(i,j) = g%mask2dCv(i,j) * g%dxCv(i,j)
1366 g%dx_Cv_obc(i,j) = g%mask2dCv(i,j) * g%dxCv(i,j)
1367 g%areaCv(i,j) = g%dyCv(i,j) * g%dx_Cv(i,j)
1371 call calltree_leave(
"initialize_masks()")
subroutine set_grid_metrics_cartesian(G, param_file)
real function int_di_dx(x, GP)
subroutine grid_metrics_chksum(parent, G)
grid_metrics_chksum performs a set of checksums on metrics on the grid for debugging.
subroutine, public initialize_masks(G, PF)
initialize_masks initializes the grid masks and any metrics that come with masks already applied...
integer, parameter, public to_all
subroutine, public set_derived_dyn_horgrid(G)
set_derived_dyn_horgrid calculates metric terms that are derived from other metrics.
real function find_root(fn, dy_df, GP, fnval, y1, ymin, ymax, ittmax)
subroutine, public calltree_leave(mesg)
Writes a message about leaving a subroutine if call tree reporting is active.
This module contains I/O framework code.
subroutine extrapolate_metric(var, jh, missing)
extrapolate_metric extrapolates missing metric data into all the halo regions.
real function int_dj_dy(y, GP)
subroutine set_grid_metrics_mercator(G, param_file)
real function dx_di(x, GP)
real function ds_di(x, y, GP)
subroutine set_grid_metrics_spherical(G, param_file)
logical function, public is_root_pe()
subroutine, public set_grid_metrics(G, param_file)
set_grid_metrics is used to set the primary values in the model's horizontal grid. The bathymetry, land-sea mask and any restricted channel widths are not known yet, so these are set later.
subroutine set_grid_metrics_from_mosaic(G, param_file)
set_grid_metrics_from_mosaic sets the grid metrics from a mosaic file.
subroutine, public mom_mesg(message, verb, all_print)
real function dy_dj(y, GP)
The MOM_domain_type contains information about the domain decompositoin.
real function dl(x1, x2, y1, y2)
subroutine, public mom_error(level, message, all_print)
real function ds_dj(x, y, GP)
real function, public adcroft_reciprocal(val)
This function implements Adcroft's rule for reciprocals, namely that Adcroft_Inv(x) = 1/x for |x|>0 o...
subroutine, public calltree_enter(mesg, n)
Writes a message about entering a subroutine if call tree reporting is active.