WAVEWATCH III  beta 0.0.1
w3ref1md.F90
Go to the documentation of this file.
1 
8 
9 !/ ------------------------------------------------------------------- /
22 MODULE w3ref1md
23  !/
24  !/ +-----------------------------------+
25  !/ | WAVEWATCH III |
26  !/ | F. Ardhuin |
27  !/ | FORTRAN 90 |
28  !/ | Last update : 27-Jun-2014 |
29  !/ +-----------------------------------+
30  !/
31  !/ 31-Mar-2010 : Origination. ( version 3.14.IFREMER )
32  !/ 03-Sep-2010 : Clean up ( version 3.14.IFREMER )
33  !/ 31-May-2011 : Adding variable reflections ( version 4.01 )
34  !/ 02-Nov-2011 : Compatibility with unst. grids ( version 4.04 )
35  !/ 24-Fev-2012 : Correction of angle in fluxes ( version 4.05 )
36  !/ 27-Jul-2013 : Adding free infragravity waves ( version 4.11 )
37  !/ 11-Nov-2013 : Extends IG energy into main band ( version 4.13 )
38  !/ 11-Jun-2014 : Put reflection by subgrids back ( version 5.01 )
39  !/ 27-Jun-2014 : Modifies subgrid reflection of IG ( version 5.01 )
40  !/
41  ! 1. Purpose :
42  !
43  ! This module computes :
44  ! - shoreline reflection
45  ! - unresolved islands and iceberg reflections
46  !
47  ! 2. Variables and types :
48  !
49  ! Name Type Scope Description
50  ! ----------------------------------------------------------------
51  ! ----------------------------------------------------------------
52  !
53  ! 3. Subroutines and functions :
54  !
55  ! Name Type Scope Description
56  ! ----------------------------------------------------------------
57  ! W3SREF Subr. Public Reflection of waves (shorline, islands...)
58  ! ----------------------------------------------------------------
59  !
60  ! 4. Subroutines and functions used :
61  !
62  ! Name Type Module Description
63  ! ----------------------------------------------------------------
64  ! STRACE Subr. W3SERVMD Subroutine tracing.
65  ! ----------------------------------------------------------------
66  !
67  ! 5. Remarks :
68  !
69  !
70  ! 6. Switches :
71  !
72  ! !/S Enable subroutine tracing.
73  !
74  ! 7. Source code :
75  !/
76  !/ ------------------------------------------------------------------- /
77  !/
78  !
79  PUBLIC
80  !/
81  !/ Public variables
82  !/
83  !
84  !/
85 CONTAINS
86  !/ ------------------------------------------------------------------- /
111  SUBROUTINE w3sref(A, CG, WN, EMEAN, FMEAN, DEPTH, CX1, CY1, REFLC, REFLD, &
112  TRNX, TRNY, BERG, DT, IX, IY, JSEA, S)
113  !/
114  !/ +-----------------------------------+
115  !/ | WAVEWATCH III NOAA/NCEP |
116  !/ | F. Ardhuin |
117  !/ | FORTRAN 90 |
118  !/ | Last update : 11-Jun-2014 |
119  !/ +-----------------------------------+
120  !/
121  !/ 06-May-2010 : Origination. ( version 3.14-Ifremer )
122  !/ 31-May-2011 : Introduction of amplitude-dependent R ( version 4.05 )
123  !/ 27-Jul-2013 : Adding free infragravity waves ( version 4.11 )
124  !/ 11-Nov-2013 : Expands IG energy frequency range ( version 4.13 )
125  !/ 05-Mar-2014 : Fixing bug with ICALC = 1 and IG1 ( version 4.18 )
126  !/ 11-Jun-2014 : Put reflection by subgrids back ( version 5.01 )
127  !/
128  ! 1. Purpose :
129  !
130  ! Computes coastal and iceberg/island reflections and adds free IG energy
131  !
132  ! 2. Method :
133  !
134  ! Adds the reflected components from 2 types of sources:
135  ! shoreline reflection, subgrid obstruction and icebergs
136  !
137  ! In the case where the IG switch is present, there are two passes:
138  ! - ICALC = 1, only the wind sea and swell are reflected (no IG added)
139  ! - ICALC = 2, IG energy is added into all frequency bands
140  !
141  !
142  ! When IG energy is put in the entire spectrum ( NINT(IGPARS(4)).EQ.2 )
143  ! two passes are done: the first for the reflection of windsea and swell
144  ! the second for the addition of IG and IG reflection alone
145  !
146  !
147  ! 3. Parameters :
148  !
149  ! Parameter list
150  ! ----------------------------------------------------------------
151  ! A R.A. I Action density spectrum (1-D)
152  ! CG R.A. I Group velocities.
153  ! WN R.A. I Wavenumbers.
154  ! DEPTH Real I Mean water depth.
155  ! S R.A. O Source term (1-D version).
156  ! D R.A. O Diagonal term of derivative (1-D version).
157  ! ----------------------------------------------------------------
158  !
159  ! 4. Subroutines used :
160  !
161  ! Name Type Module Description
162  ! ----------------------------------------------------------------
163  ! STRACE Subr. W3SERVMD Subroutine tracing.
164  ! ----------------------------------------------------------------
165  !
166  ! 5. Called by :
167  !
168  ! Name Type Module Description
169  ! ----------------------------------------------------------------
170  ! W3SRCE Subr. W3SRCEMD Source term integration.
171  ! W3EXPO Subr. N/A Point output post-processor.
172  ! GXEXPO Subr. N/A GrADS point output post-processor.
173  ! ----------------------------------------------------------------
174  !
175  ! 6. Error messages :
176  !
177  ! None.
178  !
179  ! 7. Remarks :
180  !
181  ! 8. Structure :
182  !
183  ! See source code.
184  !
185  ! 9. Switches :
186  !
187  ! !/S Enable subroutine tracing.
188  !
189  ! 10. Source code :
190  !
191  !/ ------------------------------------------------------------------- /
192  USE constants
193  USE w3gdatmd, ONLY: nk, nth, nspec, sig, dth, dden, smctype, &
196  USE w3gdatmd, ONLY : clats, hpfac, hqfac, sx, sy, si
197 #ifdef W3_PDLIB
198  USE yownodepool, ONLY: pdlib_si
200 #endif
201 #ifdef W3_IG1
202  USE w3gdatmd, ONLY : igpars
203  USE w3gig1md
204  USE w3canomd, ONLY : w3add2ndorder
205  USE w3dispmd, ONLY: nar1d, dfac, n1max, ecg1, ewn1, dsie
206 #endif
207 #ifdef W3_S
208  USE w3servmd, ONLY: strace
209 #endif
210  !/
211  !
212  IMPLICIT NONE
213  !/
214  !/ ------------------------------------------------------------------- /
215  !/ Parameter list
216  !/
217  REAL, INTENT(IN) :: CG(NK), WN(NK), DEPTH, EMEAN, FMEAN
218  REAL, INTENT(INOUT) :: A(NSPEC)
219  REAL, INTENT(IN) :: CX1, CY1, DT
220  INTEGER, INTENT(IN) :: REFLD(6), IX, IY, JSEA
221  REAL, INTENT(IN) :: REFLC(4), TRNX, &
222  TRNY, BERG
223  REAL, INTENT(OUT) :: S(NSPEC)
224  !/
225  !/ ------------------------------------------------------------------- /
226  !/ Local parameters
227  !/
228  INTEGER :: ISPECI, ISPEC, IK, ITH, ITH2, ITH3, ITH2X, ITH2Y, &
229  NRS, IK1
230  INTEGER :: ISEA, ICALC, IOBPDIP(NTH)
231  LOGICAL :: IGBCOVERWRITE, IGSWELLMAX
232  REAL :: R1, R2, R3, R4, R2X, R2Y, DEPTHIG
233  REAL :: DELA, DELX, DELY, FACX
234  REAL :: FAC1, FAC2, FAC3, FAC4, RAMP0, RAMP, &
235  RAMP1, RAMP2, RAMP4, MICHEFAC, SLOPE
236  REAL :: HS, HIG, HIG1, HIG2, EB, SB, EMEANA, FMEAN2, &
237  FMEANA, FREQIG, EFIG, EFIG1, SQRTH, SMEANA
238 #ifdef W3_IG1
239  INTEGER :: NKIG,NSPECIG,NSPECIGSTART, I1, I2
240  REAL :: ATMP(NSPEC),ATMP2(NSPEC), STMP1(NSPEC), &
241  STMP2(NSPEC), WNB(NK), CGB(NK), SIX, IGFAC1, IGFAC2
242 #endif
243 #ifdef W3_S
244  INTEGER, SAVE :: IENT = 0
245  CALL strace (ient, 'W3SREF')
246 #endif
247  !
248  ! 0. Initializations ------------------------------------------------ *
249  !
250 #ifdef W3_IG1
251  igbcoverwrite =(mod( nint(igpars(4)),2).EQ.1)
252  igswellmax =( nint(igpars(4)).GE.2)
253  ! This following line is a quick fix before the bug is understood ....
254  IF (gtype.EQ.ungtype) igswellmax =.false.
255  igfac1 = 0.25
256  igfac2 = 0.25
257 #endif
258  emeana = 0.
259  fmeana = 0.
260  fmean2 = 0.
261 
262  delx=1.
263  dely=1.
264  ! set FACx for all grid types
265  IF (flagll) THEN
266  facx = 1./(dera * radius)
267  ELSE
268  facx = 1.
269  END IF
270 
271  isea = mapfs(iy,ix)
272  !!Li SMCTYPE shares info with RLGTYPE. JGLi12Oct2020
273  IF (gtype.EQ.rlgtype .OR. gtype.EQ.smctype) THEN
274  delx=sx*clats(isea)/facx
275  dely=sy/facx
276  END IF
277 
278  IF (gtype.EQ.clgtype) THEN
279  ! Maybe what follows works also for RLGTYPE ... to be verified
280  delx=hpfac(iy,ix)/ facx
281  dely=hqfac(iy,ix)/ facx
282  END IF
283 
284  IF (gtype.EQ.ungtype) THEN
285  IF (lpdlib) THEN
286 #ifdef W3_PDLIB
287  delx=5.*sqrt(pdlib_si(jsea))*(dera * radius) ! first approximation ...
288  dely=5.*sqrt(pdlib_si(jsea))*(dera * radius) ! first approximation ...
289 #endif
290  ELSE
291  delx=5.*sqrt(si(ix))*(dera * radius) ! first approximation ...
292  dely=5.*sqrt(si(ix))*(dera * radius) ! first approximation ...
293  ENDIF
294  END IF
295 
296  ik1=1
297 #ifdef W3_IG1
298  ik1=nint(igpars(5))+1
299  nspecigstart = nint(igpars(5))*nth
300 #endif
301  DO ik=ik1, nk
302  eb = 0.
303  DO ith=1, nth
304  eb = eb + a(ith+(ik-1)*nth)
305  END DO
306  eb = eb * dden(ik) / cg(ik)
307  emeana = emeana + eb
308  fmean2 = fmean2 + eb /sig(ik)**2
309  fmeana = fmeana + eb /sig(ik)
310  END DO
311  fmeana = tpiinv * (emeana / max( 1.e-7 , fmeana ))
312  fmean2 = tpiinv * sqrt(emeana / max( 1.e-7 , fmean2 ))
313  fmeana = max(fmeana,sig(1))
314  !
315  ! 1. Sets reflection term to zero
316  !
317  icalc=1
318 #ifdef W3_IG1
319  stmp1 = 0.
320  stmp2 = 0.
321 #endif
322  hs=4.*sqrt(emeana)
323 #ifdef W3_IG1
324  atmp(:)=a(:) ! the IG energy will be added to this ATMP
325  atmp2(:)=a(:) ! this is really to keep in memory the original spectrum
326  IF (igbcoverwrite.AND.reflc(1).GT.0) THEN
327  igfac1 = 1.
328  atmp2(1:nspecigstart) = 0.
329  END IF
330  !
331  ! resets IG band energy to zero
332  !
333  DO icalc=1,2
334 #endif
335  s = 0.
336 #ifdef W3_IG1
337  IF (igbcoverwrite) a(1:nspecigstart)=0.
338  IF (icalc.EQ.1) a=atmp2
339  IF (icalc.EQ.2) THEN
340  !
341  ! 1.1 Replaces IG part by forced IG
342  !
343  ! determines highest IG frequency
344  !
345  IF (igswellmax) THEN
346  nkig=nk
347  ELSE
348  nkig=nint(igpars(5))
349  ENDIF
350  freqig=sig(nint(igpars(5)))*tpiinv
351  !
352  nspecig=nkig*nth
353  atmp(1:nspecigstart)=0. ! flat bottom approximation (Hasselmann 1962)
354  ! is not valid for long waves
355  IF (nint(igpars(3)).EQ.1) THEN ! IGPARS(3) = IGSOURCE
356  IF (nint(igpars(8)).EQ.1) THEN ! in this case, uses depth at break point
357  depthig=max(1.,hs/0.3) ! to be modified later with a proper gamma
358  ELSE
359  depthig=depth
360  END IF
361  IF (igpars(10).GT.0.) depthig = igpars(10) ! fixed depth for 2nd order calculation
362  !
363  !/ --- INLINED WAVNU1 (START) ---------------------------------------- /
364  !
365  DO ik=1, nk
366  sqrth = sqrt(depthig)
367  six = sig(ik) * sqrth
368  i1 = int(six/dsie)
369  IF (i1.LE.n1max) THEN
370  i2 = i1 + 1
371  r1 = six/dsie - real(i1)
372  r2 = 1. - r1
373  wnb(ik) = ( r2*ewn1(i1) + r1*ewn1(i2) ) / depth
374  cgb(ik) = ( r2*ecg1(i1) + r1*ecg1(i2) ) * sqrth
375  ELSE
376  wnb(ik) = sig(ik)*sig(ik)/grav
377  cgb(ik) = 0.5 * grav / sig(ik)
378  END IF
379  END DO
380  !
381  !/ --- INLINED WAVNU1 (END) ------------------------------------------ /
382  !
383  IF (nint(igpars(1)).EQ.1) THEN ! IGPARS(1) = IGMETHOD
384  CALL w3addig(atmp,depthig,wnb,cgb,1)
385  ELSE
386  CALL w3add2ndorder(atmp,depthig,wnb,cgb,1)
387  END IF
388  ! Transforms energy back to proper depth
389  DO ik=1,nkig
390  atmp(1+(ik-1)*nth:ik*nth)=atmp(1+(ik-1)*nth:ik*nth)*(cgb(ik)*wn(ik))/(cg(ik)*wnb(ik))
391  END DO
392  a(1:nspecig)=atmp(1:nspecig)
393  IF (igswellmax) THEN
394  DO ispec=1,nspecig
395  a(ispec)=max(atmp(ispec)-a(ispec),0.)
396  END DO
397  ELSE
398  a(1:nspecig)=atmp(1:nspecig)
399  ENDIF
400  !
401  ELSEIF (nint(igpars(3)).EQ.2) THEN ! Empirical source of IG energy
402  !
403  ! This empirical source was adjusted to Waimea and Duck data
404  ! When applied to deep water the 1/Depth must be replaced with k/Cg
405  ! Hence the proper coefficient is WN(IK)/CG(IK)*GRAV**2/SIG(IK)
406  !
407  ! The empirical form is HIG = IGEMPIRICAL * ...
408  ! this is not quite yet a wave height: multiplied below by MIN(0.0036, ...
409  !
410  hig= hs/(max(fmean2,freqig)**2)
411  efig=(hig*0.25)**2/0.0279 ! this is (HsIG/4)^2 / df
412  hig2 = 0.
413  DO ik=1,nkig
414  !
415  ! First approximation: constant IG spectrum with frequency
416  !
417  efig1=efig*min(0.0036,igpars(11)*wn(ik)/cg(ik)*grav**2/sig(ik))
418  !
419  ! Correction: gives a frequency shape ...
420  !
421  IF (ik.LT.ik1) THEN
422  ! The 1.5 exponent of Ardhuin et al. 2014 (see figure 8.a) was probably too high ... now reduced to 1.0
423  efig1=efig1*igfac1*1.2*min(1.,0.013/(sig(ik)*tpiinv))**1.0
424  ELSE
425  efig1=efig1*igfac2*1.2*min(1.,0.013/(sig(ik)*tpiinv))**1.0
426  END IF
427  !
428  ! Conversion to action spectral density A(k,theta), assuming isotropic dir.
429  !
430  a(1+(ik-1)*nth:ik*nth)=efig1*cg(ik)/((sig(ik)*tpi)*tpi)
431  hig2 = hig2 + efig1*dsii(ik)*tpiinv
432  END DO
433  ELSE
434  nspecig=0
435  END IF
436  !
437  END IF ! ICALC EQ 2
438 #endif
439  !
440  nrs=nint(refpars(8))
441  IF (refpars(6).GT.0) THEN
442  !
443  ! This is the Miche parameter for a beach slope of REFLC(3)
444  !
445  IF(reflc(3)/=reflc(3)) THEN ! isnan test
446  slope=0.001
447  ELSE
448  slope=max(0.001,reflc(3))
449  END IF
450  michefac=0.0001*grav**2*(slope**5) &
451  /(max(emeana,1e-4)*max(fmeana,0.001)**4)
452  ramp0=max(0.07*(alog10(michefac)+4.5)+1.5*michefac,0.005) ! IF REFLC(1)=1, 0.07 should be 0.007
453  ! NB: these constants are adjusted for REFLC(1) = 0.1. If REFLC(1)=1, 0.07 should be 0.007
454  ELSE
455  ramp0=1.
456  ENDIF
457 
458  !
459  ! 2. Shoreline reflection =============================================== *
460  !
461  IF (reflc(1).GT.0) THEN
462  fac1=1/(0.5*real(nth))
463  fac2=1.57/(0.5*real(nth))
464  ! FAC3=2.6/(0.5*REAL(NTH)) ! this is for NRS=4
465  fac3=2./sum(abs(ecos(1:nth))**nrs)
466  fac4=1.
467  !
468  DO ik=1, nk
469  !
470  ! Includes frequency dependence (see Elgar et al. JPO 1994)
471  !
472  IF (refpars(6).GT.0) THEN
473  ramp=(max((0.75*tpi*fmeana/sig(ik)),1.)**refpars(10))*ramp0
474  ramp1=min(refpars(9),reflc(1)*ramp)
475  ramp2=min(refpars(9),reflc(2)*ramp)
476  ELSE
477  ramp1=ramp0*reflc(1)
478  ramp2=ramp0*reflc(2)
479  END IF
480  !
481  ! Special treatment for unstructured grids when not using source term
482  !
483  IF (gtype.EQ.ungtype.AND.refpars(3).LT.0.5) THEN
484  IF (lpdlib) THEN
485 #ifdef W3_PDLIB
486  iobpdip = iobpd_loc(:,jsea)
487 #endif
488  ELSE
489  iobpdip = iobpd(:,ix)
490  ENDIF
491  DO ith=1, nth
492  ispeci=ith+(ik-1)*nth
493  a(ispeci)=a(ispeci)*iobpdip(ith) !puts to zero the energy not going to coast
494  END DO
495  !
496  DO ith=1, nth
497  r1=ecos(1+mod(abs(ith-refld(1)),nth))
498  r1=iobpdip(ith)
499  ispeci=ith+(ik-1)*nth
500  r2=ramp1*a(ispeci)
501  IF (r1.GT.0.AND.r2.GT.0) THEN
502  !
503  ! Determines direction of specular reflection: th3=pi+2*n-th1
504  !
505  ith3=1+mod(nth/2+nth+2*refld(1)-ith-1,nth)
506  DO ith2=1,nth
507  !
508  ! Adds energy into reflected directions (ITH2)
509  !
510  ispec=ith2+(ik-1)*nth
511  r3=ecos(1+mod(abs(ith2-refld(1)),nth))
512  IF (r3.LT.0) THEN
513  r4=ecos(1+mod(abs(ith2-ith3),nth))*(1-iobpdip(ith2))
514  IF (r4.GT.0.) THEN
515  !
516  ! Tests the type of shoreline geometry
517  !
518  SELECT CASE (refld(2))
519  CASE (0)
520  ! Sharp corner: broad reflection
521  s(ispec)=s(ispec)+r2*fac1/dt
522 
523  ! FA: analog to following lines to be swapped in if reflection method changed
524  ! RECT CASE:
525  ! S(ISPEC)=S(ISPEC)+ &
526  ! REAL(REFLD(3))*R2*CG(IK)*ABS(ECOS(ITH2X)/DELX)*FAC1 &
527  ! +REAL(REFLD(4))*R2*CG(IK)*ABS(ESIN(ITH2Y)/DELY)*FAC1
528 
529 
530  CASE (1)
531  ! mild corner: average reflection
532  s(ispec)=s(ispec)+r2*abs(r4)*fac2/dt
533  CASE (2)
534  ! straight coast: narrow reflection
535  ! IF(ITH3.EQ.ITH2) S(ISPEC)=S(ISPEC)+R2/DT ! THIS IS FOR SPECULAR REF.
536  s(ispec)=s(ispec)+r2*(r4**nrs) *fac3/dt
537  END SELECT
538  END IF ! (R4.GT.0.)
539  END IF ! (R3.LT.0)
540  END DO ! ITH2=1,NTH
541  END IF ! (R1.GT.0.AND.R2.GT.0)
542  END DO ! ITH=1, NTH
543  ELSE ! (GTYPE.NE.UNGTYPE)
544  !
545  ! This is for structured grids ....
546  !
547  !
548  ! Loop on incident wave direction (ITH)
549  !
550  DO ith=1, nth
551  r1=ecos(1+mod(abs(ith-refld(1)),nth))
552  r2=ramp1*a(ith+(ik-1)*nth)
553  IF (r1.GT.0.AND.r2.GT.0) THEN
554  DO ith2=1,nth
555  !
556  ! Adds energy into reflected directions (ITH2)
557  !
558  ispec=ith2+(ik-1)*nth
559  ith2x=1+mod(nth+ith2-refld(5)-1,nth)
560  ith2y=1+mod(nth+ith2-refld(6)-1,nth)
561  r3=ecos(1+mod(abs(ith2-refld(1)),nth))
562  IF (r3.LT.0) THEN
563  !
564  ! Determines direction of specular reflection: th3=pi+2*n-th1
565  !
566  ith3=1+mod(nth/2+nth+2*refld(1)-ith-1,nth)
567  r4=ecos(1+mod(abs(ith2-ith3),nth))
568  IF (r4.GT.0.) THEN
569  !
570  ! Tests the type of shoreline geometry
571  ! NB: REFLD(3) or REFLD(4) is equal to 1 if the reflection is applied (real land neighbor)
572  SELECT CASE (refld(2))
573  CASE (0)
574  ! Sharp corner: broad reflection
575  s(ispec)=s(ispec)+ &
576  REAL(REFLD(3))*R2*CG(IK)*ABS(ECOS(ITH2X)/DELX)*FAC1 &
577  +REAL(REFLD(4))*R2*CG(IK)*ABS(ESIN(ITH2Y)/DELY)*FAC1
578  CASE (1)
579  ! mild corner: average reflection
580  !
581  s(ispec)=s(ispec)+ &
582  REAL(REFLD(3))*R2*CG(IK)*ABS(ECOS(ITH2X)/DELX)*ABS(R4)*FAC2 &
583  + REAL(REFLD(4))*R2*CG(IK)*ABS(ESIN(ITH2Y)/DELY)*ABS(R4)*FAC2
584  CASE (2)
585  ! straight coast: narrow reflection
586  ! Specular for tests
587  ! S(ISPEC)=S(ISPEC)+REAL(REFLD(3))*R2*CG(IK)*ABS(ECOS(ITH2)/DELX) &
588  ! +REAL(REFLD(4))*R2*CG(IK)*ABS(ESIN(ITH2)/DELY)
589  !
590  s(ispec)=s(ispec)+real(refld(3))*r2*cg(ik)*abs(ecos(ith2x)/delx) &
591  *(r4**nrs) *fac3 &
592  +real(refld(4))*r2*cg(ik)*abs(esin(ith2y)/dely) &
593  *(r4**nrs) *fac3
594  END SELECT
595  END IF ! (R4.GT.0.)
596  END IF ! (R3.LT.0)
597  END DO ! ITH2=1,NTH
598  END IF ! (R1.GT.0.AND.R2.GT.0)
599  END DO ! ITH=1,NTH
600  END IF ! UNGTYPE
601 
602  END DO ! loop on IK
603  END IF ! end of test on REFLC(1)
604  !
605  ! Add diffuse reflection due to subgrid islands and icebergs
606  ! At present this feature is not supported for unstructured grids.
607  !
608  IF ( ((refpars(2).GT.0.).AND.((trnx+trny).LT.2)) &
609  .OR.((refpars(4).GT.0.).AND.(berg.GT.0) ) ) THEN
610  !
611  ! Includes frequency dependence (see Elgar et al. JPO 1994)
612  !
613  IF (refpars(6).GT.0) THEN
614  ramp=(max((0.75*tpi*fmeana/sig(ik)),1.)**refpars(10))*ramp0
615  ramp2=min(refpars(9),reflc(2)*ramp)
616  !
617  ! recomputes coefficients for iceberg slope given by REFLC(4)
618  !
619  slope=max(0.001,reflc(4))
620  michefac=0.0001*grav**2*(slope**5) &
621  /(max(emeana,1e-4)*max(fmeana,0.001)**4)
622  ramp0=max(0.007*(alog10(michefac)+4.5)+1.5*michefac,0.005) ! IF REFLC(1)=1, 0.07 should be 0.007
623  ramp=(max((0.75*tpi*fmeana/sig(ik)),1.)**refpars(10))*ramp0
624  ramp4=min(refpars(9),ramp)
625  ELSE
626  ramp2=ramp0*reflc(2)
627  ramp4=ramp0*reflc(4)
628  END IF
629  !
630  !
631  r2x= ramp2*refpars(2)*max(0.,min(1.,(1-trnx))) &
632  + ramp4*refpars(4)*max(0.,min(1.,(1-exp(-berg*delx*0.0001))))
633  r2y= ramp2*refpars(2)*max(0.,min(1.,(1-trny))) &
634  + ramp4*refpars(4)*max(0.,min(1.,(1-exp(-berg*dely*0.0001))))
635  fac1=1/(0.5*real(nth))
636  DO ik=1, nk
637  DO ith=1, nth
638  r2=a(ith+(ik-1)*nth)
639  IF (r2.GT.0.) THEN
640 
641  DO ith2=1,nth
642  ispec=ith2+(ik-1)*nth
643  r3=ecos(1+mod(nth+ith2-ith,nth))
644  IF (r3.LT.0) THEN
645  s(ispec)=s(ispec)+ &
646  cg(ik)*r2x*r2*abs(ecos(ith2)/delx)*fac1 &
647  + cg(ik)*r2y*r2*abs(esin(ith2)/dely)*fac1
648  END IF
649  END DO
650  END IF
651  END DO
652  END DO
653  END IF
654 
655 #ifdef W3_IG1
656  IF (icalc.EQ.1) THEN
657  stmp1(nspecigstart+1:nspec) = s(nspecigstart+1:nspec)
658  ELSE
659  stmp2 = s
660  DO ispec = 1, nspec
661  s(ispec) = max(stmp2(ispec),stmp1(ispec))
662  END DO
663  END IF
664  ENDDO ! ICALC = 1,2
665  a(1:nspecig)=atmp2(1:nspecig) ! removes bound IG components ...
666 #endif
667  !/
668  !/ End of W3SREF ----------------------------------------------------- /
669  !/
670  END SUBROUTINE w3sref!/ ------------------------------------------------------------------- /
671 
672  !/
673  !/ End of module W3REF1MD -------------------------------------------- /
674  !/
675 END MODULE w3ref1md
w3dispmd::dfac
real, parameter dfac
Definition: w3dispmd.F90:75
w3gdatmd::nk
integer, pointer nk
Definition: w3gdatmd.F90:1230
w3gdatmd::dth
real, pointer dth
Definition: w3gdatmd.F90:1232
w3gdatmd::nspec
integer, pointer nspec
Definition: w3gdatmd.F90:1230
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
w3gdatmd::rlgtype
integer, parameter rlgtype
Definition: w3gdatmd.F90:624
w3gdatmd::mapth
integer, dimension(:), pointer mapth
Definition: w3gdatmd.F90:1231
w3gdatmd::iobpd_loc
integer *1, dimension(:,:), pointer iobpd_loc
Definition: w3gdatmd.F90:1116
w3gdatmd::sig
real, dimension(:), pointer sig
Definition: w3gdatmd.F90:1234
w3gdatmd::sy
real, pointer sy
Definition: w3gdatmd.F90:1183
w3ref1md::w3sref
subroutine w3sref(A, CG, WN, EMEAN, FMEAN, DEPTH, CX1, CY1, REFLC, REFLD, TRNX, TRNY, BERG, DT, IX, IY, JSEA, S)
Computes coastal and iceberg/island reflections and adds free IG energy.
Definition: w3ref1md.F90:113
w3gdatmd::ecos
real, dimension(:), pointer ecos
Definition: w3gdatmd.F90:1234
w3gdatmd::iobp_loc
integer *2, dimension(:), pointer iobp_loc
Definition: w3gdatmd.F90:1117
w3gdatmd::iobdp_loc
integer *1, dimension(:), pointer iobdp_loc
Definition: w3gdatmd.F90:1118
w3gdatmd::hqfac
real, dimension(:,:), pointer hqfac
Definition: w3gdatmd.F90:1212
yownodepool::pdlib_si
real(rkind), dimension(:), allocatable, target, public pdlib_si
Definition: yownodepool.F90:80
w3dispmd::ewn1
real, dimension(0:nar1d) ewn1
Definition: w3dispmd.F90:78
w3gdatmd::mapfs
integer, dimension(:,:), pointer mapfs
Definition: w3gdatmd.F90:1163
w3gdatmd::esin
real, dimension(:), pointer esin
Definition: w3gdatmd.F90:1234
yownodepool
Has data that belong to nodes.
Definition: yownodepool.F90:39
constants::lpdlib
logical lpdlib
LPDLIB Logical for using the PDLIB library.
Definition: constants.F90:101
w3gdatmd::clgtype
integer, parameter clgtype
Definition: w3gdatmd.F90:625
w3canomd
Calculation of the second order correction to the surface gravity wave spectrum.
Definition: w3canomd.F90:23
w3servmd
Definition: w3servmd.F90:3
w3gdatmd::dsii
real, dimension(:), pointer dsii
Definition: w3gdatmd.F90:1234
constants::tpiinv
real, parameter tpiinv
TPIINV Inverse of 2*Pi.
Definition: constants.F90:74
w3gig1md
Definition: w3gig1md.F90:3
w3gdatmd::nth
integer, pointer nth
Definition: w3gdatmd.F90:1230
w3dispmd::ecg1
real, dimension(0:nar1d) ecg1
Definition: w3dispmd.F90:78
w3gdatmd::clats
real, dimension(:), pointer clats
Definition: w3gdatmd.F90:1196
w3gig1md::w3addig
subroutine w3addig(E, DEPTH, WN, CG, IACTION)
Definition: w3gig1md.F90:147
w3gdatmd::smctype
integer, parameter smctype
Definition: w3gdatmd.F90:627
constants::radius
real, parameter radius
RADIUS Radius of the earth (m).
Definition: constants.F90:79
w3gdatmd::iobpd
integer *1, dimension(:,:), pointer iobpd
Definition: w3gdatmd.F90:1130
w3gdatmd::sig2
real, dimension(:), pointer sig2
Definition: w3gdatmd.F90:1234
constants::tpi
real, parameter tpi
TPI 2*Pi.
Definition: constants.F90:72
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3gdatmd::gtype
integer, pointer gtype
Definition: w3gdatmd.F90:1094
w3gdatmd::mapwn
integer, dimension(:), pointer mapwn
Definition: w3gdatmd.F90:1231
w3gdatmd::iobpa_loc
integer *1, dimension(:), pointer iobpa_loc
Definition: w3gdatmd.F90:1119
w3gdatmd::hpfac
real, dimension(:,:), pointer hpfac
Definition: w3gdatmd.F90:1211
w3gdatmd::si
real(8), dimension(:), pointer si
Definition: w3gdatmd.F90:1122
w3gdatmd::sx
real, pointer sx
Definition: w3gdatmd.F90:1183
constants
Define some much-used constants for global use (all defined as PARAMETER).
Definition: constants.F90:20
w3gdatmd::dden
real, dimension(:), pointer dden
Definition: w3gdatmd.F90:1234
w3gdatmd
Definition: w3gdatmd.F90:16
w3dispmd::nar1d
integer, parameter nar1d
Definition: w3dispmd.F90:74
w3gdatmd::igpars
real, dimension(:), pointer igpars
Definition: w3gdatmd.F90:1142
w3gdatmd::refpars
real, dimension(:), pointer refpars
Definition: w3gdatmd.F90:1139
w3canomd::w3add2ndorder
subroutine w3add2ndorder(E, DEPTH, WN, CG, IACTION)
Adds second order spectrum on top of first order spectrum.
Definition: w3canomd.F90:153
w3ref1md
This module computes shoreline reflection, and unresolved islands and iceberg reflections.
Definition: w3ref1md.F90:22
w3gdatmd::ec2
real, dimension(:), pointer ec2
Definition: w3gdatmd.F90:1234
w3dispmd
Definition: w3dispmd.F90:3
w3dispmd::n1max
integer n1max
Definition: w3dispmd.F90:77
constants::grav
real, parameter grav
GRAV Acc.
Definition: constants.F90:61
w3dispmd::dsie
real dsie
Definition: w3dispmd.F90:78
w3gdatmd::flagll
logical, pointer flagll
Definition: w3gdatmd.F90:1219