ROMS
Loading...
Searching...
No Matches
set_massflux_mod Module Reference

Functions/Subroutines

subroutine, public set_massflux (ng, tile, model)
 
subroutine set_massflux_tile (ng, tile, model, lbi, ubi, lbj, ubj, imins, imaxs, jmins, jmaxs, nrhs, u, v, hz, om_v, on_u, huon, hvom)
 
subroutine, public reset_massflux (ng, tile, model)
 
subroutine reset_massflux_tile (ng, tile, model, lbi, ubi, lbj, ubj, imins, imaxs, jmins, jmaxs, nnew, du_avg2, dv_avg2, u, v, hz, om_v, on_u, huon, hvom)
 

Function/Subroutine Documentation

◆ reset_massflux()

subroutine, public set_massflux_mod::reset_massflux ( integer, intent(in) ng,
integer, intent(in) tile,
integer, intent(in) model )

Definition at line 190 of file set_massflux.F.

191!***********************************************************************
192!
193 USE mod_param
194 USE mod_coupling
195 USE mod_grid
196 USE mod_ocean
197 USE mod_stepping
198!
199! Imported variable declarations.
200!
201 integer, intent(in) :: ng, tile, model
202!
203! Local variable declarations.
204!
205 character (len=*), parameter :: MyFile = &
206 & __FILE__//", reset_massflux"
207!
208# include "tile.h"
209!
210# ifdef PROFILE
211 CALL wclock_on (ng, model, 12, __line__, myfile)
212# endif
213 CALL reset_massflux_tile (ng, tile, model, &
214 & lbi, ubi, lbj, ubj, &
215 & imins, imaxs, jmins, jmaxs, &
216 & nnew(ng), &
217 & coupling(ng) % DU_avg2, &
218 & coupling(ng) % DV_avg2, &
219 & ocean(ng) % u, &
220 & ocean(ng) % v, &
221# ifdef WEC
222 & ocean(ng) % u_stokes, &
223 & ocean(ng) % v_stokes, &
224# endif
225 & grid(ng) % Hz, &
226 & grid(ng) % om_v, &
227 & grid(ng) % on_u, &
228 & grid(ng) % Huon, &
229 & grid(ng) % Hvom)
230# ifdef PROFILE
231 CALL wclock_off (ng, model, 12, __line__, myfile)
232# endif
233!
234 RETURN
type(t_coupling), dimension(:), allocatable coupling
type(t_grid), dimension(:), allocatable grid
Definition mod_grid.F:365
type(t_ocean), dimension(:), allocatable ocean
Definition mod_ocean.F:351
integer, dimension(:), allocatable nnew
recursive subroutine wclock_off(ng, model, region, line, routine)
Definition timers.F:148
recursive subroutine wclock_on(ng, model, region, line, routine)
Definition timers.F:3

References mod_coupling::coupling, mod_grid::grid, mod_stepping::nnew, mod_ocean::ocean, reset_massflux_tile(), wclock_off(), and wclock_on().

Referenced by ad_main3d().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_massflux_tile()

subroutine set_massflux_mod::reset_massflux_tile ( integer, intent(in) ng,
integer, intent(in) tile,
integer, intent(in) model,
integer, intent(in) lbi,
integer, intent(in) ubi,
integer, intent(in) lbj,
integer, intent(in) ubj,
integer, intent(in) imins,
integer, intent(in) imaxs,
integer, intent(in) jmins,
integer, intent(in) jmaxs,
integer, intent(in) nnew,
real(r8), dimension(lbi:,lbj:), intent(in) du_avg2,
real(r8), dimension(lbi:,lbj:), intent(in) dv_avg2,
real(r8), dimension(lbi:,lbj:,:,:), intent(in) u,
real(r8), dimension(lbi:,lbj:,:,:), intent(in) v,
real(r8), dimension(lbi:,lbj:,:), intent(in) hz,
real(r8), dimension(lbi:,lbj:), intent(in) om_v,
real(r8), dimension(lbi:,lbj:), intent(in) on_u,
real(r8), dimension(lbi:,lbj:,:), intent(inout) huon,
real(r8), dimension(lbi:,lbj:,:), intent(inout) hvom )
private

Definition at line 238 of file set_massflux.F.

249!***********************************************************************
250!
251 USE mod_param
252 USE mod_scalars
253!
255# ifdef DISTRIBUTE
257# endif
258!
259! Imported variable declarations.
260!
261 integer, intent(in) :: ng, tile, model
262 integer, intent(in) :: LBi, UBi, LBj, UBj
263 integer, intent(in) :: IminS, ImaxS, JminS, JmaxS
264
265 integer, intent(in) :: nnew
266!
267# ifdef ASSUMED_SHAPE
268 real(r8), intent(in) :: DU_avg2(LBi:,LBj:)
269 real(r8), intent(in) :: DV_avg2(LBi:,LBj:)
270 real(r8), intent(in) :: u(LBi:,LBj:,:,:)
271 real(r8), intent(in) :: v(LBi:,LBj:,:,:)
272# ifdef WEC
273 real(r8), intent(in) :: u_stokes(LBi:,LBj:,:)
274 real(r8), intent(in) :: v_stokes(LBi:,LBj:,:)
275# endif
276 real(r8), intent(in) :: Hz(LBi:,LBj:,:)
277 real(r8), intent(in) :: om_v(LBi:,LBj:)
278 real(r8), intent(in) :: on_u(LBi:,LBj:)
279
280 real(r8), intent(inout) :: Huon(LBi:,LBj:,:)
281 real(r8), intent(inout) :: Hvom(LBi:,LBj:,:)
282# else
283 real(r8), intent(in) :: DU_avg2(LBi:UBi,LBj:UBj)
284 real(r8), intent(in) :: DV_avg2(LBi:UBi,LBj:UBj)
285 real(r8), intent(in) :: u(LBi:UBi,LBj:UBj,N(ng),2)
286 real(r8), intent(in) :: v(LBi:UBi,LBj:UBj,N(ng),2)
287# ifdef WEC
288 real(r8), intent(in) :: u_stokes(LBi:UBi,LBj:UBj,N(Ng))
289 real(r8), intent(in) :: v_stokes(LBi:UBi,LBj:UBj,N(ng))
290# endif
291 real(r8), intent(in) :: Hz(LBi:UBi,LBj:UBj,N(ng))
292 real(r8), intent(in) :: om_v(LBi:UBi,LBj:UBj)
293 real(r8), intent(in) :: on_u(LBi:UBi,LBj:UBj)
294
295 real(r8), intent(inout) :: Huon(LBi:UBi,LBj:UBj,N(ng))
296 real(r8), intent(inout) :: Hvom(LBi:UBi,LBj:UBj,N(ng))
297# endif
298!
299! Local variable declarations.
300!
301 integer :: i, j, k
302
303 real(r8), dimension(IminS:ImaxS,0:N(ng)) :: DC
304 real(r8), dimension(IminS:ImaxS,0:N(ng)) :: FC
305
306# include "set_bounds.h"
307!
308!-----------------------------------------------------------------------
309! Compute intermediate values of mass fluxes Huon and Hvom used by the
310! adjoint model. The original values can be reinstated by calling
311! "set_massflux" after "ad_omega".
312!-----------------------------------------------------------------------
313!
314! Compute mass flux, Hz*u/n.
315!
316 DO j=jstrt,jendt
317 DO i=istrp,iendt
318 dc(i,0)=0.0_r8
319 fc(i,0)=0.0_r8
320 END DO
321 DO k=1,n(ng)
322 DO i=istrp,iendt
323 dc(i,k)=0.5_r8*(hz(i,j,k)+hz(i-1,j,k))*on_u(i,j)
324 dc(i,0)=dc(i,0)+dc(i,k)
325 END DO
326 END DO
327 DO k=n(ng),1,-1
328 DO i=istrp,iendt
329 huon(i,j,k)=0.5_r8*(huon(i,j,k)+u(i,j,k,nnew)*dc(i,k))
330# ifdef WEC
331 huon(i,j,k)=huon(i,j,k)+0.5_r8*u_stokes(i,j,k)*dc(i,k)
332# endif
333 fc(i,0)=fc(i,0)+huon(i,j,k)
334 END DO
335 END DO
336!
337! Replace with correct vertical mean, DU_avg2.
338!
339 DO i=istrp,iendt
340 dc(i,0)=1.0_r8/dc(i,0)
341 fc(i,0)=dc(i,0)*(fc(i,0)-du_avg2(i,j))
342 END DO
343 DO k=1,n(ng)
344 DO i=istrp,iendt
345 huon(i,j,k)=huon(i,j,k)-dc(i,k)*fc(i,0)
346 END DO
347 END DO
348!
349! Compute mass flux, Hz*v/m.
350!
351 IF (j.ge.jstrp) THEN
352 DO i=istrt,iendt
353 dc(i,0)=0.0_r8
354 fc(i,0)=0.0_r8
355 END DO
356 DO k=1,n(ng)
357 DO i=istrt,iendt
358 dc(i,k)=0.5_r8*(hz(i,j,k)+hz(i,j-1,k))*om_v(i,j)
359 dc(i,0)=dc(i,0)+dc(i,k)
360 END DO
361 END DO
362 DO k=n(ng),1,-1
363 DO i=istrt,iendt
364 hvom(i,j,k)=0.5_r8*(hvom(i,j,k)+v(i,j,k,nnew)*dc(i,k))
365# ifdef WEC
366 hvom(i,j,k)=hvom(i,j,k)+0.5_r8*v_stokes(i,j,k)*dc(i,k)
367# endif
368 fc(i,0)=fc(i,0)+hvom(i,j,k)
369 END DO
370 END DO
371!
372! Replace with correct vertical mean, DV_avg2.
373!
374 DO i=istrt,iendt
375 dc(i,0)=1.0_r8/dc(i,0)
376 fc(i,0)=dc(i,0)*(fc(i,0)-dv_avg2(i,j))
377 END DO
378 DO k=1,n(ng)
379 DO i=istrt,iendt
380 hvom(i,j,k)=hvom(i,j,k)-dc(i,k)*fc(i,0)
381 END DO
382 END DO
383 ENDIF
384 END DO
385!
386! Exchange boundary information.
387!
388 IF (ewperiodic(ng).or.nsperiodic(ng)) THEN
389 CALL exchange_u3d_tile (ng, tile, &
390 & lbi, ubi, lbj, ubj, 1, n(ng), &
391 & huon)
392 CALL exchange_v3d_tile (ng, tile, &
393 & lbi, ubi, lbj, ubj, 1, n(ng), &
394 & hvom)
395 END IF
396
397# ifdef DISTRIBUTE
398 CALL mp_exchange3d (ng, tile, model, 2, &
399 & lbi, ubi, lbj, ubj, 1, n(ng), &
400 & nghostpoints, &
401 & ewperiodic(ng), nsperiodic(ng), &
402 & huon, hvom)
403# endif
404!
405 RETURN
subroutine exchange_u3d_tile(ng, tile, lbi, ubi, lbj, ubj, lbk, ubk, a)
subroutine exchange_v3d_tile(ng, tile, lbi, ubi, lbj, ubj, lbk, ubk, a)
integer, dimension(:), allocatable n
Definition mod_param.F:479
integer nghostpoints
Definition mod_param.F:710
logical, dimension(:), allocatable ewperiodic
logical, dimension(:), allocatable nsperiodic
subroutine mp_exchange3d(ng, tile, model, nvar, lbi, ubi, lbj, ubj, lbk, ubk, nghost, ew_periodic, ns_periodic, a, b, c, d)

References mod_scalars::ewperiodic, exchange_3d_mod::exchange_u3d_tile(), exchange_3d_mod::exchange_v3d_tile(), mp_exchange_mod::mp_exchange3d(), mod_param::nghostpoints, and mod_scalars::nsperiodic.

Referenced by reset_massflux().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_massflux()

subroutine, public set_massflux_mod::set_massflux ( integer, intent(in) ng,
integer, intent(in) tile,
integer, intent(in) model )

Definition at line 28 of file set_massflux.F.

29!***********************************************************************
30!
31 USE mod_param
32 USE mod_grid
33 USE mod_ocean
34 USE mod_stepping
35!
36! Imported variable declarations.
37!
38 integer, intent(in) :: ng, tile, model
39!
40! Local variable declarations.
41!
42 character (len=*), parameter :: MyFile = &
43 & __FILE__
44!
45# include "tile.h"
46!
47# ifdef PROFILE
48 CALL wclock_on (ng, model, 12, __line__, myfile)
49# endif
50 CALL set_massflux_tile (ng, tile, model, &
51 & lbi, ubi, lbj, ubj, &
52 & imins, imaxs, jmins, jmaxs, &
53 & nrhs(ng), &
54 & ocean(ng) % u, &
55 & ocean(ng) % v, &
56# ifdef WEC
57 & ocean(ng) % u_stokes, &
58 & ocean(ng) % v_stokes, &
59# endif
60 & grid(ng) % Hz, &
61 & grid(ng) % om_v, &
62 & grid(ng) % on_u, &
63 & grid(ng) % Huon, &
64 & grid(ng) % Hvom)
65# ifdef PROFILE
66 CALL wclock_off (ng, model, 12, __line__, myfile)
67# endif
68!
69 RETURN
integer, dimension(:), allocatable nrhs

References mod_grid::grid, mod_stepping::nrhs, mod_ocean::ocean, set_massflux_tile(), wclock_off(), and wclock_on().

Referenced by ad_initial(), ad_main3d(), initial(), main3d(), roms_kernel_mod::nlm_initial(), rp_initial(), rp_main3d(), and tl_main3d().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_massflux_tile()

subroutine set_massflux_mod::set_massflux_tile ( integer, intent(in) ng,
integer, intent(in) tile,
integer, intent(in) model,
integer, intent(in) lbi,
integer, intent(in) ubi,
integer, intent(in) lbj,
integer, intent(in) ubj,
integer, intent(in) imins,
integer, intent(in) imaxs,
integer, intent(in) jmins,
integer, intent(in) jmaxs,
integer, intent(in) nrhs,
real(r8), dimension(lbi:,lbj:,:,:), intent(in) u,
real(r8), dimension(lbi:,lbj:,:,:), intent(in) v,
real(r8), dimension(lbi:,lbj:,:), intent(in) hz,
real(r8), dimension(lbi:,lbj:), intent(in) om_v,
real(r8), dimension(lbi:,lbj:), intent(in) on_u,
real(r8), dimension(lbi:,lbj:,:), intent(out) huon,
real(r8), dimension(lbi:,lbj:,:), intent(out) hvom )
private

Definition at line 73 of file set_massflux.F.

83!***********************************************************************
84!
85 USE mod_param
86 USE mod_scalars
87!
89# ifdef DISTRIBUTE
91# endif
92!
93! Imported variable declarations.
94!
95 integer, intent(in) :: ng, tile, model
96 integer, intent(in) :: LBi, UBi, LBj, UBj
97 integer, intent(in) :: IminS, ImaxS, JminS, JmaxS
98 integer, intent(in) :: nrhs
99!
100# ifdef ASSUMED_SHAPE
101 real(r8), intent(in) :: u(LBi:,LBj:,:,:)
102 real(r8), intent(in) :: v(LBi:,LBj:,:,:)
103# ifdef WEC
104 real(r8), intent(in) :: u_stokes(LBi:,LBj:,:)
105 real(r8), intent(in) :: v_stokes(LBi:,LBj:,:)
106# endif
107 real(r8), intent(in) :: Hz(LBi:,LBj:,:)
108 real(r8), intent(in) :: om_v(LBi:,LBj:)
109 real(r8), intent(in) :: on_u(LBi:,LBj:)
110
111 real(r8), intent(out) :: Huon(LBi:,LBj:,:)
112 real(r8), intent(out) :: Hvom(LBi:,LBj:,:)
113# else
114 real(r8), intent(in) :: u(LBi:UBi,LBj:UBj,N(ng),2)
115 real(r8), intent(in) :: v(LBi:UBi,LBj:UBj,N(ng),2)
116# ifdef WEC
117 real(r8), intent(in) :: u_stokes(LBi:UBi,LBj:UBj,N(ng))
118 real(r8), intent(in) :: v_stokes(LBi:UBi,LBj:UBj,N(ng))
119# endif
120 real(r8), intent(in) :: Hz(LBi:UBi,LBj:UBj,N(ng))
121 real(r8), intent(in) :: om_v(LBi:UBi,LBj:UBj)
122 real(r8), intent(in) :: on_u(LBi:UBi,LBj:UBj)
123
124 real(r8), intent(out) :: Huon(LBi:UBi,LBj:UBj,N(ng))
125 real(r8), intent(out) :: Hvom(LBi:UBi,LBj:UBj,N(ng))
126# endif
127!
128! Local variable declarations.
129!
130 integer :: i, j, k
131
132# include "set_bounds.h"
133!
134!-----------------------------------------------------------------------
135! Compute horizontal mass fluxes, Hz*u/n and Hz*v/m.
136!-----------------------------------------------------------------------
137!
138! Compute horizontal mass fluxes.
139!
140 DO k=1,n(ng)
141 DO j=jstrt,jendt
142 DO i=istrp,iendt
143 huon(i,j,k)=0.5_r8*(hz(i,j,k)+hz(i-1,j,k))*u(i,j,k,nrhs)* &
144 & on_u(i,j)
145# ifdef WEC
146 huon(i,j,k)=huon(i,j,k)+ &
147 & 0.5_r8*(hz(i,j,k)+hz(i-1,j,k))* &
148 & u_stokes(i,j,k)*on_u(i,j)
149# endif
150 END DO
151 END DO
152 DO j=jstrp,jendt
153 DO i=istrt,iendt
154 hvom(i,j,k)=0.5_r8*(hz(i,j,k)+hz(i,j-1,k))*v(i,j,k,nrhs)* &
155 & om_v(i,j)
156# ifdef WEC
157 hvom(i,j,k)=hvom(i,j,k)+ &
158 & 0.5_r8*(hz(i,j,k)+hz(i,j-1,k))* &
159 & v_stokes(i,j,k)*om_v(i,j)
160# endif
161 END DO
162 END DO
163 END DO
164!
165! Exchange boundary information.
166!
167 IF (ewperiodic(ng).or.nsperiodic(ng)) THEN
168 CALL exchange_u3d_tile (ng, tile, &
169 & lbi, ubi, lbj, ubj, 1, n(ng), &
170 & huon)
171 CALL exchange_v3d_tile (ng, tile, &
172 & lbi, ubi, lbj, ubj, 1, n(ng), &
173 & hvom)
174 END IF
175
176# ifdef DISTRIBUTE
177 CALL mp_exchange3d (ng, tile, model, 2, &
178 & lbi, ubi, lbj, ubj, 1, n(ng), &
179 & nghostpoints, &
180 & ewperiodic(ng), nsperiodic(ng), &
181 & huon, hvom)
182# endif
183
184 RETURN

References mod_scalars::ewperiodic, exchange_3d_mod::exchange_u3d_tile(), exchange_3d_mod::exchange_v3d_tile(), mp_exchange_mod::mp_exchange3d(), mod_param::nghostpoints, and mod_scalars::nsperiodic.

Referenced by set_massflux().

Here is the call graph for this function:
Here is the caller graph for this function: