WAVEWATCH III  beta 0.0.1
w3updtmd.F90
Go to the documentation of this file.
1 
7 
8 #include "w3macros.h"
9 !/ ------------------------------------------------------------------- /
10 
22 MODULE w3updtmd
23  !/
24  !/ +-----------------------------------+
25  !/ | WAVEWATCH III NOAA/NCEP |
26  !/ | H. L. Tolman |
27  !/ | FORTRAN 90 |
28  !/ | Last update : 22-Mar-2021 |
29  !/ +-----------------------------------+
30  !/
31  !/ 21-Jan-2000 : Origination. ( version 2.00 )
32  !/ 24-Jan-2001 : Flat grid version. ( version 2.06 )
33  !/ 02-Apr-2001 : Adding sub-grid obstacles. ( version 2.10 )
34  !/ 18-May-2001 : Clean up and bug fixes. ( version 2.11 )
35  !/ 11-Jan-2002 : Sub-grid ice. ( version 2.15 )
36  !/ 30-Apr-2002 : Water level fixes. ( version 2.20 )
37  !/ 13-Nov-2002 : Add stress vector. ( version 3.00 )
38  !/ 26-Dec-2002 : Moving grid wind correction. ( version 3.02 )
39  !/ 15-Dec-2004 : Multiple grid version. ( version 3.06 )
40  !/ 15-Jul-2005 : Adding MAPST2. ( version 3.07 )
41  !/ 07-Sep-2005 : Upgrading W3UBPT. ( version 3.08 )
42  !/ 04-Jul-2006 : Consolidate stress arrays. ( version 3.09 )
43  !/ 11-Jan-2007 : Clean-up W3UTRN boundary points. ( version 3.10 )
44  !/ 11-May-2007 : Adding NTPROC/NAPROC separation. ( version 3.11 )
45  !/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
46  !/ 30-Oct-2009 : Implement run-time grid selection. ( version 3.14 )
47  !/ (W. E. Rogers & T. J. Campbell, NRL)
48  !/ 30-Oct-2009 : Implement curvilinear grid type. ( version 3.14 )
49  !/ (W. E. Rogers & T. J. Campbell, NRL)
50  !/ 17-Aug-2010 : ABPI0-N(:,0) init. bug fix. ( version 3.14 )
51  !/ 06-Dec-2010 : Change from GLOBAL (logical) to ICLOSE (integer) to
52  !/ specify index closure for a grid. ( version 3.14 )
53  !/ (T. J. Campbell, NRL)
54  !/ 05-Apr-2011 : Place holder for XGR in UNGTYPE ( version 4.04 )
55  !/ (A. Roland/F. Ardhuin)
56  !/ 13-Mar-2012 : Add initialization of UST on re- ( version 4.07 )
57  !/ activation of grid point.
58  !/ 06-Jun-2012 : Porting bugfixes from 3.14 to 4.07 ( version 4.07 )
59  !/ 12-Jun-2012 : Add /RTD option or rotated grid option.
60  !/ (Jian-Guo Li) ( version 4.07 )
61  !/ 26-Sep-2012 : Adding update from tidal analysis ( version 4.08 )
62  !/ (F. Ardhuin)
63  !/ 16-Sep-2013 : Add Arctic part for SMC grid. ( version 4.11 )
64  !/ 11-Nov-2013 : SMC and rotated grid incorporated in the main
65  !/ trunk ( version 4.13 )
66  !/ 13-Nov-2013 : Moved reflection from ww3_grid.ftn ( version 4.13 )
67  !/ 27-May-2014 : Ading OMPG parallelizations dir, ( version 5.02 )
68  !/ 08-May-2014 : Implement tripolar grid for first order propagation
69  !/ scheme ( version 5.03 )
70  !/ (W. E. Rogers, NRL)
71  !/ 27-Aug-2015 : New function to update variables ( version 5.08 )
72  !/ ICEF and ICEDMAX at the first time step
73  !/ and add ICEH initialization in W3UICE.
74  !/ 13-Jan-2016 : Changed initial value of ICEDMAX ( version 5.08 )
75  !/ 26-Mar-2018 : Sea-point only Wnd/Cur input. JGLi ( version 6.04 )
76  !/ 07-Oct-2019 : RTD option with standard lat-lon
77  !/ grid when nesting to rotated grid ( version 7.11 )
78  !/ 22-Mar-2021 : Add W3UTAU, W3URHO routines ( version 7.13 )
79  !/ 06-May-2021 : Use ARCTC option for SMC grid. JGLi ( version 7.13 )
80  !/
81  !/ Copyright 2009-2014 National Weather Service (NWS),
82  !/ National Oceanic and Atmospheric Administration. All rights
83  !/ reserved. WAVEWATCH III is a trademark of the NWS.
84  !/ No unauthorized use without permission.
85  !/
86  ! 1. Purpose :
87  !
88  ! Bundles all input updating routines for WAVEWATCH III.
89  !
90  ! 2. Variables and types :
91  !
92  ! 3. Subroutines and functions :
93  !
94  ! Name Type Scope Description
95  ! ----------------------------------------------------------------
96  ! W3UCUR Subr. Public Update current fields.
97  ! W3UWND Subr. Public Update wind fields.
98  ! W3UTAU Subr. Public Update atmospheric momentum fields.
99  ! W3UINI Subr. Public Update initial conditions.
100  ! W3UBPT Subr. Public Update boundary conditions.
101  ! W3UICE Subr. Public Update ice concentrations.
102  ! W3ULEV Subr. Public Update water levels.
103  ! W3URHO Subr. Public Update air density.
104  ! W3UTRN Subr. Public Update cell boundary transparancies.
105  ! W3DZXY Subr. Public Calculate derivatives of a field.
106  ! ----------------------------------------------------------------
107  !
108  ! 4. Subroutines and functions used :
109  !
110  ! Name Type Module Description
111  ! ----------------------------------------------------------------
112  ! DSEC21 Func. W3TIMEMD Difference in time.
113  ! STRACE Subr. W3SERVMD Subroutine tracing.
114  ! EXTCDE Subr. W3SERVMD Exit program with error code.
115  ! PRTBLK Subr. W3ARRYMD Print plot output.
116  ! PRT2DS Subr. W3ARRYMD Print plot output.
117  ! ----------------------------------------------------------------
118  !
119  ! 5. Remarks :
120  !
121  ! 6. Switches :
122  !
123  ! !/SHRD Switch for shared / distributed memory architecture.
124  ! !/DIST Id.
125  !
126  ! !/OMPG OpenMP compiler directives.
127  !
128  ! !/CRT0 No current interpolation.
129  ! !/CRT1 Linear current interpolation.
130  ! !/CRT2 Quasi-quadratic current interpolation.
131  !
132  ! !/WNT0 No wind/momentum interpolation.
133  ! !/WNT1 Linear wind/momentum interpolation.
134  ! !/WNT2 Energy conservation in wind/momentum interpolation.
135  !
136  ! !/RWND Use wind speeds relative to currents.
137  !
138  ! !/STAB2 Calculate effective wind speed factor for stability
139  ! to be used with !/ST2.
140  !
141  ! !/S Enable subroutine tracing.
142  ! !/Tn Test output
143  !
144  ! 7. Source code :
145  !
146  !/ ------------------------------------------------------------------- /
147  USE constants
148  USE w3odatmd, ONLY: ndse, ndst, naproc, iaproc, naperr
149 #ifdef W3_S
150  USE w3servmd, ONLY : strace
151 #endif
152  USE w3timemd, ONLY: dsec21
153  !/
154  !/ ------------------------------------------------------------------- /
155  !/
156 CONTAINS
157  !/ ------------------------------------------------------------------- /
158 
171  SUBROUTINE w3ucur ( FLFRST )
172  !/
173  !/ +-----------------------------------+
174  !/ | WAVEWATCH III NOAA/NCEP |
175  !/ | H. L. Tolman |
176  !/ | FORTRAN 90 |
177  !/ | Last update : 15-Dec-2004 |
178  !/ +-----------------------------------+
179  !/
180  !/ 09-Dec-1996 : Final FORTRAN 77 ( version 1.18 )
181  !/ 20-Dec-1999 : Upgrade to FORTRAN 90 ( version 2.00 )
182  !/ 15-Dec-2004 : Multiple grid version. ( version 3.06 )
183  !/ 27-Aug-2015 : Rename DT0,DTT by DT0T,DT0N ( version 5.10 )
184  !/ 23-Mar-2016 : SMC grid Arctic part adjustment. ( version 5.18 )
185  !/ 26-Mar-2018 : Sea-point only current on SMC grid. ( version 6.02 )
186  !/
187  ! 1. Purpose :
188  !
189  ! Interpolate the current field to the present time.
190  !
191  ! 2. Method :
192  !
193  ! Linear interpolation of speed and direction, with optionally
194  ! a correction to get approximate quadratic interpolation of speed
195  ! only.
196  !
197  ! 3. Parameters :
198  !
199  ! Parameter list
200  ! ----------------------------------------------------------------
201  ! FLFRST Log. I Flag for first pass through routine.
202  ! ----------------------------------------------------------------
203  !
204  ! 4. Subroutines used :
205  !
206  ! See module documentation.
207  !
208  ! 5. Called by :
209  !
210  ! Name Type Module Description
211  ! ----------------------------------------------------------------
212  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
213  ! ----------------------------------------------------------------
214  !
215  ! 6. Error messages :
216  !
217  ! None.
218  !
219  ! 7. Remarks :
220  !
221  ! - Only currents at sea points are considered.
222  ! - Time ranges checked in W3WAVE.
223  ! - Currents are stored by components to save on the use of
224  ! SIN and COS functions. The actual interpolations, however
225  ! are by absolute value and direction.
226  !
227  ! 8. Structure :
228  !
229  ! --------------------------------------
230  ! 1. Prepare auxiliary arrays.
231  ! 2. Calculate interpolation factors.
232  ! 3. Get actual winds.
233  ! --------------------------------------
234  !
235  ! 9. Switches :
236  !
237  ! !/CRT0 No current interpolation.
238  ! !/CRT1 Linear current interpolation.
239  ! !/CRT2 Quasi-quadratic current interpolation.
240  !
241  ! !/S Enable subroutine tracing.
242  ! !/T Test output.
243  !
244  ! 10. Source code :
245  !
246  !/ ------------------------------------------------------------------- /
247  USE w3gdatmd, ONLY: nx, ny, nsea, mapsf
248 #ifdef W3_SMC
249  USE w3gdatmd, ONLY: narc, nglo, angarc
250  USE w3gdatmd, ONLY: fswnd, arctc
251 #endif
252  USE w3wdatmd, ONLY: time
253  USE w3adatmd, ONLY: cx, cy, ca0, cai, cd0, cdi
254  USE w3idatmd, ONLY: tc0, cx0, cy0, tcn, cxn, cyn
255 #ifdef W3_TIDE
256  USE w3gdatmd, ONLY: ygrd
257  USE w3timemd
258  USE w3idatmd, ONLY: flcurtide, cxtide, cytide, ntide
259  USE w3tidemd
260 #endif
261  !
262  IMPLICIT NONE
263  !/
264  !/ ------------------------------------------------------------------- /
265  !/ Parameter list
266  !/
267  LOGICAL, INTENT(IN) :: FLFRST
268  !/
269  !/ ------------------------------------------------------------------- /
270  !/
271  INTEGER :: ISEA, IX, IY
272 #ifdef W3_S
273  INTEGER, SAVE :: IENT = 0
274 #endif
275  REAL :: D0, DN, DD, DT0N, DT0T, RD, CABS, CDIR
276 #ifdef W3_CRT2
277  REAL :: RD2, CI2
278 #endif
279 #ifdef W3_TIDE
280  INTEGER :: J,K
281  INTEGER(KIND=4) :: TIDE_KD0, INT24, INTDYS ! "Gregorian day constant"
282  REAL :: WCURTIDEX, WCURTIDEY, TIDE_ARGX, TIDE_ARGY
283  REAL(KIND=8) :: d1,h,tide_hour,hh,pp,s,p,enp,dh,dpp,ds,dp,dnp,tau
284  REAL :: FX(44),UX(44),VX(44)
285 #endif
286  !/
287  !/ ------------------------------------------------------------------- /
288  !/
289 #ifdef W3_S
290  CALL strace (ient, 'W3UCUR')
291 #endif
292  !
293  ! 1. Prepare auxiliary arrays
294  !
295  IF ( flfrst ) THEN
296  DO isea=1, nsea
297 #ifdef W3_SMC
298  !!Li For sea-point SMC grid current, the 1-D current is stored on
299  !!Li 2-D CX0(NSEA, 1) variable.
300  IF( fswnd ) THEN
301  ix = isea
302  iy = 1
303  ELSE
304 #endif
305  ix = mapsf(isea,1)
306  iy = mapsf(isea,2)
307 #ifdef W3_SMC
308  ENDIF
309 #endif
310 
311  ca0(isea) = sqrt( cx0(ix,iy)**2 + cy0(ix,iy)**2 )
312  cai(isea) = sqrt( cxn(ix,iy)**2 + cyn(ix,iy)**2 )
313  IF ( ca0(isea) .GT. 1.e-7) THEN
314  d0 = mod( tpi+atan2(cy0(ix,iy),cx0(ix,iy)) , tpi )
315  ELSE
316  d0 = 0
317  END IF
318  IF ( cai(isea) .GT. 1.e-7) THEN
319  dn = mod( tpi+atan2(cyn(ix,iy),cxn(ix,iy)) , tpi )
320  ELSE
321  dn = d0
322  END IF
323  IF ( ca0(isea) .GT. 1.e-7) THEN
324  cd0(isea) = d0
325  ELSE
326  cd0(isea) = dn
327  END IF
328  dd = dn - cd0(isea)
329  IF (abs(dd).GT.pi) dd = dd - tpi*sign(1.,dd)
330  cdi(isea) = dd
331  cai(isea) = cai(isea) - ca0(isea)
332  END DO
333  END IF
334  !
335  ! 2. Calculate interpolation factor
336  !
337  dt0n = dsec21( tc0, tcn )
338  dt0t = dsec21( tc0, time )
339  !
340 #ifdef W3_CRT0
341  rd = 0.
342 #endif
343 #ifdef W3_CRT1
344  rd = dt0t / max( 1.e-7 , dt0n )
345 #endif
346 #ifdef W3_CRT2
347  rd = dt0t / max( 1.e-7 , dt0n )
348  rd2 = 1. - rd
349 #endif
350 #ifdef W3_OASOCM
351  rd = 1.
352 #endif
353  !
354 #ifdef W3_T
355  WRITE (ndst,9000) dt0n, dt0t, rd
356 #endif
357 
358 #ifdef W3_TIDE
359  IF (flcurtide) THEN
360  ! WRITE(6,*) 'TIME CUR:',TIME, '##',TC0, '##',TCN
361  tide_hour = time2hours(time)
362  !
363  !* THE ASTRONOMICAL ARGUMENTS ARE CALCULATED BY LINEAR APPROXIMATION
364  !* AT THE MID POINT OF THE ANALYSIS PERIOD.
365  d1=tide_hour/24.d0
366  tide_kd0= 2415020
367  d1=d1-dfloat(tide_kd0)-0.5d0
368  call astr(d1,h,pp,s,p,enp,dh,dpp,ds,dp,dnp)
369  int24=24
370  intdys=int((tide_hour+0.00001)/int24)
371  hh=tide_hour-dfloat(intdys*int24)
372  tau=hh/24.d0+h-s
373  END IF
374  !
375  ! ONLY THE FRACTIONAL PART OF A SOLAR DAY NEED BE RETAINED FOR COMPU-
376  ! TING THE LUNAR TIME TAU.
377  !
378 #endif
379 
380  !
381  ! 3. Actual currents for all grid points
382  !
383  DO isea=1, nsea
384 #ifdef W3_TIDE
385  IF (flcurtide) THEN ! could move IF test outside of ISEA loop ...
386  ! VUF should only be updated in latitude changes significantly ...
387  ix = mapsf(isea,1)
388  iy = mapsf(isea,2)
389  CALL setvuf_fast(h,pp,s,p,enp,dh,dpp,ds,dp,dnp,tau,real(ygrd(iy,ix)),fx,ux,vx)
390  wcurtidex = cxtide(ix,iy,1,1)
391  wcurtidey = cytide(ix,iy,1,1)
392 
393  DO j=2,tide_mf
394  tide_argx=(vx(j)+ux(j))*twpi-cxtide(ix,iy,j,2)*dera
395  tide_argy=(vx(j)+ux(j))*twpi-cytide(ix,iy,j,2)*dera
396  wcurtidex = wcurtidex+fx(j)*cxtide(ix,iy,j,1)*cos(tide_argx)
397  wcurtidey = wcurtidey+fx(j)*cytide(ix,iy,j,1)*cos(tide_argy)
398  END DO
399 
400 #endif
401 
402 #ifdef W3_TIDET
403  !Verification
404  IF (isea.EQ.1) THEN
405 
406  tide_ampc(1:ntide,1)=cxtide(ix,iy,1:ntide,1)
407  tide_phg(1:ntide,1 )=cxtide(ix,iy,1:ntide,2)
408  tide_ampc(1:ntide,2)=cytide(ix,iy,1:ntide,1)
409  tide_phg(1:ntide,2) =cytide(ix,iy,1:ntide,2)
410 
411  WRITE(993,'(A,F20.2,13F8.3)') 'TEST ISEA 0:', &
412  d1,h,s,tau,pp,s,p,enp,dh,dpp,ds,dp,dnp,real(ygrd(iy,ix))
413 
414  DO j=1,tide_mf
415  WRITE(993,'(A,4I9,F12.0,3F8.3,I4,X,A)') 'TEST ISEA 1:',ix,j,time,tide_hour, &
416  fx(j),ux(j),vx(j),tide_index2(j),tidecon_allnames(tide_index2(j))
417  END DO
418  DO k=1,2
419  DO j=1,tide_mf
420  WRITE(993,'(A,5I9,F12.0,5F8.3)') 'TEST ISEA 2:',ix,k,j,time,tide_hour, &
421  fx(j),ux(j),vx(j),tide_ampc(j,k),tide_phg(j,k)
422  END DO
423  END DO
424 
425  WRITE(993,'(A,2F8.4,A,2F8.4)') '#:',cx0(ix,iy),cy0(ix,iy),'##',wcurtidex,wcurtidey
426  CLOSE(993)
427  END IF
428  ! End of verification
429 #endif
430 #ifdef W3_TIDE
431  cx(isea) = wcurtidex
432  cy(isea) = wcurtidey
433  ELSE
434 #endif
435 
436  cabs = ca0(isea) + rd * cai(isea)
437 #ifdef W3_CRT2
438  ci2 = sqrt( rd2 * ca0(isea)**2 + &
439  rd *(ca0(isea)+cai(isea))**2 )
440  cabs = cabs * min( 1.25 , ci2/max(1.e-7,cabs) )
441 #endif
442  cdir = cd0(isea) + rd * cdi(isea)
443 
444 #ifdef W3_SMC
445  !Li Rotate curreent direction by ANGARC for Arctic part cells. JGLi23Mar2016
446  IF( arctc .AND. (isea .GT. nglo) ) THEN
447  dn = cdir + angarc( isea - nglo )*dera
448  cdir = mod( tpi + dn, tpi )
449  ENDIF
450 #endif
451 
452  cx(isea) = cabs * cos(cdir)
453  cy(isea) = cabs * sin(cdir)
454 #ifdef W3_TIDE
455  ! IF (ISEA.EQ.1) WRITE(6,'(A,4F8.4,A,4F8.4)') 'CUR#:',RD,CA0(ISEA),CAI(ISEA),CABS,'##', &
456  ! CX(ISEA), CY(ISEA),WCURTIDEX, WCURTIDEY
457  END IF
458 #endif
459  !
460  END DO
461  !
462  RETURN
463  !
464  ! Formats
465  !
466 #ifdef W3_T
467 9000 FORMAT (' TEST W3UCUR : DT0N, DT0T, RD :',2f8.1,f6.3)
468 #endif
469  !/
470  !/ End of W3UCUR ----------------------------------------------------- /
471  !/
472  END SUBROUTINE w3ucur
473  !/ ------------------------------------------------------------------- /
474 
488  SUBROUTINE w3uwnd ( FLFRST, VGX, VGY )
489  !/
490  !/ +-----------------------------------+
491  !/ | WAVEWATCH III NOAA/NCEP |
492  !/ | H. L. Tolman |
493  !/ | FORTRAN 90 |
494  !/ | Last update : 27-May-2014 |
495  !/ +-----------------------------------+
496  !/
497  !/ 03-Dec-1998 : Final FORTRAN 77 ( version 1.18 )
498  !/ 20-Dec-1999 : Upgrade to FORTRAN 90 ( version 2.00 )
499  !/ 13-Nov-2002 : Add stress vector. ( version 3.00 )
500  !/ 26-Dec-2002 : Moving grid wind correction. ( version 3.02 )
501  !/ 15-Dec-2004 : Multiple grid version. ( version 3.06 )
502  !/ 04-Jul-2006 : Consolidate stress arrays. ( version 3.09 )
503  !/ 16-Sep-2013 : Rotating wind for Arctic part. ( version 4.11 )
504  !/ 27-May-2014 : Adding OMPG parallelizations dir. ( version 5.02 )
505  !/ 27-Aug-2015 : Rename DT0,DTT by DT0T,DT0N ( version 5.10 )
506  !/ 26-Mar-2018 : Sea-point only wind for SMC grid. ( version 6.07 )
507  !/
508  ! 1. Purpose :
509  !
510  ! Interpolate wind fields to the given time.
511  !
512  ! 2. Method :
513  !
514  ! Linear interpolation of wind speed and direction, with a simple
515  ! correction to obtain quasi-conservation of energy.
516  !
517  ! 3. Parameters :
518  !
519  ! Parameter list
520  ! ----------------------------------------------------------------
521  ! FLFRST Log. I Flag for first pass through routine.
522  ! VGX/Y Real I Grid velocity (!/MGW)
523  ! ----------------------------------------------------------------
524  !
525  ! 4. Subroutines used :
526  !
527  ! See module documentation.
528  !
529  ! 5. Called by :
530  !
531  ! Name Type Module Description
532  ! ----------------------------------------------------------------
533  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
534  ! ----------------------------------------------------------------
535  !
536  ! 6. Error messages :
537  !
538  ! None.
539  !
540  ! 7. Remarks :
541  !
542  ! - Only winds over sea points are considered.
543  ! - Time ranges checked in W3WAVE.
544  !
545  ! 8. Structure :
546  !
547  ! --------------------------------------
548  ! 1. Prepare auxiliary arrays.
549  ! 2. Calculate interpolation factors
550  ! 3. Get actual winds
551  ! 4. Correct for currents
552  ! 5. Convert to stresses
553  ! 6. Stability correction
554  ! --------------------------------------
555  !
556  ! 9. Switches :
557  !
558  ! !/OMPG OpenMP compiler directives.
559  !
560  ! !/WNT0 No wind interpolation.
561  ! !/WNT1 Linear wind interpolation.
562  ! !/WNT2 Energy conservation in wind interpolation.
563  !
564  ! !/RWND Use wind speeds relative to currents.
565  ! !/MGW Moving grid wind correction.
566  !
567  ! !/STAB2 Calculate effective wind speed factor for stability
568  ! to be used with !/ST2.
569  !
570  ! !/S Enable subroutine tracing.
571  ! !/T Test output.
572  !
573  ! 10. Source code :
574  !
575  !/ ------------------------------------------------------------------- /
576  USE w3gdatmd, ONLY: nx, ny, nsea, mapsf
577 #ifdef W3_WCOR
578  USE w3gdatmd, ONLY: wwcor
579 #endif
580 #ifdef W3_RWND
581  USE w3gdatmd, ONLY: rwindc
582 #endif
583 #ifdef W3_ST2
584  USE w3gdatmd, ONLY: zwind, ofstab, ffng, ffps, ccng, ccps, shstab
585 #endif
586 #ifdef W3_SMC
587  USE w3gdatmd, ONLY: narc, nglo, angarc, arctc, fswnd
588 #endif
589  USE w3wdatmd, ONLY: time, asf
590  USE w3adatmd, ONLY: dw, cx, cy, ua, ud, u10, u10d, as, &
591  ua0, uai, ud0, udi, as0, asi
592  USE w3idatmd, ONLY: tw0, wx0, wy0, dt0, twn, wxn, wyn, dtn, flcur
593  !/
594  IMPLICIT NONE
595  !/
596  !/ ------------------------------------------------------------------- /
597  !/ Parameter list
598  !/
599  REAL, INTENT(IN) :: VGX, VGY
600  LOGICAL, INTENT(IN) :: FLFRST
601  !/
602  !/ ------------------------------------------------------------------- /
603  !/
604  INTEGER :: ISEA, IX, IY
605 #ifdef W3_S
606  INTEGER, SAVE :: IENT = 0
607 #endif
608  REAL :: D0, DN, DD, DT0N, DT0T, RD, UI2, &
609  UXR, UYR
610 #ifdef W3_WNT2
611  REAL :: RD2
612 #endif
613 #ifdef W3_STAB2
614  REAL :: STAB0, STAB, THARG1, THARG2, COR1, COR2
615 #endif
616  REAL :: UDARC
617  !/
618  !/ ------------------------------------------------------------------- /
619  !/
620 #ifdef W3_S
621  CALL strace (ient, 'W3UWND')
622 #endif
623  !
624  ! 1. Prepare auxiliary arrays
625  !
626  IF ( flfrst ) THEN
627  DO isea=1, nsea
628 #ifdef W3_SMC
629  !!Li For sea-point only SMC grid wind 1-D wind is stored on
630  !!Li 2-D WX0(NSEA, 1) variable.
631  IF( fswnd ) THEN
632  ix = isea
633  iy = 1
634  ELSE
635 #endif
636  ix = mapsf(isea,1)
637  iy = mapsf(isea,2)
638 #ifdef W3_SMC
639  ENDIF
640 #endif
641 
642  ua0(isea) = sqrt( wx0(ix,iy)**2 + wy0(ix,iy)**2 )
643  uai(isea) = sqrt( wxn(ix,iy)**2 + wyn(ix,iy)**2 )
644  IF ( ua0(isea) .GT. 1.e-7) THEN
645  d0 = mod( tpi+atan2(wy0(ix,iy),wx0(ix,iy)) , tpi )
646  ELSE
647  d0 = 0
648  END IF
649  IF ( uai(isea) .GT. 1.e-7) THEN
650  dn = mod( tpi+atan2(wyn(ix,iy),wxn(ix,iy)) , tpi )
651  ELSE
652  dn = d0
653  END IF
654  IF ( ua0(isea) .GT. 1.e-7) THEN
655  ud0(isea) = d0
656  ELSE
657  ud0(isea) = dn
658  END IF
659  dd = dn - ud0(isea)
660  IF (abs(dd).GT.pi) dd = dd - tpi*sign(1.,dd)
661  udi(isea) = dd
662  uai(isea) = uai(isea) - ua0(isea)
663  as0(isea) = dt0(ix,iy)
664  asi(isea) = dtn(ix,iy) - dt0(ix,iy)
665  END DO
666  END IF
667  !
668  ! 2. Calculate interpolation factor
669  !
670  dt0n = dsec21( tw0, twn )
671  dt0t = dsec21( tw0, time )
672  !
673 #ifdef W3_WNT0
674  rd = 0.
675 #endif
676 #ifdef W3_WNT1
677  rd = dt0t / max( 1.e-7 , dt0n )
678 #endif
679 #ifdef W3_WNT2
680  rd = dt0t / max( 1.e-7 , dt0n )
681  rd2 = 1. - rd
682 #endif
683 #ifdef W3_OASACM
684  rd = 1.
685 #endif
686  !
687 #ifdef W3_T
688  WRITE (ndst,9000) dt0n, dt0t, rd
689 #endif
690  !
691  ! 3. Actual wind for all grid points
692  !
693 #ifdef W3_OMPG
694  !$OMP PARALLEL DO PRIVATE (ISEA,UI2,UXR,UYR,UDARC)
695 #endif
696  !
697  DO isea=1, nsea
698  !
699  ua(isea) = ua0(isea) + rd * uai(isea)
700 #ifdef W3_WNT2
701  ui2 = sqrt( rd2 * ua0(isea)**2 + &
702  rd *(ua0(isea)+uai(isea))**2 )
703  ua(isea) = ua(isea) * min(1.25,ui2/max(1.e-7,ua(isea)))
704 #endif
705  ud(isea) = ud0(isea) + rd * udi(isea)
706 #ifdef W3_MGW
707  uxr = ua(isea)*cos(ud(isea)) + vgx
708  uyr = ua(isea)*sin(ud(isea)) + vgy
709  ua(isea) = max( 0.001 , sqrt(uxr**2+uyr**2) )
710  ud(isea) = mod( tpi+atan2(uyr,uxr) , tpi )
711 #endif
712 #ifdef W3_SMC
713  !Li Rotate wind direction by ANGARC for Arctic part cells.
714  IF( arctc .AND. (isea .GT. nglo) ) THEN
715  udarc = ud(isea) + angarc( isea - nglo )*dera
716  ud(isea) = mod( tpi + udarc, tpi )
717  ENDIF
718 #endif
719  !
720  as(isea) = as0(isea) + rd * asi(isea)
721  ! IF (UA(ISEA).NE.UA(ISEA)) WRITE(6,*) 'BUG WIND:',ISEA,UA(ISEA),MAPSF(ISEA,1), MAPSF(ISEA,2),UA0(ISEA),RD,UAI(ISEA)
722  ! IF (UD(ISEA).NE.UD(ISEA)) WRITE(6,*) 'BUG WIN2:',ISEA,UD(ISEA),MAPSF(ISEA,1), MAPSF(ISEA,2)
723  !
724  END DO
725  !
726 #ifdef W3_OMPG
727  !$OMP END PARALLEL DO
728 #endif
729  !
730  ! 3.b Bias correction ( !/WCOR )
731 #ifdef W3_WCOR
732  WHERE ( ua .GE. wwcor(1) ) ua = ua+(ua-wwcor(1))*wwcor(2)
733 #endif
734 
735  !
736  ! 4. Correct for currents and grid motion
737  !
738 #ifdef W3_RWND
739  IF ( flcur ) THEN
740 #endif
741  !
742 #ifdef W3_RWND
743  DO isea=1, nsea
744  uxr = ua(isea)*cos(ud(isea)) - rwindc*cx(isea)
745  uyr = ua(isea)*sin(ud(isea)) - rwindc*cy(isea)
746  u10(isea) = max( 0.001 , sqrt(uxr**2+uyr**2) )
747  u10d(isea) = mod( tpi+atan2(uyr,uxr) , tpi )
748  END DO
749 #endif
750  !
751 #ifdef W3_RWND
752  ELSE
753 #endif
754  !
755 #ifdef W3_OMPG
756  !$OMP PARALLEL DO PRIVATE (ISEA)
757 #endif
758  !
759  DO isea=1, nsea
760  u10(isea) = max( ua(isea) , 0.001 )
761  u10d(isea) = ud(isea)
762  END DO
763  !
764 #ifdef W3_OMPG
765  !$OMP END PARALLEL DO
766 #endif
767  !
768 #ifdef W3_RWND
769  END IF
770 #endif
771  !
772  ! 5. Stability correction ( !/STAB2 )
773  ! Original settings :
774  !
775  ! SHSTAB = 1.4
776  ! OFSTAB = -0.01
777  ! CCNG = -0.1
778  ! CCPS = 0.1
779  ! FFNG = -150.
780  ! FFPS = 150.
781  !
782 #ifdef W3_STAB2
783  stab0 = zwind * grav / 273.
784 #endif
785  !
786 #ifdef W3_STAB2
787  DO isea=1, nsea
788  stab = stab0 * as(isea) / max(5.,u10(isea))**2
789  stab = max( -1. , min( 1. , stab ) )
790 #endif
791  !
792 #ifdef W3_STAB2
793  tharg1 = max( 0. , ffng*(stab-ofstab))
794  tharg2 = max( 0. , ffps*(stab-ofstab))
795  cor1 = ccng * tanh(tharg1)
796  cor2 = ccps * tanh(tharg2)
797 #endif
798  !
799 #ifdef W3_STAB2
800  asf(isea) = sqrt( (1.+cor1+cor2)/shstab )
801  u10(isea) = u10(isea) / asf(isea)
802  END DO
803 #endif
804  !
805  RETURN
806  !
807  ! Formats
808  !
809 #ifdef W3_T
810 9000 FORMAT (' TEST W3UWND : DT0N, DT0T, RD :',2f8.1,f6.3)
811 #endif
812  !/
813  !/ End of W3UWND ----------------------------------------------------- /
814  !/
815  END SUBROUTINE w3uwnd
816  !/ ------------------------------------------------------------------- /
828  SUBROUTINE w3utau ( FLFRST )
829  !/
830  !/ +-----------------------------------+
831  !/ | WAVEWATCH III NOAA/NCEP |
832  !/ | J. M. Castillo |
833  !/ | FORTRAN 90 |
834  !/ | Last update : 22-Mar-2021 |
835  !/ +-----------------------------------+
836  !/
837  !/ 22-Mar-2021 : First implementation ( version 7.13 )
838  !/
839  ! 1. Purpose :
840  !
841  ! Interpolate atmosphere momentum fields to the given time.
842  !
843  ! 2. Method :
844  !
845  ! Linear interpolation of momentum module and direction, with a simple
846  ! correction to obtain quasi-conservation of energy.
847  !
848  ! 3. Parameters :
849  !
850  ! Parameter list
851  ! ----------------------------------------------------------------
852  ! FLFRST Log. I Flag for first pass through routine.
853  ! ----------------------------------------------------------------
854  !
855  ! 4. Subroutines used :
856  !
857  ! See module documentation.
858  !
859  ! 5. Called by :
860  !
861  ! Name Type Module Description
862  ! ----------------------------------------------------------------
863  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
864  ! ----------------------------------------------------------------
865  !
866  ! 6. Error messages :
867  !
868  ! None.
869  !
870  ! 7. Remarks :
871  !
872  ! - Only momentum over sea points is considered.
873  ! - Time ranges checked in W3WAVE.
874  !
875  ! 8. Structure :
876  !
877  ! --------------------------------------
878  ! 1. Prepare auxiliary arrays.
879  ! 2. Calculate interpolation factors
880  ! 3. Get actual momentum
881  ! --------------------------------------
882  !
883  ! 9. Switches :
884  !
885  ! !/OMPG OpenMP compiler directives.
886  !
887  ! !/WNT0 No momentum interpolation.
888  ! !/WNT1 Linear momentum interpolation.
889  ! !/WNT2 Energy conservation in momentum interpolation.
890  !
891  ! !/S Enable subroutine tracing.
892  ! !/T Test output.
893  !
894  ! 10. Source code :
895  !
896  !/ ------------------------------------------------------------------- /
897  USE w3gdatmd, ONLY: nsea, mapsf
898 #ifdef W3_SMC
899  USE w3gdatmd, ONLY: narc, nglo, angarc
900  USE w3gdatmd, ONLY: fswnd, arctc
901 #endif
902  USE w3wdatmd, ONLY: time
903  USE w3adatmd, ONLY: taua, tauadir, ma0, mai, md0, mdi
904  USE w3idatmd, ONLY: tu0, ux0, uy0, tun, uxn, uyn
905  !/
906  IMPLICIT NONE
907  !/
908  !/ ------------------------------------------------------------------- /
909  !/ Parameter list
910  !/
911  LOGICAL, INTENT(IN) :: FLFRST
912  !/
913  !/ ------------------------------------------------------------------- /
914  !/
915  INTEGER :: ISEA, IX, IY
916 #ifdef W3_S
917  INTEGER, SAVE :: IENT = 0
918 #endif
919  REAL :: D0, DN, DD, DT0N, DT0T, RD, MI2, &
920  MXR, MYR
921 #ifdef W3_WNT2
922  REAL :: RD2
923 #endif
924  REAL :: MDARC
925  !/
926  !/ ------------------------------------------------------------------- /
927  !/
928 #ifdef W3_S
929  CALL strace (ient, 'W3UTAU')
930 #endif
931  !
932  ! 1. Prepare auxiliary arrays
933  !
934  IF ( flfrst ) THEN
935  DO isea=1, nsea
936 #ifdef W3_SMC
937  !!Li For sea-point only SMC grid momentum 1-D momentum is stored on
938  !!Li 2-D UX0(NSEA, 1) variable.
939  IF( fswnd ) THEN
940  ix = isea
941  iy = 1
942  ELSE
943 #endif
944  ix = mapsf(isea,1)
945  iy = mapsf(isea,2)
946 #ifdef W3_SMC
947  ENDIF
948 #endif
949 
950  ma0(isea) = sqrt( ux0(ix,iy)**2 + uy0(ix,iy)**2 )
951  mai(isea) = sqrt( uxn(ix,iy)**2 + uyn(ix,iy)**2 )
952  IF ( ma0(isea) .GT. 1.e-7) THEN
953  d0 = mod( tpi+atan2(uy0(ix,iy),ux0(ix,iy)) , tpi )
954  ELSE
955  d0 = 0
956  END IF
957  IF ( mai(isea) .GT. 1.e-7) THEN
958  dn = mod( tpi+atan2(uyn(ix,iy),uxn(ix,iy)) , tpi )
959  ELSE
960  dn = d0
961  END IF
962  IF ( ma0(isea) .GT. 1.e-7) THEN
963  md0(isea) = d0
964  ELSE
965  md0(isea) = dn
966  END IF
967  dd = dn - md0(isea)
968  IF (abs(dd).GT.pi) dd = dd - tpi*sign(1.,dd)
969  mdi(isea) = dd
970  mai(isea) = mai(isea) - ma0(isea)
971  END DO
972  END IF
973  !
974  ! 2. Calculate interpolation factor
975  !
976  dt0n = dsec21( tu0, tun )
977  dt0t = dsec21( tu0, time )
978  !
979 #ifdef W3_WNT0
980  rd = 0.
981 #endif
982 #ifdef W3_WNT1
983  rd = dt0t / max( 1.e-7 , dt0n )
984 #endif
985 #ifdef W3_WNT2
986  rd = dt0t / max( 1.e-7 , dt0n )
987  rd2 = 1. - rd
988 #endif
989 #ifdef W3_OASACM
990  rd = 1.
991 #endif
992  !
993 #ifdef W3_T
994  WRITE (ndst,9000) dt0n, dt0t, rd
995 #endif
996  !
997  ! 3. Actual momentum for all grid points
998  !
999 #ifdef W3_OMPG
1000  !$OMP PARALLEL DO PRIVATE (ISEA,MI2,MXR,MYR,MDARC)
1001 #endif
1002  !
1003  DO isea=1, nsea
1004  !
1005  taua(isea) = ma0(isea) + rd * mai(isea)
1006 #ifdef W3_WNT2
1007  mi2 = sqrt( rd2 * ma0(isea)**2 + &
1008  rd *(ma0(isea)+mai(isea))**2 )
1009  taua(isea) = taua(isea) * min(1.25,mi2/max(1.e-7,taua(isea)))
1010 #endif
1011  tauadir(isea) = md0(isea) + rd * mdi(isea)
1012 #ifdef W3_SMC
1013  !Li Rotate momentum direction by ANGARC for Arctic part cells.
1014  IF( arctc .AND. (isea .GT. nglo) ) THEN
1015  mdarc = tauadir(isea) + angarc( isea - nglo )*dera
1016  tauadir(isea) = mod( tpi + mdarc, tpi )
1017  ENDIF
1018 #endif
1019  !
1020  END DO
1021  !
1022  RETURN
1023  !
1024  ! Formats
1025  !
1026 #ifdef W3_T
1027 9000 FORMAT (' TEST W3UTAU : DT0N, DT0T, RD :',2f8.1,f6.3)
1028 #endif
1029  !/
1030  !/ End of W3UTAU ----------------------------------------------------- /
1031  !/
1032  END SUBROUTINE w3utau
1033  !/ ------------------------------------------------------------------- /
1049  SUBROUTINE w3uini ( A )
1050  !/
1051  !/ +-----------------------------------+
1052  !/ | WAVEWATCH III NOAA/NCEP |
1053  !/ | H. L. Tolman |
1054  !/ | FORTRAN 90 |
1055  !/ | Last update : 06-Jun-2018 |
1056  !/ +-----------------------------------+
1057  !/
1058  !/ 19-Oct-1998 : Final FORTRAN 77 ( version 1.18 )
1059  !/ 20-Dec-1999 : Upgrade to FORTRAN 90 ( version 2.00 )
1060  !/ 24-Jan-2001 : Flat grid version. ( version 2.06 )
1061  !/ 18-May-2001 : Fix CG declaration. ( version 2.11 )
1062  !/ 15-Dec-2004 : Multiple grid version. ( version 3.06 )
1063  !/ 30-Oct-2009 : Implement run-time grid selection. ( version 3.14 )
1064  !/ (W. E. Rogers & T. J. Campbell, NRL)
1065  !/ 30-Oct-2009 : Implement curvilinear grid type. ( version 3.14 )
1066  !/ (W. E. Rogers & T. J. Campbell, NRL)
1067  !/ 30-Oct-2009 : Implement curvilinear grid type. ( version 3.14 )
1068  !/ 06-Jun-2018 : use W3PARALL and INIT_GET_ISEA ( version 6.04 )
1069  !/
1070  ! 1. Purpose :
1071  !
1072  ! Initialize the wave field with fetch-limited spectra before the
1073  ! actual calculation start. (Named as an update routine due to
1074  ! placement in code.)
1075  !
1076  ! 2. Method :
1077  !
1078  ! Fetch-limited JONSWAP spectra with a cosine^2 directional
1079  ! distribution and a mean direction taken from the wind.
1080  !
1081  ! 3. Parameters :
1082  !
1083  ! Parameter list
1084  ! ----------------------------------------------------------------
1085  ! A R.A. O Action density spectra.
1086  ! ----------------------------------------------------------------
1087  !
1088  ! 4. Subroutines used :
1089  !
1090  ! See module documentation.
1091  !
1092  ! 5. Called by :
1093  !
1094  ! Name Type Module Description
1095  ! ----------------------------------------------------------------
1096  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
1097  ! ----------------------------------------------------------------
1098  !
1099  ! 6. Error messages :
1100  !
1101  ! None.
1102  !
1103  ! 7. Remarks :
1104  !
1105  ! - Wind speeds filtered by U10MIN and U10MAX (DATA statements)
1106  !
1107  ! 8. Structure :
1108  !
1109  ! See source code.
1110  !
1111  ! 9. Switches :
1112  !
1113  ! !/SHRD Switch for shared / distributed memory architecture.
1114  ! !/DIST Id.
1115  !
1116  ! !/S Enable subroutine tracing.
1117  ! !/T General test output.
1118  ! !/T1 Parameters at grid points.
1119  !
1120  ! 10. Source code :
1121  !
1122  !/ ------------------------------------------------------------------- /
1123  USE w3gdatmd, ONLY: nx, ny, nsea, nseal, mapsf, &
1124  nk, nth, th, sig, dth, dsip, ungtype, &
1125  rlgtype, clgtype, gtype, flagll, &
1126  hpfac, hqfac
1127  USE w3adatmd, ONLY: u10, u10d, cg
1129  USE w3parall, only : get_jsea_ibelong
1130 #ifdef W3_T
1131  USE w3arrymd, ONLY : prtblk
1132 #endif
1133  !
1134  IMPLICIT NONE
1135  !/
1136  !/ ------------------------------------------------------------------- /
1137  !/ Parameter list
1138  !/
1139  REAL, INTENT(OUT) :: A(NTH,NK,0:NSEAL)
1140  !/
1141  !/ ------------------------------------------------------------------- /
1142  !/ Local variables
1143  !/
1144  INTEGER :: IX, IY, ISEA, JSEA, IK, ITH, ISPROC
1145 #ifdef W3_S
1146  INTEGER, SAVE :: IENT = 0
1147 #endif
1148 #ifdef W3_T
1149  INTEGER :: IX0, IXN, MAPOUT(NX,NY)
1150  INTEGER :: NXP = 60
1151 #endif
1152  REAL :: ALFA(NSEAL), FP(NSEAL), YLN(NSEAL), &
1153  AA, BB, CC
1154  REAL :: XGR, U10C, U10DIR, XSTAR, FSTAR, &
1155  GAMMA, FR, D1(NTH), D1INT, F1, F2
1156  REAL :: ETOT, E1I
1157  REAL :: U10MIN = 1.
1158  REAL :: U10MAX = 20.
1159 #ifdef W3_T
1160  REAL :: HSIG(NX,NY)
1161 #endif
1162  !/
1163  !/ ------------------------------------------------------------------- /
1164  !/
1165 #ifdef W3_S
1166  CALL strace (ient, 'W3UINI')
1167 #endif
1168  !
1169  !
1170  ! Pre-process JONSWAP data for all grid points ----------------------- *
1171  !
1172 #ifdef W3_T1
1173  WRITE (ndst,9010)
1174 #endif
1175  !
1176  ! this is not clear what is going on betwen w3init and this ...
1177  a(:,:,:)=0
1178  DO jsea=1, nseal
1179  CALL init_get_isea(isea, jsea)
1180  IF (gtype.EQ.ungtype) THEN
1181  xgr=1. ! to be fixed later
1182  ELSE
1183  ix = mapsf(isea,1)
1184  iy = mapsf(isea,2)
1185  xgr = 0.5 * sqrt(hpfac(iy,ix)**2+hqfac(iy,ix)**2)
1186  END IF
1187  IF ( flagll ) THEN
1188  xgr = xgr * radius * dera
1189  END IF
1190  !
1191  u10c = max( min(u10(isea),u10max) , u10min )
1192  !
1193  xstar = grav * xgr / u10c**2
1194  fstar = 3.5 / xstar**(0.33)
1195  gamma = max( 1. , 7.0 / xstar**(0.143) )
1196  !
1197  alfa(jsea) = 0.076 / xstar**(0.22)
1198  fp(jsea) = fstar * grav / u10c
1199  yln(jsea) = log( gamma )
1200  !
1201 #ifdef W3_T1
1202  WRITE (ndst,9011) isea, u10c, xstar, &
1203  alfa(jsea), fp(jsea), gamma
1204 #endif
1205  !
1206  END DO
1207  !
1208  ! 1-D spectrum at location ITH = NTH --------------------------------- *
1209  !
1210  DO ik=1, nk
1211  fr = sig(ik) * tpiinv
1212  DO jsea=1, nseal
1213  !
1214  !/ ----- INLINED EJ5P (REDUCED) -------------------------------------- /
1215  !
1216  aa = alfa(jsea) * 0.06175/fr**5
1217  bb = max( -50. , -1.25*(fp(jsea)/fr)**4 )
1218  cc = max( -50. , -0.5*((fr-fp(jsea))/(0.07*fp(jsea)))**2 )
1219  a(nth,ik,jsea) &
1220  = aa * exp(bb + exp(cc) * yln(jsea))
1221  !
1222  !/ ----- INLINED EJ5P (END) ------------------------------------------ /
1223  !
1224  END DO
1225  END DO
1226  !
1227  ! Apply directional distribution ------------------------------------- *
1228  !
1229  DO jsea=1, nseal
1230  CALL init_get_isea(isea, jsea)
1231  u10dir = u10d(isea)
1232  d1int = 0.
1233  !
1234  DO ith=1, nth
1235  d1(ith) = ( max( 0. , cos(th(ith)-u10dir) ) )**2
1236  d1int = d1int + d1(ith)
1237  END DO
1238  !
1239  d1int = d1int * dth
1240  f1 = tpiinv / d1int
1241  !
1242  DO ik=1, nk
1243  f2 = f1 * a(nth,ik,jsea) * cg(ik,isea) / sig(ik)
1244  DO ith=1, nth
1245  a(ith,ik,jsea) = f2 * d1(ith)
1246  END DO
1247  END DO
1248  !
1249  END DO
1250  !
1251  ! Test output -------------------------------------------------------- *
1252  !
1253 #ifdef W3_T
1254  hsig = 0.
1255  mapout = 0
1256 #endif
1257  !
1258 #ifdef W3_T
1259  DO isea=iaproc, nsea, naproc
1260  jsea = 1 + (isea-1)/naproc
1261  etot = 0.
1262  DO ik=1, nk
1263  e1i = 0.
1264  DO ith=1, nth
1265  e1i = e1i + a(ith,ik,jsea)
1266  END DO
1267  etot = etot + e1i * dsip(ik) * sig(ik) / cg(ik,isea)
1268  END DO
1269  ix = mapsf(isea,1)
1270  iy = mapsf(isea,2)
1271  hsig(ix,iy) = 4. * sqrt( etot * dth )
1272  mapout(ix,iy) = 1
1273  END DO
1274 #endif
1275  !
1276 #ifdef W3_T
1277  ix0 = 1
1278  DO
1279  ixn = min( nx , ix0+nxp-1 )
1280  CALL prtblk (ndst, nx, ny, nx, hsig, mapout, 0, 0., &
1281  ix0, ixn, 1, 1, ny, 1, 'Hs', 'm')
1282  IF ( ixn .EQ. nx ) EXIT
1283  ix0 = ix0 + nxp
1284  END DO
1285 #endif
1286  !
1287  RETURN
1288  !
1289  ! Formats
1290  !
1291 #ifdef W3_T
1292 9000 FORMAT (' TEST W3UINI : XGR = ',e10.3)
1293 #endif
1294  !
1295 #ifdef W3_T1
1296 9010 FORMAT (' TEST W3UINI : ISEA, U10C, XSTAR, ALPHA, FP, GAMMA')
1297 9011 FORMAT (' ',i6,f8.2,f10.1,2f6.3,f6.2)
1298 #endif
1299  !/
1300  !/ End of W3UINI ----------------------------------------------------- /
1301  !/
1302  END SUBROUTINE w3uini
1303  !/ ------------------------------------------------------------------- /
1313  SUBROUTINE w3ubpt
1314  !/
1315  !/ +-----------------------------------+
1316  !/ | WAVEWATCH III NOAA/NCEP |
1317  !/ | H. L. Tolman |
1318  !/ | FORTRAN 90 |
1319  !/ | Last update : 06-Jun-2018 |
1320  !/ +-----------------------------------+
1321  !/
1322  !/ 19-Oct-1998 : Final FORTRAN 77 ( version 1.18 )
1323  !/ 20-Dec-1999 : Upgrade to FORTRAN 90 ( version 2.00 )
1324  !/ 15-Dec-2004 : Multiple grid version. ( version 3.06 )
1325  !/ 07-Sep-2005 : Moving update to end of time step. ( version 3.08 )
1326  !/ 17-Aug-2010 : Add initialization ABPI0-N(:,0). ( version 3.14.5 )
1327  !/ 12-Jun-2012 : Add /RTD option or rotated grid option.
1328  !/ (Jian-Guo Li) ( version 4.06 )
1329  !/ 06-Jun-2018 : Add DEBUGIOBC/SETUP/DEBUGW3ULEV ( version 6.04 )
1330  !/ 13-Jun-2019 : Rotation only if POLAT<90 (C.Hansen)( version 7.11 )
1331  !/
1332  ! 1. Purpose :
1333  !
1334  ! Update spectra at the active boundary points.
1335  !
1336  ! 2. Method :
1337  !
1338  ! Spectra are read and interpolated in space and time from the
1339  ! data read by W3IOBC.
1340  !
1341  ! 3. Parameters :
1342  !
1343  ! Parameter list
1344  ! ----------------------------------------------------------------
1345  ! ----------------------------------------------------------------
1346  !
1347  ! 4. Subroutines used :
1348  !
1349  ! See module documentation.
1350  !
1351  ! 5. Called by :
1352  !
1353  ! Name Type Module Description
1354  ! ----------------------------------------------------------------
1355  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
1356  ! ----------------------------------------------------------------
1357  ! STRACE, DSEC21
1358  ! Service routines.
1359  !
1360  ! 6. Error messages :
1361  !
1362  ! None.
1363  !
1364  ! 7. Remarks :
1365  !
1366  ! - The data arrays contain sigma spectra to assure conservation
1367  ! when changing grids.
1368  !
1369  ! 8. Structure :
1370  !
1371  ! See source code.
1372  !
1373  ! 9. Switches :
1374  !
1375  ! !/S Enable subroutine tracing.
1376  ! !/T0 Test output of wave heights.
1377  !
1378  ! 10. Source code :
1379  !
1380  !/ ------------------------------------------------------------------- /
1381  USE w3gdatmd, ONLY: nspec, mapwn, sig2, dden
1382 #ifdef W3_RTD
1383  !! Use rotation angle and action conversion sub. JGLi12Jun2012
1384  USE w3gdatmd, ONLY: nk, nth, nspec, angld, polat
1385  USE w3servmd, ONLY: w3acturn
1386 #endif
1387  USE w3adatmd, ONLY: cg
1388  USE w3odatmd, ONLY: nbi, abpi0, abpin, isbpi, ipbpi, rdbpi, &
1389  bbpi0, bbpin
1390  !/
1391  IMPLICIT NONE
1392  !/
1393  !/ ------------------------------------------------------------------- /
1394  !/ Parameter list
1395  !/
1396  !/ ------------------------------------------------------------------- /
1397  !/
1398  INTEGER :: IBI, ISP, ISEA
1399 #ifdef W3_S
1400  INTEGER, SAVE :: IENT = 0
1401 #endif
1402 #ifdef W3_T0
1403  REAL :: HS1, HS2
1404 #endif
1405 #ifdef W3_RTD
1406  !! Declare a temporary spectr variable. JGLi12Jun2012
1407  REAL :: Spectr(NSPEC), AnglBP
1408 #endif
1409  !/
1410  !/ ------------------------------------------------------------------- /
1411  !/
1412 #ifdef W3_S
1413  CALL strace (ient, 'W3UBPT')
1414 #endif
1415  !
1416  ! 1. Process BBPI0 -------------------------------------------------- *
1417  ! 1.a First intialization
1418 
1419 
1420  !
1421  IF ( bbpi0(1,0) .EQ. -1. ) THEN
1422  !
1423  bbpi0(:,0) = 0.
1424  bbpin(:,0) = 0.
1425  abpi0(:,0) = 0.
1426  abpin(:,0) = 0.
1427  !
1428  DO ibi=1, nbi
1429  isea = isbpi(ibi)
1430  DO isp=1, nspec
1431  bbpi0(isp,ibi) = cg(mapwn(isp),isea) / sig2(isp) * &
1432  ( rdbpi(ibi,1) * abpi0(isp,ipbpi(ibi,1)) &
1433  + rdbpi(ibi,2) * abpi0(isp,ipbpi(ibi,2)) &
1434  + rdbpi(ibi,3) * abpi0(isp,ipbpi(ibi,3)) &
1435  + rdbpi(ibi,4) * abpi0(isp,ipbpi(ibi,4)) )
1436  END DO
1437  END DO
1438  !
1439  ! 1.b Shift BBPIN
1440  !
1441  ELSE
1442  bbpi0 = bbpin
1443  END IF
1444  !
1445  ! 2. Process BBPIN -------------------------------------------------- *
1446  !
1447  DO ibi=1, nbi
1448  isea = isbpi(ibi)
1449  DO isp=1, nspec
1450  bbpin(isp,ibi) = cg(mapwn(isp),isea) / sig2(isp) * &
1451  ( rdbpi(ibi,1) * abpin(isp,ipbpi(ibi,1)) &
1452  + rdbpi(ibi,2) * abpin(isp,ipbpi(ibi,2)) &
1453  + rdbpi(ibi,3) * abpin(isp,ipbpi(ibi,3)) &
1454  + rdbpi(ibi,4) * abpin(isp,ipbpi(ibi,4)) )
1455  END DO
1456  !
1457 #ifdef W3_RTD
1458  !! Rotate the spectra if model is on rotated grid. JGLi12Jun2012
1459  !! PoLat == 90. if the grid is standard lat/lon (C. Hansen 20190613)
1460  IF ( polat < 90. ) THEN
1461  spectr = bbpin(:,ibi)
1462  anglbp = angld(isea)
1463  CALL w3acturn( nth, nk, anglbp, spectr )
1464  bbpin(:,ibi) = spectr
1465  END IF
1466 
1467 #endif
1468  !
1469  END DO
1470 
1471  ! 3. Wave height test output ---------------------------------------- *
1472  !
1473 #ifdef W3_T0
1474  WRITE (ndst,9000)
1475  DO ibi=1, nbi
1476  hs1 = 0.
1477  hs2 = 0.
1478  DO isp=1, nspec
1479  hs1 = hs1 + bbpi0(isp,ibi) * dden(mapwn(isp)) / &
1480  cg(mapwn(isp),isbpi(ibi))
1481  hs2 = hs2 + bbpin(isp,ibi) * dden(mapwn(isp)) / &
1482  cg(mapwn(isp),isbpi(ibi))
1483  END DO
1484  hs1 = 4. * sqrt( hs1 )
1485  hs2 = 4. * sqrt( hs2 )
1486  WRITE (ndst,9001) ibi, isbpi(ibi), hs1, hs2
1487  END DO
1488 #endif
1489  !
1490  RETURN
1491  !
1492  ! Formats
1493  !
1494 #ifdef W3_T0
1495 9000 FORMAT ( ' TEST W3UBPT : WAVE HEIGHTS BBPI0/N (NO TAIL)')
1496 9001 FORMAT ( ' ',2i8,2x,2f8.2)
1497 #endif
1498 
1499  !/
1500  !/ End of W3UBPT ----------------------------------------------------- /
1501  !/
1502  END SUBROUTINE w3ubpt
1503  !/ ------------------------------------------------------------------- /
1512  SUBROUTINE w3uic1( FLFRST )
1513  !/
1514  !/ +-----------------------------------+
1515  !/ | WAVEWATCH III NOAA/NCEP |
1516  !/ | C. Sevigny |
1517  !/ | FORTRAN 90 |
1518  !/ | Last update : 27-Aug-2015 |
1519  !/ +-----------------------------------+
1520  !/
1521  !/ 27-Aug-2015 : Creation ( version 5.10 )
1522  !/
1523  ! 1. Purpose :
1524  !
1525  ! Update ice thickness in the wave model.
1526  !
1527  ! 2. Method :
1528  !
1529  ! 3. Parameters :
1530  !
1531  ! Parameter list
1532  ! ----------------------------------------------------------------
1533  ! FLFRST L. I Spectra in 1-D or 2-D representation
1534  ! (points to same address).
1535  ! ----------------------------------------------------------------
1536  !
1537  ! 4. Subroutines used :
1538  !
1539  ! See module documentation.
1540  !
1541  ! 5. Called by :
1542  !
1543  ! Name Type Module Description
1544  ! ----------------------------------------------------------------
1545  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
1546  ! ----------------------------------------------------------------
1547  !
1548  ! 6. Error messages :
1549  !
1550  ! None.
1551  !
1552  ! 7. Remarks :
1553  !
1554  ! 8. Structure :
1555  !
1556  ! See source code.
1557  !
1558  ! 9. Switches :
1559  !
1560  ! !/SHRD Switch for shared / distributed memory architecture.
1561  ! !/DIST Id.
1562  !
1563  ! !/S Enable subroutine tracing.
1564  ! !/T Enable test output.
1565  !
1566  ! 10. Source code :
1567  !
1568  !/ ------------------------------------------------------------------- /
1569  USE w3gdatmd, ONLY: nsea, nsea, mapsf, iicehmin, iicehfac
1570  USE w3wdatmd, ONLY: time, tic1, iceh
1571  USE w3idatmd, ONLY: ti1, icep1, flic1
1572  !/
1573  IMPLICIT NONE
1574  !/
1575  !/ ------------------------------------------------------------------- /
1576  !/ Parameter list
1577  LOGICAL, INTENT(IN) :: FLFRST
1578  !/
1579  !/ ------------------------------------------------------------------- /
1580  !/ Local variables
1581  !/
1582  INTEGER :: IX, IY, ISEA
1583  !/
1584  !/
1585  ! 1. Preparations --------------------------------------------------- *
1586  ! 1.a Update times
1587  !
1588 #ifdef W3_T
1589  WRITE (ndst,9010) time, tic1, ti1
1590 #endif
1591  tic1(1) = ti1(1)
1592  tic1(2) = ti1(2)
1593 
1594  ! 2. Main loop over sea points -------------------------------------- *
1595 
1596  DO isea=1, nsea
1597  !
1598  ix = mapsf(isea,1)
1599  iy = mapsf(isea,2)
1600  iceh(isea) = max(iicehmin,iicehfac*icep1(ix,iy))
1601  END DO
1602  !
1603  RETURN
1604 #ifdef W3_T
1605 9010 FORMAT ( ' TEST W3UIC1 : TIME :',i9.8,i7.6/ &
1606  ' OLD TICE :',i9.8,i7.6/ &
1607  ' NEW TICE :',i9.8,i7.6)
1608 #endif
1609  !/
1610  !/ End of W3UIC1 ----------------------------------------------------- /
1611  !/
1612  END SUBROUTINE w3uic1
1613  !/ ------------------------------------------------------------------- /
1623  SUBROUTINE w3uic5( FLFRST )
1624  !/
1625  !/ +-----------------------------------+
1626  !/ | WAVEWATCH III NOAA/NCEP |
1627  !/ | C. Sevigny & F. Ardhuin |
1628  !/ | FORTRAN 90 |
1629  !/ | Last update : 13-Jan-2016 |
1630  !/ +-----------------------------------+
1631  !/
1632  !/ 27-Aug-2015 : Creation ( version 5.08 )
1633  !/ 13-Jan-2016 : Changed initial value of ICEDMAX ( version 5.08 )
1634  !/
1635  ! 1. Purpose :
1636  !
1637  ! Update ice floe mean and max diameters in the wave model.
1638  !
1639  ! 2. Method :
1640  !
1641  ! 3. Parameters :
1642  !
1643  ! Parameter list
1644  ! ----------------------------------------------------------------
1645  ! FLFRST L. I Spectra in 1-D or 2-D representation
1646  ! (points to same address).
1647  ! ----------------------------------------------------------------
1648  !
1649  ! 4. Subroutines used :
1650  !
1651  ! See module documentation.
1652  !
1653  ! 5. Called by :
1654  !
1655  ! Name Type Module Description
1656  ! ----------------------------------------------------------------
1657  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
1658  ! ----------------------------------------------------------------
1659  !
1660  ! 6. Error messages :
1661  !
1662  ! None.
1663  !
1664  ! 7. Remarks :
1665  !
1666  ! 8. Structure :
1667  !
1668  ! See source code.
1669  !
1670  ! 9. Switches :
1671  !
1672  ! !/SHRD Switch for shared / distributed memory architecture.
1673  ! !/DIST Id.
1674  !
1675  ! !/S Enable subroutine tracing.
1676  ! !/T Enable test output.
1677  !
1678  ! 10. Source code :
1679  !
1680  !/ ------------------------------------------------------------------- /
1681  USE w3idatmd, ONLY: ti5, icep5
1682  USE w3gdatmd, ONLY: nsea, mapsf
1683  USE w3wdatmd, ONLY: time, tic5, ice, iceh, icef, icedmax
1684  !/
1685  IMPLICIT NONE
1686  !/
1687  !/ ------------------------------------------------------------------- /
1688  !/ Parameter list
1689  LOGICAL, INTENT(IN) :: FLFRST
1690  !/
1691  !/
1692  !/ ------------------------------------------------------------------- /
1693  !/ Local variables
1694  !/
1695  INTEGER :: IX, IY, ISEA
1696  LOGICAL :: FLFLOE
1697  !/
1698  !/
1699  ! 1. Preparations --------------------------------------------------- *
1700  ! 1.a Update times
1701  !
1702 #ifdef W3_T
1703  WRITE (ndst,9010) time, tic5, ti5
1704 #endif
1705  tic5(1) = ti5(1)
1706  tic5(2) = ti5(2)
1707 
1708  ! 2. Main loop over sea points -------------------------------------- *
1709 
1710  DO isea=1, nsea
1711  !
1712  ix = mapsf(isea,1)
1713  iy = mapsf(isea,2)
1714  flfloe = ice(isea) .EQ. 0 .OR. iceh(isea) .EQ. 0
1715  IF ( flfloe) THEN
1716  icef(isea) = 0.0
1717  icedmax(isea) = 1000.0
1718  ELSE
1719  icef(isea) = icep5(ix,iy)
1720  icedmax(isea) = icep5(ix,iy)
1721  END IF
1722  END DO
1723  !
1724  RETURN
1725 #ifdef W3_T
1726 9010 FORMAT ( ' TEST W3UIC5 : TIME :',i9.8,i7.6/ &
1727  ' OLD TICE :',i9.8,i7.6/ &
1728  ' NEW TICE :',i9.8,i7.6)
1729 #endif
1730 
1731  !/
1732  !/
1733  !/ End of W3UIC5 ----------------------------------------------------- /
1734  !/
1735  END SUBROUTINE w3uic5
1736  !/ ------------------------------------------------------------------- /
1755  SUBROUTINE w3uice ( VA )
1756  !/
1757  !/ +-----------------------------------+
1758  !/ | WAVEWATCH III NOAA/NCEP |
1759  !/ | H. L. Tolman |
1760  !/ | FORTRAN 90 |
1761  !/ | Last update : 28-Mar-2014 |
1762  !/ +-----------------------------------+
1763  !/
1764  !/ 19-Oct-1998 : Final FORTRAN 77 ( version 1.18 )
1765  !/ 20-Dec-1999 : Upgrade to FORTRAN 90 ( version 2.00 )
1766  !/ 11-Jan-2002 : Sub-grid ice. ( version 2.15 )
1767  !/ 15-Dec-2004 : Multiple grid version. ( version 3.06 )
1768  !/ 28-Jun-2005 : Adding MAPST2. ( version 3.07 )
1769  !/ Taking out initilization.
1770  !/ 11-May-2007 : Adding NTPROC/NAPROC separation. ( version 3.11 )
1771  !/ 15-May-2010 : Adding second field for icebergs ( version 3.14 )
1772  !/ 13-Mar-2012 : Add initialization of UST on re- ( version 4.07 )
1773  !/ activation of grid point.
1774  !/ 06-Jun-2012 : Porting bugfixes from 3.14 to 4.07 ( version 4.07 )
1775  !/ 28-Mar-2014 : Adapting to ICx source terms ( version 4.18 )
1776  !/
1777  ! 1. Purpose :
1778  !
1779  ! Update ice map in the wave model.
1780  !
1781  ! 2. Method :
1782  !
1783  ! Points with an ice concentration larger than FICEN are removed
1784  ! from the sea map in the wave model. Such points are identified
1785  ! by negative numbers is the grid status map MAPSTA. For ice
1786  ! points spectra are set to zero. Points from wich ice disappears
1787  ! are initialized with a "small" JONSWAP spectrum, based on the
1788  ! frequency SIG(NK-1) and the local wind direction.
1789  !
1790  ! In the case of icebergs, the iceberg attenuation coefficient is
1791  ! added to the subgrid obstruction map.
1792  !
1793  ! 3. Parameters :
1794  !
1795  ! Parameter list
1796  ! ----------------------------------------------------------------
1797  ! VA R.A. I/O Spectra in 1-D or 2-D representation
1798  ! (points to same address).
1799  ! ----------------------------------------------------------------
1800  !
1801  ! 4. Subroutines used :
1802  !
1803  ! See module documentation.
1804  !
1805  ! 5. Called by :
1806  !
1807  ! Name Type Module Description
1808  ! ----------------------------------------------------------------
1809  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
1810  ! ----------------------------------------------------------------
1811  !
1812  ! 6. Error messages :
1813  !
1814  ! None.
1815  !
1816  ! 7. Remarks :
1817  !
1818  ! 8. Structure :
1819  !
1820  ! See source code.
1821  !
1822  ! 9. Switches :
1823  !
1824  ! !/SHRD Switch for shared / distributed memory architecture.
1825  ! !/DIST Id.
1826  !
1827  ! !/S Enable subroutine tracing.
1828  ! !/T Enable test output.
1829  !
1830  ! 10. Source code :
1831  !
1832  !/ ------------------------------------------------------------------- /
1833  USE w3gdatmd, ONLY: nx, ny, nsea, mapsf, mapsta, mapst2, &
1834  nspec, ficen
1835  USE w3wdatmd, ONLY: time, tice, ice, berg, ust
1836  USE w3adatmd, ONLY: nsealm, charn
1837 #if defined W3_ST3 || defined(W3_ST4)
1838  USE w3gdatmd, ONLY: aalpha
1839 #endif
1840  USE w3idatmd, ONLY: tin, icei, bergi
1842  !/
1843  IMPLICIT NONE
1844  !/
1845  !/ ------------------------------------------------------------------- /
1846  !/ Parameter list
1847  !/
1848  REAL, INTENT(INOUT) :: VA(NSPEC,0:NSEALM)
1849  !/
1850  !/ ------------------------------------------------------------------- /
1851  !/
1852  INTEGER :: ISEA, JSEA, IX, IY
1853 #ifdef W3_S
1854  INTEGER, SAVE :: IENT = 0
1855 #endif
1856  INTEGER :: MAPICE(NY,NX), ISPROC
1857  LOGICAL :: LOCAL
1858  !/
1859  !/ ------------------------------------------------------------------- /
1860  !/
1861 #ifdef W3_S
1862  CALL strace (ient, 'W3UICE')
1863 #endif
1864  !
1865  local = iaproc .LE. naproc
1866  !
1867 #ifdef W3_T
1868  WRITE (ndst,9000) ficen
1869  IF ( .NOT. local ) WRITE (ndst,9001)
1870 #endif
1871  !
1872  ! 1. Preparations --------------------------------------------------- *
1873  ! 1.a Update times
1874  !
1875 #ifdef W3_T
1876  WRITE (ndst,9010) time, tice, tin
1877 #endif
1878  tice(1) = tin(1)
1879  tice(2) = tin(2)
1880  !
1881  ! 1.b Process maps
1882  !
1883 #ifdef W3_IC0
1884  mapice = mod(mapst2,2)
1885  mapst2 = mapst2 - mapice
1886 #endif
1887  !
1888  ! 2. Main loop over sea points -------------------------------------- *
1889  !
1890  DO isea=1, nsea
1891  !
1892  ! 2.a Get grid counters
1893  !
1894  ix = mapsf(isea,1)
1895  iy = mapsf(isea,2)
1896  ice(isea) = icei(ix,iy)
1897  berg(isea)= bergi(ix,iy)
1898  !
1899  ! 2.b Sea point to be de-activated..
1900  !
1901 #ifdef W3_IC0
1902  IF ( icei(ix,iy).GE.ficen .AND. mapice(iy,ix).EQ.0 ) THEN
1903  mapsta(iy,ix) = - abs(mapsta(iy,ix))
1904  mapice(iy,ix) = 1
1905  CALL init_get_jsea_isproc(isea, jsea, isproc)
1906  IF (local .AND. (iaproc .eq. isproc)) THEN
1907 #ifdef W3_T
1908  WRITE (ndst,9021) isea, ix, iy, mapsta(iy,ix), &
1909  icei(ix,iy), 'ICE (NEW)'
1910 #endif
1911  va(:,jsea) = 0.
1912 #if defined W3_ST3 || defined(W3_ST4)
1913  charn(jsea) = aalpha
1914 #else
1915  charn(jsea) = 0.
1916 #endif
1917 #ifdef W3_T
1918  ELSE
1919  WRITE (ndst,9021) isea, ix, iy, mapsta(iy,ix), &
1920  icei(ix,iy), 'ICE (NEW X)'
1921 #endif
1922  END IF
1923 
1924 #ifdef W3_T
1925  ELSE IF ( icei(ix,iy).GE.ficen ) THEN
1926  WRITE (ndst,9021) isea, ix, iy, mapsta(iy,ix), &
1927  icei(ix,iy), 'ICE'
1928 #endif
1929  END IF
1930  !
1931  ! 2.b Ice point to be re-activated.
1932  !
1933  IF ( icei(ix,iy).LT.ficen .AND. mapice(iy,ix).EQ.1 ) THEN
1934 
1935  mapice(iy,ix) = 0
1936  ust(isea) = 0.05
1937 
1938  IF ( mapst2(iy,ix) .EQ. 0 ) THEN
1939  mapsta(iy,ix) = abs(mapsta(iy,ix))
1940 
1941  CALL init_get_jsea_isproc(isea, jsea, isproc)
1942  IF ( local .AND. (iaproc .eq. isproc) ) THEN
1943 #ifdef W3_T
1944  WRITE (ndst,9021) isea, ix, iy, mapsta(iy,ix), &
1945  icei(ix,iy), 'SEA (NEW)'
1946 #endif
1947  va(:,jsea) = 0.
1948 #if defined W3_ST3 || defined(W3_ST4)
1949  charn(jsea) = aalpha
1950 #else
1951  charn(jsea) = 0.
1952 #endif
1953 #ifdef W3_T
1954  ELSE
1955  WRITE (ndst,9021) isea, ix, iy, mapsta(iy,ix), &
1956  icei(ix,iy), 'SEA (NEW X)'
1957 #endif
1958  END IF
1959 
1960 #ifdef W3_T
1961  ELSE
1962  WRITE (ndst,9021) isea, ix, iy, mapsta(iy,ix), &
1963  icei(ix,iy), 'DIS'
1964 #endif
1965  END IF
1966 
1967 #ifdef W3_T
1968  ELSE IF ( icei(ix,iy).LT.ficen ) THEN
1969  WRITE (ndst,9021) isea, ix, iy, mapsta(iy,ix), &
1970  icei(ix,iy), 'SEA'
1971 #endif
1972 
1973  END IF
1974 #endif
1975 
1976  END DO
1977  !
1978  ! 3. Update MAPST2 -------------------------------------------------- *
1979  !
1980 #ifdef W3_IC0
1981  mapst2 = mapst2 + mapice
1982 #endif
1983  !
1984  RETURN
1985  !
1986 #ifdef W3_T
1987 9000 FORMAT ( ' TEST W3UICE : FICEN :',f9.3)
1988 9001 FORMAT ( ' TEST W3UICE : NO LOCAL SPECTRA')
1989 9010 FORMAT ( ' TEST W3UICE : TIME :',i9.8,i7.6/ &
1990  ' OLD TICE :',i9.8,i7.6/ &
1991  ' NEW TICE :',i9.8,i7.6)
1992 9020 FORMAT ( ' TEST W3UICE : ISEA, IX, IY, MAP, ICE, STATUS :')
1993 9021 FORMAT ( ' ',i8,3i4,f6.2,2x,a)
1994 #endif
1995  !/
1996  !/ End of W3UICE ----------------------------------------------------- /
1997  !/
1998  END SUBROUTINE w3uice
1999  !/ ------------------------------------------------------------------- /
2012  SUBROUTINE w3ulev ( A, VA )
2013  !/
2014  !/ +-----------------------------------+
2015  !/ | WAVEWATCH III NOAA/NCEP |
2016  !/ | H. L. Tolman |
2017  !/ | FORTRAN 90 |
2018  !/ | Last update : 26-Sep-2012 |
2019  !/ +-----------------------------------+
2020  !/
2021  !/ 15-Jan-1998 : Final FORTRAN 77 ( version 1.18 )
2022  !/ 21-Jan-2000 : Upgrade to FORTRAN 90 ( version 2.00 )
2023  !/ 30-Apr-2002 : Water level fixes. ( version 2.20 )
2024  !/ 15-Dec-2004 : Multiple grid version. ( version 3.06 )
2025  !/ 15-Jul-2005 : Adding drying out of points. ( version 3.07 )
2026  !/ 11-May-2007 : Adding NTPROC/NAPROC separation. ( version 3.11 )
2027  !/ 23-Aug-2011 : Bug fix for UG grids : new boundary ( version 4.04 )
2028  !/ 13-Mar-2012 : Add initialization of UST on re- ( version 4.07 )
2029  !/ activation of grid point.
2030  !/ 06-Jun-2012 : Porting bugfixes from 3.14 to 4.07 ( version 4.07 )
2031  !/ 26-Sep-2012 : Adding update from tidal analysis ( version 4.08 )
2032  !/
2033  ! 1. Purpose :
2034  !
2035  ! Update the water level.
2036  !
2037  ! 2. Method :
2038  !
2039  ! The wavenumber grid is modified without modyfying the spectrum
2040  ! (conservative linear interpolation to new grid).
2041  !
2042  ! 3. Parameters :
2043  !
2044  ! Parameter list
2045  ! ----------------------------------------------------------------
2046  ! (V)A R.A. I/O 2-D and 1-D represetation of the spectra.
2047  ! ----------------------------------------------------------------
2048  !
2049  ! Local variables
2050  ! ----------------------------------------------------------------
2051  ! KDMAX Real Deep water cut-off for kd.
2052  ! WNO R.A. Old wavenumbers.
2053  ! CGO R.A. Old group velocities.
2054  ! OWN R.A. Old wavenumber band width.
2055  ! DWN R.A. New wavenumber band width.
2056  ! TA R.A. Auxiliary spectrum.
2057  ! ----------------------------------------------------------------
2058  !
2059  ! 4. Subroutines used :
2060  !
2061  ! See module documentation.
2062  !
2063  ! 5. Called by :
2064  !
2065  ! Name Type Module Description
2066  ! ----------------------------------------------------------------
2067  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
2068  ! ----------------------------------------------------------------
2069  !
2070  ! 6. Error messages :
2071  !
2072  ! None.
2073  !
2074  ! 7. Remarks :
2075  !
2076  ! - The grid is updated only if KDmin > KDMAX.
2077  ! - The grid is updated for inactive points too.
2078  ! - The local wavenumber bandwidth is DSIGMA/CG.
2079  ! - The local spectrum is updated only if the grid is updated,
2080  ! the grid point is not disabled (MAPST2) and if the change of
2081  ! the lowest wavenumber exceeds RDKMIN times the band width.
2082  ! - No spectral initialization for newly wet points.
2083  !
2084  ! 8. Structure :
2085  !
2086  ! See source code.
2087  !
2088  ! 9. Switches :
2089  !
2090  ! !/S Enable subroutine tracing.
2091  ! !/T Basic test output.
2092  ! !/T2 Output of minimum relative depth per grid point.
2093  ! !/T3 Spectra before and after
2094  !
2095  ! 10. Source code :
2096  !
2097  !/ ------------------------------------------------------------------- /
2098  USE w3gdatmd, ONLY: nx, ny, nsea, nseal, mapsf, mapsta, mapst2, &
2099  zb, dmin, nk, nth, nspec, sig, dsip, &
2101  USE w3wdatmd, ONLY: time, tlev, wlv, ust
2102  USE w3adatmd, ONLY: cg, wn, dw, hs
2103  USE w3idatmd, ONLY: tln, wlev
2104  USE w3servmd, ONLY: extcde
2105  USE w3dispmd, ONLY: wavnu1
2106  USE w3timemd
2108  USE w3parall, only : get_jsea_ibelong
2109 #ifdef W3_PDLIB
2110  USE w3dispmd, ONLY: wavnu3
2111  USE pdlib_w3profsmd, ONLY : set_iobdp_pdlib
2112 #endif
2113 #ifdef W3_TIDE
2114  USE w3gdatmd, ONLY: ygrd
2115  USE w3idatmd, ONLY: fllevtide, wltide, ntide
2116  USE w3tidemd
2117 #endif
2118 #ifdef W3_SETUP
2119  USE w3wdatmd, ONLY: zeta_setup
2120  USE w3gdatmd, ONLY : do_change_wlv
2121 #endif
2122 
2123 
2124 #ifdef W3_T3
2125  USE w3arrymd, ONLY: prt2ds
2126 #endif
2127  !/
2128  IMPLICIT NONE
2129  !/
2130  !/ ------------------------------------------------------------------- /
2131  !/ Parameter list
2132  !/
2133  REAL, INTENT(INOUT) :: A(NTH,NK,0:NSEAL), VA(NSPEC,0:NSEAL)
2134  !/
2135  !/ ------------------------------------------------------------------- /
2136  !/
2137  INTEGER :: ISEA, JSEA, IX, IY, IK, I1, I2, &
2138  ISPEC, IK0, ITH
2139 #ifdef W3_S
2140  INTEGER, SAVE :: IENT = 0
2141 #endif
2142  INTEGER :: MAPDRY(NY,NX), ISPROC
2143  REAL :: DWO(NSEA), KDCHCK, WNO(0:NK+1), &
2144  CGO(0:NK+1), DEPTH, &
2145  RDK, RD1, RD2, TA(NTH,NK), &
2146  OWN(NK), DWN(NK)
2147  REAL :: KDMAX = 4., rdkmin = 0.05
2148  REAL :: WLVeff
2149 #ifdef W3_T3
2150  REAL :: OUT(NK,NTH)
2151 #endif
2152  LOGICAL :: LOCAL
2153  INTEGER :: IBELONG
2154  !
2155 #ifdef W3_TIDE
2156  INTEGER :: J
2157  INTEGER(KIND=4) :: TIDE_KD0, INT24, INTDYS ! "Gregorian day constant"
2158  REAL :: WLEVTIDE, TIDE_ARG, WLEVTIDE2(1)
2159  REAL(KIND=8) :: d1,h,tide_hour,hh,pp,s,p,enp,dh,dpp,ds,dp,dnp,tau
2160  REAL :: FX(44),UX(44),VX(44)
2161 #endif
2162  !/
2163  !/ ------------------------------------------------------------------- /
2164  !/
2165 #ifdef W3_S
2166  CALL strace (ient, 'W3ULEV')
2167 #endif
2168  !
2169  local = iaproc .LE. naproc
2170  !
2171 #ifdef W3_T
2172  WRITE (ndst,9000) kdmax, rdkmin
2173 #endif
2174  !
2175  ! 1. Preparations --------------------------------------------------- *
2176  ! 1.a Check NK
2177  !
2178  IF ( nk .LT. 2 ) THEN
2179  IF ( iaproc .EQ. naperr ) WRITE (ndse,1000)
2180  CALL extcde ( 1 )
2181  END IF
2182  !
2183  ! 1.b Update times
2184  !
2185 #ifdef W3_T
2186  WRITE (ndst,9010) time, tlev
2187 #endif
2188  tlev = tln
2189 #ifdef W3_T
2190  WRITE (ndst,9011) tlev
2191 #endif
2192  !
2193  ! 1.c Extract dry point map, and residual MAPST2
2194  !
2195  mapdry = mod(mapst2/2,2)
2196  mapst2 = mapst2 - 2*mapdry
2197  !
2198  ! 1.d Update water levels and save old
2199  !
2200 #ifdef W3_TIDE
2201  IF (fllevtide) THEN
2202  ! WRITE(6,*) 'TIME:',TIME
2203  tide_hour = time2hours(time)
2204  !
2205  !* THE ASTRONOMICAL ARGUMENTS ARE CALCULATED BY LINEAR APPROXIMATION
2206  !* AT THE MID POINT OF THE ANALYSIS PERIOD.
2207  d1=tide_hour/24.d0
2208  tide_kd0= 2415020
2209  d1=d1-dfloat(tide_kd0)-0.5d0
2210  call astr(d1,h,pp,s,p,enp,dh,dpp,ds,dp,dnp)
2211  int24=24
2212  intdys=int((tide_hour+0.00001)/int24)
2213  hh=tide_hour-dfloat(intdys*int24)
2214  tau=hh/24.d0+h-s
2215  END IF
2216  !
2217  ! ONLY THE FRACTIONAL PART OF A SOLAR DAY NEED BE RETAINED FOR COMPU-
2218  ! TING THE LUNAR TIME TAU.
2219  !
2220 #endif
2221  DO isea=1, nsea
2222  ix = mapsf(isea,1)
2223  iy = mapsf(isea,2)
2224  dwo(isea) = dw(isea)
2225  !
2226 #ifdef W3_TIDE
2227  IF (fllevtide) THEN
2228  ! VUF should be updated only if latitude changes significantly ...
2229  CALL setvuf_fast(h,pp,s,p,enp,dh,dpp,ds,dp,dnp,tau,real(ygrd(iy,ix)),fx,ux,vx)
2230  wlevtide = wltide(ix,iy,1,1)
2231  !Verification
2232  ! IF (ISEA.EQ.1) THEN
2233 
2234  tide_ampc(1:ntide,1)=wltide(ix,iy,1:ntide,1)
2235  tide_phg(1:ntide,1)=wltide(ix,iy,1:ntide,2)
2236  !
2237  ! WRITE(991,'(A,F20.2,13F8.3)') 'TEST ISEA 0:', &
2238  ! d1,H,S,TAU,pp,s,p,enp,dh,dpp,ds,dp,dnp,YGRD(IY,IX)
2239  j=1
2240  ! WRITE(991,'(A,4I9,F12.0,3F8.3,I4,X,A)') 'TEST ISEA 1:',IX,J,TIME,TIDE_HOUR, &
2241  ! FX(J),UX(J),VX(J),TIDE_INDEX2(J),TIDECON_ALLNAMES(TIDE_INDEX2(J))
2242  DO j=2,tide_mf
2243  tide_arg=(vx(j)+ux(j))*twpi-wltide(ix,iy,j,2)*dera
2244  wlevtide =wlevtide+fx(j)*wltide(ix,iy,j,1)*cos(tide_arg)
2245  ! WRITE(991,'(A,4I9,F12.0,3F8.3,I4,X,A)') 'TEST ISEA 1:',IX,J,TIME,TIDE_HOUR, &
2246  ! FX(J),UX(J),VX(J),TIDE_INDEX2(J),TIDECON_ALLNAMES(TIDE_INDEX2(J))
2247  END DO
2248  DO j=1,tide_mf
2249  ! WRITE(991,'(A,4I9,F12.0,5F8.3)') 'TEST ISEA 2:',IX,J,TIME,TIDE_HOUR, &
2250  ! FX(J),UX(J),VX(J),TIDE_AMPC(J,1),TIDE_PHG(J,1)
2251  END DO
2252  ! WRITE(991,'(A,3F7.3)') '#:',WLEV(IX,IY),WLEVTIDE,WLEV(IX,IY)-WLEVTIDE
2253 #endif
2254 
2255 #ifdef W3_TIDE
2256  ! CLOSE(991)
2257  ! END IF
2258  ! End of verification
2259  wlv(isea) = wlevtide
2260  ELSE
2261 #endif
2262  !
2263  wlv(isea) = wlev(ix,iy)
2264  wlveff = wlv(isea)
2265 
2266 #ifdef W3_SETUP
2267  IF (do_change_wlv) THEN
2268  wlveff = wlveff + zeta_setup(isea)
2269  wlv(isea) = wlveff
2270  END IF
2271 #endif
2272 #ifdef W3_TIDE
2273  ENDIF
2274 #endif
2275  dw(isea) = max( 0. , wlveff-zb(isea) )
2276 
2277  END DO ! NSEA
2278 
2279  !
2280  ! 2. Loop over all sea points --------------------------------------- *
2281  !
2282 #ifdef W3_T2
2283  WRITE (ndst,9020)
2284 #endif
2285  !
2286  DO isea=1, nsea
2287  !
2288  ix = mapsf(isea,1)
2289  iy = mapsf(isea,2)
2290  !
2291  ! 2.a Check if deep water
2292  !
2293  kdchck = wn(1,isea) * min( dwo(isea) , dw(isea) )
2294  IF ( kdchck .LT. kdmax ) THEN
2295  !
2296  ! 2.b Update grid and save old grid
2297  !
2298  depth = max( dmin, dw(isea) )
2299  !
2300  DO ik=0, nk+1
2301  wno(ik) = wn(ik,isea)
2302  cgo(ik) = cg(ik,isea)
2303  !
2304  ! Calculate wavenumbers and group velocities.
2305 #ifdef W3_PDLIB
2306  CALL wavnu3(sig(ik),depth,wn(ik,isea),cg(ik,isea))
2307 #else
2308  CALL wavnu1(sig(ik),depth,wn(ik,isea),cg(ik,isea))
2309 #endif
2310  END DO
2311  !
2312  DO ik=1, nk
2313  own(ik) = dsip(ik) / cgo(ik)
2314  dwn(ik) = dsip(ik) / cg(ik,isea)
2315  END DO
2316  !
2317  ! 2.c Process dry points
2318  !
2319  IF ( wlv(isea)-zb(isea) .LE.0. ) THEN
2320  IF ( mapdry(iy,ix) .EQ. 0 ) THEN
2321  CALL get_jsea_ibelong(isea, jsea, ibelong)
2322  IF ( local .AND. (ibelong .eq. 1) ) THEN
2323  va(:,jsea) = 0.
2324  END IF
2325  mapdry(iy,ix) = 1
2326  mapsta(iy,ix) = -abs(mapsta(iy,ix))
2327 #ifdef W3_T2
2328  WRITE (ndst,9021) isea, wlv(isea)-zb(isea), &
2329  0., 0., ' (NEW DRY)'
2330  ELSE
2331  WRITE (ndst,9021) isea, wlv(isea)-zb(isea), &
2332  0., 0., ' (DRY)'
2333 #endif
2334  ENDIF
2335  cycle
2336  END IF
2337  !
2338  ! 2.d Process new wet point
2339  !
2340  IF (wlv(isea)-zb(isea).GT.0. .AND. mapdry(iy,ix).EQ.1) THEN
2341  mapdry(iy,ix) = 0
2342  !
2343  ! Resets the spectrum to zero
2344  !
2345  CALL get_jsea_ibelong(isea, jsea, ibelong)
2346  IF ( local .AND. (ibelong .eq. 1) ) THEN
2347  va(:,jsea) = 0.
2348  END IF
2349  !
2350  ust(isea) = 0.05
2351  IF ( mapst2(iy,ix) .EQ. 0 ) THEN
2352  mapsta(iy,ix) = abs(mapsta(iy,ix))
2353 #ifdef W3_T2
2354  WRITE (ndst,9021) isea, wlv(isea)-zb(isea), &
2355  0., 0., ' (NEW WET)'
2356  ELSE
2357  WRITE (ndst,9021) isea, wlv(isea)-zb(isea), &
2358  0., 0., ' (NEW WET INACTIVE)'
2359 #endif
2360  END IF
2361  cycle
2362  END IF
2363  !
2364  ! 2.e Check if ice on grid point, or if grid changes negligible
2365  !
2366  rdk = abs(wno(1)-wn(1,isea)) / dwn(1)
2367  !
2368 #ifdef W3_T2
2369  IF ( mapsta(iy,ix) .LT. 0 ) THEN
2370  WRITE (ndst,9021) &
2371  isea, dw(isea), kdchck, rdk, ' (INACTIVE)'
2372  ELSE IF ( rdk .LT. rdkmin ) THEN
2373  WRITE (ndst,9021) &
2374  isea, dw(isea), kdchck, rdk, ' (NEGL)'
2375  ELSE
2376  WRITE (ndst,9021) &
2377  isea, dw(isea), kdchck, rdk, ' '
2378  END IF
2379 #endif
2380  !
2381  IF ( rdk.LT.rdkmin .OR. mapsta(iy,ix).LT.0 ) cycle
2382  CALL get_jsea_ibelong(isea, jsea, ibelong)
2383  IF ( ibelong .eq. 0) cycle
2384  !
2385  IF ( .NOT. local ) cycle
2386  !
2387  ! 2.d Save discrete actions and clean spectrum
2388  !
2389  DO ik=1, nk
2390  DO ith=1, nth
2391 #ifdef W3_T3
2392  out(ik,ith) = a(ith,ik,jsea) * sig(ik) / cgo(ik)
2393 #endif
2394  ta(ith,ik) = a(ith,ik,jsea) * own(ik)
2395  END DO
2396  END DO
2397  !
2398  va(:,jsea) = 0.
2399  !
2400 #ifdef W3_T3
2401  CALL prt2ds ( ndst, nk, nk, nth, out, sig, ' ', &
2402  tpi, 0., 1.e-5, 'F(f,th)', 'm2s', 'Before' )
2403 #endif
2404  !
2405  ! 2.e Redistribute discrete action density
2406  !
2407  IF ( wno(1) .LT. wn(1,isea) ) THEN
2408  ik0 = 1
2409  i1 = 0
2410  i2 = 1
2411 220 CONTINUE
2412  ik0 = ik0 + 1
2413  IF ( ik0 .GT. nk+1 ) GOTO 251
2414  IF ( wno(ik0) .GE. wn(1,isea) ) THEN
2415  ik0 = ik0 - 1
2416  ELSE
2417  GOTO 220
2418  END IF
2419  ELSE
2420  ik0 = 1
2421  i1 = 1
2422  i2 = 2
2423  END IF
2424  !
2425  DO ik=ik0, nk
2426  !
2427 230 CONTINUE
2428  IF ( wno(ik) .GT. wn(i2,isea) ) THEN
2429  i1 = i1 + 1
2430  IF ( i1 .GT. nk ) GOTO 250
2431  i2 = i1 + 1
2432  GOTO 230
2433  END IF
2434  !
2435  IF ( i1 .EQ. 0 ) THEN
2436  rd1 = ( wn(1,isea) - wno(ik) ) / dwn(1)
2437  rd2 = 1. - rd1
2438  ELSE
2439  rd1 = ( wn(i2,isea) - wno(ik) ) / &
2440  ( wn(i2,isea) - wn(i1,isea) )
2441  rd2 = 1. - rd1
2442  END IF
2443  !
2444  IF ( i1 .GE. 1 ) THEN
2445  DO ith=1, nth
2446  a(ith,i1,jsea) = a(ith,i1,jsea) + rd1*ta(ith,ik)
2447  END DO
2448  END IF
2449  !
2450  IF ( i2 .LE. nk ) THEN
2451  DO ith=1, nth
2452  a(ith,i2,jsea) = a(ith,i2,jsea) + rd2*ta(ith,ik)
2453  END DO
2454  END IF
2455  !
2456 250 CONTINUE
2457  END DO
2458 251 CONTINUE
2459  !
2460  ! 2.f Convert discrete action densities to spectrum
2461  !
2462  DO ispec=1, nspec
2463  va(ispec,jsea) = va(ispec,jsea) / dwn(mapwn(ispec))
2464  END DO
2465  !
2466  ! 2.f Add tail if necessary
2467  !
2468  IF ( i2.LE.nk .AND. rd2.LE.0.95 ) THEN
2469  DO ik=max(i2,2), nk
2470  DO ith=1, nth
2471  a(ith,ik,jsea) = fachfa * a(ith,ik-1,jsea)
2472  END DO
2473  END DO
2474  END IF
2475  !
2476 #ifdef W3_T3
2477  DO ispec=1, nspec
2478  ik = mapwn(ispec)
2479  ith = mapth(ispec)
2480  out(ik,ith) = a(ith,ik,jsea) * sig(ik) / cg(ik,isea)
2481  END DO
2482 #endif
2483  !
2484 #ifdef W3_T3
2485  CALL prt2ds ( ndst, nk, nk, nth, out, sig, ' ', &
2486  tpi, 0., 1.e-5, 'F(f,th)', 'm2s', 'After' )
2487 #endif
2488  !
2489 #ifdef W3_T2
2490  ELSE
2491  WRITE (ndst,9021) isea, kdchck, ' (DEEP)'
2492 #endif
2493  END IF
2494  !
2495  END DO ! NSEA
2496  !
2497  ! 3. Reconstruct new MAPST2 ----------------------------------------- *
2498  !
2499  mapst2 = mapst2 + 2*mapdry
2500  !
2501  ! 4. Re-generates the boundary data ---------------------------------- *
2502  !
2503  IF (gtype.EQ.ungtype) THEN
2504 #ifdef W3_PDLIB
2505  CALL set_iobdp_pdlib
2506 #endif
2507 #ifdef W3_REF1
2508  ELSE
2509  CALL w3setref
2510 #endif
2511  ENDIF
2512  !
2513  RETURN
2514  !
2515  ! Formats
2516  !
2517 1000 FORMAT (/' *** ERROR W3ULEV *** '/ &
2518  ' THIS ROUTINE REQUIRES NK > 1 '/)
2519  !
2520 #ifdef W3_T
2521 9000 FORMAT ( ' TEST W3ULEV : KDMAX :',f6.1/ &
2522  ' RDKMIN :',f8.3)
2523 #endif
2524  !
2525 #ifdef W3_T
2526 9010 FORMAT ( ' TEST W3ULEV : TIME :',i9.8,i7.6/ &
2527  ' OLD TLEV :',i9.8,i7.6)
2528 9011 FORMAT ( ' NEW TLEV :',i9.8,i7.6)
2529 #endif
2530  !
2531 #ifdef W3_T2
2532 9020 FORMAT ( ' TEST W3ULEV : LOOP OVER ALL POINTS:', &
2533  ' ISEA, DW, KDMIN, RDK : ')
2534 9021 FORMAT ( ' ',i6,f8.2,f6.2,f7.3,a)
2535 #endif
2536  !/
2537  !/ End of W3ULEV ----------------------------------------------------- /
2538  !/
2539  END SUBROUTINE w3ulev
2540  !/ ------------------------------------------------------------------- /
2551  SUBROUTINE w3urho ( FLFRST )
2552  !/
2553  !/ +-----------------------------------+
2554  !/ | WAVEWATCH III NOAA/NCEP |
2555  !/ | J. M. Castillo |
2556  !/ | FORTRAN 90 |
2557  !/ | Last update : 13-Aug-2021 |
2558  !/ +-----------------------------------+
2559  !/
2560  !/ 22-Mar-2021 : First implementation ( version 7.13 )
2561  !/ 13-Aug-2021 : Enable time interpolation ( version 7.14 )
2562  !/
2563  ! 1. Purpose :
2564  !
2565  ! Interpolate air density field to the given time.
2566  !
2567  ! 2. Method :
2568  !
2569  ! Linear interpolation.
2570  !
2571  ! 3. Parameters :
2572  !
2573  ! Parameter list
2574  ! ----------------------------------------------------------------
2575  ! FLFRST Log. I Flag for first pass through routine.
2576  ! ----------------------------------------------------------------
2577  !
2578  ! 4. Subroutines used :
2579  !
2580  ! See module documentation.
2581  !
2582  ! 5. Called by :
2583  !
2584  ! Name Type Module Description
2585  ! ----------------------------------------------------------------
2586  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
2587  ! ----------------------------------------------------------------
2588  !
2589  ! 6. Error messages :
2590  !
2591  ! None.
2592  !
2593  ! 7. Remarks :
2594  !
2595  ! - Only air density over sea points is considered.
2596  ! - Time ranges checked in W3WAVE.
2597  !
2598  ! 8. Structure :
2599  !
2600  ! --------------------------------------
2601  ! 1. Prepare auxiliary arrays
2602  ! 2. Calculate interpolation factors
2603  ! 3. Get actual air density
2604  ! --------------------------------------
2605  !
2606  ! 9. Switches :
2607  !
2608  ! !/OMPG OpenMP compiler directives
2609  !
2610  ! !/WNT0 No air density interpolation.
2611  ! !/WNT1 Linear air density interpolation.
2612  ! !/WNT2 Linear air density interpolation (and energy conservation for momentum).
2613  !
2614  ! !/S Enable subroutine tracing.
2615  ! !/T Enable test output.
2616  !
2617  ! 10. Source code :
2618  !
2619  !/ ------------------------------------------------------------------- /
2620  USE w3gdatmd, ONLY: nsea, mapsf
2621 #ifdef W3_SMC
2622  USE w3gdatmd, ONLY: fswnd
2623 #endif
2624  USE w3wdatmd, ONLY: time, trho, rhoair
2625  USE w3idatmd, ONLY: tr0, trn, rh0, rhn
2626  USE w3adatmd, ONLY: ra0, rai
2627  USE w3odatmd, ONLY: iaproc, naproc
2628  !/
2629  IMPLICIT NONE
2630  !/
2631  !/ ------------------------------------------------------------------- /
2632  !/ Parameter list
2633  !/
2634  LOGICAL, INTENT(IN) :: FLFRST
2635  !/
2636  !/ ------------------------------------------------------------------- /
2637  !/
2638  INTEGER :: ISEA, IX, IY
2639 #ifdef W3_S
2640  INTEGER, SAVE :: IENT = 0
2641 #endif
2642  REAL :: DT0N, DT0T, RD
2643  !/
2644  !/ ------------------------------------------------------------------- /
2645  !/
2646 #ifdef W3_S
2647  CALL strace (ient, 'W3URHO')
2648 #endif
2649  !
2650  ! 1. Prepare auxiliary arrays
2651  !
2652  IF ( flfrst ) THEN
2653  DO isea=1, nsea
2654 #ifdef W3_SMC
2655  !!Li For sea-point only SMC grid air density is stored on
2656  !!Li 2-D RH0(NSEA, 1) variable.
2657  IF( fswnd ) THEN
2658  ix = isea
2659  iy = 1
2660  ELSE
2661 #endif
2662  ix = mapsf(isea,1)
2663  iy = mapsf(isea,2)
2664 #ifdef W3_SMC
2665  ENDIF
2666 #endif
2667 
2668  ra0(isea) = rh0(ix,iy)
2669  rai(isea) = rhn(ix,iy) - rh0(ix,iy)
2670  END DO
2671  END IF
2672  !
2673  ! 2. Calculate interpolation factor
2674  !
2675  dt0n = dsec21( tr0, trn )
2676  dt0t = dsec21( tr0, time )
2677  !
2678 #ifdef W3_WNT0
2679  rd = 0.
2680 #endif
2681 #ifdef W3_WNT1
2682  rd = dt0t / max( 1.e-7 , dt0n )
2683 #endif
2684 #ifdef W3_WNT2
2685  rd = dt0t / max( 1.e-7 , dt0n )
2686 #endif
2687 #ifdef W3_OASACM
2688  rd = 1.
2689 #endif
2690  !
2691 #ifdef W3_T
2692  WRITE (ndst,9000) dt0n, dt0t, rd
2693 #endif
2694  !
2695  ! 3. Actual momentum for all grid points
2696  !
2697 #ifdef W3_OMPG
2698  !$OMP PARALLEL DO PRIVATE (ISEA,RA0,RAI)
2699 #endif
2700  !
2701  DO isea=1, nsea
2702  !
2703  rhoair(isea) = ra0(isea) + rd * rai(isea)
2704  !
2705  END DO
2706  !
2707  RETURN
2708  !
2709  ! Formats
2710  !
2711 #ifdef W3_T
2712 9000 FORMAT (' TEST W3URHO : DT0N, DT0T, RD :',2f8.1,f6.3)
2713 #endif
2714  !/
2715  !/ End of W3URHO ----------------------------------------------------- /
2716  !/
2717  END SUBROUTINE w3urho
2718  !/ ------------------------------------------------------------------- /
2735  SUBROUTINE w3utrn ( TRNX, TRNY )
2736  !/
2737  !/ +-----------------------------------+
2738  !/ | WAVEWATCH III NOAA/NCEP |
2739  !/ | H. L. Tolman |
2740  !/ | FORTRAN 90 |
2741  !/ | Last update : 30-Oct-2009 |
2742  !/ +-----------------------------------+
2743  !/
2744  !/ 02-Apr-2001 : Origination. ( version 2.10 )
2745  !/ 11-Jan-2002 : Sub-grid ice. ( version 2.15 )
2746  !/ 30-Apr-2002 : Change to ICE on storage grid. ( version 2.20 )
2747  !/ 15-Dec-2004 : Multiple grid version. ( version 3.06 )
2748  !/ 11-Jan-2007 : Clean-up for boundary points. ( version 3.10 )
2749  !/ 30-Oct-2009 : Implement run-time grid selection. ( version 3.14 )
2750  !/ (W. E. Rogers & T. J. Campbell, NRL)
2751  !/ 30-Oct-2009 : Implement curvilinear grid type. ( version 3.14 )
2752  !/ (W. E. Rogers & T. J. Campbell, NRL)
2753  !/
2754  ! 1. Purpose :
2755  !
2756  ! Update cell boundary transparencies for general use in propagation
2757  ! routines.
2758  !
2759  ! 2. Method :
2760  !
2761  ! Two arrays are generated with the size (NY*NX,-1:1). The value
2762  ! at (IXY,-1) indicates the transparency to be used if the lower
2763  ! or left boundary is an inflow boundary. (IXY,1) is used if the
2764  ! upper or right boundary is an inflow boundary. (IXY,0) is used
2765  ! for all other cases (by definition full transparency).
2766  !
2767  ! 3. Parameters :
2768  !
2769  ! Parameter list
2770  ! ----------------------------------------------------------------
2771  ! TRNX/Y R.A. I Transparencies from model defintion file.
2772  ! ----------------------------------------------------------------
2773  !
2774  ! 4. Subroutines used :
2775  !
2776  ! See module documentation.
2777  !
2778  ! 5. Called by :
2779  !
2780  ! Name Type Module Description
2781  ! ----------------------------------------------------------------
2782  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
2783  ! ----------------------------------------------------------------
2784  !
2785  ! 6. Error messages :
2786  !
2787  ! None.
2788  !
2789  ! 7. Remarks :
2790  !
2791  ! 8. Structure :
2792  !
2793  ! See source code.
2794  !
2795  ! 9. Switches :
2796  !
2797  ! !/S Enable subroutine tracing.
2798  ! !/T Basic test output.
2799  !
2800  ! 10. Source code :
2801  !
2802  !/ ------------------------------------------------------------------- /
2803  USE w3gdatmd, ONLY: nx, ny, nsea, mapsta, mapsf, &
2804  trflag, fice0, ficen, ficel, &
2805  rlgtype, clgtype, gtype, flagll, &
2806  hpfac, hqfac, ffacberg
2807  USE w3wdatmd, ONLY: ice, berg
2808  USE w3adatmd, ONLY: atrnx, atrny
2809  !
2810  IMPLICIT NONE
2811  !/
2812  !/ ------------------------------------------------------------------- /
2813  !/ Parameter list
2814  !/
2815  REAL, INTENT(IN) :: TRNX(NY*NX), TRNY(NY*NX)
2816  !/
2817  !/ ------------------------------------------------------------------- /
2818  !/
2819  INTEGER :: ISEA, IX, IY, IXY, IXN, IXP, IYN, IYP
2820 #ifdef W3_S
2821  INTEGER, SAVE :: IENT = 0
2822 #endif
2823 #ifdef W3_T
2824  INTEGER :: ILEV, NLEV
2825 #endif
2826 
2827  REAL :: TRIX(NY*NX), TRIY(NY*NX), DX, DY, &
2828  LICE0, LICEN
2829 #ifdef W3_T
2830  REAL :: LEVS(0:10)
2831 #endif
2832  !/
2833  !/ ------------------------------------------------------------------- /
2834  !/
2835 #ifdef W3_S
2836  CALL strace (ient, 'W3UTRN')
2837 #endif
2838 #ifdef W3_T
2839  WRITE (ndst,9000) trflag
2840 #endif
2841  !
2842  ! 1. Preparations --------------------------------------------------- *
2843  !
2844  atrnx = 1.
2845  atrny = 1.
2846 #ifdef W3_T
2847  WRITE (ndst,9001) 'INITIALIZING ATRNX/Y'
2848 #endif
2849  !
2850  ! 2. Filling arrays from TRNX/Y for obstructions -------------------- *
2851  ! 2.a TRFLAG = 0, no action needed
2852  IF ( trflag .EQ. 0 ) THEN
2853 #ifdef W3_T
2854  WRITE (ndst,9001) 'NO FURTHER ACTION REQUIRED'
2855 #endif
2856  RETURN
2857  !
2858  ! 2.b TRFLAG = 1,3: TRNX/Y defined at boundaries
2859  !
2860  ELSE IF ( trflag.EQ.1 .OR. trflag.EQ.3 .OR. trflag.EQ.5 ) THEN
2861 #ifdef W3_T
2862  WRITE (ndst,9001) 'DATA APPLIED AT CELL BOUNDARIES'
2863  levs = 0.
2864 #endif
2865  !
2866  DO isea=1, nsea
2867  !
2868  ix = mapsf(isea,1)
2869  iy = mapsf(isea,2)
2870  ixy = mapsf(isea,3)
2871  IF ( ix .EQ. 1 ) THEN
2872  atrnx(ixy,-1) = trnx(iy+(nx-1)*ny)
2873  atrnx(ixy, 1) = trnx(ixy)
2874  ELSE IF ( ix .EQ. nx ) THEN
2875  atrnx(ixy,-1) = trnx(ixy-ny)
2876  atrnx(ixy, 1) = trnx(iy)
2877  ELSE
2878  atrnx(ixy,-1) = trnx(ixy-ny)
2879  atrnx(ixy, 1) = trnx(ixy)
2880  END IF
2881  atrny(ixy,-1) = trny(ixy-1)
2882  atrny(ixy, 1) = trny(ixy)
2883  !
2884 #ifdef W3_T
2885  ilev = nint(10.*min(trnx(ixy),trny(ixy)))
2886  levs(ilev) = levs(ilev) + 1.
2887 #endif
2888  !
2889  END DO
2890  !
2891  ! 2.c TRFLAG = 2,4: TRNX/Y defined at cell centers
2892  !
2893  ELSE
2894 #ifdef W3_T
2895  WRITE (ndst,9001) 'DATA APPLIED AT CELL CENTERS'
2896  levs = 0.
2897 #endif
2898  !
2899  DO isea=1, nsea
2900  !
2901  ix = mapsf(isea,1)
2902  iy = mapsf(isea,2)
2903  ixy = mapsf(isea,3)
2904  !
2905  IF ( ix .EQ. 1 ) THEN
2906  ixn = iy + (nx-1)*ny
2907  ixp = iy + ix *ny
2908  ELSE IF ( ix .EQ. nx ) THEN
2909  ixn = iy + (ix-2)*ny
2910  ixp = iy
2911  ELSE
2912  ixn = iy + (ix-2)*ny
2913  ixp = iy + ix *ny
2914  END IF
2915  !
2916  IF ( iy .EQ. 1 ) THEN
2917  iyn = ixy
2918  iyp = ixy + 1
2919  ELSE IF ( iy .EQ. ny ) THEN
2920  iyn = ixy - 1
2921  iyp = ixy
2922  ELSE
2923  iyn = ixy - 1
2924  iyp = ixy + 1
2925  END IF
2926  !
2927  ! factors 0.5 in first term and 2. in second term cancel
2928  !
2929  atrnx(ixy,-1) = (1.+trnx(ixy)) * trnx(ixn)/(1.+trnx(ixn))
2930  atrnx(ixy, 1) = (1.+trnx(ixy)) * trnx(ixp)/(1.+trnx(ixp))
2931  atrny(ixy,-1) = (1.+trny(ixy)) * trny(iyn)/(1.+trny(iyn))
2932  atrny(ixy, 1) = (1.+trny(ixy)) * trny(iyp)/(1.+trny(iyp))
2933  !
2934  IF ( mapsta(iy,ix) .EQ. 2 ) THEN
2935  IF ( ix .EQ. 1 ) THEN
2936  atrnx(ixy,-1) = 1.
2937  ELSE IF ( mapsta( iy ,ix-1) .LE. 0 ) THEN
2938  atrnx(ixy,-1) = 1.
2939  END IF
2940  IF ( ix .EQ. nx ) THEN
2941  atrnx(ixy, 1) = 1.
2942  ELSE IF ( mapsta( iy ,ix+1) .LE. 0 ) THEN
2943  atrnx(ixy, 1) = 1.
2944  END IF
2945  IF ( iy .EQ. 1 ) THEN
2946  atrny(ixy,-1) = 1.
2947  ELSE IF ( mapsta(iy-1, ix ) .LE. 0 ) THEN
2948  atrny(ixy,-1) = 1.
2949  END IF
2950  IF ( iy .EQ. ny ) THEN
2951  atrny(ixy, 1) = 1.
2952  ELSE IF ( mapsta(iy+1, ix ) .LE. 0 ) THEN
2953  atrny(ixy, 1) = 1.
2954  END IF
2955  END IF
2956  !
2957 #ifdef W3_T
2958  ilev = nint(10.*min(trnx(ixy),trny(ixy)))
2959  levs(ilev) = levs(ilev) + 1.
2960 #endif
2961  !
2962  END DO
2963  END IF
2964  !
2965 #ifdef W3_T
2966  WRITE(ndst,9010) 'ISLANDS'
2967  nlev = 0
2968  DO ilev=0, 10
2969  WRITE (ndst,9011) ilev, levs(ilev)/real(nsea)
2970  nlev = nlev + nint(levs(ilev))
2971  END DO
2972 #endif
2973  !
2974  ! 3. Adding ice to obstructions ------------------------------------- *
2975  ! 3.a TRFLAG < 3, no action needed
2976  !
2977  IF ( trflag.LT.3 .OR. ficen-fice0.LT.1.e-6 ) THEN
2978 #ifdef W3_T
2979  WRITE (ndst,9001) 'NO ICE ACTION REQUIRED'
2980 #endif
2981  RETURN
2982  !
2983  ! 3.b TRFLAG = 3,4: Calculate ice transparencies
2984  !
2985  ELSE
2986 #ifdef W3_T
2987  WRITE (ndst,9001) 'CALCULATE ICE TRANSPARENCIES'
2988  levs = 0.
2989 #endif
2990  trix = 1.
2991  triy = 1.
2992  !
2993  DO isea=1, nsea
2994  !
2995  ix = mapsf(isea,1)
2996  iy = mapsf(isea,2)
2997  ixy = mapsf(isea,3)
2998  !
2999  dx = hpfac(iy,ix)
3000  dy = hqfac(iy,ix)
3001  IF ( flagll ) THEN
3002  dx = dx * radius * dera
3003  dy = dy * radius * dera
3004  END IF
3005 
3006  !
3007 #ifdef W3_IC0
3008  IF (ice(isea).GT.0) THEN
3009  IF (ficel.GT.0.) THEN
3010  trix(ixy) = exp(-ice(isea)*dx/ficel)
3011  triy(ixy) = exp(-ice(isea)*dy/ficel)
3012  ELSE
3013 #endif
3014  ! Otherwise: original Tolman expression (Tolman 2003)
3015 #ifdef W3_IC0
3016  lice0 = fice0*dx
3017  licen = ficen*dx
3018  trix(ixy) = ( licen - ice(isea)*dx ) / ( licen - lice0 )
3019 #endif
3020 
3021  ! begin temporary notes
3022  ! TRIX = ( LICEN - ICE(ISEA)*DX ) / ( LICEN - LICE0 )
3023  ! thus, it is TRIX= ( (FICEN*DX) - ICE(ISEA)*DX ) / ( (FICEN*DX) - (FICE0*DX) )
3024  ! thus, it is TRIX= ( FICEN - ICE(ISEA) ) / ( FICEN - FICE0 )
3025  ! in other words, the variables DX DY are not used
3026  ! and the variables LICE0 LICEN are not necessary.
3027  ! end temporary notes
3028 
3029 #ifdef W3_IC0
3030  lice0 = fice0*dy
3031  licen = ficen*dy
3032  triy(ixy) = ( licen - ice(isea)*dy ) / ( licen - lice0 )
3033  END IF
3034 #endif
3035  !
3036 #ifdef W3_IC0
3037  trix(ixy) = max( 0. , min( 1. , trix(ixy) ) )
3038  triy(ixy) = max( 0. , min( 1. , triy(ixy) ) )
3039  END IF
3040 #endif
3041  !
3042  ! Adding iceberg attenuation
3043  !
3044  IF (berg(isea).GT.0) THEN
3045  trix(ixy) = trix(ixy)*exp(-berg(isea)*ffacberg *dx*0.0001)
3046  triy(ixy) = triy(ixy)*exp(-berg(isea)*ffacberg *dy*0.0001)
3047  END IF
3048  !
3049 #ifdef W3_T
3050  ilev = nint(10.*min(trix(ixy),triy(ixy)))
3051  levs(ilev) = levs(ilev) + 1.
3052 #endif
3053  !
3054  END DO
3055  !
3056 #ifdef W3_T
3057  WRITE(ndst,9010) 'ICE'
3058  nlev = 0
3059  DO ilev=0, 10
3060  WRITE (ndst,9011) ilev, levs(ilev)/real(nsea)
3061  nlev = nlev + nint(levs(ilev))
3062  END DO
3063 #endif
3064  !
3065  ! 3.c Combine transparencies, ice always defined at cell center !
3066  !
3067  DO isea=1, nsea
3068  !
3069  ix = mapsf(isea,1)
3070  iy = mapsf(isea,2)
3071  ixy = mapsf(isea,3)
3072  !
3073  IF ( ix .EQ. 1 ) THEN
3074  ixn = iy + (nx-1)*ny
3075  ixp = iy + ix *ny
3076  ELSE IF ( ix .EQ. nx ) THEN
3077  ixn = iy + (ix-2)*ny
3078  ixp = iy
3079  ELSE
3080  ixn = iy + (ix-2)*ny
3081  ixp = iy + ix *ny
3082  END IF
3083  !
3084  IF ( iy .EQ. 1 ) THEN
3085  iyn = ixy
3086  iyp = ixy + 1
3087  ELSE IF ( iy .EQ. ny ) THEN
3088  iyn = ixy - 1
3089  iyp = ixy
3090  ELSE
3091  iyn = ixy - 1
3092  iyp = ixy + 1
3093  END IF
3094  !
3095  atrnx(ixy,-1) = atrnx(ixy,-1) &
3096  * (1.+trix(ixy)) * trix(ixn)/(1.+trix(ixn))
3097  atrnx(ixy, 1) = atrnx(ixy, 1) &
3098  * (1.+trix(ixy)) * trix(ixp)/(1.+trix(ixp))
3099  atrny(ixy,-1) = atrny(ixy,-1) &
3100  * (1.+triy(ixy)) * triy(iyn)/(1.+triy(iyn))
3101  atrny(ixy, 1) = atrny(ixy, 1) &
3102  * (1.+triy(ixy)) * triy(iyp)/(1.+triy(iyp))
3103  !
3104  END DO
3105  !
3106  END IF
3107  !
3108  RETURN
3109  !
3110  ! Formats
3111  !
3112 #ifdef W3_T
3113 9000 FORMAT ( ' TEST W3UTRN : TRFLAG = ',i3)
3114 9001 FORMAT ( ' TEST W3UTRN : ',a)
3115 9010 FORMAT ( ' TEST W3UTRN : OBSTRICTION LEVELS FOR ',a,' :')
3116 9011 FORMAT ( ' ',i4,f8.5)
3117 #endif
3118  !/
3119  !/ End of W3UTRN ----------------------------------------------------- /
3120  !/
3121  END SUBROUTINE w3utrn
3122  !/ ------------------------------------------------------------------- /
3138  SUBROUTINE w3dzxy( ZZ, ZUNIT, DZZDX, DZZDY )
3139  !/
3140  !/ +-----------------------------------+
3141  !/ | WAVEWATCH III NOAA/NCEP |
3142  !/ | W. E. Rogers, NRL |
3143  !/ | FORTRAN 90 |
3144  !/ | Last update : 06-Dec-2010 |
3145  !/ +-----------------------------------+
3146  !/
3147  !/ 30-Oct-2009 : Origination. ( version 3.14 )
3148  !/ 06-Dec-2010 : Change from GLOBAL (logical) to ICLOSE (integer) to
3149  !/ specify index closure for a grid. ( version 3.14 )
3150  !/ (T. J. Campbell, NRL)
3151  !/
3152  ! 1. Purpose :
3153  !
3154  ! Calculate derivatives of a field.
3155  !
3156  ! 2. Method :
3157  !
3158  ! Derivatives are calculated in m/m from the longitude/latitude
3159  ! grid, central in space for iternal points, one-sided for
3160  ! coastal points.
3161  !
3162  ! 3. Parameters :
3163  !
3164  ! Parameter list
3165  ! ----------------------------------------------------------------
3166  ! ZZ R.A. I Field to calculate derivatives of.
3167  ! ZUNIT R.A. I Units of ZZ (used for test output).
3168  ! DZZDX R.A. O Derivative in X-direction (W-E).
3169  ! DZZDY R.A. O Derivative in Y-direction (S-N).
3170  ! IXP: IX plus 1 (with branch cut incorporated)
3171  ! IYP, IXM, IYM: ditto
3172  ! IXPS: value to use for IXP if IXPS is not masked.
3173  ! (use IX if masked)
3174  ! IYPS, IXMS, IYMS : ditto
3175  ! IXTRPL : in case of needing IY+1 for IY=NY, IX needs to be
3176  ! modified (tripole grid only)
3177  ! IXTRPLS : value to use for IXTRPL if IXTRPLS is not masked
3178  ! (use IX if masked)
3179  ! ----------------------------------------------------------------
3180  !
3181  ! 4. Subroutines used :
3182  !
3183  ! See module documentation.
3184  !
3185  ! 5. Called by :
3186  !
3187  ! Name Type Module Description
3188  ! ----------------------------------------------------------------
3189  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
3190  ! ----------------------------------------------------------------
3191  !
3192  ! 6. Error messages :
3193  !
3194  ! None.
3195  !
3196  ! 7. Remarks :
3197  !
3198  ! This routine replaces the functionality of W3DDXY and W3DCXY.
3199  ! NB: subroutine "W3CGDM" has a similar purpose.
3200  ! Output arrays are always initialized to zero.
3201  !
3202  ! 8. Structure :
3203  !
3204  ! ----------------------------------------
3205  ! 1. Preparations
3206  ! a Initialize arrays
3207  ! b Set constants
3208  ! 2. Derivatives in X-direction (W-E).
3209  ! 3. Derivatives in Y-direction (S-N).
3210  ! ----------------------------------------
3211  !
3212  ! 9. Switches :
3213  !
3214  ! !/S Enable subroutine tracing.
3215  ! !/T Enable test output.
3216  !
3217  ! 10. Source code :
3218  !
3219  !/ ------------------------------------------------------------------- /
3220  USE w3gdatmd, ONLY: nx, ny, nsea, mapsta, mapfs, mapfs, &
3221  dpdx, dpdy, dqdx, dqdy, flagll, iclose, &
3223  USE w3odatmd, ONLY: ndse, iaproc, naperr, naproc
3224  USE w3servmd, ONLY: extcde
3225 #ifdef W3_T
3226  USE w3arrymd, ONLY : prtblk
3227 #endif
3228  !/
3229  IMPLICIT NONE
3230  !/
3231  !/ ------------------------------------------------------------------- /
3232  !/ Parameter list
3233  !/
3234  !/ ------------------------------------------------------------------- /
3235  !/ Local parameters
3236  !/
3237  REAL, INTENT(IN) :: ZZ(NSEA)
3238  CHARACTER, INTENT(IN) :: ZUNIT*(*)
3239  REAL, INTENT(OUT) :: DZZDX(NY,NX), DZZDY(NY,NX)
3240  INTEGER :: ISEA, IX, IY, IXP, IXM, IYP, IYM
3241 #ifdef W3_T
3242  INTEGER :: ISX, ISY, MAPOUT(NX,NY)
3243 #endif
3244 #ifdef W3_S
3245  INTEGER, SAVE :: IENT = 0
3246 #endif
3247 #ifdef W3_T
3248  INTEGER, SAVE :: NXS = 49
3249 #endif
3250  REAL :: DFAC , STX, STY
3251  INTEGER :: IXPS,IYPS,IXMS,IYMS,IXTRPL,IXTRPLS
3252  INTEGER :: IXSTART,IXEND
3253 #ifdef W3_T
3254  REAL :: XOUT(NX,NY)
3255 #endif
3256  !/
3257  !/ ------------------------------------------------------------------- /
3258  !/
3259 #ifdef W3_S
3260  CALL strace (ient, 'W3DZXY')
3261 #endif
3262  !
3263  ! 1. Preparations --------------------------------------------------- *
3264 
3265  ! 1.a Initialize arrays
3266  !
3267  dzzdx = 0.
3268  dzzdy = 0.
3269  !
3270  ! 1.b Set constants
3271  !
3272 
3273  IF ( flagll ) THEN
3274  dfac = 1. / ( dera * radius )
3275  ELSE
3276  dfac = 1.
3277  END IF
3278 
3279  !
3280  ! 2. Derivatives in X-direction (W-E) and Y-direction (S-N) ----- *
3281  !
3282 
3283  ! 2a. All points previously done in 2a,2b,2c of v4.18 done in 2a now:
3284  IF ( iclose.EQ.iclose_none ) THEN
3285  ixstart=2
3286  ixend=nx-1
3287  ELSE
3288  ixstart=1
3289  ixend=nx
3290  ENDIF
3291 
3292  DO iy=2, ny-1
3293  DO ix=ixstart,ixend
3294  IF ( mapsta(iy,ix) .NE. 0 ) THEN
3295  stx = 0.5
3296  IF (ix.EQ.nx)THEN
3297  ixps=1
3298  ELSE
3299  ixps=ix+1
3300  ENDIF
3301 
3302  IF (mapsta(iy,ixps).EQ.0) THEN
3303  ixp = ix
3304  stx = 1.0
3305  ELSE
3306  ixp = ixps
3307  END IF
3308 
3309  IF(ix.EQ.1)THEN
3310  ixms=nx
3311  ELSE
3312  ixms=ix-1
3313  ENDIF
3314 
3315  IF (mapsta(iy,ixms).EQ.0) THEN
3316  ixm = ix
3317  stx = 1.0
3318  ELSE
3319  ixm = ixms
3320  END IF
3321  sty = 0.5
3322  iyps=iy+1
3323  IF (mapsta(iyps,ix).EQ.0) THEN
3324  iyp = iy
3325  sty = 1.0
3326  ELSE
3327  iyp = iyps
3328  END IF
3329  iyms=iy-1
3330  IF (mapsta(iyms,ix).EQ.0) THEN
3331  iym = iy
3332  sty = 1.0
3333  ELSE
3334  iym = iyms
3335  END IF
3336  dzzdx(iy,ix) = (zz(mapfs(iy ,ixp))-zz(mapfs(iy ,ixm))) * stx * dpdx(iy,ix) &
3337  + (zz(mapfs(iyp,ix ))-zz(mapfs(iym,ix ))) * sty * dqdx(iy,ix)
3338  dzzdy(iy,ix) = (zz(mapfs(iy ,ixp))-zz(mapfs(iy ,ixm))) * stx * dpdy(iy,ix) &
3339  + (zz(mapfs(iyp,ix ))-zz(mapfs(iym,ix ))) * sty * dqdy(iy,ix)
3340  dzzdx(iy,ix) = dzzdx(iy,ix) * dfac
3341  dzzdy(iy,ix) = dzzdy(iy,ix) * dfac
3342  END IF
3343  END DO
3344  END DO
3345 
3346  ! 2b. column IY=NY for tripole case
3347  ! This is more complex, since for these two points: (IYP,IX) (IYM,IX),
3348  ! not only is the first index different (IYP.NE.IYM), but also the
3349  ! second index is different (IX.NE.IX)!
3350  IF ( iclose.EQ.iclose_trpl ) THEN
3351 
3352  iy=ny
3353  DO ix=1, nx
3354  IF ( mapsta(iy,ix) .NE. 0 ) THEN
3355 
3356  stx = 0.5
3357 
3358  IF (ix.EQ.nx)THEN
3359  ixps=1
3360  ELSE
3361  ixps=ix+1
3362  ENDIF
3363  IF (mapsta(iy,ixps).EQ.0) THEN
3364  ixp = ix
3365  stx = 1.0
3366  ELSE
3367  ixp = ixps
3368  END IF
3369 
3370  IF(ix.EQ.1)THEN
3371  ixms=nx
3372  ELSE
3373  ixms=ix-1
3374  ENDIF
3375  IF (mapsta(iy,ixms).EQ.0) THEN
3376  ixm = ix
3377  stx = 1.0
3378  ELSE
3379  ixm = ixms
3380  END IF
3381 
3382  sty = 0.5
3383 
3384  !..............next point: j+1: tripole: j==>j+1==>j and i==>ni-i+1
3385  !..............i.e. target point is MAPFS(IY,(NX-IX+1))
3386  ixtrpls=nx-ix+1
3387  IF (mapsta(iy,ixtrpls).EQ.0) THEN
3388  ixtrpl = ix
3389  sty = 1.0
3390  ELSE
3391  ixtrpl=ixtrpls
3392  END IF
3393 
3394  iyms=iy-1
3395  IF (mapsta(iyms,ix).EQ.0) THEN
3396  iym = iy
3397  sty = 1.0
3398  ELSE
3399  iym = iyms
3400  END IF
3401 
3402  ! tripole grid: (IYP,IX) is replaced with (IY,IXTRPL)
3403  dzzdx(iy,ix) = (zz(mapfs(iy ,ixp))-zz(mapfs(iy ,ixm))) * stx * dpdx(iy,ix) &
3404  + (zz(mapfs(iy,ixtrpl))-zz(mapfs(iym,ix ))) * sty * dqdx(iy,ix)
3405  dzzdy(iy,ix) = (zz(mapfs(iy ,ixp))-zz(mapfs(iy ,ixm))) * stx * dpdy(iy,ix) &
3406  + (zz(mapfs(iy,ixtrpl))-zz(mapfs(iym,ix ))) * sty * dqdy(iy,ix)
3407  dzzdx(iy,ix) = dzzdx(iy,ix) * dfac
3408  dzzdy(iy,ix) = dzzdy(iy,ix) * dfac
3409  END IF
3410  END DO
3411 
3412  END IF ! IF ( ICLOSE.EQ.ICLOSE_TRPL ) THEN
3413 
3414  !
3415  ! 3. Test output of fields ------------------------------------------ *
3416  !
3417 #ifdef W3_T
3418  WRITE (ndst,9010)
3419  isx = 1 + nx/nxs
3420  isy = 1 + ny/nxs
3421  DO iy=1, ny
3422  DO ix=1, nx
3423  mapout(ix,iy) = mapsta(iy,ix)
3424  IF ( mapfs(iy,ix) .NE. 0 ) &
3425  xout(ix,iy) = zz(mapfs(iy,ix))
3426  END DO
3427  END DO
3428  CALL prtblk (ndst, nx, ny, nx, xout, mapout, 0, 0., &
3429  1, nx, isx, 1, ny, isy, 'ZZ', zunit)
3430  DO iy=1, ny
3431  DO ix=1, nx
3432  xout(ix,iy) = dzzdx(iy,ix)
3433  END DO
3434  END DO
3435  CALL prtblk (ndst, nx, ny, nx, xout, mapout, 0, 0., &
3436  1, nx, isx, 1, ny, isy, 'DZZDX',trim(zunit)//'/m')
3437  DO iy=1, ny
3438  DO ix=1, nx
3439  xout(ix,iy) = dzzdy(iy,ix)
3440  END DO
3441  END DO
3442  CALL prtblk (ndst, nx, ny, nx, xout, mapout, 0, 0., &
3443  1, nx, isx, 1, ny, isy, 'DZZDY',trim(zunit)//'/m')
3444 #endif
3445  !
3446  RETURN
3447  !
3448  ! Formats
3449  !
3450 #ifdef W3_T
3451 9000 FORMAT (' TEST W3DZXY : DX0I, DY0I : ',2e12.5)
3452 9010 FORMAT (' TEST W3DZXY : FIELDS ')
3453 #endif
3454  !/
3455  !/ End of W3DZXY ----------------------------------------------------- /
3456  !/
3457  END SUBROUTINE w3dzxy
3458  !/ ------------------------------------------------------------------- /
3459  !/ End of module W3UPDTMD -------------------------------------------- /
3460  !/
3461 END MODULE w3updtmd
w3gdatmd::nk
integer, pointer nk
Definition: w3gdatmd.F90:1230
w3gdatmd::nseal
integer, pointer nseal
Definition: w3gdatmd.F90:1097
constants::pi
real, parameter pi
PI Value of Pi.
Definition: constants.F90:71
w3timemd::dsec21
real function dsec21(TIME1, TIME2)
Definition: w3timemd.F90:333
w3gdatmd::do_change_wlv
logical, pointer do_change_wlv
Definition: w3gdatmd.F90:1407
w3gdatmd::wwcor
real, dimension(:), pointer wwcor
Definition: w3gdatmd.F90:1251
w3wdatmd::iceh
real, dimension(:), pointer iceh
Definition: w3wdatmd.F90:183
w3idatmd::twn
integer, dimension(:), pointer twn
Definition: w3idatmd.F90:236
w3adatmd::charn
real, dimension(:), pointer charn
Definition: w3adatmd.F90:603
w3gdatmd::dth
real, pointer dth
Definition: w3gdatmd.F90:1232
w3adatmd::nsealm
integer, pointer nsealm
Definition: w3adatmd.F90:686
w3adatmd::as
real, dimension(:), pointer as
Definition: w3adatmd.F90:584
w3gdatmd::ygrd
double precision, dimension(:,:), pointer ygrd
Definition: w3gdatmd.F90:1205
w3idatmd::dt0
real, dimension(:,:), pointer dt0
Definition: w3idatmd.F90:243
w3adatmd
Define data structures to set up wave model auxiliary data for several models simultaneously.
Definition: w3adatmd.F90:26
w3gdatmd::nspec
integer, pointer nspec
Definition: w3gdatmd.F90:1230
w3gdatmd::zb
real, dimension(:), pointer zb
Definition: w3gdatmd.F90:1195
w3tidemd
Definition: w3tidemd.F90:3
w3gdatmd::ccps
real, pointer ccps
Definition: w3gdatmd.F90:1304
w3gdatmd::fswnd
logical, pointer fswnd
Definition: w3gdatmd.F90:1264
constants::dera
real, parameter dera
DERA Conversion factor from degrees to radians.
Definition: constants.F90:77
w3gdatmd::ungtype
integer, parameter ungtype
Definition: w3gdatmd.F90:626
w3updtmd::w3ucur
subroutine w3ucur(FLFRST)
Interpolate the current field to the present time.
Definition: w3updtmd.F90:172
w3gdatmd::dmin
real, pointer dmin
Definition: w3gdatmd.F90:1183
w3wdatmd
Define data structures to set up wave model dynamic data for several models simultaneously.
Definition: w3wdatmd.F90:18
w3updtmd::w3urho
subroutine w3urho(FLFRST)
Interpolate air density field to the given time.
Definition: w3updtmd.F90:2552
w3adatmd::atrnx
real, dimension(:,:), pointer atrnx
Definition: w3adatmd.F90:578
w3dispmd::wavnu3
pure subroutine wavnu3(SI, H, K, CG)
Definition: w3dispmd.F90:347
w3updtmd::w3uini
subroutine w3uini(A)
Initialize the wave field with fetch-limited spectra before the actual calculation start.
Definition: w3updtmd.F90:1050
w3adatmd::cg
real, dimension(:,:), pointer cg
Definition: w3adatmd.F90:575
w3gdatmd::ccng
real, pointer ccng
Definition: w3gdatmd.F90:1304
w3parall::get_jsea_ibelong
subroutine get_jsea_ibelong(ISEA, JSEA, IBELONG)
Set belongings of JSEA in context of PDLIB.
Definition: w3parall.F90:1271
w3gdatmd::rlgtype
integer, parameter rlgtype
Definition: w3gdatmd.F90:624
w3idatmd::wy0
real, dimension(:,:), pointer wy0
Definition: w3idatmd.F90:243
w3gdatmd::mapth
integer, dimension(:), pointer mapth
Definition: w3gdatmd.F90:1231
w3gdatmd::ofstab
real, pointer ofstab
Definition: w3gdatmd.F90:1304
w3adatmd::dw
real, dimension(:), pointer dw
Definition: w3adatmd.F90:584
w3adatmd::u10d
real, dimension(:), pointer u10d
Definition: w3adatmd.F90:584
w3adatmd::atrny
real, dimension(:,:), pointer atrny
Definition: w3adatmd.F90:578
w3gdatmd::sig
real, dimension(:), pointer sig
Definition: w3gdatmd.F90:1234
w3wdatmd::icef
real, dimension(:), pointer icef
Definition: w3wdatmd.F90:183
w3wdatmd::wlv
real, dimension(:), pointer wlv
Definition: w3wdatmd.F90:183
w3idatmd::ti5
integer, dimension(:), pointer ti5
Definition: w3idatmd.F90:236
w3odatmd::iaproc
integer, pointer iaproc
Definition: w3odatmd.F90:457
w3updtmd
Bundles all input updating routines for WAVEWATCH III.
Definition: w3updtmd.F90:22
w3gdatmd::ffng
real, pointer ffng
Definition: w3gdatmd.F90:1304
w3wdatmd::time
integer, dimension(:), pointer time
Definition: w3wdatmd.F90:172
w3adatmd::hs
real, dimension(:), pointer hs
Definition: w3adatmd.F90:587
w3odatmd::bbpi0
real, dimension(:,:), pointer bbpi0
Definition: w3odatmd.F90:541
w3updtmd::w3ubpt
subroutine w3ubpt
Update spectra at the active boundary points.
Definition: w3updtmd.F90:1314
w3gdatmd::ny
integer, pointer ny
Definition: w3gdatmd.F90:1097
w3odatmd::abpin
real, dimension(:,:), pointer abpin
Definition: w3odatmd.F90:541
w3idatmd::flcurtide
logical, pointer flcurtide
Definition: w3idatmd.F90:266
w3adatmd::asi
real, dimension(:), pointer asi
Definition: w3adatmd.F90:578
w3adatmd::cdi
real, dimension(:), pointer cdi
Definition: w3adatmd.F90:578
w3gdatmd::dsip
real, dimension(:), pointer dsip
Definition: w3gdatmd.F90:1234
w3idatmd::wltide
real, dimension(:,:,:,:), pointer wltide
Definition: w3idatmd.F90:256
w3odatmd::nbi
integer, pointer nbi
Definition: w3odatmd.F90:530
w3idatmd::flcur
logical, pointer flcur
Definition: w3idatmd.F90:261
w3idatmd::tu0
integer, dimension(:), pointer tu0
Definition: w3idatmd.F90:236
w3wdatmd::trho
integer, dimension(:), pointer trho
Definition: w3wdatmd.F90:172
w3gdatmd::th
real, dimension(:), pointer th
Definition: w3gdatmd.F90:1234
w3gdatmd::iclose_none
integer, parameter iclose_none
Definition: w3gdatmd.F90:629
w3updtmd::w3ulev
subroutine w3ulev(A, VA)
Update the water level.
Definition: w3updtmd.F90:2013
w3gdatmd::hqfac
real, dimension(:,:), pointer hqfac
Definition: w3gdatmd.F90:1212
w3wdatmd::tlev
integer, dimension(:), pointer tlev
Definition: w3wdatmd.F90:172
w3gdatmd::nglo
integer, pointer nglo
Definition: w3gdatmd.F90:1168
w3servmd::w3acturn
subroutine w3acturn(NDirc, NFreq, Alpha, Spectr)
Definition: w3servmd.F90:977
w3adatmd::ca0
real, dimension(:), pointer ca0
Definition: w3adatmd.F90:578
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
w3tidemd::tide_index2
integer, dimension(mc) tide_index2
Definition: w3tidemd.F90:133
w3wdatmd::berg
real, dimension(:), pointer berg
Definition: w3wdatmd.F90:183
w3gdatmd::fachfa
real, pointer fachfa
Definition: w3gdatmd.F90:1232
w3adatmd::ra0
real, dimension(:), pointer ra0
Definition: w3adatmd.F90:578
w3gdatmd::dqdy
real, dimension(:,:), pointer dqdy
Definition: w3gdatmd.F90:1209
w3gdatmd::mapfs
integer, dimension(:,:), pointer mapfs
Definition: w3gdatmd.F90:1163
w3idatmd::wxn
real, dimension(:,:), pointer wxn
Definition: w3idatmd.F90:243
w3odatmd::naperr
integer, pointer naperr
Definition: w3odatmd.F90:457
w3idatmd::ntide
integer ntide
Definition: w3idatmd.F90:165
w3gdatmd::polat
real, pointer polat
Definition: w3gdatmd.F90:1191
w3gdatmd::nsea
integer, pointer nsea
Definition: w3gdatmd.F90:1097
w3adatmd::md0
real, dimension(:), pointer md0
Definition: w3adatmd.F90:578
w3gdatmd::clgtype
integer, parameter clgtype
Definition: w3gdatmd.F90:625
w3servmd
Definition: w3servmd.F90:3
w3idatmd::fllevtide
logical, pointer fllevtide
Definition: w3idatmd.F90:266
w3gdatmd::iicehmin
real, pointer iicehmin
Definition: w3gdatmd.F90:1183
w3adatmd::ud
real, dimension(:), pointer ud
Definition: w3adatmd.F90:584
w3wdatmd::tic1
integer, dimension(:), pointer tic1
Definition: w3wdatmd.F90:172
w3gdatmd::trflag
integer, pointer trflag
Definition: w3gdatmd.F90:1097
w3odatmd::ipbpi
integer, dimension(:,:), pointer ipbpi
Definition: w3odatmd.F90:535
w3tidemd::tidecon_allnames
character *5, dimension(:), allocatable tidecon_allnames
Definition: w3tidemd.F90:97
w3idatmd::cxtide
real, dimension(:,:,:,:), pointer cxtide
Definition: w3idatmd.F90:256
constants::tpiinv
real, parameter tpiinv
TPIINV Inverse of 2*Pi.
Definition: constants.F90:74
w3adatmd::cai
real, dimension(:), pointer cai
Definition: w3adatmd.F90:578
w3adatmd::ud0
real, dimension(:), pointer ud0
Definition: w3adatmd.F90:578
w3tidemd::astr
subroutine astr(d1, h, pp, s, p, np, dh, dpp, ds, dp, dnp)
Definition: w3tidemd.F90:911
w3gdatmd::nth
integer, pointer nth
Definition: w3gdatmd.F90:1230
w3odatmd
Definition: w3odatmd.F90:3
w3adatmd::mdi
real, dimension(:), pointer mdi
Definition: w3adatmd.F90:578
w3updtmd::w3uice
subroutine w3uice(VA)
Update ice map in the wave model.
Definition: w3updtmd.F90:1756
w3adatmd::cy
real, dimension(:), pointer cy
Definition: w3adatmd.F90:584
w3gdatmd::iicehfac
real, pointer iicehfac
Definition: w3gdatmd.F90:1183
w3adatmd::taua
real, dimension(:), pointer taua
Definition: w3adatmd.F90:584
w3gdatmd::angarc
real, dimension(:), pointer angarc
Definition: w3gdatmd.F90:1204
w3idatmd::dtn
real, dimension(:,:), pointer dtn
Definition: w3idatmd.F90:243
w3gdatmd::mapsf
integer, dimension(:,:), pointer mapsf
Definition: w3gdatmd.F90:1163
w3idatmd::ti1
integer, dimension(:), pointer ti1
Definition: w3idatmd.F90:236
w3odatmd::naproc
integer, pointer naproc
Definition: w3odatmd.F90:457
w3gdatmd::dpdx
real, dimension(:,:), pointer dpdx
Definition: w3gdatmd.F90:1208
w3adatmd::ma0
real, dimension(:), pointer ma0
Definition: w3adatmd.F90:578
w3adatmd::uai
real, dimension(:), pointer uai
Definition: w3adatmd.F90:578
w3gdatmd::ffps
real, pointer ffps
Definition: w3gdatmd.F90:1304
w3updtmd::w3uic5
subroutine w3uic5(FLFRST)
Update ice floe mean and max diameters in the wave model.
Definition: w3updtmd.F90:1624
w3adatmd::ua0
real, dimension(:), pointer ua0
Definition: w3adatmd.F90:578
constants::radius
real, parameter radius
RADIUS Radius of the earth (m).
Definition: constants.F90:79
w3gdatmd::w3setref
subroutine w3setref
Definition: w3gdatmd.F90:3294
w3gdatmd::sig2
real, dimension(:), pointer sig2
Definition: w3gdatmd.F90:1234
w3adatmd::wn
real, dimension(:,:), pointer wn
Definition: w3adatmd.F90:575
w3updtmd::w3dzxy
subroutine w3dzxy(ZZ, ZUNIT, DZZDX, DZZDY)
Calculate derivatives of a field.
Definition: w3updtmd.F90:3139
w3adatmd::mai
real, dimension(:), pointer mai
Definition: w3adatmd.F90:578
w3adatmd::u10
real, dimension(:), pointer u10
Definition: w3adatmd.F90:584
w3gdatmd::iclose
integer, pointer iclose
Definition: w3gdatmd.F90:1096
constants::tpi
real, parameter tpi
TPI 2*Pi.
Definition: constants.F90:72
w3gdatmd::dpdy
real, dimension(:,:), pointer dpdy
Definition: w3gdatmd.F90:1208
w3gdatmd::ficen
real, pointer ficen
Definition: w3gdatmd.F90:1183
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3odatmd::rdbpi
real, dimension(:,:), pointer rdbpi
Definition: w3odatmd.F90:541
w3wdatmd::icedmax
real, dimension(:), pointer icedmax
Definition: w3wdatmd.F90:183
w3gdatmd::gtype
integer, pointer gtype
Definition: w3gdatmd.F90:1094
w3wdatmd::zeta_setup
real, dimension(:), pointer zeta_setup
Definition: w3wdatmd.F90:187
w3tidemd::setvuf_fast
subroutine setvuf_fast(h, pp, s, p, enp, dh, dpp, ds, dp, dnp, tau, XLAT, F, U, V)
Definition: w3tidemd.F90:532
w3idatmd
Define data structures to set up wave model input data for several models simultaneously.
Definition: w3idatmd.F90:16
w3gdatmd::mapwn
integer, dimension(:), pointer mapwn
Definition: w3gdatmd.F90:1231
w3odatmd::abpi0
real, dimension(:,:), pointer abpi0
Definition: w3odatmd.F90:541
w3wdatmd::ice
real, dimension(:), pointer ice
Definition: w3wdatmd.F90:183
w3arrymd
Definition: w3arrymd.F90:3
w3updtmd::w3utau
subroutine w3utau(FLFRST)
Interpolate atmosphere momentum fields to the given time.
Definition: w3updtmd.F90:829
w3gdatmd::rwindc
real, pointer rwindc
Definition: w3gdatmd.F90:1248
w3adatmd::as0
real, dimension(:), pointer as0
Definition: w3adatmd.F90:578
w3idatmd::wx0
real, dimension(:,:), pointer wx0
Definition: w3idatmd.F90:243
w3idatmd::tc0
integer, dimension(:), pointer tc0
Definition: w3idatmd.F90:236
w3idatmd::tw0
integer, dimension(:), pointer tw0
Definition: w3idatmd.F90:236
w3idatmd::tin
integer, dimension(:), pointer tin
Definition: w3idatmd.F90:236
w3gdatmd::hpfac
real, dimension(:,:), pointer hpfac
Definition: w3gdatmd.F90:1211
w3parall::init_get_jsea_isproc
subroutine init_get_jsea_isproc(ISEA, JSEA, ISPROC)
Set JSEA for all schemes.
Definition: w3parall.F90:1163
w3tidemd::tide_mf
integer tide_mf
Definition: w3tidemd.F90:109
w3gdatmd::ffacberg
real, pointer ffacberg
Definition: w3gdatmd.F90:1136
w3odatmd::ndst
integer, pointer ndst
Definition: w3odatmd.F90:456
w3wdatmd::ust
real, dimension(:), pointer ust
Definition: w3wdatmd.F90:183
w3adatmd::udi
real, dimension(:), pointer udi
Definition: w3adatmd.F90:578
w3gdatmd::narc
integer, pointer narc
Definition: w3gdatmd.F90:1168
w3idatmd::cytide
real, dimension(:,:,:,:), pointer cytide
Definition: w3idatmd.F90:256
constants
Define some much-used constants for global use (all defined as PARAMETER).
Definition: constants.F90:20
w3adatmd::ua
real, dimension(:), pointer ua
Definition: w3adatmd.F90:584
w3gdatmd::shstab
real, pointer shstab
Definition: w3gdatmd.F90:1304
w3gdatmd::dden
real, dimension(:), pointer dden
Definition: w3gdatmd.F90:1234
w3gdatmd
Definition: w3gdatmd.F90:16
w3gdatmd::iclose_trpl
integer, parameter iclose_trpl
Definition: w3gdatmd.F90:631
w3updtmd::w3uic1
subroutine w3uic1(FLFRST)
Update ice thickness in the wave model.
Definition: w3updtmd.F90:1513
w3gdatmd::arctc
logical, pointer arctc
Definition: w3gdatmd.F90:1264
w3dispmd::wavnu1
subroutine wavnu1(SI, H, K, CG)
Definition: w3dispmd.F90:85
w3adatmd::tauadir
real, dimension(:), pointer tauadir
Definition: w3adatmd.F90:584
w3servmd::extcde
subroutine extcde(IEXIT, UNIT, MSG, FILE, LINE, COMM)
Definition: w3servmd.F90:736
w3arrymd::prt2ds
subroutine prt2ds(NDS, NFR0, NFR, NTH, E, FR, UFR, FACSP, FSC, RRCUT, PRVAR, PRUNIT, PNTNME)
Definition: w3arrymd.F90:1943
w3wdatmd::rhoair
real, dimension(:), pointer rhoair
Definition: w3wdatmd.F90:183
w3gdatmd::zwind
real, pointer zwind
Definition: w3gdatmd.F90:1304
w3gdatmd::aalpha
real, pointer aalpha
Definition: w3gdatmd.F90:1311
w3gdatmd::ficel
real, pointer ficel
Definition: w3gdatmd.F90:1183
w3tidemd::twpi
double precision, parameter twpi
Definition: w3tidemd.F90:86
w3gdatmd::angld
real, dimension(:), pointer angld
Definition: w3gdatmd.F90:1192
w3idatmd::tln
integer, dimension(:), pointer tln
Definition: w3idatmd.F90:236
w3adatmd::rai
real, dimension(:), pointer rai
Definition: w3adatmd.F90:578
w3odatmd::isbpi
integer, dimension(:), pointer isbpi
Definition: w3odatmd.F90:535
w3adatmd::cx
real, dimension(:), pointer cx
Definition: w3adatmd.F90:584
w3adatmd::cd0
real, dimension(:), pointer cd0
Definition: w3adatmd.F90:578
w3gdatmd::nx
integer, pointer nx
Definition: w3gdatmd.F90:1097
w3wdatmd::tic5
integer, dimension(:), pointer tic5
Definition: w3wdatmd.F90:172
w3idatmd::trn
integer, dimension(:), pointer trn
Definition: w3idatmd.F90:236
w3tidemd::tide_ampc
real, dimension(mc, 2) tide_ampc
Definition: w3tidemd.F90:129
w3timemd
Definition: w3timemd.F90:3
w3gdatmd::fice0
real, pointer fice0
Definition: w3gdatmd.F90:1183
w3parall
Parallel routines for implicit solver.
Definition: w3parall.F90:22
w3timemd::time2hours
real(kind=8) function time2hours(TIME)
Definition: w3timemd.F90:844
w3dispmd
Definition: w3dispmd.F90:3
w3gdatmd::iclose_smpl
integer, parameter iclose_smpl
Definition: w3gdatmd.F90:630
w3tidemd::tide_phg
real, dimension(mc, 2) tide_phg
Definition: w3tidemd.F90:129
w3idatmd::tun
integer, dimension(:), pointer tun
Definition: w3idatmd.F90:236
w3idatmd::tr0
integer, dimension(:), pointer tr0
Definition: w3idatmd.F90:236
w3arrymd::prtblk
subroutine prtblk(NDS, NX, NY, MX, F, MAP, MAP0, FSC, IX1, IX2, IX3, IY1, IY2, IY3, PRVAR, PRUNIT)
Definition: w3arrymd.F90:1112
w3idatmd::wyn
real, dimension(:,:), pointer wyn
Definition: w3idatmd.F90:243
w3updtmd::w3utrn
subroutine w3utrn(TRNX, TRNY)
Update cell boundary transparencies for general use in propagation routines.
Definition: w3updtmd.F90:2736
w3gdatmd::dqdx
real, dimension(:,:), pointer dqdx
Definition: w3gdatmd.F90:1209
w3gdatmd::mapsta
integer, dimension(:,:), pointer mapsta
Definition: w3gdatmd.F90:1163
w3updtmd::w3uwnd
subroutine w3uwnd(FLFRST, VGX, VGY)
Interpolate wind fields to the given time.
Definition: w3updtmd.F90:489
w3wdatmd::tice
integer, dimension(:), pointer tice
Definition: w3wdatmd.F90:172
constants::grav
real, parameter grav
GRAV Acc.
Definition: constants.F90:61
w3gdatmd::mapst2
integer, dimension(:,:), pointer mapst2
Definition: w3gdatmd.F90:1163
pdlib_w3profsmd
Definition: w3profsmd_pdlib.F90:4
w3parall::init_get_isea
subroutine init_get_isea(ISEA, JSEA)
Set ISEA for all schemes.
Definition: w3parall.F90:1398
w3idatmd::tcn
integer, dimension(:), pointer tcn
Definition: w3idatmd.F90:236
pdlib_w3profsmd::set_iobdp_pdlib
subroutine set_iobdp_pdlib
Definition: w3profsmd_pdlib.F90:6814
w3idatmd::flic1
logical, pointer flic1
Definition: w3idatmd.F90:264
w3odatmd::bbpin
real, dimension(:,:), pointer bbpin
Definition: w3odatmd.F90:541
w3gdatmd::flagll
logical, pointer flagll
Definition: w3gdatmd.F90:1219
w3wdatmd::asf
real, dimension(:), pointer asf
Definition: w3wdatmd.F90:183