ROMS
Loading...
Searching...
No Matches
set_data.F File Reference
#include "cppdefs.h"
#include "tile.h"
#include "set_bounds.h"
Include dependency graph for set_data.F:

Go to the source code of this file.

Functions/Subroutines

subroutine set_data (ng, tile)
 
subroutine set_data_tile (ng, tile, lbi, ubi, lbj, ubj, imins, imaxs, jmins, jmaxs)
 

Function/Subroutine Documentation

◆ set_data()

subroutine set_data ( integer, intent(in) ng,
integer, intent(in) tile )

Definition at line 3 of file set_data.F.

4!
5!git $Id$
6!================================================== Hernan G. Arango ===
7! Copyright (c) 2002-2025 The ROMS Group !
8! Licensed under a MIT/X style license !
9! See License_ROMS.md !
10!=======================================================================
11! !
12! This subroutine processes forcing, boundary, climatology, and !
13! other input data. It time-interpolates between snapshots. !
14! !
15!=======================================================================
16!
17 USE mod_param
18!
19! Imported variable declarations.
20!
21 integer, intent(in) :: ng, tile
22!
23! Local variable declarations.
24!
25 character (len=*), parameter :: MyFile = &
26 & __FILE__
27!
28# include "tile.h"
29!
30# ifdef PROFILE
31 CALL wclock_on (ng, inlm, 4, __line__, myfile)
32# endif
33 CALL set_data_tile (ng, tile, &
34 & lbi, ubi, lbj, ubj, &
35 & imins, imaxs, jmins, jmaxs)
36# ifdef PROFILE
37 CALL wclock_off (ng, inlm, 4, __line__, myfile)
38# endif
39!
40 RETURN
integer, parameter inlm
Definition mod_param.F:662
subroutine set_data_tile(ng, tile, lbi, ubi, lbj, ubj, imins, imaxs, jmins, jmaxs)
Definition set_data.F:47
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_param::inlm, set_data_tile(), wclock_off(), and wclock_on().

Referenced by main3d(), and roms_kernel_mod::nlm_initial().

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

◆ set_data_tile()

subroutine set_data_tile ( integer, intent(in) ng,
integer, intent(in) tile,
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 )

Definition at line 44 of file set_data.F.

47!***********************************************************************
48!
49 USE mod_param
50# if defined HYPOXIA_SRM || defined RED_TIDE
51 USE mod_biology
52# endif
53 USE mod_boundary
54 USE mod_clima
55 USE mod_forces
56 USE mod_grid
57 USE mod_mixing
58 USE mod_ncparam
59 USE mod_ocean
60 USE mod_stepping
61 USE mod_scalars
62 USE mod_sources
63!
64# ifdef ANALYTICAL
66# endif
69# ifdef SOLVE3D
71# endif
72# ifdef DISTRIBUTE
73# ifdef WET_DRY
74 USE distribute_mod, ONLY : mp_boundary
75# endif
77# ifdef SOLVE3D
79# endif
80# endif
81 USE strings_mod, ONLY : founderror
82!
83 implicit none
84!
85! Imported variable declarations.
86!
87 integer, intent(in) :: ng, tile
88 integer, intent(in) :: LBi, UBi, LBj, UBj
89 integer, intent(in) :: IminS, ImaxS, JminS, JmaxS
90!
91! Local variable declarations.
92!
93 logical :: Lprocess, SetBC
94 logical :: update = .false.
95# ifdef WET_DRY
96 logical :: bry_update
97# endif
98!
99 integer :: ILB, IUB, JLB, JUB
100 integer :: i, ic, itrc, j, k, my_tile
101!
102 real(r8) :: cff, cff1, cff2
103!
104 character (len=*), parameter :: MyFile = &
105 & __FILE__//", set_data_tile"
106!
107# include "set_bounds.h"
108!
109! Lower and upper bounds for nontiled (global values) boundary arrays.
110!
111 my_tile=-1 ! for global values
112 ilb=bounds(ng)%LBi(my_tile)
113 iub=bounds(ng)%UBi(my_tile)
114 jlb=bounds(ng)%LBj(my_tile)
115 jub=bounds(ng)%UBj(my_tile)
116!
117!=======================================================================
118! Set point Sources/Sinks (river runoff).
119!=======================================================================
120!
121! Point Source/Sink vertically integrated mass transport.
122!
123# ifdef ANA_PSOURCE
124 IF (luvsrc(ng).or.lwsrc(ng).or.any(ltracersrc(:,ng))) THEN
125 CALL ana_psource (ng, tile, inlm)
126 END IF
127# else
128 IF (domain(ng)%SouthWest_Test(tile)) THEN
129 IF (luvsrc(ng).or.lwsrc(ng)) THEN
130 CALL set_ngfld (ng, inlm, idrtra, 1, nsrc(ng), 1, &
131 & 1, nsrc(ng), 1, &
132 & sources(ng) % QbarG, &
133 & sources(ng) % Qbar, &
134 & update)
135 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
136
137# ifdef SOLVE3D
138 DO k=1,n(ng)
139 DO i=1,nsrc(ng)
140 sources(ng)%Qsrc(i,k)=sources(ng)%Qbar(i)* &
141 & sources(ng)%Qshape(i,k)
142 END DO
143 END DO
144# endif
145 END IF
146
147# ifdef SOLVE3D
148!
149! Tracer Sources/Sinks.
150!
151 DO itrc=1,nt(ng)
152 IF (ltracersrc(itrc,ng)) THEN
153 CALL set_ngfld (ng, inlm, idrtrc(itrc), 1, nsrc(ng), n(ng), &
154 & 1, nsrc(ng), n(ng), &
155 & sources(ng) % TsrcG(:,:,:,itrc), &
156 & sources(ng) % Tsrc(:,:,itrc), &
157 & update)
158 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
159 END IF
160 END DO
161# endif
162 END IF
163# endif
164!
165!=======================================================================
166! Set forcing data.
167!=======================================================================
168!
169! Set switch to process surface atmospheric fields.
170!
171# if defined FOUR_DVAR && \
172 defined bulk_fluxes && defined prior_bulk_fluxes
173! In 4D-Var data assimilation applications, the user have the option
174! to fix the prior (background phase) surface fluxes in the successive
175! outer loops (Nouter>1) or the final analysis phase. In such case, the
176! fluxes are read from the background trajectory.
177!
178 IF (nrun.eq.1) THEN
179 lprocess=.true.
180 ELSE
181 lprocess=.false.
182 END IF
183# else
184 lprocess=.true.
185# endif
186
187# ifdef SOLVE3D
188
189# ifdef CLOUDS
190!
191! Set cloud fraction (nondimensional). Notice that clouds are
192! processed first in case that they are used to adjust shortwave
193! radiation.
194!
195 IF (lprocess) THEN
196# ifdef ANA_CLOUD
197 CALL ana_cloud (ng, tile, inlm)
198# elif (defined FRC_COUPLING && defined TIME_INTERP) || \
199 !defined FRC_COUPLING
200 CALL set_2dfld_tile (ng, tile, inlm, idcfra, &
201 & lbi, ubi, lbj, ubj, &
202 & forces(ng)%cloudG, &
203 & forces(ng)%cloud, &
204 & update)
205 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
206# endif
207 END IF
208# endif
209
210# if defined BULK_FLUXES || defined ECOSIM || \
211 (defined shortwave && defined ana_srflux && defined albedo)
212!
213! Set surface air temperature (degC).
214!
215 IF (lprocess) THEN
216# ifdef ANA_TAIR
217 CALL ana_tair (ng, tile, inlm)
218# elif (defined FRC_COUPLING && defined TIME_INTERP) || \
219 !defined FRC_COUPLING
220 CALL set_2dfld_tile (ng, tile, inlm, idtair, &
221 & lbi, ubi, lbj, ubj, &
222 & forces(ng)%TairG, &
223 & forces(ng)%Tair, &
224 & update)
225 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
226# endif
227 END IF
228# endif
229
230# if defined BULK_FLUXES || defined ECOSIM || \
231 (defined shortwave && defined ana_srflux && defined albedo)
232!
233! Set surface air relative or specific humidity.
234!
235 IF (lprocess) THEN
236# ifdef ANA_HUMIDITY
237 CALL ana_humid (ng, tile, inlm)
238# elif (defined FRC_COUPLING && defined TIME_INTERP) || \
239 !defined FRC_COUPLING
240 CALL set_2dfld_tile (ng, tile, inlm, idqair, &
241 & lbi, ubi, lbj, ubj, &
242 & forces(ng)%HairG, &
243 & forces(ng)%Hair, &
244 & update)
245 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
246# endif
247 END IF
248# endif
249
250# ifdef SHORTWAVE
251!
252! Set kinematic surface solar shortwave radiation flux (degC m/s).
253!
254# ifdef ANA_SRFLUX
255 CALL ana_srflux (ng, tile, inlm)
256# elif (defined FRC_COUPLING && defined TIME_INTERP) || \
257 !defined FRC_COUPLING
258 CALL set_2dfld_tile (ng, tile, inlm, idsrad, &
259 & lbi, ubi, lbj, ubj, &
260 & forces(ng)%srflxG, &
261 & forces(ng)%srflx, &
262 & update)
263 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
264# endif
265
266# ifdef DIURNAL_SRFLUX
267!
268! Modulate the averaged shortwave radiation flux by the local diurnal
269! cycle.
270!
271 IF (lprocess) THEN
272 CALL ana_srflux (ng, tile, inlm)
273 END IF
274# endif
275# endif
276
277# if defined RED_TIDE && defined DAILY_SHORTWAVE
278!
279! Set kinematic daily-averaged surface solar shortwave radiation flux
280! (degC m/s).
281!
282 CALL set_2dfld_tile (ng, tile, inlm, idasrf, &
283 & lbi, ubi, lbj, ubj, &
284 & forces(ng)%srflxG_avg, &
285 & forces(ng)%srflx_avg, &
286 & update)
287 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
288# endif
289
290# if defined BULK_FLUXES && \
291 !(defined LONGWAVE || defined LONGWAVE_OUT) && \
292 ( (defined frc_coupling && defined time_interp) || \
293 !defined FRC_COUPLING )
294!
295! Surface net longwave radiation (degC m/s).
296!
297 IF (lprocess) THEN
298 CALL set_2dfld_tile (ng, tile, inlm, idlrad, &
299 & lbi, ubi, lbj, ubj, &
300 & forces(ng)%lrflxG, &
301 & forces(ng)%lrflx, &
302 & update)
303 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
304 END IF
305# endif
306
307# if defined LONGWAVE_OUT && defined BULK_FLUXES && \
308 ( (defined frc_coupling && defined time_interp) || \
309 !defined FRC_COUPLING )
310!
311! Surface downwelling longwave radiation (degC m/s).
312!
313 IF (lprocess) THEN
314 CALL set_2dfld_tile (ng, tile, inlm, idldwn, &
315 & lbi, ubi, lbj, ubj, &
316 & forces(ng)%lrflxG, &
317 & forces(ng)%lrflx, &
318 & update)
319 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
320 END IF
321# endif
322
323# if defined BULK_FLUXES || defined ECOSIM
324!
325! Set surface winds (m/s).
326!
327 IF (lprocess) THEN
328# ifdef ANA_WINDS
329 CALL ana_winds (ng, tile, inlm)
330# elif (defined FRC_COUPLING && defined TIME_INTERP) || \
331 !defined FRC_COUPLING
332 CALL set_2dfld_tile (ng, tile, inlm, iduair, &
333 & lbi, ubi, lbj, ubj, &
334 & forces(ng)%UwindG, &
335 & forces(ng)%Uwind, &
336 & update)
337 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
338!
339 CALL set_2dfld_tile (ng, tile, inlm, idvair, &
340 & lbi, ubi, lbj, ubj, &
341 & forces(ng)%VwindG, &
342 & forces(ng)%Vwind, &
343 & update)
344 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
345
346# ifdef CURVGRID
347!
348! If input point surface winds or interpolated from coarse data, rotate
349! to curvilinear grid.
350!
351 IF (.not.linfo(1,iduair,ng).or. &
352 & (iinfo(5,iduair,ng).ne.lm(ng)+2).or. &
353 & (iinfo(6,iduair,ng).ne.mm(ng)+2)) THEN
354 DO j=jstrr,jendr
355 DO i=istrr,iendr
356 cff1=forces(ng)%Uwind(i,j)*grid(ng)%CosAngler(i,j)+ &
357 & forces(ng)%Vwind(i,j)*grid(ng)%SinAngler(i,j)
358 cff2=forces(ng)%Vwind(i,j)*grid(ng)%CosAngler(i,j)- &
359 & forces(ng)%Uwind(i,j)*grid(ng)%SinAngler(i,j)
360 forces(ng)%Uwind(i,j)=cff1
361 forces(ng)%Vwind(i,j)=cff2
362 END DO
363 END DO
364
365 IF (ewperiodic(ng).or.nsperiodic(ng)) THEN
366 CALL exchange_r2d_tile (ng, tile, &
367 & lbi, ubi, lbj, ubj, &
368 & forces(ng)%UWind)
369 CALL exchange_r2d_tile (ng, tile, &
370 & lbi, ubi, lbj, ubj, &
371 & forces(ng)%VWind)
372 END IF
373
374# ifdef DISTRIBUTE
375 CALL mp_exchange2d (ng, tile, inlm, 2, &
376 & lbi, ubi, lbj, ubj, &
377 & nghostpoints, &
378 & ewperiodic(ng), nsperiodic(ng), &
379 & forces(ng)%UWind, &
380 & forces(ng)%VWind)
381# endif
382 END IF
383# endif
384# endif
385 END IF
386# endif
387
388# ifdef BULK_FLUXES
389!
390! Set rain fall rate (kg/m2/s).
391!
392 IF (lprocess) THEN
393# ifdef ANA_RAIN
394 CALL ana_rain (ng, tile, inlm)
395# elif (defined FRC_COUPLING && defined TIME_INTERP) || \
396 !defined FRC_COUPLING
397 CALL set_2dfld_tile (ng, tile, inlm, idrain, &
398 & lbi, ubi, lbj, ubj, &
399 & forces(ng)%rainG, &
400 & forces(ng)%rain, &
401 & update)
402 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
403# endif
404 END IF
405# endif
406
407# ifndef BULK_FLUXES
408!
409! Set kinematic surface net heat flux (degC m/s).
410!
411# ifdef ANA_STFLUX
412 CALL ana_stflux (ng, tile, inlm, itemp)
413# elif (defined FRC_COUPLING && defined TIME_INTERP) || \
414 !defined FRC_COUPLING
415 CALL set_2dfld_tile (ng, tile, inlm, idtsur(itemp), &
416 & lbi, ubi, lbj, ubj, &
417 & forces(ng)%stfluxG(:,:,:,itemp), &
418 & forces(ng)%stflux (:,:,itemp), &
419 & update)
420 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
421# endif
422# endif
423
424# ifdef QCORRECTION
425!
426! Set sea surface temperature (SST) and heat flux sensitivity to
427! SST (dQdSST) which are used for surface heat flux correction.
428!
429# ifdef ANA_SST
430 CALL ana_sst (ng, tile, inlm)
431# else
432 CALL set_2dfld_tile (ng, tile, inlm, idsstc, &
433 & lbi, ubi, lbj, ubj, &
434 & forces(ng)%sstG, &
435 & forces(ng)%sst, &
436 & update)
437 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
438# endif
439!
440# ifdef ANA_DQDSST
441 CALL ana_dqdsst (ng, tile, inlm)
442# else
443 CALL set_2dfld_tile (ng, tile, inlm, iddqdt, &
444 & lbi, ubi, lbj, ubj, &
445 & forces(ng)%dqdtG, &
446 & forces(ng)%dqdt, &
447 & update)
448 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
449# endif
450# endif
451!
452! Set kinematic bottom net heat flux (degC m/s).
453!
454# ifdef ANA_BTFLUX
455 CALL ana_btflux (ng, tile, inlm, itemp)
456# else
457 CALL set_2dfld_tile (ng, tile, inlm, idtbot(itemp), &
458 & lbi, ubi, lbj, ubj, &
459 & forces(ng)%btfluxG(:,:,:,itemp), &
460 & forces(ng)%btflux (:,:,itemp), &
461 & update)
462 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
463# endif
464
465# ifdef SALINITY
466# ifdef ANA_SSFLUX
467!
468! Surface freshwater (E-P) flux (m/s) from analytical function.
469!
470 CALL ana_stflux (ng, tile, inlm, isalt)
471# else
472
473# if !(defined BULK_FLUXES || defined EMINUSP || \
474 defined frc_coupling)
475!
476! Surface freshwater (E-P) flux (m/s) from NetCDF variable "swflux".
477!
478 CALL set_2dfld_tile (ng, tile, inlm, idsfwf, &
479 & lbi, ubi, lbj, ubj, &
480 & forces(ng)%stfluxG(:,:,:,isalt), &
481 & forces(ng)%stflux (:,:,isalt), &
482 & update)
483 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
484
485# elif defined BULK_FLUXES && !defined EMINUSP
486!
487! Surface freshwater (E-P) flux (m/s) from NetCDF variable "EminusP".
488!
489 IF (lprocess) THEN
490 CALL set_2dfld_tile (ng, tile, inlm, idempf, &
491 & lbi, ubi, lbj, ubj, &
492 & forces(ng)%stfluxG(:,:,:,isalt), &
493 & forces(ng)%stflux (:,:,isalt), &
494 & update)
495 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
496 END IF
497# endif
498# endif
499
500# if defined SCORRECTION || defined SRELAXATION
501!
502! Set surface salinity for freshwater flux correction.
503!
504# ifdef ANA_SSS
505 CALL ana_sss (ng, tile, inlm)
506# else
507 CALL set_2dfld_tile (ng, tile, inlm, idsssc, &
508 & lbi, ubi, lbj, ubj, &
509 & forces(ng)%sssG, &
510 & forces(ng)%sss, &
511 & update)
512 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
513# endif
514# endif
515!
516! Set kinematic bottom salt flux (m/s).
517!
518# ifdef ANA_BSFLUX
519 CALL ana_btflux (ng, tile, inlm, isalt)
520# else
521 CALL set_2dfld_tile (ng, tile, inlm, idtbot(isalt), &
522 & lbi, ubi, lbj, ubj, &
523 & forces(ng)%btfluxG(:,:,:,isalt), &
524 & forces(ng)%btflux (:,:,isalt), &
525 & update)
526 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
527# endif
528# endif
529
530# if defined BIOLOGY || defined SEDIMENT || defined T_PASSIVE
531!
532! Set kinematic surface and bottom passive tracer fluxes (T m/s).
533!
534 DO itrc=nat+1,nt(ng)
535# ifdef ANA_SPFLUX
536 CALL ana_stflux (ng, tile, inlm, itrc)
537# else
538 CALL set_2dfld_tile (ng, tile, inlm, idtsur(itrc), &
539 & lbi, ubi, lbj, ubj, &
540 & forces(ng)%stfluxG(:,:,:,itrc), &
541 & forces(ng)%stflux (:,:,itrc), &
542 & update)
543 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
544# endif
545# ifdef ANA_BPFLUX
546 CALL ana_btflux (ng, tile, inlm, itrc)
547# else
548 CALL set_2dfld_tile (ng, tile, inlm, idtbot(itrc), &
549 & lbi, ubi, lbj, ubj, &
550 & forces(ng)%btfluxG(:,:,:,itrc), &
551 & forces(ng)%btflux (:,:,itrc), &
552 & update)
553 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
554# endif
555 END DO
556# endif
557# endif
558
559# ifndef BULK_FLUXES
560!
561! Set kinematic surface momentum flux (m2/s2).
562!
563# ifdef ANA_SMFLUX
564 CALL ana_smflux (ng, tile, inlm)
565# elif (defined FRC_COUPLING && defined TIME_INTERP) || \
566 !defined FRC_COUPLING
567 CALL set_2dfld_tile (ng, tile, inlm, idusms, &
568 & lbi, ubi, lbj, ubj, &
569 & forces(ng)%sustrG, &
570 & forces(ng)%sustr, &
571 & update)
572 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
573!
574 CALL set_2dfld_tile (ng, tile, inlm, idvsms, &
575 & lbi, ubi, lbj, ubj, &
576 & forces(ng)%svstrG, &
577 & forces(ng)%svstr, &
578 & update)
579 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
580
581# ifdef CURVGRID
582!
583! If input point wind stress, rotate to curvilinear grid. Notice
584! that rotation is done at RHO-points. It does not matter.
585!
586 IF (.not.linfo(1,idusms,ng).or. &
587 & (iinfo(5,idusms,ng).ne.lm(ng)+1).or. &
588 & (iinfo(6,idusms,ng).ne.mm(ng)+2)) THEN
589 DO j=jstrr,jendr
590 DO i=istrr,iendr
591 cff1=forces(ng)%sustr(i,j)*grid(ng)%CosAngler(i,j)+ &
592 & forces(ng)%svstr(i,j)*grid(ng)%SinAngler(i,j)
593 cff2=forces(ng)%svstr(i,j)*grid(ng)%CosAngler(i,j)- &
594 & forces(ng)%sustr(i,j)*grid(ng)%SinAngler(i,j)
595 forces(ng)%sustr(i,j)=cff1
596 forces(ng)%svstr(i,j)=cff2
597 END DO
598 END DO
599
600 IF (ewperiodic(ng).or.nsperiodic(ng)) THEN
601 CALL exchange_u2d_tile (ng, tile, &
602 & lbi, ubi, lbj, ubj, &
603 & forces(ng)%sustr)
604 CALL exchange_v2d_tile (ng, tile, &
605 & lbi, ubi, lbj, ubj, &
606 & forces(ng)%svstr)
607 END IF
608
609# ifdef DISTRIBUTE
610 CALL mp_exchange2d (ng, tile, inlm, 2, &
611 & lbi, ubi, lbj, ubj, &
612 & nghostpoints, &
613 & ewperiodic(ng), nsperiodic(ng), &
614 & forces(ng)%sustr, &
615 & forces(ng)%svstr)
616# endif
617 END IF
618# endif
619# endif
620# endif
621
622# if defined BULK_FLUXES || defined ECOSIM || defined ATM_PRESS
623!
624! Set surface air pressure (mb).
625!
626 IF (lprocess) THEN
627# ifdef ANA_PAIR
628 CALL ana_pair (ng, tile, inlm)
629# elif (defined FRC_COUPLING && defined TIME_INTERP) || \
630 !defined FRC_COUPLING
631 setbc=.true.
632! SetBC=.FALSE.
633 CALL set_2dfld_tile (ng, tile, inlm, idpair, &
634 & lbi, ubi, lbj, ubj, &
635 & forces(ng)%PairG, &
636 & forces(ng)%Pair, &
637 & update, setbc)
638 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
639# endif
640 END IF
641# endif
642
643# ifdef WAVE_DATA
644!
645! Set surface wind-induced wave amplitude, direction and period.
646!
647# ifdef ANA_WWAVE
648 CALL ana_wwave (ng, tile, inlm)
649# else
650# ifdef WAVES_DIR
651 CALL set_2dfld_tile (ng, tile, inlm, idwdir, &
652 & lbi, ubi, lbj, ubj, &
653 & forces(ng)%DwaveG, &
654 & forces(ng)%Dwave, &
655 & update)
656 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
657!
658# endif
659
660# ifdef WAVES_DIRP
661 CALL set_2dfld_tile (ng, tile, inlm, idwdip, &
662 & lbi, ubi, lbj, ubj, &
663 & forces(ng)%DwavepG, &
664 & forces(ng)%Dwavep, &
665 & update)
666 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
667!
668# endif
669
670# ifdef WAVES_HEIGHT
671 CALL set_2dfld_tile (ng, tile, inlm, idwamp, &
672 & lbi, ubi, lbj, ubj, &
673 & forces(ng)%HwaveG, &
674 & forces(ng)%Hwave, &
675 & update)
676 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
677!
678# endif
679
680# ifdef WAVES_LENGTH
681 CALL set_2dfld_tile (ng, tile, inlm, idwlen, &
682 & lbi, ubi, lbj, ubj, &
683 & forces(ng)%LwaveG, &
684 & forces(ng)%Lwave, &
685 & update)
686 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
687!
688# endif
689
690# ifdef WAVES_LENGTHP
691 CALL set_2dfld_tile (ng, tile, inlm, idwlep, &
692 & lbi, ubi, lbj, ubj, &
693 & forces(ng)%LwavepG, &
694 & forces(ng)%Lwavep, &
695 & update)
696 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
697!
698# endif
699
700# ifdef WAVES_TOP_PERIOD
701 CALL set_2dfld_tile (ng, tile, inlm, idwptp, &
702 & lbi, ubi, lbj, ubj, &
703 & forces(ng)%Pwave_topG, &
704 & forces(ng)%Pwave_top, &
705 & update)
706 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
707!
708# endif
709
710# ifdef WAVES_BOT_PERIOD
711 CALL set_2dfld_tile (ng, tile, inlm, idwpbt, &
712 & lbi, ubi, lbj, ubj, &
713 & forces(ng)%Pwave_botG, &
714 & forces(ng)%Pwave_bot, &
715 & update)
716 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
717!
718# endif
719
720# if defined WAVES_UB
721 CALL set_2dfld_tile (ng, tile, inlm, idworb, &
722 & lbi, ubi, lbj, ubj, &
723 & forces(ng)%Uwave_rmsG, &
724 & forces(ng)%Uwave_rms, &
725 & update)
726 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
727!
728# endif
729
730# if defined WAVES_DISS
731 CALL set_2dfld_tile (ng, tile, inlm, idwdib, &
732 & lbi, ubi, lbj, ubj, &
733 & forces(ng)%Dissip_breakG, &
734 & forces(ng)%Dissip_break, &
735 & update)
736 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
737!
738 CALL set_2dfld_tile (ng, tile, inlm, idwdiw, &
739 & lbi, ubi, lbj, ubj, &
740 & forces(ng)%Dissip_wcapG, &
741 & forces(ng)%Dissip_wcap, &
742 & update)
743 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
744!
745# endif
746
747# if defined ROLLER_SVENDSEN
748 CALL set_2dfld_tile (ng, tile, inlm, idwbrk, &
749 & lbi, ubi, lbj, ubj, &
750 & forces(ng)%Wave_breakG, &
751 & forces(ng)%Wave_break, &
752 & update)
753 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
754!
755# endif
756# endif
757# endif
758
759# if defined ECOSIM && defined SOLVE3D
760!
761! Compute spectral irradiance and cosine of average zenith angle of
762! downwelling spectral photons.
763!
764 CALL ana_specir (ng, tile, inlm)
765# endif
766
767# ifdef ANA_SPINNING
768!
769! Set time-varying rotation force (centripetal accelerations) for
770! polar coordinate grids.
771!
772 CALL ana_spinning (ng, tile, inlm)
773# endif
774
775# ifdef HYPOXIA_SRM
776!
777! Total respiration rate for hypoxia.
778!
779# ifdef ANA_RESPIRATION
780 CALL ana_respiration (ng, tile, inlm)
781# else
782 CALL set_3dfld_tile (ng, tile, inlm, idresr, &
783 & lbi, ubi, lbj, ubj, 1, n(ng), &
784 & ocean(ng)%respirationG, &
785 & ocean(ng)%respiration, &
786 & update)
787 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
788# endif
789# endif
790
791# ifdef RED_TIDE
792!
793! Red tide Observed Dissolved Inorganic Nutrient.
794!
795 CALL set_3dfld_tile (ng, tile, inlm, idodin, &
796 & lbi, ubi, lbj, ubj, 1, n(ng), &
797 & ocean(ng)%DIN_obsG, &
798 & ocean(ng)%DIN_obs, &
799 & update)
800 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
801# endif
802
803#if defined FOUR_DVAR && \
804 defined bulk_fluxes && defined prior_bulk_fluxes
805!
806!=======================================================================
807! In 4D-Var data assimilation algorithms, the user has the option to
808! impose the prior (background phase) surface fluxes in the successive
809! outer loops (Nouter>1) or the final analysis phase. Such fluxes were
810! computed by routine "bulk_fluxes" and stored in the NLM background
811! trajectory, BLK structure. Notice that "bulk_fluxes" is called in
812! "main3d" only during the prior trajectory computation.
813!
814! Therefore, the fluxes are time interpolated from the pior snapshots.
815!=======================================================================
816!
817 IF (.not.lprocess) THEN
818!
819! Set prior surface wind stress components.
820!
821 CALL set_2dfld_tile (ng, tile, inlm, idusms, &
822 & lbi, ubi, lbj, ubj, &
823 & forces(ng)%sustrG, &
824 & forces(ng)%sustr, &
825 & update)
826 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
827!
828 CALL set_2dfld_tile (ng, tile, inlm, idvsms, &
829 & lbi, ubi, lbj, ubj, &
830 & forces(ng)%svstrG, &
831 & forces(ng)%svstr, &
832 & update)
833 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
834
835# ifdef ATM_PRESS
836!
837! Set prior surface air pressure.
838!
839 setbc=.true.
840!! SetBC=.FALSE.
841 CALL set_2dfld_tile (ng, tile, inlm, idpair, &
842 & lbi, ubi, lbj, ubj, &
843 & forces(ng)%PairG, &
844 & forces(ng)%Pair, &
845 & update, setbc)
846 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
847# endif
848
849# ifdef SOLVE3D
850# ifndef ANA_STFLUX
851!
852! Set prior surface net heat flux.
853!
854 CALL set_2dfld_tile (ng, tile, inlm, idtsur(itemp), &
855 & lbi, ubi, lbj, ubj, &
856 & forces(ng)%stfluxG(:,:,:,itemp), &
857 & forces(ng)%stflux (:,:,itemp), &
858 & update)
859 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
860# endif
861
862# if defined SALINITY && !defined ANA_SSFLUX
863!
864! Set prior surface freshwater flux.
865!
866 CALL set_2dfld_tile (ng, tile, inlm, idempf, &
867 & lbi, ubi, lbj, ubj, &
868 & forces(ng)%stfluxG(:,:,:,isalt), &
869 & forces(ng)%stflux (:,:,isalt), &
870 & update)
871 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
872# endif
873# endif
874 END IF
875#endif
876!
877!=======================================================================
878! Set open boundary conditions fields.
879!=======================================================================
880!
881! Set free-surface open boundary conditions.
882!
883 IF (lprocessobc(ng)) THEN
884# ifdef ANA_FSOBC
885 CALL ana_fsobc (ng, tile, inlm)
886# else
887 IF (domain(ng)%SouthWest_Test(tile)) THEN
888 IF (lbc(iwest,isfsur,ng)%acquire) THEN
889 CALL set_ngfld (ng, inlm, idzbry(iwest), jlb, jub, 1, &
890 & 0, mm(ng)+1, 1, &
891 & boundary(ng) % zetaG_west, &
892 & boundary(ng) % zeta_west, &
893 & update)
894 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
895 END IF
896!
897 IF (lbc(ieast,isfsur,ng)%acquire) THEN
898 CALL set_ngfld (ng, inlm, idzbry(ieast), jlb, jub, 1, &
899 & 0, mm(ng)+1, 1, &
900 & boundary(ng) % zetaG_east, &
901 & boundary(ng) % zeta_east, &
902 & update)
903 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
904 END IF
905!
906 IF (lbc(isouth,isfsur,ng)%acquire) THEN
907 CALL set_ngfld (ng, inlm, idzbry(isouth), ilb, iub, 1, &
908 & 0, lm(ng)+1 ,1, &
909 & boundary(ng) % zetaG_south, &
910 & boundary(ng) % zeta_south, &
911 & update)
912 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
913 END IF
914!
915 IF (lbc(inorth,isfsur,ng)%acquire) THEN
916 CALL set_ngfld (ng, inlm, idzbry(inorth), ilb, iub, 1, &
917 & 0, lm(ng)+1, 1, &
918 & boundary(ng) % zetaG_north, &
919 & boundary(ng) % zeta_north, &
920 & update)
921 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
922 END IF
923 END IF
924# endif
925
926# if defined WET_DRY
927!
928! Ensure that water level on boundary cells is above bed elevation.
929!
930 IF (lbc(iwest,isfsur,ng)%acquire) THEN
931 bry_update=.false.
932 IF (domain(ng)%Western_Edge(tile)) THEN
933 DO j=jstrr,jendr
934 cff=dcrit(ng)-grid(ng)%h(0,j)
935 IF (boundary(ng)%zeta_west(j).le.cff) THEN
936 boundary(ng)%zeta_west(j)=cff
937 END IF
938 END DO
939 bry_update=.true.
940 END IF
941# ifdef DISTRIBUTE
942 CALL mp_boundary (ng, inlm, jstrr, jendr, jlb, jub, 1, 1, &
943 & bry_update, &
944 & boundary(ng)%zeta_west)
945# endif
946 END IF
947!
948 IF (lbc(ieast,isfsur,ng)%acquire) THEN
949 bry_update=.false.
950 IF (domain(ng)%Eastern_Edge(tile)) THEN
951 DO j=jstrr,jendr
952 cff=dcrit(ng)-grid(ng)%h(lm(ng)+1,j)
953 IF (boundary(ng)%zeta_east(j).le.cff) THEN
954 boundary(ng)%zeta_east(j)=cff
955 END IF
956 END DO
957 bry_update=.true.
958 END IF
959# ifdef DISTRIBUTE
960 CALL mp_boundary (ng, inlm, jstrr, jendr, jlb, jub, 1, 1, &
961 & bry_update, &
962 & boundary(ng)%zeta_east)
963# endif
964 END IF
965!
966 IF (lbc(isouth,isfsur,ng)%acquire) THEN
967 bry_update=.false.
968 IF (domain(ng)%Southern_Edge(tile)) THEN
969 DO i=istrr,iendr
970 cff=dcrit(ng)-grid(ng)%h(i,0)
971 IF (boundary(ng)%zeta_south(i).le.cff) THEN
972 boundary(ng)%zeta_south(i)=cff
973 END IF
974 END DO
975 bry_update=.true.
976 END IF
977# ifdef DISTRIBUTE
978 CALL mp_boundary (ng, inlm, istrr, iendr, ilb, iub, 1, 1, &
979 & bry_update, &
980 & boundary(ng)%zeta_south)
981# endif
982 END IF
983!
984 IF (lbc(inorth,isfsur,ng)%acquire) THEN
985 bry_update=.false.
986 IF (domain(ng)%Northern_Edge(tile)) THEN
987 DO i=istrr,iendr
988 cff=dcrit(ng)-grid(ng)%h(i,mm(ng)+1)
989 IF (boundary(ng)%zeta_north(i).le.cff) THEN
990 boundary(ng)%zeta_north(i)=cff
991 END IF
992 END DO
993 bry_update=.true.
994 END IF
995# ifdef DISTRIBUTE
996 CALL mp_boundary (ng, inlm, istrr, iendr, ilb, iub, 1, 1, &
997 & bry_update, &
998 & boundary(ng)%zeta_north)
999# endif
1000 END IF
1001# endif
1002 END IF
1003!
1004! Set 2D momentum component open boundary conditions.
1005!
1006 IF (lprocessobc(ng)) THEN
1007# ifdef ANA_M2OBC
1008 CALL ana_m2obc (ng, tile, inlm)
1009# else
1010 IF (domain(ng)%SouthWest_Test(tile)) THEN
1011 IF (lbc(iwest,isubar,ng)%acquire) THEN
1012 CALL set_ngfld (ng, inlm, idu2bc(iwest), jlb, jub, 1, &
1013 & 0, mm(ng)+1, 1, &
1014 & boundary(ng) % ubarG_west, &
1015 & boundary(ng) % ubar_west, &
1016 & update)
1017 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1018 END IF
1019!
1020 IF (lbc(iwest,isvbar,ng)%acquire) THEN
1021 CALL set_ngfld (ng, inlm, idv2bc(iwest), jlb, jub, 1, &
1022 & 1, mm(ng)+1, 1, &
1023 & boundary(ng) % vbarG_west, &
1024 & boundary(ng) % vbar_west, &
1025 & update)
1026 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1027 END IF
1028!
1029 IF (lbc(ieast,isubar,ng)%acquire) THEN
1030 CALL set_ngfld (ng, inlm, idu2bc(ieast), jlb, jub, 1, &
1031 & 0, mm(ng)+1, 1, &
1032 & boundary(ng) % ubarG_east, &
1033 & boundary(ng) % ubar_east, &
1034 & update)
1035 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1036 END IF
1037!
1038 IF (lbc(ieast,isvbar,ng)%acquire) THEN
1039 CALL set_ngfld (ng, inlm, idv2bc(ieast), jlb, jub, 1, &
1040 & 1, mm(ng)+1, 1, &
1041 & boundary(ng) % vbarG_east, &
1042 & boundary(ng) % vbar_east, &
1043 & update)
1044 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1045 END IF
1046!
1047 IF (lbc(isouth,isubar,ng)%acquire) THEN
1048 CALL set_ngfld (ng, inlm, idu2bc(isouth), ilb, iub, 1, &
1049 & 1, lm(ng)+1, 1, &
1050 & boundary(ng) % ubarG_south, &
1051 & boundary(ng) % ubar_south, &
1052 & update)
1053 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1054 END IF
1055!
1056 IF (lbc(isouth,isvbar,ng)%acquire) THEN
1057 CALL set_ngfld (ng, inlm, idv2bc(isouth), ilb, iub, 1, &
1058 & 0, lm(ng)+1, 1, &
1059 & boundary(ng) % vbarG_south, &
1060 & boundary(ng) % vbar_south, &
1061 & update)
1062 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1063 END IF
1064!
1065 IF (lbc(inorth,isubar,ng)%acquire) THEN
1066 CALL set_ngfld (ng, inlm, idu2bc(inorth), ilb, iub, 1, &
1067 & 1, lm(ng)+1, 1, &
1068 & boundary(ng) % ubarG_north, &
1069 & boundary(ng) % ubar_north, &
1070 & update)
1071 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1072 END IF
1073!
1074 IF (lbc(inorth,isvbar,ng)%acquire) THEN
1075 CALL set_ngfld (ng, inlm, idv2bc(inorth), ilb, iub, 1, &
1076 & 0, lm(ng)+1, 1, &
1077 & boundary(ng) % vbarG_north, &
1078 & boundary(ng) % vbar_north, &
1079 & update)
1080 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1081 END IF
1082 END IF
1083# endif
1084 END IF
1085
1086# ifdef SOLVE3D
1087!
1088! Set 3D momentum components open boundary conditions.
1089!
1090 IF (lprocessobc(ng)) THEN
1091# ifdef ANA_M3OBC
1092 CALL ana_m3obc (ng, tile, inlm)
1093# else
1094 IF (domain(ng)%SouthWest_Test(tile)) THEN
1095 IF (lbc(iwest,isuvel,ng)%acquire) THEN
1096 CALL set_ngfld (ng, inlm, idu3bc(iwest), jlb, jub, n(ng), &
1097 & 0, mm(ng)+1, n(ng), &
1098 & boundary(ng) % uG_west, &
1099 & boundary(ng) % u_west, &
1100 & update)
1101 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1102 END IF
1103!
1104 IF (lbc(iwest,isvvel,ng)%acquire) THEN
1105 CALL set_ngfld (ng, inlm, idv3bc(iwest), jlb, jub, n(ng), &
1106 & 1, mm(ng)+1, n(ng), &
1107 & boundary(ng) % vG_west, &
1108 & boundary(ng) % v_west, &
1109 & update)
1110 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1111 END IF
1112!
1113 IF (lbc(ieast,isuvel,ng)%acquire) THEN
1114 CALL set_ngfld (ng, inlm, idu3bc(ieast), jlb, jub, n(ng), &
1115 & 0, mm(ng)+1, n(ng), &
1116 & boundary(ng) % uG_east, &
1117 & boundary(ng) % u_east, &
1118 & update)
1119 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1120 END IF
1121!
1122 IF (lbc(ieast,isvvel,ng)%acquire) THEN
1123 CALL set_ngfld (ng, inlm, idv3bc(ieast), jlb, jub, n(ng), &
1124 & 1, mm(ng)+1, n(ng), &
1125 & boundary(ng) % vG_east, &
1126 & boundary(ng) % v_east, &
1127 & update)
1128 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1129 END IF
1130!
1131 IF (lbc(isouth,isuvel,ng)%acquire) THEN
1132 CALL set_ngfld (ng, inlm, idu3bc(isouth), ilb, iub, n(ng), &
1133 & 1, lm(ng)+1, n(ng), &
1134 & boundary(ng) % uG_south, &
1135 & boundary(ng) % u_south, &
1136 & update)
1137 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1138 END IF
1139!
1140 IF (lbc(isouth,isvvel,ng)%acquire) THEN
1141 CALL set_ngfld (ng, inlm, idv3bc(isouth), ilb, iub, n(ng), &
1142 & 0, lm(ng)+1, n(ng), &
1143 & boundary(ng) % vG_south, &
1144 & boundary(ng) % v_south, &
1145 & update)
1146 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1147 END IF
1148!
1149 IF (lbc(inorth,isuvel,ng)%acquire) THEN
1150 CALL set_ngfld (ng, inlm, idu3bc(inorth), ilb, iub, n(ng), &
1151 & 1, lm(ng)+1, n(ng), &
1152 & boundary(ng) % uG_north, &
1153 & boundary(ng) % u_north, &
1154 & update)
1155 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1156 END IF
1157!
1158 IF (lbc(inorth,isvvel,ng)%acquire) THEN
1159 CALL set_ngfld (ng, inlm, idv3bc(inorth), ilb, iub, n(ng), &
1160 & 0, lm(ng)+1, n(ng), &
1161 & boundary(ng) % vG_north, &
1162 & boundary(ng) % v_north, &
1163 & update)
1164 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1165 END IF
1166 END IF
1167# endif
1168 END IF
1169!
1170! Set tracer variables open boundary conditions.
1171!
1172 IF (lprocessobc(ng)) THEN
1173# ifdef ANA_TOBC
1174 CALL ana_tobc (ng, tile, inlm)
1175# else
1176 IF (domain(ng)%SouthWest_Test(tile)) THEN
1177 DO itrc=1,nt(ng)
1178 IF (lbc(iwest,istvar(itrc),ng)%acquire) THEN
1179 CALL set_ngfld (ng, inlm, idtbry(iwest,itrc), &
1180 & jlb, jub, n(ng), 0, mm(ng)+1, n(ng), &
1181 & boundary(ng) % tG_west(:,:,:,itrc), &
1182 & boundary(ng) % t_west(:,:,itrc), &
1183 & update)
1185 & __line__, myfile)) RETURN
1186 END IF
1187!
1188 IF (lbc(ieast,istvar(itrc),ng)%acquire) THEN
1189 CALL set_ngfld (ng, inlm, idtbry(ieast,itrc), &
1190 & jlb, jub, n(ng), 0, mm(ng)+1, n(ng), &
1191 & boundary(ng) % tG_east(:,:,:,itrc), &
1192 & boundary(ng) % t_east(:,:,itrc), &
1193 & update)
1195 & __line__, myfile)) RETURN
1196 END IF
1197!
1198 IF (lbc(isouth,istvar(itrc),ng)%acquire) THEN
1199 CALL set_ngfld (ng, inlm, idtbry(isouth,itrc), &
1200 & ilb, iub, n(ng), 0, lm(ng)+1, n(ng), &
1201 & boundary(ng) % tG_south(:,:,:,itrc), &
1202 & boundary(ng) % t_south(:,:,itrc), &
1203 & update)
1205 & __line__, myfile)) RETURN
1206 END IF
1207!
1208 IF (lbc(inorth,istvar(itrc),ng)%acquire) THEN
1209 CALL set_ngfld (ng, inlm, idtbry(inorth,itrc), &
1210 & ilb, iub, n(ng), 0, lm(ng)+1, n(ng), &
1211 & boundary(ng) % tG_north(:,:,:,itrc), &
1212 & boundary(ng) % t_north(:,:,itrc), &
1213 & update)
1215 & __line__, myfile)) RETURN
1216 END IF
1217 END DO
1218 END IF
1219# endif
1220 END IF
1221# endif
1222!
1223!=======================================================================
1224! Set climatology data.
1225!=====================================================================
1226!
1227! Set sea surface height climatology (m).
1228!
1229 IF (lsshclm(ng)) THEN
1230# ifdef ANA_SSH
1231 CALL ana_ssh (ng, tile, inlm)
1232# else
1233 CALL set_2dfld_tile (ng, tile, inlm, idsshc, &
1234 & lbi, ubi, lbj, ubj, &
1235 & clima(ng)%sshG, &
1236 & clima(ng)%ssh, &
1237 & update)
1238 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1239# endif
1240 END IF
1241!
1242! Set 2D momentum components climatology (m/s).
1243!
1244 IF (lm2clm(ng)) THEN
1245# ifdef ANA_M2CLIMA
1246 CALL ana_m2clima (ng, tile, inlm)
1247# else
1248 CALL set_2dfld_tile (ng, tile, inlm, idubcl, &
1249 & lbi, ubi, lbj, ubj, &
1250 & clima(ng)%ubarclmG, &
1251 & clima(ng)%ubarclm, &
1252 & update)
1253 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1254!
1255 CALL set_2dfld_tile (ng, tile, inlm, idvbcl, &
1256 & lbi, ubi, lbj, ubj, &
1257 & clima(ng)%vbarclmG, &
1258 & clima(ng)%vbarclm, &
1259 & update)
1260 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1261# endif
1262 END IF
1263
1264# ifdef SOLVE3D
1265!
1266! Set 3D momentum components climatology (m/s).
1267!
1268 IF (lm3clm(ng)) THEN
1269# ifdef ANA_M3CLIMA
1270 CALL ana_m3clima (ng, tile, inlm)
1271# else
1272 CALL set_3dfld_tile (ng, tile, inlm, iduclm, &
1273 & lbi, ubi, lbj, ubj, 1, n(ng), &
1274 & clima(ng)%uclmG, &
1275 & clima(ng)%uclm, &
1276 & update)
1277 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1278!
1279 CALL set_3dfld_tile (ng, tile, inlm, idvclm, &
1280 & lbi, ubi, lbj, ubj, 1, n(ng), &
1281 & clima(ng)%vclmG, &
1282 & clima(ng)%vclm, &
1283 & update)
1284 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1285# endif
1286 END IF
1287!
1288! Set tracer variables climatology.
1289!
1290# ifdef ANA_TCLIMA
1291 IF (any(ltracerclm(:,ng))) THEN
1292 CALL ana_tclima (ng, tile, inlm)
1293 END IF
1294# else
1295 ic=0
1296 DO itrc=1,nt(ng)
1297 IF (ltracerclm(itrc,ng)) THEN
1298 ic=ic+1
1299 CALL set_3dfld_tile (ng, tile, inlm, idtclm(itrc), &
1300 & lbi, ubi, lbj, ubj, 1, n(ng), &
1301 & clima(ng)%tclmG(:,:,:,:,ic), &
1302 & clima(ng)%tclm (:,:,:,ic), &
1303 & update)
1304 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1305 END IF
1306 END DO
1307# endif
1308# endif
1309
1310# if defined NLM_OUTER || \
1311 defined rbl4dvar || \
1312 defined rbl4dvar_ana_sensitivity || \
1313 defined rbl4dvar_fct_sensitivity || \
1314 defined sp4dvar
1315!
1316!=======================================================================
1317! Set weak contraint forcing.
1318!=======================================================================
1319!
1320 IF (frequentimpulse(ng)) THEN
1321!
1322! Set free-surface forcing.
1323!
1324 CALL set_2dfld_tile (ng, tile, inlm, idfsur, &
1325 & lbi, ubi, lbj, ubj, &
1326 & ocean(ng)%zetaG, &
1327 & ocean(ng)%f_zeta, &
1328 & update)
1329 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1330
1331# ifndef SOLVE3D
1332!
1333! Set 2D momentum forcing.
1334!
1335 CALL set_2dfld_tile (ng, tile, inlm, idubar, &
1336 & lbi, ubi, lbj, ubj, &
1337 & ocean(ng)%ubarG, &
1338 & ocean(ng)%f_ubar, &
1339 & update)
1340 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1341
1342 CALL set_2dfld_tile (ng, tile, inlm, idvbar, &
1343 & lbi, ubi, lbj, ubj, &
1344 & ocean(ng)%vbarG, &
1345 & ocean(ng)%f_vbar, &
1346 & update)
1347 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1348
1349# else
1350!
1351! Set 3D momentum.
1352!
1353 CALL set_3dfld_tile (ng, tile, inlm, iduvel, &
1354 & lbi, ubi, lbj, ubj, 1, n(ng), &
1355 & ocean(ng)%uG, &
1356 & ocean(ng)%f_u, &
1357 & update)
1358 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1359
1360 CALL set_3dfld_tile (ng, tile, inlm, idvvel, &
1361 & lbi, ubi, lbj, ubj, 1, n(ng), &
1362 & ocean(ng)%vG, &
1363 & ocean(ng)%f_v, &
1364 & update)
1365 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1366!
1367! Set 3D tracers.
1368!
1369 DO itrc=1,nt(ng)
1370 CALL set_3dfld_tile (ng, tile, inlm, idtvar(itrc), &
1371 & lbi, ubi, lbj, ubj, 1, n(ng), &
1372 & ocean(ng)%tG(:,:,:,:,itrc), &
1373 & ocean(ng)%f_t(:,:,:,itrc), &
1374 & update)
1375 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1376 END DO
1377# endif
1378 END IF
1379# endif
1380!
1381 RETURN
subroutine ana_spinning(ng, tile, model)
Definition ana_spinning.h:3
subroutine ana_fsobc(ng, tile, model)
Definition ana_fsobc.h:3
subroutine ana_wwave(ng, tile, model)
Definition ana_wwave.h:3
subroutine ana_sst(ng, tile, model)
Definition ana_sst.h:3
subroutine ana_m3obc(ng, tile, model)
Definition ana_m3obc.h:3
subroutine ana_dqdsst(ng, tile, model)
Definition ana_dqdsst.h:3
subroutine ana_tclima(ng, tile, model)
Definition ana_tclima.h:3
subroutine ana_btflux(ng, tile, model, itrc)
Definition ana_btflux.h:3
subroutine ana_ssh(ng, tile, model)
Definition ana_ssh.h:3
subroutine ana_m2obc(ng, tile, model)
Definition ana_m2obc.h:3
subroutine ana_tobc(ng, tile, model)
Definition ana_tobc.h:3
subroutine ana_sss(ng, tile, model)
Definition ana_sss.h:3
subroutine ana_psource(ng, tile, model)
Definition ana_psource.h:3
subroutine ana_winds(ng, tile, model)
Definition ana_winds.h:3
subroutine ana_srflux(ng, tile, model)
Definition ana_srflux.h:3
subroutine ana_smflux(ng, tile, model)
Definition ana_smflux.h:3
subroutine ana_pair(ng, tile, model)
Definition ana_pair.h:3
subroutine ana_m2clima(ng, tile, model)
Definition ana_m2clima.h:3
subroutine ana_tair(ng, tile, model)
Definition ana_tair.h:3
subroutine ana_m3clima(ng, tile, model)
Definition ana_m3clima.h:3
subroutine ana_stflux(ng, tile, model, itrc)
Definition ana_stflux.h:3
subroutine ana_rain(ng, tile, model)
Definition ana_rain.h:3
subroutine ana_respiration(ng, tile, model)
subroutine ana_specir(ng, tile, model)
Definition ana_specir.h:3
subroutine ana_humid(ng, tile, model)
Definition ana_humid.h:3
subroutine ana_cloud(ng, tile, model)
Definition ana_cloud.h:3
subroutine mp_boundary(ng, model, imin, imax, lbi, ubi, lbk, ubk, update, a)
subroutine exchange_r2d_tile(ng, tile, lbi, ubi, lbj, ubj, a)
subroutine exchange_u2d_tile(ng, tile, lbi, ubi, lbj, ubj, a)
subroutine exchange_v2d_tile(ng, tile, lbi, ubi, lbj, ubj, a)
integer idodin
integer idasrf
type(t_boundary), dimension(:), allocatable boundary
type(t_clima), dimension(:), allocatable clima
Definition mod_clima.F:153
type(t_forces), dimension(:), allocatable forces
Definition mod_forces.F:554
type(t_grid), dimension(:), allocatable grid
Definition mod_grid.F:365
integer iddqdt
integer idvair
integer, dimension(4) idu3bc
integer idrtra
integer idubar
integer, dimension(4) idzbry
integer idvvel
integer, dimension(4) idu2bc
integer idvsms
logical, dimension(:,:,:), allocatable linfo
integer idcfra
integer idwlen
integer idwdiw
integer isvvel
integer isvbar
integer idvclm
integer, dimension(:), allocatable idrtrc
integer idpair
integer idwlep
integer, dimension(:), allocatable idtbot
integer, dimension(:), allocatable idtsur
integer idempf
integer, dimension(:), allocatable idtclm
integer idfsur
integer idwbrk
integer, dimension(:), allocatable idtvar
integer, dimension(:), allocatable istvar
integer idldwn
integer isuvel
integer idsssc
integer isfsur
integer iduclm
integer idsfwf
integer, dimension(4) idv3bc
integer iduair
integer iduvel
integer idqair
integer isubar
integer, dimension(:,:,:), allocatable iinfo
integer idubcl
integer, dimension(4) idv2bc
integer idlrad
integer idwdip
integer idusms
integer idwamp
integer idwdir
integer idwptp
integer idwdib
integer idrain
integer idvbcl
integer idsrad
integer idsshc
integer idwpbt
integer idworb
integer idsstc
integer, dimension(:,:), allocatable idtbry
integer idtair
integer idvbar
type(t_ocean), dimension(:), allocatable ocean
Definition mod_ocean.F:351
integer nat
Definition mod_param.F:499
integer, dimension(:), allocatable n
Definition mod_param.F:479
type(t_bounds), dimension(:), allocatable bounds
Definition mod_param.F:232
integer nghostpoints
Definition mod_param.F:710
type(t_lbc), dimension(:,:,:), allocatable lbc
Definition mod_param.F:375
type(t_domain), dimension(:), allocatable domain
Definition mod_param.F:329
integer, dimension(:), allocatable lm
Definition mod_param.F:455
integer, dimension(:), allocatable nt
Definition mod_param.F:489
integer, dimension(:), allocatable mm
Definition mod_param.F:456
logical, dimension(:), allocatable luvsrc
logical, dimension(:,:), allocatable ltracersrc
real(r8), dimension(:), allocatable dcrit
logical, dimension(:), allocatable lprocessobc
logical, dimension(:), allocatable ewperiodic
integer, parameter iwest
logical, dimension(:), allocatable nsperiodic
logical, dimension(:), allocatable lm3clm
logical, dimension(:), allocatable lsshclm
logical, dimension(:), allocatable frequentimpulse
logical, dimension(:), allocatable lwsrc
integer exit_flag
integer isalt
integer itemp
integer, parameter isouth
logical, dimension(:), allocatable lm2clm
integer, parameter ieast
logical, dimension(:,:), allocatable ltracerclm
integer nrun
integer, parameter inorth
integer noerror
type(t_sources), dimension(:), allocatable sources
Definition mod_sources.F:90
integer, dimension(:), allocatable nsrc
Definition mod_sources.F:97
subroutine mp_exchange2d(ng, tile, model, nvar, lbi, ubi, lbj, ubj, nghost, ew_periodic, ns_periodic, a, b, c, d)
subroutine mp_exchange3d(ng, tile, model, nvar, lbi, ubi, lbj, ubj, lbk, ubk, nghost, ew_periodic, ns_periodic, a, b, c, d)
subroutine set_2dfld_tile(ng, tile, model, ifield, lbi, ubi, lbj, ubj, finp, fout, update, setbc)
Definition set_2dfld.F:25
subroutine set_3dfld_tile(ng, tile, model, ifield, lbi, ubi, lbj, ubj, lbk, ubk, finp, fout, update, setbc)
Definition set_3dfld.F:26
logical function, public founderror(flag, noerr, line, routine)
Definition strings.F:52
subroutine set_ngfld(ng, model, ifield, lbi, ubi, ubj, istr, iend, jrec, finp, fout, update)
Definition set_ngfld.F:5

References analytical_mod::ana_btflux(), analytical_mod::ana_cloud(), analytical_mod::ana_dqdsst(), analytical_mod::ana_fsobc(), analytical_mod::ana_humid(), analytical_mod::ana_m2clima(), analytical_mod::ana_m2obc(), analytical_mod::ana_m3clima(), analytical_mod::ana_m3obc(), analytical_mod::ana_pair(), analytical_mod::ana_psource(), analytical_mod::ana_rain(), analytical_mod::ana_respiration(), analytical_mod::ana_smflux(), analytical_mod::ana_specir(), analytical_mod::ana_spinning(), analytical_mod::ana_srflux(), analytical_mod::ana_ssh(), analytical_mod::ana_sss(), analytical_mod::ana_sst(), analytical_mod::ana_stflux(), analytical_mod::ana_tair(), analytical_mod::ana_tclima(), analytical_mod::ana_tobc(), analytical_mod::ana_winds(), analytical_mod::ana_wwave(), mod_boundary::boundary, mod_param::bounds, mod_clima::clima, mod_scalars::dcrit, mod_param::domain, mod_scalars::ewperiodic, exchange_2d_mod::exchange_r2d_tile(), exchange_2d_mod::exchange_u2d_tile(), exchange_2d_mod::exchange_v2d_tile(), mod_scalars::exit_flag, mod_forces::forces, strings_mod::founderror(), mod_scalars::frequentimpulse, mod_grid::grid, mod_biology::idasrf, mod_ncparam::idcfra, mod_ncparam::iddqdt, mod_ncparam::idempf, mod_ncparam::idfsur, mod_ncparam::idldwn, mod_ncparam::idlrad, mod_biology::idodin, mod_ncparam::idpair, mod_ncparam::idqair, mod_ncparam::idrain, mod_biology::idresr, mod_ncparam::idrtra, mod_ncparam::idrtrc, mod_ncparam::idsfwf, mod_ncparam::idsrad, mod_ncparam::idsshc, mod_ncparam::idsssc, mod_ncparam::idsstc, mod_ncparam::idtair, mod_ncparam::idtbot, mod_ncparam::idtbry, mod_ncparam::idtclm, mod_ncparam::idtsur, mod_ncparam::idtvar, mod_ncparam::idu2bc, mod_ncparam::idu3bc, mod_ncparam::iduair, mod_ncparam::idubar, mod_ncparam::idubcl, mod_ncparam::iduclm, mod_ncparam::idusms, mod_ncparam::iduvel, mod_ncparam::idv2bc, mod_ncparam::idv3bc, mod_ncparam::idvair, mod_ncparam::idvbar, mod_ncparam::idvbcl, mod_ncparam::idvclm, mod_ncparam::idvsms, mod_ncparam::idvvel, mod_ncparam::idwamp, mod_ncparam::idwbrk, mod_ncparam::idwdib, mod_ncparam::idwdip, mod_ncparam::idwdir, mod_ncparam::idwdiw, mod_ncparam::idwlen, mod_ncparam::idwlep, mod_ncparam::idworb, mod_ncparam::idwpbt, mod_ncparam::idwptp, mod_ncparam::idzbry, mod_scalars::ieast, mod_ncparam::iinfo, mod_param::inlm, mod_scalars::inorth, mod_scalars::isalt, mod_ncparam::isfsur, mod_scalars::isouth, mod_ncparam::istvar, mod_ncparam::isubar, mod_ncparam::isuvel, mod_ncparam::isvbar, mod_ncparam::isvvel, mod_scalars::itemp, mod_scalars::iwest, mod_param::lbc, mod_ncparam::linfo, mod_param::lm, mod_scalars::lm2clm, mod_scalars::lm3clm, mod_scalars::lprocessobc, mod_scalars::lsshclm, mod_scalars::ltracerclm, mod_scalars::ltracersrc, mod_scalars::luvsrc, mod_scalars::lwsrc, mod_param::mm, distribute_mod::mp_boundary(), mp_exchange_mod::mp_exchange2d(), mp_exchange_mod::mp_exchange3d(), mod_param::n, mod_param::nat, mod_param::nghostpoints, mod_scalars::noerror, mod_scalars::nrun, mod_scalars::nsperiodic, mod_sources::nsrc, mod_param::nt, mod_ocean::ocean, set_2dfld_mod::set_2dfld_tile(), set_3dfld_mod::set_3dfld_tile(), set_ngfld(), and mod_sources::sources.

Referenced by set_data().

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