27 implicit none ;
private 37 integer :: isc, iec, jsc, jec
38 integer :: isd, ied, jsd, jed
39 integer :: isg, ieg, jsg, jeg
40 integer :: iscb, iecb, jscb, jecb
41 integer :: isdb, iedb, jsdb, jedb
42 integer :: isgb, iegb, jsgb, jegb
49 logical :: nonblocking_updates
51 integer :: first_direction
57 real,
allocatable,
dimension(:,:) :: &
68 real,
allocatable,
dimension(:,:) :: &
79 real,
allocatable,
dimension(:,:) :: &
90 real,
allocatable,
dimension(:,:) :: &
99 real,
pointer,
dimension(:) :: &
100 gridlatt => null(), gridlatb => null()
103 real,
pointer,
dimension(:) :: &
104 gridlont => null(), gridlonb => null()
107 character(len=40) :: &
112 real,
allocatable,
dimension(:,:) :: &
115 logical :: bathymetry_at_vel
118 real,
allocatable,
dimension(:,:) :: &
121 real,
allocatable,
dimension(:,:) :: &
124 real,
allocatable,
dimension(:,:) :: &
126 real,
allocatable,
dimension(:,:) :: &
131 real :: iareat_global
140 real :: rad_earth = 6.378e6
151 logical,
optional,
intent(in) :: bathymetry_at_vel
155 integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB, isg, ieg, jsg, jeg
160 if (
associated(g))
then 161 call mom_error(warning,
"create_dyn_horgrid called with an associated horgrid_type.")
168 g%isc = hi%isc ; g%iec = hi%iec ; g%jsc = hi%jsc ; g%jec = hi%jec
169 g%isd = hi%isd ; g%ied = hi%ied ; g%jsd = hi%jsd ; g%jed = hi%jed
170 g%isg = hi%isg ; g%ieg = hi%ieg ; g%jsg = hi%jsg ; g%jeg = hi%jeg
172 g%IscB = hi%IscB ; g%IecB = hi%IecB ; g%JscB = hi%JscB ; g%JecB = hi%JecB
173 g%IsdB = hi%IsdB ; g%IedB = hi%IedB ; g%JsdB = hi%JsdB ; g%JedB = hi%JedB
174 g%IsgB = hi%IsgB ; g%IegB = hi%IegB ; g%JsgB = hi%JsgB ; g%JegB = hi%JegB
176 g%idg_offset = hi%idg_offset ; g%jdg_offset = hi%jdg_offset
177 g%isd_global = g%isd + hi%idg_offset ; g%jsd_global = g%jsd + hi%jdg_offset
178 g%symmetric = hi%symmetric
180 g%bathymetry_at_vel = .false.
181 if (
present(bathymetry_at_vel)) g%bathymetry_at_vel = bathymetry_at_vel
183 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
184 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
185 isg = g%isg ; ieg = g%ieg ; jsg = g%jsg ; jeg = g%jeg
187 allocate(g%dxT(isd:ied,jsd:jed)) ; g%dxT(:,:) = 0.0
188 allocate(g%dxCu(isdb:iedb,jsd:jed)) ; g%dxCu(:,:) = 0.0
189 allocate(g%dxCv(isd:ied,jsdb:jedb)) ; g%dxCv(:,:) = 0.0
190 allocate(g%dxBu(isdb:iedb,jsdb:jedb)) ; g%dxBu(:,:) = 0.0
191 allocate(g%IdxT(isd:ied,jsd:jed)) ; g%IdxT(:,:) = 0.0
192 allocate(g%IdxCu(isdb:iedb,jsd:jed)) ; g%IdxCu(:,:) = 0.0
193 allocate(g%IdxCv(isd:ied,jsdb:jedb)) ; g%IdxCv(:,:) = 0.0
194 allocate(g%IdxBu(isdb:iedb,jsdb:jedb)) ; g%IdxBu(:,:) = 0.0
196 allocate(g%dyT(isd:ied,jsd:jed)) ; g%dyT(:,:) = 0.0
197 allocate(g%dyCu(isdb:iedb,jsd:jed)) ; g%dyCu(:,:) = 0.0
198 allocate(g%dyCv(isd:ied,jsdb:jedb)) ; g%dyCv(:,:) = 0.0
199 allocate(g%dyBu(isdb:iedb,jsdb:jedb)) ; g%dyBu(:,:) = 0.0
200 allocate(g%IdyT(isd:ied,jsd:jed)) ; g%IdyT(:,:) = 0.0
201 allocate(g%IdyCu(isdb:iedb,jsd:jed)) ; g%IdyCu(:,:) = 0.0
202 allocate(g%IdyCv(isd:ied,jsdb:jedb)) ; g%IdyCv(:,:) = 0.0
203 allocate(g%IdyBu(isdb:iedb,jsdb:jedb)) ; g%IdyBu(:,:) = 0.0
205 allocate(g%areaT(isd:ied,jsd:jed)) ; g%areaT(:,:) = 0.0
206 allocate(g%IareaT(isd:ied,jsd:jed)) ; g%IareaT(:,:) = 0.0
207 allocate(g%areaBu(isdb:iedb,jsdb:jedb)) ; g%areaBu(:,:) = 0.0
208 allocate(g%IareaBu(isdb:iedb,jsdb:jedb)) ; g%IareaBu(:,:) = 0.0
210 allocate(g%mask2dT(isd:ied,jsd:jed)) ; g%mask2dT(:,:) = 0.0
211 allocate(g%mask2dCu(isdb:iedb,jsd:jed)) ; g%mask2dCu(:,:) = 0.0
212 allocate(g%mask2dCv(isd:ied,jsdb:jedb)) ; g%mask2dCv(:,:) = 0.0
213 allocate(g%mask2dBu(isdb:iedb,jsdb:jedb)) ; g%mask2dBu(:,:) = 0.0
214 allocate(g%geoLatT(isd:ied,jsd:jed)) ; g%geoLatT(:,:) = 0.0
215 allocate(g%geoLatCu(isdb:iedb,jsd:jed)) ; g%geoLatCu(:,:) = 0.0
216 allocate(g%geoLatCv(isd:ied,jsdb:jedb)) ; g%geoLatCv(:,:) = 0.0
217 allocate(g%geoLatBu(isdb:iedb,jsdb:jedb)) ; g%geoLatBu(:,:) = 0.0
218 allocate(g%geoLonT(isd:ied,jsd:jed)) ; g%geoLonT(:,:) = 0.0
219 allocate(g%geoLonCu(isdb:iedb,jsd:jed)) ; g%geoLonCu(:,:) = 0.0
220 allocate(g%geoLonCv(isd:ied,jsdb:jedb)) ; g%geoLonCv(:,:) = 0.0
221 allocate(g%geoLonBu(isdb:iedb,jsdb:jedb)) ; g%geoLonBu(:,:) = 0.0
223 allocate(g%dx_Cv(isd:ied,jsdb:jedb)) ; g%dx_Cv(:,:) = 0.0
224 allocate(g%dy_Cu(isdb:iedb,jsd:jed)) ; g%dy_Cu(:,:) = 0.0
225 allocate(g%dx_Cv_obc(isd:ied,jsdb:jedb)) ; g%dx_Cv_obc(:,:) = 0.0
226 allocate(g%dy_Cu_obc(isdb:iedb,jsd:jed)) ; g%dy_Cu_obc(:,:) = 0.0
228 allocate(g%areaCu(isdb:iedb,jsd:jed)) ; g%areaCu(:,:) = 0.0
229 allocate(g%areaCv(isd:ied,jsdb:jedb)) ; g%areaCv(:,:) = 0.0
230 allocate(g%IareaCu(isdb:iedb,jsd:jed)) ; g%IareaCu(:,:) = 0.0
231 allocate(g%IareaCv(isd:ied,jsdb:jedb)) ; g%IareaCv(:,:) = 0.0
233 allocate(g%bathyT(isd:ied, jsd:jed)) ; g%bathyT(:,:) = 0.0
234 allocate(g%CoriolisBu(isdb:iedb, jsdb:jedb)) ; g%CoriolisBu(:,:) = 0.0
235 allocate(g%dF_dx(isd:ied, jsd:jed)) ; g%dF_dx(:,:) = 0.0
236 allocate(g%dF_dy(isd:ied, jsd:jed)) ; g%dF_dy(:,:) = 0.0
238 allocate(g%sin_rot(isd:ied,jsd:jed)) ; g%sin_rot(:,:) = 0.0
239 allocate(g%cos_rot(isd:ied,jsd:jed)) ; g%cos_rot(:,:) = 1.0
241 if (g%bathymetry_at_vel)
then 242 allocate(g%Dblock_u(isdb:iedb, jsd:jed)) ; g%Dblock_u(:,:) = 0.0
243 allocate(g%Dopen_u(isdb:iedb, jsd:jed)) ; g%Dopen_u(:,:) = 0.0
244 allocate(g%Dblock_v(isd:ied, jsdb:jedb)) ; g%Dblock_v(:,:) = 0.0
245 allocate(g%Dopen_v(isd:ied, jsdb:jedb)) ; g%Dopen_v(:,:) = 0.0
250 allocate(g%gridLonT(isg:ieg)) ; g%gridLonT(:) = 0.0
251 allocate(g%gridLonB(isg-1:ieg)) ; g%gridLonB(:) = 0.0
252 allocate(g%gridLatT(jsg:jeg)) ; g%gridLatT(:) = 0.0
253 allocate(g%gridLatB(jsg-1:jeg)) ; g%gridLatB(:) = 0.0
262 integer :: i, j, isd, ied, jsd, jed
263 integer :: IsdB, IedB, JsdB, JedB
265 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
266 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
268 do j=jsd,jed ;
do i=isd,ied
269 if (g%dxT(i,j) < 0.0) g%dxT(i,j) = 0.0
270 if (g%dyT(i,j) < 0.0) g%dyT(i,j) = 0.0
276 do j=jsd,jed ;
do i=isdb,iedb
277 if (g%dxCu(i,j) < 0.0) g%dxCu(i,j) = 0.0
278 if (g%dyCu(i,j) < 0.0) g%dyCu(i,j) = 0.0
283 do j=jsdb,jedb ;
do i=isd,ied
284 if (g%dxCv(i,j) < 0.0) g%dxCv(i,j) = 0.0
285 if (g%dyCv(i,j) < 0.0) g%dyCv(i,j) = 0.0
290 do j=jsdb,jedb ;
do i=isdb,iedb
291 if (g%dxBu(i,j) < 0.0) g%dxBu(i,j) = 0.0
292 if (g%dyBu(i,j) < 0.0) g%dyBu(i,j) = 0.0
297 if (g%areaBu(i,j) <= 0.0) g%areaBu(i,j) = g%dxBu(i,j) * g%dyBu(i,j)
305 real,
intent(in) :: val
308 i_val = 0.0 ;
if (val /= 0.0) i_val = 1.0/val
316 if (.not.
associated(g))
then 317 call mom_error(fatal,
"destroy_dyn_horgrid called with an unassociated horgrid_type.")
320 deallocate(g%dxT) ;
deallocate(g%dxCu) ;
deallocate(g%dxCv) ;
deallocate(g%dxBu)
321 deallocate(g%IdxT) ;
deallocate(g%IdxCu) ;
deallocate(g%IdxCv) ;
deallocate(g%IdxBu)
323 deallocate(g%dyT) ;
deallocate(g%dyCu) ;
deallocate(g%dyCv) ;
deallocate(g%dyBu)
324 deallocate(g%IdyT) ;
deallocate(g%IdyCu) ;
deallocate(g%IdyCv) ;
deallocate(g%IdyBu)
326 deallocate(g%areaT) ;
deallocate(g%IareaT)
327 deallocate(g%areaBu) ;
deallocate(g%IareaBu)
328 deallocate(g%areaCu) ;
deallocate(g%IareaCu)
329 deallocate(g%areaCv) ;
deallocate(g%IareaCv)
331 deallocate(g%mask2dT) ;
deallocate(g%mask2dCu)
332 deallocate(g%mask2dCv) ;
deallocate(g%mask2dBu)
334 deallocate(g%geoLatT) ;
deallocate(g%geoLatCu)
335 deallocate(g%geoLatCv) ;
deallocate(g%geoLatBu)
336 deallocate(g%geoLonT) ;
deallocate(g%geoLonCu)
337 deallocate(g%geoLonCv) ;
deallocate(g%geoLonBu)
339 deallocate(g%dx_Cv) ;
deallocate(g%dy_Cu)
340 deallocate(g%dx_Cv_obc) ;
deallocate(g%dy_Cu_obc)
342 deallocate(g%bathyT) ;
deallocate(g%CoriolisBu)
343 deallocate(g%dF_dx) ;
deallocate(g%dF_dy)
344 deallocate(g%sin_rot) ;
deallocate(g%cos_rot)
346 if (
allocated(g%Dblock_u))
deallocate(g%Dblock_u)
347 if (
allocated(g%Dopen_u))
deallocate(g%Dopen_u)
348 if (
allocated(g%Dblock_v))
deallocate(g%Dblock_v)
349 if (
allocated(g%Dopen_v))
deallocate(g%Dopen_v)
351 deallocate(g%gridLonT) ;
deallocate(g%gridLatT)
352 deallocate(g%gridLonB) ;
deallocate(g%gridLatB)
354 deallocate(g%Domain%mpp_domain)
subroutine, public set_derived_dyn_horgrid(G)
set_derived_dyn_horgrid calculates metric terms that are derived from other metrics.
Defines the horizontal index type (hor_index_type) used for providing index ranges.
Container for horizontal index ranges for data, computational and global domains. ...
real function adcroft_reciprocal(val)
Adcroft_reciprocal(x) = 1/x for |x|>0 or 0 for x=0.
subroutine, public destroy_dyn_horgrid(G)
Release memory used by the dyn_horgrid_type and related structures.
subroutine, public mom_mesg(message, verb, all_print)
The MOM_domain_type contains information about the domain decompositoin.
subroutine, public create_dyn_horgrid(G, HI, bathymetry_at_vel)
Allocate memory used by the dyn_horgrid_type and related structures.
subroutine, public mom_error(level, message, all_print)