WAVEWATCH III  beta 0.0.1
w3profsmd Module Reference

Functions/Subroutines

subroutine w3xypug (ISP, FACX, FACY, DTG, VQ, VGX, VGY, LCALC)
 
subroutine w3cflug (ISEA, NKCFL, FACX, FACY, DT, MAPFS, CFLXYMAX, VGX, VGY)
 
subroutine w3xypfsn2 (ISP, C, LCALC, RD10, RD20, DT, AC)
 
subroutine w3xypfspsi2 (ISP, C, LCALC, RD10, RD20, DT, AC)
 
subroutine w3xypfsnimp (ISP, C, LCALC, RD10, RD20, DT, AC)
 
subroutine w3xypfsfct2 (ISP, C, LCALC, RD10, RD20, DT, AC)
 
subroutine setdepth
 

Function/Subroutine Documentation

◆ setdepth()

subroutine w3profsmd::setdepth

Definition at line 1587 of file w3profsmd.F90.

1587  !/
1588  !/ +-----------------------------------+
1589  !/ | WAVEWATCH III NOAA/NCEP |
1590  !/ | |
1591  !/ | Aron Roland (BGS IT&E GmbH) |
1592  !/ | Mathieu Dutour-Sikiric (IRB) |
1593  !/ | |
1594  !/ | FORTRAN 90 |
1595  !/ | Last update : 01-June-2018 |
1596  !/ +-----------------------------------+
1597  !/
1598  !/ 01-June-2018 : Origination. ( version 6.04 )
1599  !/
1600  ! 1. Purpose : Init pdlib part
1601  ! 2. Method :
1602  ! 3. Parameters :
1603  !
1604  ! Parameter list
1605  ! ----------------------------------------------------------------
1606  ! ----------------------------------------------------------------
1607  !
1608  ! 4. Subroutines used :
1609  !
1610  ! Name Type Module Description
1611  ! ----------------------------------------------------------------
1612  ! STRACE Subr. W3SERVMD Subroutine tracing.
1613  ! ----------------------------------------------------------------
1614  !
1615  ! 5. Called by :
1616  !
1617  ! Name Type Module Description
1618  ! ----------------------------------------------------------------
1619  ! ----------------------------------------------------------------
1620  !
1621  ! 6. Error messages :
1622  ! 7. Remarks
1623  ! 8. Structure :
1624  ! 9. Switches :
1625  !
1626  ! !/S Enable subroutine tracing.
1627  !
1628  ! 10. Source code :
1629  !
1630  !/ ------------------------------------------------------------------- /
1631 #ifdef W3_S
1632  USE w3servmd, ONLY: strace
1633 #endif
1634  !
1635  USE constants, ONLY : lpdlib
1636  USE w3gdatmd, ONLY: mapsf, nseal, dmin, iobdp, mapsta, iobp, mapfs, nx
1637  USE w3adatmd, ONLY: dw
1638 
1639  IMPLICIT NONE
1640  !/
1641  !/ ------------------------------------------------------------------- /
1642  !/ Parameter list
1643  !/
1644  !/ ------------------------------------------------------------------- /
1645  !/ Local PARAMETERs
1646  !/
1647 #ifdef W3_S
1648  INTEGER, SAVE :: IENT = 0
1649 #endif
1650  !/
1651  !/ ------------------------------------------------------------------- /
1652  !
1653  INTEGER :: JSEA, ISEA, IX, IP
1654  real*8, PARAMETER :: dthr = 10e-6
1655 #ifdef W3_S
1656  CALL strace (ient, 'SETDEPTH')
1657 #endif
1658  iobdp = 1
1659  DO ip=1,nx
1660  IF (dw(ip) .LT. dmin + dthr) iobdp(ip) = 0
1661  !WRITE(*,*) ip, ip_glob, MAPSTA(1,IP_glob), IOBP(IP_glob), DW(ISEA), DMIN
1662  END DO
1663 

References w3gdatmd::dmin, w3adatmd::dw, w3gdatmd::iobdp, w3gdatmd::iobp, constants::lpdlib, w3gdatmd::mapfs, w3gdatmd::mapsf, w3gdatmd::mapsta, w3gdatmd::nseal, w3gdatmd::nx, and w3servmd::strace().

Referenced by w3xypug().

◆ w3cflug()

subroutine w3profsmd::w3cflug ( integer, intent(in)  ISEA,
integer, intent(in)  NKCFL,
real, intent(in)  FACX,
real, intent(in)  FACY,
real, intent(in)  DT,
integer, dimension(ny*nx), intent(in)  MAPFS,
real, intent(inout)  CFLXYMAX,
real, intent(in)  VGX,
real, intent(in)  VGY 
)

Definition at line 272 of file w3profsmd.F90.

272  !/
273  !/ +-----------------------------------+
274  !/ | WAVEWATCH III NOAA/NCEP |
275  !/ | Fabrice Ardhuin |
276  !/ | FORTRAN 90 |
277  !/ | Last update : 20-Jun-2013 |
278  !/ +-----------------------------------+
279  !/
280  !/ 01-Mar-2011 : Origination. ( version 3.14 )
281  !/ 20-Jun-2013 : Computes only up to NKCFL for tests ( version 4.10 )
282  !/ 1-Jun-2017 : Rewrite routine for performance ( version 5.xx )
283  !/
284  ! 1. Purpose :
285  !
286  ! Computes the max CFL number for output purposes
287  !
288  ! 2. Method :
289  !
290  !
291  !
292  ! 3. Parameters :
293  !
294  ! Parameter list
295  ! ----------------------------------------------------------------
296  ! ISEA Int. I Index of sea point
297  ! NKCFL Int. I Maximum frequency index
298  ! FACX/Y Real I Factor in propagation velocity.
299  ! ( 1 or 0 * DT / DX )
300  ! DT Real I Time step.
301  ! MAPFS I.A. I Storage map.
302  ! CFLXYMAX Real Maxmimum CFL for spatial advection
303  ! VGX/Y Real I Speed of grid.
304  ! ----------------------------------------------------------------
305  !
306  ! Local variables.
307  ! ----------------------------------------------------------------
308  ! VCFL0X R.A. Local courant numbers for absolute group vel.
309  ! using local X-grid step.
310  ! VCFL0Y R.A. Id. in Y.
311  ! ----------------------------------------------------------------
312  !
313  ! 4. Subroutines used :
314  !
315 
316  ! 5. Called by :
317  !
318  ! W3WAVE Wave model routine.
319  !
320  ! 6. Error messages :
321  !
322  ! None.
323  !
324  ! 7. Remarks :
325  ! make the interface between the WAVEWATCH and the WWM code.
326  !
327  ! 8. Structure :
328  !
329  !
330  ! 9. Switches :
331  !
332  ! !/S Enable subroutine tracing.
333  !
334  !
335  ! 10. Source code :
336  !/ ------------------------------------------------------------------- /
337  !/
338  !
339  USE constants
340  !
341  USE w3timemd, ONLY: dsec21
342  !
343  USE w3gdatmd, ONLY: nx, ny, nsea, mapsf, dtcfl, clats, &
344  flcx, flcy, nk, nth, dth, xfr, &
346  ntri, trigp, ccon , &
348 
349  USE w3adatmd, ONLY: cg, cx, cy, atrnx, atrny, itime, dw
350  USE w3idatmd, ONLY: flcur
351 #ifdef W3_T
352  USE w3odatmd, ONLY: ndse, ndst, flbpi, nbi, tbpi0, tbpin, &
353  isbpi, bbpi0, bbpin
354 #endif
355 #ifdef W3_S
356  USE w3servmd, ONLY: strace
357 #endif
358 
359  IMPLICIT NONE
360  !/ ------------------------------------------------------------------- /
361  !/ Parameter list
362  !/
363  INTEGER, INTENT(IN) :: ISEA, NKCFL, MAPFS(NY*NX)
364  REAL, INTENT(IN) :: FACX, FACY, DT, VGX, VGY
365  REAL, INTENT(INOUT) :: CFLXYMAX
366  !/
367  !/ ------------------------------------------------------------------- /
368  !/ Local parameters
369  !/
370  INTEGER :: ITH, IK
371  INTEGER :: IP, IP2, ISEA2, I, J, IE, IV, I1, I2, I3
372 #ifdef W3_S
373  INTEGER, SAVE :: IENT = 0
374 #endif
375  REAL :: CCOS, CSIN, CCURX, CCURY
376  REAL :: C(NX,2)
377  real*8 :: kelem(3), ktmp(3), lambda(2)
378  real*8 :: kksum, dtmaxexp
379  !/
380  !/ Velocities
381  !/
382  real*8, PARAMETER :: onesixth = 1.0d0/6.0d0
383  real*8, PARAMETER :: thr8 = tiny(1.0d0)
384  REAL, PARAMETER :: THR = tiny(1.0)
385 
386  !/ ------------------------------------------------------------------- /
387  !
388  ! 1. Preparations --------------------------------------------------- *
389  ! 1.a Set constants
390  !
391 
392 #ifdef W3_S
393  CALL strace (ient, 'W3CFLUG')
394 #endif
395  cflxymax=1e-10
396  ip = mapsf(isea,3)
397  !
398  ! CFL no important on boundary
399  !
400  IF (iobp(ip).EQ.1) THEN
401  ccurx = facx
402  ccury = facy
403  !
404  ! Loop over spectral components
405  !
406  DO ik=1,nkcfl
407  DO ith=1,nth
408  ccos = facx * ecos(ith)
409  csin = facy * esin(ith)
410  c(:,:)=0.
411 
412  !
413  ! 2. Calculate advection velocities: group speed ---------------- *
414  !
415  !AR: needs to be rewritten for speed ... single node computation is costly ...
416  !MA: you are right but now it is only called if CFX and UNST for CFL profiling
417 
418  DO i = index_cell(ip), index_cell(ip+1)-1
419  ie=ie_cell(i) ! TRIGP(IV,IE)=IP with IV=POS_CELL(I)
420  DO j=1,3
421  ip2=trigp(j,ie)
422  isea2=mapfs(ip2)
423  c(ip2,1) = ccos * cg(ik,isea2) / clats(isea2)
424  c(ip2,2) = csin * cg(ik,isea2)
425 #ifdef W3_MGP
426  c(ip2,1) = c(ip2,1) - ccurx*vgx/clats(isea2)
427  c(ip2,2) = c(ip2,2) - ccury*vgy
428 #endif
429  IF ( flcur ) THEN
430  IF (iobp(ip2) .EQ. 1) THEN
431  c(ip2,1) = c(ip2,1) + ccurx*cx(isea2)/clats(isea2)
432  c(ip2,2) = c(ip2,2) + ccury*cy(isea2)
433  END IF
434  END IF ! end of ( FLCUR )
435  END DO
436  END DO
437  !
438  !3. Calculate K-Values and contour based quantities ...
439  !
440  kksum = 0.d0
441  DO i = index_cell(ip), index_cell(ip+1)-1
442  ie=ie_cell(i) ! TRIGP(IV,IE)=IP
443  iv=pos_cell(i)
444  i1 = trigp(1,ie)
445  i2 = trigp(2,ie)
446  i3 = trigp(3,ie)
447  lambda(1) = onesixth *(c(i1,1)+c(i2,1)+c(i3,1)) ! Advection speed in X direction
448  lambda(2) = onesixth *(c(i1,2)+c(i2,2)+c(i3,2)) ! Advection speed in Y direction
449  kelem(1) = lambda(1) * ien(ie,1) + lambda(2) * ien(ie,2) ! K-Values - so called Flux Jacobians
450  kelem(2) = lambda(1) * ien(ie,3) + lambda(2) * ien(ie,4) ! K-Values - so called Flux Jacobians
451  kelem(3) = lambda(1) * ien(ie,5) + lambda(2) * ien(ie,6) ! K-Values - so called Flux Jacobians
452 
453  ktmp = kelem ! Copy
454  kelem = max(0.d0,ktmp)
455 
456  kksum = kksum + kelem(iv)
457  END DO ! COUNTRI
458  !
459  dtmaxexp = si(ip)/max(dble(10.e-10),kksum)
460  cflxymax = max(dble(dt)/dtmaxexp,dble(cflxymax))
461  END DO
462  END DO
463  END IF
464  !
465  RETURN

References w3adatmd::atrnx, w3adatmd::atrny, w3odatmd::bbpi0, w3odatmd::bbpin, w3gdatmd::ccon, w3adatmd::cg, w3gdatmd::clats, w3gdatmd::countri, w3adatmd::cx, w3adatmd::cy, w3timemd::dsec21(), w3gdatmd::dtcfl, w3gdatmd::dth, w3adatmd::dw, w3gdatmd::ecos, w3gdatmd::esin, w3odatmd::flbpi, w3idatmd::flcur, w3gdatmd::flcx, w3gdatmd::flcy, w3gdatmd::ie_cell, w3gdatmd::ien, w3gdatmd::index_cell, w3gdatmd::iobp, w3odatmd::isbpi, w3adatmd::itime, w3gdatmd::mapsf, w3odatmd::nbi, w3odatmd::ndse, w3odatmd::ndst, w3gdatmd::nk, w3gdatmd::nsea, w3gdatmd::nth, w3gdatmd::ntri, w3gdatmd::nx, w3gdatmd::ny, w3gdatmd::pfmove, w3gdatmd::pos_cell, w3gdatmd::si, w3gdatmd::sig, w3servmd::strace(), w3odatmd::tbpi0, w3odatmd::tbpin, w3gdatmd::trigp, and w3gdatmd::xfr.

Referenced by w3wavemd::w3wave().

◆ w3xypfsfct2()

subroutine w3profsmd::w3xypfsfct2 ( integer, intent(in)  ISP,
real, dimension(:,:), intent(in)  C,
logical, intent(in)  LCALC,
real, intent(in)  RD10,
real, intent(in)  RD20,
real, intent(in)  DT,
double precision, dimension(:), intent(inout)  AC 
)

Definition at line 1282 of file w3profsmd.F90.

1282  !/
1283  !/
1284  !/ +-----------------------------------+
1285  !/ | WWIII Version of the WWM FS Code |
1286  !/ | by Aron Roland |
1287  !/ | for use in WWIII |
1288  !/ | GPL License |
1289  !/ | Last update : 19-Dec-2007 |
1290  !/ +-----------------------------------+
1291  !/
1292  ! 1. Purpose :
1293  ! Advection of a scalar in a arbitary velocity field on unstructured meshes
1294  ! for the conservative hyperbolic equation N,t + (c*N),xy = 0 in spatial space
1295  !
1296  ! 2. Method :
1297  !
1298  ! 3. Parameters :
1299  !
1300  ! Parameter list
1301  ! ----------------------------------------------------------------
1302  ! ----------------------------------------------------------------
1303  !
1304  ! 4. Subroutines used :
1305  !
1306  ! STRACE Subroutine tracing (!/S switch)
1307  !
1308  ! 5. Called by :
1309  !
1310  ! W3XYPUG Routine for advection on unstructured grid
1311  !
1312  ! 6. Error messages :
1313  !
1314  ! None.
1315  !
1316  ! 7. Remarks :
1317  !
1318  ! 8. Structure :
1319  !
1320  ! See source code.
1321  !
1322  ! 9. Switches :
1323  !
1324  ! !/S Enable subroutine tracing.
1325  !
1326  ! 10. Source code :
1327  !
1328  !/ ------------------------------------------------------------------- /
1329  !/
1330  USE w3gdatmd, ONLY : nk, nth, ntri, nx, ccon, ie_cell,pos_cell, si, &
1332 #ifdef W3_REF1
1333  USE w3gdatmd, ONLY : refpars
1334 #endif
1335  USE w3wdatmd, ONLY: time
1336  USE w3adatmd, ONLY: cg, iter
1337  USE w3odatmd, ONLY: ndse, ndst, flbpi, nbi, tbpi0, tbpin, isbpi, bbpi0, bbpin
1338  USE w3timemd, ONLY: dsec21
1339 #ifdef W3_S
1340  USE w3servmd, ONLY: strace
1341 #endif
1342  IMPLICIT NONE
1343 
1344  INTEGER, INTENT(IN) :: ISP ! Actual Frequency/Wavenumber, actual Wave Direction
1345  REAL, INTENT(IN) :: DT ! Time intervall for which the advection should be computed for the given velocity field
1346  REAL, INTENT(IN) :: C(:,:) ! Velocity field in it's X- and Y- Components,
1347  DOUBLE PRECISION, INTENT(INOUT) :: AC(:) ! Wave Action before and after advection
1348  REAL, INTENT(IN) :: RD10, RD20 ! Time interpolation coefficients for boundary condition
1349  LOGICAL, INTENT(IN) :: LCALC ! Switch for the calculation of the max. Global Time step
1350  !/
1351  !/ ------------------------------------------------------------------- /
1352  !/ Parameter list
1353  !/
1354  !/
1355  !/ ------------------------------------------------------------------- /
1356  !/ Local parameters
1357  !/
1358 #ifdef W3_S
1359  INTEGER, SAVE :: IENT = 0
1360 #endif
1361 
1362  real*8, PARAMETER :: onesixth = 1.0d0/6.0d0
1363  real*8, PARAMETER :: onethird = 1.0d0/3.0d0
1364  real*8, PARAMETER :: thr8 = tiny(1.0d0)
1365  REAL, PARAMETER :: THR = tiny(1.0)
1366  !/
1367  !/ ------------------------------------------------------------------- /
1368  !/
1369  !
1370  ! local integer
1371  !
1372  INTEGER :: IP, IE, IT, I1, I2, I3, I, ITH, IK
1373  INTEGER :: IBI, NI(3)
1374  !
1375  ! local real
1376  !
1377  REAL :: RD1, RD2
1378  !:
1379  ! local double
1380  !
1381  real*8 :: utilde, boundary_forcing
1382  real*8 :: ft, cflxy
1383  real*8 :: fl11, fl12, fl21, fl22, fl31, fl32
1384  real*8 :: fl111, fl112, fl211, fl212, fl311, fl312
1385  real*8 :: dtsi(nx), u(nx), dt4ai
1386  real*8 :: dtmaxgl, dtmaxexp, rest
1387  real*8 :: lambda(2), ktmp(3), tmp(3)
1388  real*8 :: bet1(3), betahat(3)
1389  real*8 :: theta_l(3,ntri), theta_h(3,ntri), theta_ace(3,ntri), utmp(3)
1390  real*8 :: wii(2,nx), ul(nx), ustari(2,nx)
1391 
1392  real*8 :: pm(nx), pp(nx), uim(nx), uip(nx)
1393 
1394  real*8 :: kelem(3,ntri), flall(3,ntri)
1395  real*8 :: kksum(nx), st(nx), beta
1396  real*8 :: nm(ntri)
1397 
1398 #ifdef W3_S
1399  CALL strace (ient, 'W3XYPFSFCT2')
1400 #endif
1401 
1402  ! 1. initialisation
1403 
1404  ith = 1 + mod(isp-1,nth)
1405  ik = 1 + (isp-1)/nth
1406  dtmaxgl = dble(10.e10)
1407  !
1408  !2 Propagation
1409  !2.a Calculate K-Values and contour based quantities ...
1410  !
1411  DO ie = 1, ntri ! I precacalculate this arrays below as I assume that current velocity changes continusly ...
1412  i1 = trigp(1,ie) ! Index of the Element Nodes (TRIGP)
1413  i2 = trigp(2,ie)
1414  i3 = trigp(3,ie)
1415  lambda(1) = onesixth *(c(i1,1)+c(i2,1)+c(i3,1)) ! Linearized advection speed in X and Y direction
1416  lambda(2) = onesixth *(c(i1,2)+c(i2,2)+c(i3,2))
1417  kelem(1,ie) = lambda(1) * ien(ie,1) + lambda(2) * ien(ie,2) ! K-Values - so called Flux Jacobians
1418  kelem(2,ie) = lambda(1) * ien(ie,3) + lambda(2) * ien(ie,4)
1419  kelem(3,ie) = lambda(1) * ien(ie,5) + lambda(2) * ien(ie,6)
1420  ktmp = kelem(:,ie) ! Copy
1421  nm(ie) = - 1.d0/min(-thr8,sum(min(0.d0,ktmp))) ! N-Values
1422  fl11 = c(i2,1) * ien(ie,1) + c(i2,2) * ien(ie,2) ! Weights for Simpson Integration
1423  fl12 = c(i3,1) * ien(ie,1) + c(i3,2) * ien(ie,2)
1424  fl21 = c(i3,1) * ien(ie,3) + c(i3,2) * ien(ie,4)
1425  fl22 = c(i1,1) * ien(ie,3) + c(i1,2) * ien(ie,4)
1426  fl31 = c(i1,1) * ien(ie,5) + c(i1,2) * ien(ie,6)
1427  fl32 = c(i2,1) * ien(ie,5) + c(i2,2) * ien(ie,6)
1428  fl111 = 2.d0*fl11+fl12
1429  fl112 = 2.d0*fl12+fl11
1430  fl211 = 2.d0*fl21+fl22
1431  fl212 = 2.d0*fl22+fl21
1432  fl311 = 2.d0*fl31+fl32
1433  fl312 = 2.d0*fl32+fl31
1434  flall(1,ie) = (fl311 + fl212)! * ONESIXTH + KELEM(1,IE)
1435  flall(2,ie) = (fl111 + fl312)! * ONESIXTH + KELEM(2,IE)
1436  flall(3,ie) = (fl211 + fl112)! * ONESIXTH + KELEM(3,IE)
1437  END DO ! NTRI
1438 
1439  IF (lcalc) THEN ! If the current field or water level changes estimate the iteration number based on the new flow field and the CFL number of the scheme
1440  kksum = 0.d0
1441  DO ie = 1, ntri
1442  ni = trigp(:,ie)
1443  kksum(ni) = kksum(ni) + kelem(:,ie)
1444  END DO ! IE
1445  dtmaxexp = 1e10 ! initialize to large number
1446  DO ip = 1, nx
1447  dtmaxexp = si(ip)/max(dble(10.e-10),kksum(ip)*iobdp(ip))
1448  dtmaxgl = min( dtmaxgl, dtmaxexp)
1449  END DO ! IP
1450  cflxy = dble(dt)/dtmaxgl
1451  rest = abs(mod(cflxy,1.0d0))
1452  IF (rest .LT. thr8) THEN
1453  iter(ik,ith) = abs(nint(cflxy))
1454  ELSE IF (rest .GT. thr8 .AND. rest .LT. 0.5d0) THEN
1455  iter(ik,ith) = abs(nint(cflxy)) + 1
1456  ELSE
1457  iter(ik,ith) = abs(nint(cflxy))
1458  END IF
1459  END IF ! LCALC
1460 
1461  dt4ai = dble(dt)/dble(iter(ik,ith))
1462  dtsi(:) = dt4ai/si(:) ! Some precalculations for the time integration.
1463 
1464  u = ac
1465  ul = u
1466  !
1467  ! Now loop on sub-timesteps
1468  !
1469  DO it = 1, iter(ik,ith)
1470 
1471  st = 0.d0
1472 
1473  DO ie = 1, ntri
1474  ni = trigp(:,ie)
1475  utmp = u(ni)
1476  ft = - onesixth*dot_product(utmp,flall(:,ie))
1477  tmp = max(0.d0,kelem(:,ie))
1478  utilde = nm(ie) * ( dot_product(tmp,utmp) - ft )
1479  theta_l(:,ie) = tmp * ( utmp - utilde )
1480  IF (abs(ft) .GT. dble(thr)) THEN
1481  bet1(:) = theta_l(:,ie)/ft
1482  IF (any( bet1 .LT. 0.0d0) ) THEN
1483  betahat(1) = bet1(1) + 0.5d0 * bet1(2)
1484  betahat(2) = bet1(2) + 0.5d0 * bet1(3)
1485  betahat(3) = bet1(3) + 0.5d0 * bet1(1)
1486  bet1(1) = max(0.d0,min(betahat(1),1.d0-betahat(2),1.d0))
1487  bet1(2) = max(0.d0,min(betahat(2),1.d0-betahat(3),1.d0))
1488  bet1(3) = max(0.d0,min(betahat(3),1.d0-betahat(1),1.d0))
1489  theta_l(:,ie) = ft * bet1
1490  END IF
1491  ELSE
1492  theta_l(:,ie) = 0.d0
1493  END IF
1494  ! THETA_H(:,IE) = (ONETHIRD+DT4AI/(2.d0*TRIA(IE)) * KELEM(:,IE))*FT ! LAX-WENDROFF
1495  theta_h(:,ie) = (1./3.+2./3.* kelem(:,ie)/sum(abs(kelem(:,ie))) )*ft ! CENTRAL SCHEME
1496  ! Antidiffusive residual according to the higher order nonmonotone scheme
1497  theta_ace(:,ie) = ((theta_h(:,ie) - theta_l(:,ie))) * dt4ai/si(ni)
1498  st(ni) = st(ni) + theta_l(:,ie)*dt4ai/si(ni)
1499  END DO
1500 
1501  ! UL = MAX(0.d0,U-ST)*DBLE(IOBPD(ITH,:))!*DBLE(IOBDP(:)) ... add for IOBDP dry/wet flag.
1502 
1503  DO ip = 1,nx
1504  ul(ip) = max(0.d0,u(ip)-st(ip))*dble(iobpd(ith,ip))
1505  END DO
1506 
1507  ustari(1,:) = max(ul,u)
1508  ustari(2,:) = min(ul,u)
1509 
1510  uip = -thr8
1511  uim = thr8
1512  pp = 0.d0
1513  pm = 0.d0
1514  DO ie = 1, ntri
1515  ni = trigp(:,ie)
1516  pp(ni) = pp(ni) + max( thr8, -theta_ace(:,ie))
1517  pm(ni) = pm(ni) + min( -thr8, -theta_ace(:,ie))
1518  uip(ni) = max(uip(ni), maxval( ustari(1,ni) ))
1519  uim(ni) = min(uim(ni), minval( ustari(2,ni) ))
1520  END DO
1521 
1522  wii(1,:) = min(1.0d0,(uip-ul)/max( thr8,pp))
1523  wii(2,:) = min(1.0d0,(uim-ul)/min(-thr8,pm))
1524 
1525  st = 0.d0
1526  DO ie = 1, ntri
1527  DO i = 1, 3
1528  ip = trigp(i,ie)
1529  IF (-theta_ace(i,ie) .GE. 0.) THEN
1530  tmp(i) = wii(1,ip)
1531  ELSE
1532  tmp(i) = wii(2,ip)
1533  END IF
1534  END DO
1535  beta = minval(tmp)
1536  ni = trigp(:,ie)
1537  st(ni) = st(ni) + beta * theta_ace(:,ie)
1538  END DO
1539 
1540  DO ip = 1,nx
1541  !
1542  ! IOBPD is the switch for removing energy coming from the shoreline
1543  !
1544  u(ip) = max(0.d0,ul(ip)-st(ip))*dble(iobpd(ith,ip))
1545 #ifdef W3_REF1
1546  IF (refpars(3).LT.0.5.AND.iobpd(ith,ip).EQ.0.AND.iobpa(ip).EQ.0) u(ip)= ac(ip) ! restores reflected boundary values
1547 #endif
1548  END DO
1549  !
1550  ! update spectrum
1551  ac = u
1552  !
1553  ! 4 Update boundaries: performs interpolation in time as done in rect grids (e.g. w3pro1md.ftn)
1554  !
1555  IF ( flbpi ) THEN
1556  !
1557  ! 4.1 In this case the boundary is read from the nest.ww3 file
1558  !
1559  rd1=rd10 - dt * real(iter(ik,ith)-it)/real(iter(ik,ith))
1560  rd2=rd20
1561  IF ( rd2 .GT. 0.001 ) THEN
1562  rd2 = min(1.,max(0.,rd1/rd2))
1563  rd1 = 1. - rd2
1564  ELSE
1565  rd1 = 0.
1566  rd2 = 1.
1567  END IF
1568  !
1569  ! Overwrites only the incoming energy ( IOBPD(ITH,IP) = 0)
1570  !
1571  DO ibi=1, nbi
1572  ip = mapsf(isbpi(ibi),1)
1573  ac(ip) = ( rd1*bbpi0(isp,ibi) + rd2*bbpin(isp,ibi) ) &
1574  / cg(ik,isbpi(ibi)) * clats(isbpi(ibi))
1575  END DO
1576 
1577  ENDIF
1578  !
1579  END DO ! End of loop on time steps
1580  ! CALL EXTCDE ( 99 )
1581  !/
1582  !/ End of W3XYPFSN ----------------------------------------------------- /
1583  !/

References w3odatmd::bbpi0, w3odatmd::bbpin, w3gdatmd::ccon, w3adatmd::cg, w3gdatmd::clats, w3timemd::dsec21(), w3odatmd::flbpi, w3gdatmd::ie_cell, w3gdatmd::ien, w3gdatmd::iobdp, w3gdatmd::iobpa, w3gdatmd::iobpd, w3odatmd::isbpi, w3adatmd::iter, w3gdatmd::mapsf, w3odatmd::nbi, w3odatmd::ndse, w3odatmd::ndst, w3gdatmd::nk, w3gdatmd::nth, w3gdatmd::ntri, w3gdatmd::nx, w3gdatmd::pos_cell, w3gdatmd::refpars, w3gdatmd::si, w3servmd::strace(), w3odatmd::tbpi0, w3odatmd::tbpin, w3wdatmd::time, w3gdatmd::tria, and w3gdatmd::trigp.

Referenced by w3xypug().

◆ w3xypfsn2()

subroutine w3profsmd::w3xypfsn2 ( integer, intent(in)  ISP,
real, dimension(:,:), intent(in)  C,
logical, intent(in)  LCALC,
real, intent(in)  RD10,
real, intent(in)  RD20,
real, intent(in)  DT,
double precision, dimension(:), intent(inout)  AC 
)

Definition at line 470 of file w3profsmd.F90.

470 
471  !/
472  !/
473  !/ +-----------------------------------+
474  !/ | WWIII Version of the WWM FS Code |
475  !/ | by Aron Roland |
476  !/ | and Fabrice Ardhuin |
477  !/ | for use in WWIII |
478  !/ | GPL License |
479  !/ | Last update : 15-Apr-2020 |
480  !/ +-----------------------------------+
481  !/
482  !/ 19-Dec-2007 : Origination. ( version 3.13 )
483  !/ 25-Aug-2011 : Change of method for IOBPD ( version 4.04 )
484  !/ 03-Nov-2011 : Addition of shoreline reflection ( version 4.04 )
485  !/ 15-Apr-2020 : Adds optional opt-out for CFL on BC ( version 7.08 )
486  !/
487  !/
488  ! 1. Purpose :
489  ! Advection of a scalar in a arbitary velocity field on unstructured meshes
490  ! for the conservative hyperbolic equation N,t + (c*N),xy = 0 in spatial space
491  ! This is the standard explicit N-Scheme from Roe as formulated in Abgrall
492  !
493  ! 2. Method :
494  !
495  ! 3. Parameters :
496  !
497  ! Parameter list
498  ! ----------------------------------------------------------------
499  ! ----------------------------------------------------------------
500  !
501  ! 4. Subroutines used :
502  !
503  ! STRACE Subroutine tracing (!/S switch)
504  !
505  ! 5. Called by :
506  !
507  ! W3XYPUG Routine for advection on unstructured grid
508  !
509  ! 6. Error messages :
510  !
511  ! None.
512  !
513  ! 7. Remarks :
514  !
515  ! 8. Structure :
516  !
517  ! See source code.
518  !
519  ! 9. Switches :
520  !
521  ! !/S Enable subroutine tracing.
522  !
523  ! 10. Source code :
524  !
525  !/ ------------------------------------------------------------------- /
526  !/
527  USE w3gdatmd, ONLY : nk, nth, ntri, nx, ccon, ie_cell,pos_cell, si, &
528  ien, trigp, clats, mapsf, iobpd, iobp, iobdp, &
529  iobpa, fsbccfl
530 #ifdef W3_REF1
531  USE w3gdatmd, ONLY : refpars
532 #endif
533  USE w3wdatmd, ONLY: time
534  USE w3adatmd, ONLY: cg, iter, dw
535  USE w3odatmd, ONLY: ndse, ndst, flbpi, nbi, tbpi0, tbpin, isbpi, bbpi0, bbpin
536  USE w3timemd, ONLY: dsec21
537 #ifdef W3_S
538  USE w3servmd, ONLY: strace
539 #endif
540  IMPLICIT NONE
541 
542  INTEGER, INTENT(IN) :: ISP ! Actual Frequency/Wavenumber, actual Wave Direction
543  REAL, INTENT(IN) :: DT ! Time intervall for which the advection should be computed for the given velocity field
544  REAL, INTENT(IN) :: C(:,:) ! Velocity field in it's X- and Y- Components,
545  DOUBLE PRECISION, INTENT(INOUT):: AC(:) ! Wave Action before and after advection
546  REAL, INTENT(IN) :: RD10, RD20 ! Time interpolation coefficients for boundary conditions
547  LOGICAL, INTENT(IN) :: LCALC ! Switch for the calculation of the max. Global Time step
548  !/
549  !/ ------------------------------------------------------------------- /
550  !/ Parameter list
551  !/
552  !/
553  !/ ------------------------------------------------------------------- /
554  !/ Local parameters
555  !/
556 #ifdef W3_S
557  INTEGER, SAVE :: IENT = 0
558 #endif
559 
560  real*8, PARAMETER :: onesixth = 1.0d0/6.0d0
561  real*8, PARAMETER :: thr8 = tiny(1.0d0)
562  REAL, PARAMETER :: THR = tiny(1.0)
563  !/
564  !/ ------------------------------------------------------------------- /
565  !/
566  !
567  ! local integer
568  !
569  INTEGER :: IP, IE, IT, I1, I2, I3, ITH, IK
570  INTEGER :: IBI, NI(3)
571  !
572  ! local real
573  !
574  REAL :: RD1, RD2
575  !
576  ! local double
577  !
578  real*8 :: utilde, boundary_forcing
579  real*8 :: cflxy
580  real*8 :: fl11, fl12, fl21, fl22, fl31, fl32
581  real*8 :: fl111, fl112, fl211, fl212, fl311, fl312
582  real*8 :: dtsi(nx), u(nx)
583  real*8 :: dtmaxgl, dtmaxexp, rest
584  real*8 :: lambda(2), ktmp(3), cloc(2,3)
585  real*8 :: kelem(3,ntri), flall(3,ntri)
586  real*8 :: kksum(nx), st(nx)
587  real*8 :: nm(ntri)
588 
589 #ifdef W3_S
590  CALL strace (ient, 'W3XYPFSN')
591 #endif
592 
593  ! 1. initialisation
594 
595  ith = 1 + mod(isp-1,nth)
596  ik = 1 + (isp-1)/nth
597  dtmaxgl = dble(10.e10)
598  !
599  !2 Propagation
600  !2.a Calculate K-Values and contour based quantities ...
601  !
602  DO ie = 1, ntri ! I precacalculate this arrays below as I assume that current velocity changes continusly ...
603 
604  i1 = trigp(1,ie) ! Index of the Element Nodes (TRIGP)
605  i2 = trigp(2,ie)
606  i3 = trigp(3,ie)
607  ni = trigp(:,ie)
608  lambda(1) = onesixth *(c(i1,1)+c(i2,1)+c(i3,1)) ! Linearized advection speed in X and Y direction
609  lambda(2) = onesixth *(c(i1,2)+c(i2,2)+c(i3,2))
610  kelem(1,ie) = lambda(1) * ien(ie,1) + lambda(2) * ien(ie,2) ! K-Values - so called Flux Jacobians
611  kelem(2,ie) = lambda(1) * ien(ie,3) + lambda(2) * ien(ie,4)
612  kelem(3,ie) = lambda(1) * ien(ie,5) + lambda(2) * ien(ie,6)
613  !
614  ktmp = kelem(:,ie) ! Copy
615  nm(ie) = - 1.d0/min(-thr8,sum(min(0.d0,ktmp))) ! N-Values
616  kelem(:,ie) = max(0.d0,ktmp)
617  fl11 = c(i2,1) * ien(ie,1) + c(i2,2) * ien(ie,2) ! Weights for Simpson Integration
618  fl12 = c(i3,1) * ien(ie,1) + c(i3,2) * ien(ie,2)
619  fl21 = c(i3,1) * ien(ie,3) + c(i3,2) * ien(ie,4)
620  fl22 = c(i1,1) * ien(ie,3) + c(i1,2) * ien(ie,4)
621  fl31 = c(i1,1) * ien(ie,5) + c(i1,2) * ien(ie,6)
622  fl32 = c(i2,1) * ien(ie,5) + c(i2,2) * ien(ie,6)
623  fl111 = 2.d0*fl11+fl12
624  fl112 = 2.d0*fl12+fl11
625  fl211 = 2.d0*fl21+fl22
626  fl212 = 2.d0*fl22+fl21
627  fl311 = 2.d0*fl31+fl32
628  fl312 = 2.d0*fl32+fl31
629  flall(1,ie) = (fl311 + fl212) * onesixth + kelem(1,ie)
630  flall(2,ie) = (fl111 + fl312) * onesixth + kelem(2,ie)
631  flall(3,ie) = (fl211 + fl112) * onesixth + kelem(3,ie)
632  ! IF (I1.EQ.1.OR.I2.EQ.1.OR.I3.EQ.1) WRITE(6,*) 'TEST N1 :',IK,ITH,IP,IE,KELEM(:,IE),'##',LAMBDA
633  END DO ! NTRI
634 
635  IF (lcalc) THEN ! If the current field or water level changes estimate the iteration number based on the new flow field and the CFL number of the scheme
636  kksum = 0.d0
637  DO ie = 1, ntri
638  ni = trigp(:,ie)
639  kksum(ni) = kksum(ni) + kelem(:,ie)
640  END DO ! IE
641  dtmaxexp = 1e10 ! initialize to large number
642  DO ip = 1, nx
643  IF (iobp(ip) .EQ. 1 .OR. fsbccfl) THEN
644  dtmaxexp = si(ip)/max(dble(10.e-10),kksum(ip)*iobdp(ip))
645  dtmaxgl = min( dtmaxgl, dtmaxexp)
646  END IF
647  END DO ! IP
648  cflxy = dble(dt)/dtmaxgl
649  rest = abs(mod(cflxy,1.0d0))
650  IF (rest .LT. thr8) THEN
651  iter(ik,ith) = abs(nint(cflxy))
652  ELSE IF (rest .GT. thr8 .AND. rest .LT. 0.5d0) THEN
653  iter(ik,ith) = abs(nint(cflxy)) + 1
654  ELSE
655  iter(ik,ith) = abs(nint(cflxy))
656  END IF
657  END IF ! LCALC
658 
659  DO ip = 1, nx
660  dtsi(ip) = dble(dt)/dble(iter(ik,ith))/si(ip) ! Some precalculations for the time integration.
661  END DO
662 
663  DO it = 1, iter(ik,ith)
664  u = ac
665  st = 0.d0
666  DO ie = 1, ntri
667  ni = trigp(:,ie)
668  utilde = nm(ie) * (dot_product(flall(:,ie),u(ni)))
669  st(ni) = st(ni) + kelem(:,ie) * (u(ni) - utilde) ! the 2nd term are the theta values of each node ...
670  END DO ! IE
671 
672  DO ip = 1, nx
673  !
674  ! IOBPD=0 : waves coming from land (or outside grid)
675  ! Possibly set flux to zero by multiplying ST by IOBPD but also in UTILDE multiply U(NI) by IOBPD ...
676  !
677  u(ip) = max(0.d0,u(ip)-dtsi(ip)*st(ip)*(1-iobpa(ip)))*dble(iobpd(ith,ip))
678 
679 #ifdef W3_REF1
680  WRITE(10111,*) refpars(3), iobpd(ith,ip), iobpa(ip), u(ip), ac(ip)
681  IF (refpars(3).LT.0.5.AND.iobpd(ith,ip).EQ.0.AND.iobpa(ip).EQ.0) THEN
682  u(ip) = ac(ip) ! restores reflected boundary values
683  ENDIF
684 #endif
685  END DO
686  ! update spectrum
687  ac = u
688  !
689  ! 4 Update boundaries: performs interpolation in time as done in rect grids (e.g. w3pro1md.ftn)
690  !
691  IF ( flbpi ) THEN
692  !
693  ! 4.1 In this case the boundary is read from the nest.ww3 file
694  !
695  rd1=rd10 - dt * real(iter(ik,ith)-it)/real(iter(ik,ith))
696  rd2=rd20
697  IF ( rd2 .GT. 0.001 ) THEN
698  rd2 = min(1.,max(0.,rd1/rd2))
699  rd1 = 1. - rd2
700  ELSE
701  rd1 = 0.
702  rd2 = 1.
703  END IF
704  !
705  ! Overwrites only the incoming energy ( IOBPD(ITH,IP) = 0)
706  !
707  DO ibi=1, nbi
708  ip = mapsf(isbpi(ibi),1)
709  ac(ip) = ( rd1*bbpi0(isp,ibi) + rd2*bbpin(isp,ibi) ) &
710  / cg(ik,isbpi(ibi)) * clats(isbpi(ibi))
711  END DO
712 
713  ENDIF
714  !
715  END DO ! End of loop on time steps
716  ! CALL EXTCDE ( 99 )
717  !/
718  !/ End of W3XYPFSN ----------------------------------------------------- /
719  !/

References w3odatmd::bbpi0, w3odatmd::bbpin, w3gdatmd::ccon, w3adatmd::cg, w3gdatmd::clats, w3timemd::dsec21(), w3adatmd::dw, w3odatmd::flbpi, w3gdatmd::fsbccfl, w3gdatmd::ie_cell, w3gdatmd::ien, w3gdatmd::iobdp, w3gdatmd::iobp, w3gdatmd::iobpa, w3gdatmd::iobpd, w3odatmd::isbpi, w3adatmd::iter, w3gdatmd::mapsf, w3odatmd::nbi, w3odatmd::ndse, w3odatmd::ndst, w3gdatmd::nk, w3gdatmd::nth, w3gdatmd::ntri, w3gdatmd::nx, w3gdatmd::pos_cell, w3gdatmd::refpars, w3gdatmd::si, w3servmd::strace(), w3odatmd::tbpi0, w3odatmd::tbpin, w3wdatmd::time, and w3gdatmd::trigp.

Referenced by w3xypug().

◆ w3xypfsnimp()

subroutine w3profsmd::w3xypfsnimp ( integer, intent(in)  ISP,
real, dimension(:,:), intent(in)  C,
logical, intent(in)  LCALC,
real, intent(in)  RD10,
real, intent(in)  RD20,
real, intent(in)  DT,
double precision, dimension(:), intent(inout)  AC 
)

Definition at line 976 of file w3profsmd.F90.

976 
977  !/
978  !/
979  !/ +-----------------------------------+
980  !/ | WWIII Version of the WWM FS Code |
981  !/ | by Aron Roland |
982  !/ | for use in WWIII |
983  !/ | GPL License |
984  !/ | Last update : 15-Dec-2013 |
985  !/ +-----------------------------------+
986  !/
987  !/ 15-Dec-2013 : Bug fix for implicit scheme ( version 4.16 )
988  !/
989  ! 1. Purpose :
990  ! Advection of a scalar in a arbitary velocity field on unstructured meshes
991  ! for the conservative hyperbolic equation N,t + (c*N),xy = 0 in spatial space
992  ! This is the standard explicit N-Scheme from Roe as formulated in Abgrall
993  !
994  ! 2. Method :
995  !
996  ! 3. Parameters :
997  !
998  ! Parameter list
999  ! ----------------------------------------------------------------
1000  ! ----------------------------------------------------------------
1001  !
1002  ! 4. Subroutines used :
1003  !
1004  ! STRACE Subroutine tracing (!/S switch)
1005  !
1006  ! 5. Called by :
1007  !
1008  ! W3XYPUG Routine for advection on unstructured grid
1009  !
1010  ! 6. Error messages :
1011  !
1012  ! None.
1013  !
1014  ! 7. Remarks :
1015  !
1016  ! 8. Structure :
1017  !
1018  ! See source code.
1019  !
1020  ! 9. Switches :
1021  !
1022  ! !/S Enable subroutine tracing.
1023  !
1024  ! 10. Source code :
1025  !
1026  !/ ------------------------------------------------------------------- /
1027  !/
1028  USE w3gdatmd, ONLY : nk, nth, ntri, nx, ccon, ie_cell,pos_cell, si, &
1029  ien, trigp, clats, mapsf, iobpd, iobpa, iobp, iaa, jaa, posi, &
1030  tria, nnz
1031 #ifdef W3_REF1
1032  USE w3gdatmd, ONLY : refpars
1033 #endif
1034  USE w3wdatmd, ONLY: time
1035  USE w3adatmd, ONLY: cg, iter
1036  USE w3odatmd, ONLY: ndse, ndst, flbpi, nbi, tbpi0, tbpin, isbpi, bbpi0, bbpin
1037  USE w3timemd, ONLY: dsec21
1038 #ifdef W3_S
1039  USE w3servmd, ONLY: strace
1040 #endif
1041  IMPLICIT NONE
1042 
1043  INTEGER, INTENT(IN) :: ISP ! Actual Frequency/Wavenumber, actual Wave Direction
1044  REAL, INTENT(IN) :: DT ! Time intervall for which the advection should be computed for the given velocity field
1045  REAL, INTENT(IN) :: C(:,:) ! Velocity field in it's X- and Y- Components,
1046  DOUBLE PRECISION,INTENT(INOUT) :: AC(:) ! Wave Action before and after advection
1047  REAL, INTENT(IN) :: RD10, RD20 ! Time interpolation coefficients for boundary conditions
1048  LOGICAL, INTENT(IN) :: LCALC ! Switch for the calculation of the max. Global Time step
1049  !/
1050  !/ ------------------------------------------------------------------- /
1051  !/ Parameter list
1052  !/
1053  !/
1054  !/ ------------------------------------------------------------------- /
1055  !/ Local parameters
1056  !/
1057 #ifdef W3_S
1058  INTEGER, SAVE :: IENT = 0
1059 #endif
1060 
1061  real*8, PARAMETER :: onesixth = 1.0d0/6.0d0
1062  real*8, PARAMETER :: onethird = 1.0d0/3.0d0
1063  real*8, PARAMETER :: thr8 = tiny(1.0d0)
1064  REAL, PARAMETER :: THR = tiny(1.0)
1065  !/
1066  !/ ------------------------------------------------------------------- /
1067  !/
1068  !
1069  ! local integer
1070  !
1071  INTEGER :: IP, IE, POS, I1, I2, I3, I, J, ITH, IK
1072  INTEGER :: IBI
1073  !
1074  ! local real
1075  !
1076  REAL :: RD1, RD2
1077  !:
1078  ! local double
1079  !
1080  real*8 :: boundary_forcing
1081  real*8 :: fl11, fl12, fl21, fl22, fl31, fl32
1082  real*8 :: u(nx)
1083  real*8 :: dtmaxgl
1084  real*8 :: lambda(2)
1085  real*8 :: kp(3,ntri)
1086  real*8 :: k1, dtk, tmp3, km(3), k(3)
1087  real*8 :: nm(ntri), crfs(3), deltal(3,ntri)
1088  real*8 :: b(nx), x(nx)
1089  real*8 :: aspar(nnz)
1090 
1091  INTEGER :: IWKSP( 20*NX )
1092  INTEGER :: FLJU(NX)
1093  INTEGER :: FLJAU(NNZ+1)
1094 
1095 
1096  INTEGER :: POS_TRICK(3,2)
1097 
1098  INTEGER :: IPAR(16)
1099  INTEGER :: IERROR ! IWK ! ERROR Indicator and Work Array Size,
1100  INTEGER :: JAU(NNZ+1), JU(NX)
1101 
1102  real*8 :: fpar(16) ! DROPTOL
1103  real*8 :: wksp( 8 * nx ) ! REAL WORKSPACES
1104  real*8 :: au(nnz+1)
1105  real*8 :: iniu(nx)
1106 
1107  external bcgstab
1108 
1109  pos_trick(1,1) = 2
1110  pos_trick(1,2) = 3
1111  pos_trick(2,1) = 3
1112  pos_trick(2,2) = 1
1113  pos_trick(3,1) = 1
1114  pos_trick(3,2) = 2
1115 
1116 #ifdef W3_S
1117  CALL strace (ient, 'W3XYPFSN')
1118 #endif
1119 
1120  ! 1. initialisation
1121 
1122  ith = 1 + mod(isp-1,nth)
1123  ik = 1 + (isp-1)/nth
1124  dtmaxgl = dble(10.e10)
1125 
1126  IF (.false.) THEN
1127  WRITE(*,*) 'NNZ', nnz
1128  WRITE(*,*) 'MINVAL IAA,JAA', minval(iaa), minval(jaa)
1129  WRITE(*,*) 'MINVAL IAA,JAA', maxval(iaa), maxval(jaa)
1130  WRITE(*,*) 'MAX/MIN POSI', maxval(posi), minval(posi)
1131  WRITE(*,*) 'AC, AQ', sum(ac)
1132  END IF
1133  !
1134  !2 Propagation
1135  !2.a Calculate K-Values and contour based quantities ...
1136  !
1137  DO ie = 1, ntri ! I precacalculate this arrays below as I assume that current velocity changes continusly ...
1138  i1 = trigp(1,ie) ! Index of the Element Nodes (TRIGP)
1139  i2 = trigp(2,ie)
1140  i3 = trigp(3,ie)
1141  lambda(1) = onesixth * (c(i1,1)+c(i2,1)+c(i3,1))
1142  lambda(2) = onesixth * (c(i1,2)+c(i2,2)+c(i3,2))
1143  k(1) = lambda(1) * ien(ie,1) + lambda(2) * ien(ie,2)
1144  k(2) = lambda(1) * ien(ie,3) + lambda(2) * ien(ie,4)
1145  k(3) = lambda(1) * ien(ie,5) + lambda(2) * ien(ie,6)
1146  kp(1,ie) = max(0.d0,k(1))
1147  kp(2,ie) = max(0.d0,k(2))
1148  kp(3,ie) = max(0.d0,k(3))
1149  km(1) = min(0.d0,k(1))
1150  km(2) = min(0.d0,k(2))
1151  km(3) = min(0.d0,k(3))
1152  fl11 = c(i2,1)*ien(ie,1)+c(i2,2)*ien(ie,2)
1153  fl12 = c(i3,1)*ien(ie,1)+c(i3,2)*ien(ie,2)
1154  fl21 = c(i3,1)*ien(ie,3)+c(i3,2)*ien(ie,4)
1155  fl22 = c(i1,1)*ien(ie,3)+c(i1,2)*ien(ie,4)
1156  fl31 = c(i1,1)*ien(ie,5)+c(i1,2)*ien(ie,6)
1157  fl32 = c(i2,1)*ien(ie,5)+c(i2,2)*ien(ie,6)
1158  crfs(1) = - onesixth * (2.0d0 *fl31 + fl32 + fl21 + 2.0d0 * fl22 )
1159  crfs(2) = - onesixth * (2.0d0 *fl32 + 2.0d0 * fl11 + fl12 + fl31 )
1160  crfs(3) = - onesixth * (2.0d0 *fl12 + 2.0d0 * fl21 + fl22 + fl11 )
1161  deltal(:,ie) = crfs(:)- kp(:,ie)
1162  nm(ie) = 1.d0/min(dble(thr),sum(km(:)))
1163  END DO ! NTRI
1164 
1165  u = dble(ac)
1166  j = 0
1167  aspar = 0.d0
1168  b = 0.d0
1169  DO ip = 1, nx
1170  DO i = 1, ccon(ip)
1171  j = j + 1
1172  ie = ie_cell(j)
1173  pos = pos_cell(j)
1174  k1 = kp(pos,ie) * iobpd(ith,ip)
1175  IF (k1 > 0.) THEN
1176  dtk = k1 * dt
1177  tmp3 = dtk * nm(ie)
1178  i1 = posi(1,j)
1179  i2 = posi(2,j)
1180  i3 = posi(3,j)
1181  aspar(i1) = onethird * tria(ie) + dtk - tmp3 * deltal(pos,ie) + aspar(i1)
1182  aspar(i2) = - tmp3 * deltal(pos_trick(pos,1),ie) + aspar(i2)
1183  aspar(i3) = - tmp3 * deltal(pos_trick(pos,2),ie) + aspar(i3)
1184  b(ip) = b(ip) + onethird * tria(ie) * u(ip)
1185  ELSE
1186  i1 = posi(1,j)
1187  aspar(i1) = onethird * tria(ie) + aspar(i1)
1188  b(ip) = b(ip) + onethird * tria(ie) * u(ip)
1189  END IF
1190  END DO ! End loop over connected elements ...
1191  END DO
1192  !
1193  !2DO setup a semi-implicit integration scheme for source terms only ...
1194  !
1195  ipar(1) = 0 ! always 0 to start an iterative solver
1196  ipar(2) = 1 ! right preconditioning
1197  ipar(3) = 1 ! use convergence test scheme 1
1198  ipar(4) = 8*nx !
1199  ipar(5) = 15
1200  ipar(6) = 1000 ! use at most 1000 matvec's
1201  fpar(1) = dble(1.0e-8) ! relative tolerance 1.0E-6
1202  fpar(2) = dble(1.0e-10) ! absolute tolerance 1.0E-10
1203  fpar(11) = 0.d0 ! clearing the FLOPS counter
1204 
1205  au = 0.
1206  fljau = 0
1207  flju = 0
1208  jau = 0
1209  ju = 0
1210 
1211  CALL ilu0 (nx, aspar, jaa, iaa, au, fljau, flju, iwksp, ierror)
1212 
1213  ! WRITE(*,*) 'PRECONDITIONER', IERROR
1214 
1215  ! IF (SUM(AC) .GT. 0.) THEN
1216  IF (.false.) THEN
1217  WRITE(*,*) sum(ac)
1218  WRITE(*,*) 'CALL SOLVER'
1219  WRITE(*,*) 'WRITE CG', sum(cg)
1220  WRITE(*,*) 'B, X, AC, U', sum(b), sum(x), sum(ac), sum(u)
1221  WRITE(*,*) 'IPAR, FPAR', sum(ipar), sum(fpar)
1222  WRITE(*,*) 'WKSP, INIU', sum(wksp), sum(iniu)
1223  WRITE(*,*) 'ASPAR, JAA, IAA',sum(aspar), sum(iaa), sum(jaa)
1224  WRITE(*,*) 'AU, FLJAU, FLJU',sum(au), sum(fljau), sum(flju)
1225  END IF
1226 
1227  iniu = u
1228  x = 0.d0
1229 
1230  CALL runrc (nx, b, x, ipar, fpar, wksp, iniu, aspar, jaa, iaa, au, fljau, flju, bcgstab)
1231 
1232  IF (.false.) THEN
1233  WRITE(*,*) 'SOLUTION'
1234  WRITE(*,*) 'B, X, AC, U', sum(b), sum(x), sum(ac), sum(u)
1235  WRITE(*,*) 'IPAR, FPAR', sum(ipar), sum(fpar)
1236  WRITE(*,*) 'WKSP, INIU', sum(wksp), sum(iniu)
1237  WRITE(*,*) 'ASPAR, JAA, IAA', sum(aspar), sum(jaa), sum(iaa)
1238  WRITE(*,*) 'AU, FLJAU, FLJU', sum(au), sum(fljau), sum(flju)
1239  END IF
1240 
1241  DO ip = 1,nx
1242  u(ip) = max(0.d0,x(ip)*dble(iobpd(ith,ip)))
1243 #ifdef W3_REF1
1244  IF (refpars(3).LT.0.5.AND.iobpd(ith,ip).EQ.0.AND.iobpa(ip).EQ.0) u(ip)= ac(ip) ! restores reflected boundary values
1245 #endif
1246  END DO
1247  !
1248  ! update spectrum
1249  ac = real(u)
1250  !
1251  ! 4 Update boundaries: performs interpolation in time as done in rect grids (e.g. w3pro1md.ftn)
1252  !
1253  IF ( flbpi ) THEN
1254  rd1=rd10
1255  rd2=rd20
1256  IF ( rd2 .GT. 0.001 ) THEN
1257  rd2 = min(1.,max(0.,rd1/rd2))
1258  rd1 = 1. - rd2
1259  ELSE
1260  rd1 = 0.
1261  rd2 = 1.
1262  END IF
1263  !
1264  ! Time interpolation as done in rect grids
1265  !
1266  DO ibi=1, nbi
1267  ip = mapsf(isbpi(ibi),1)
1268  ac(ip) = ( rd1*bbpi0(isp,ibi) + rd2*bbpin(isp,ibi) ) &
1269  *iobpa(ip)*iobpd(ith,ip) / cg(ik,isbpi(ibi)) * clats(isbpi(ibi))
1270  END DO
1271  END IF
1272 
1273  ! CALL EXTCDE ( 99 )
1274  !/
1275  !/ End of W3XYPFSNIMP------------------------------------------------- /
1276  !/

References w3odatmd::bbpi0, w3odatmd::bbpin, bcgstab(), w3gdatmd::ccon, w3adatmd::cg, w3gdatmd::clats, w3timemd::dsec21(), w3odatmd::flbpi, w3gdatmd::iaa, w3gdatmd::ie_cell, w3gdatmd::ien, ilu0(), w3gdatmd::iobp, w3gdatmd::iobpa, w3gdatmd::iobpd, w3odatmd::isbpi, w3adatmd::iter, w3gdatmd::jaa, w3gdatmd::mapsf, w3odatmd::nbi, w3odatmd::ndse, w3odatmd::ndst, w3gdatmd::nk, w3gdatmd::nnz, w3gdatmd::nth, w3gdatmd::ntri, w3gdatmd::nx, w3gdatmd::pos_cell, w3gdatmd::posi, w3gdatmd::refpars, runrc(), w3gdatmd::si, w3servmd::strace(), w3odatmd::tbpi0, w3odatmd::tbpin, w3wdatmd::time, w3gdatmd::tria, and w3gdatmd::trigp.

Referenced by w3xypug().

◆ w3xypfspsi2()

subroutine w3profsmd::w3xypfspsi2 ( integer, intent(in)  ISP,
real, dimension(:,:), intent(in)  C,
logical, intent(in)  LCALC,
real, intent(in)  RD10,
real, intent(in)  RD20,
real, intent(in)  DT,
double precision, dimension(:), intent(inout)  AC 
)

Definition at line 724 of file w3profsmd.F90.

724 
725  !/
726  !/
727  !/ +-----------------------------------+
728  !/ | WWIII Version of the WWM FS Code |
729  !/ | by Aron Roland |
730  !/ | for use in WWIII |
731  !/ | GPL License |
732  !/ | Last update : 19-Dec-2007 |
733  !/ +-----------------------------------+
734  !/
735  ! 1. Purpose :
736  ! Advection of a scalar in a arbitary velocity field on unstructured meshes
737  ! for the conservative hyperbolic equation N,t + (c*N),xy = 0 in spatial space
738  ! This is the standard explicit N-Scheme from Roe as formulated in Abgrall
739  !
740  ! 2. Method :
741  !
742  ! 3. Parameters :
743  !
744  ! Parameter list
745  ! ----------------------------------------------------------------
746  ! ----------------------------------------------------------------
747  !
748  ! 4. Subroutines used :
749  !
750  ! STRACE Subroutine tracing (!/S switch)
751  !
752  ! 5. Called by :
753  !
754  ! W3XYPUG Routine for advection on unstructured grid
755  !
756  ! 6. Error messages :
757  !
758  ! None.
759  !
760  ! 7. Remarks :
761  !
762  ! 8. Structure :
763  !
764  ! See source code.
765  !
766  ! 9. Switches :
767  !
768  ! !/S Enable subroutine tracing.
769  !
770  ! 10. Source code :
771  !
772  !/ ------------------------------------------------------------------- /
773  !/
774  USE w3gdatmd, ONLY : nk, nth, ntri, nx, ccon, ie_cell,pos_cell, si, &
775  ien, trigp, clats, mapsf, iobpa, iobpd, iobp, nnz, iobdp
776 #ifdef W3_REF1
777  USE w3gdatmd, ONLY : refpars
778 #endif
779  USE w3wdatmd, ONLY: time
780  USE w3adatmd, ONLY: cg, iter
781  USE w3odatmd, ONLY: ndse, ndst, flbpi, nbi, tbpi0, tbpin, isbpi, bbpi0, bbpin
782  USE w3timemd, ONLY: dsec21
783 #ifdef W3_S
784  USE w3servmd, ONLY: strace
785 #endif
786  IMPLICIT NONE
787 
788  INTEGER, INTENT(IN) :: ISP ! Actual Frequency/Wavenumber, actual Wave Direction
789  REAL, INTENT(IN) :: DT ! Time intervall for which the advection should be computed for the given velocity field
790  REAL, INTENT(IN) :: C(:,:) ! Velocity field in it's X- and Y- Components,
791  DOUBLE PRECISION,INTENT(INOUT) :: AC(:) ! Wave Action before and after advection
792  REAL, INTENT(IN) :: RD10, RD20 ! Time interpolation coefficients for boundary conditions
793  LOGICAL, INTENT(IN) :: LCALC ! Switch for the calculation of the max. Global Time step
794  !/
795  !/ ------------------------------------------------------------------- /
796  !/ Parameter list
797  !/
798  !/
799  !/ ------------------------------------------------------------------- /
800  !/ Local parameters
801  !/
802 #ifdef W3_S
803  INTEGER, SAVE :: IENT = 0
804 #endif
805 
806  real*8, PARAMETER :: onesixth = 1.0d0/6.0d0
807  real*8, PARAMETER :: thr8 = tiny(1.0d0)
808  REAL, PARAMETER :: THR = tiny(1.0)
809  !/
810  !/ ------------------------------------------------------------------- /
811  !/
812  !
813  ! local integer
814  !
815  INTEGER :: IP, IE, IT, I1, I2, I3, ITH, IK
816  INTEGER :: IBI, NI(3)
817  !
818  ! local real
819  !
820  REAL :: RD1, RD2
821  !:
822  ! local double
823  !
824  real*8 :: utilde, boundary_forcing
825  real*8 :: ft, cflxy
826  real*8 :: fl11, fl12, fl21, fl22, fl31, fl32
827  real*8 :: fl111, fl112, fl211, fl212, fl311, fl312
828  real*8 :: dtsi(nx), u(nx)
829  real*8 :: dtmaxgl, dtmaxexp, rest
830  real*8 :: lambda(2), ktmp(3), tmp(3)
831  real*8 :: theta_l(3), bet1(3), betahat(3)
832  real*8 :: kelem(3,ntri), flall(3,ntri)
833  real*8 :: kksum(nx), st(nx)
834  real*8 :: nm(ntri)
835 
836 #ifdef W3_S
837  CALL strace (ient, 'W3XYPFSN')
838 #endif
839 
840  ! 1. initialisation
841 
842  ith = 1 + mod(isp-1,nth)
843  ik = 1 + (isp-1)/nth
844  dtmaxgl = dble(10.e10)
845  !
846  !2 Propagation
847  !2.a Calculate K-Values and contour based quantities ...
848  !
849  DO ie = 1, ntri ! I precacalculate this arrays below as I assume that current velocity changes continusly ...
850  i1 = trigp(1,ie) ! Index of the Element Nodes (TRIGP)
851  i2 = trigp(2,ie)
852  i3 = trigp(3,ie)
853  lambda(1) = onesixth *(c(i1,1)+c(i2,1)+c(i3,1)) ! Linearized advection speed in X and Y direction
854  lambda(2) = onesixth *(c(i1,2)+c(i2,2)+c(i3,2))
855  kelem(1,ie) = lambda(1) * ien(ie,1) + lambda(2) * ien(ie,2) ! K-Values - so called Flux Jacobians
856  kelem(2,ie) = lambda(1) * ien(ie,3) + lambda(2) * ien(ie,4)
857  kelem(3,ie) = lambda(1) * ien(ie,5) + lambda(2) * ien(ie,6)
858  ktmp = kelem(:,ie) ! Copy
859  nm(ie) = - 1.d0/min(-thr8,sum(min(0.d0,ktmp))) ! N-Values
860  kelem(:,ie) = max(0.d0,ktmp)
861  fl11 = c(i2,1) * ien(ie,1) + c(i2,2) * ien(ie,2) ! Weights for Simpson Integration
862  fl12 = c(i3,1) * ien(ie,1) + c(i3,2) * ien(ie,2)
863  fl21 = c(i3,1) * ien(ie,3) + c(i3,2) * ien(ie,4)
864  fl22 = c(i1,1) * ien(ie,3) + c(i1,2) * ien(ie,4)
865  fl31 = c(i1,1) * ien(ie,5) + c(i1,2) * ien(ie,6)
866  fl32 = c(i2,1) * ien(ie,5) + c(i2,2) * ien(ie,6)
867  fl111 = 2.d0*fl11+fl12
868  fl112 = 2.d0*fl12+fl11
869  fl211 = 2.d0*fl21+fl22
870  fl212 = 2.d0*fl22+fl21
871  fl311 = 2.d0*fl31+fl32
872  fl312 = 2.d0*fl32+fl31
873  flall(1,ie) = (fl311 + fl212)! * ONESIXTH + KELEM(1,IE)
874  flall(2,ie) = (fl111 + fl312)! * ONESIXTH + KELEM(2,IE)
875  flall(3,ie) = (fl211 + fl112)! * ONESIXTH + KELEM(3,IE)
876  END DO ! NTRI
877 
878  IF (lcalc) THEN ! If the current field or water level changes estimate the iteration number based on the new flow field and the CFL number of the scheme
879  kksum = 0.d0
880  DO ie = 1, ntri
881  ni = trigp(:,ie)
882  kksum(ni) = kksum(ni) + kelem(:,ie)
883  END DO ! IE
884  dtmaxexp = 1e10 ! initialize to large number
885  DO ip = 1, nx
886  dtmaxexp = si(ip)/max(dble(10.e-10),kksum(ip)*iobdp(ip))
887  dtmaxgl = min( dtmaxgl, dtmaxexp)
888  END DO ! IP
889  cflxy = dble(dt)/dtmaxgl
890  rest = abs(mod(cflxy,1.0d0))
891  IF (rest .LT. thr8) THEN
892  iter(ik,ith) = abs(nint(cflxy))
893  ELSE IF (rest .GT. thr8 .AND. rest .LT. 0.5d0) THEN
894  iter(ik,ith) = abs(nint(cflxy)) + 1
895  ELSE
896  iter(ik,ith) = abs(nint(cflxy))
897  END IF
898  END IF ! LCALC
899 
900  DO ip = 1, nx
901  dtsi(ip) = dble(dt)/dble(iter(ik,ith))/si(ip) ! Some precalculations for the time integration.
902  END DO
903 
904  DO it = 1, iter(ik,ith)
905  u = ac
906 
907  st = 0.d0
908 
909  DO ie = 1, ntri
910  ni = trigp(:,ie)
911  ft =-onesixth*dot_product(u(ni),flall(:,ie))
912  utilde = nm(ie) * ( dot_product(kelem(:,ie),u(ni)) - ft )
913  theta_l(:) = kelem(:,ie) * (u(ni) - utilde)
914  IF (abs(ft) .GT. 0.0d0) THEN
915  bet1(:) = theta_l(:)/ft
916  IF (any( bet1 .LT. 0.0d0) ) THEN
917  betahat(1) = bet1(1) + 0.5d0 * bet1(2)
918  betahat(2) = bet1(2) + 0.5d0 * bet1(3)
919  betahat(3) = bet1(3) + 0.5d0 * bet1(1)
920  bet1(1) = max(0.d0,min(betahat(1),1.d0-betahat(2),1.d0))
921  bet1(2) = max(0.d0,min(betahat(2),1.d0-betahat(3),1.d0))
922  bet1(3) = max(0.d0,min(betahat(3),1.d0-betahat(1),1.d0))
923  theta_l(:) = ft * bet1
924  END IF
925  ELSE
926  theta_l(:) = 0.d0
927  END IF
928  st(ni) = st(ni) + theta_l ! the 2nd term are the theta values of each node ...
929  END DO
930 
931  DO ip = 1, nx
932  u(ip) = max(0.d0,u(ip)-dtsi(ip)*st(ip)*(1-iobpa(ip)))*dble(iobpd(ith,ip))
933 #ifdef W3_REF1
934  IF (refpars(3).LT.0.5.AND.iobpd(ith,ip).EQ.0.AND.iobpa(ip).EQ.0) u(ip)= ac(ip) ! restores reflected boundary values
935 #endif
936  END DO
937 
938  ! update spectrum
939  ac = u
940  !
941  ! 4 Update boundaries: performs interpolation in time as done in rect grids (e.g. w3pro1md.ftn)
942  !
943  IF ( flbpi ) THEN
944  !
945  ! 4.1 In this case the boundary is read from the nest.ww3 file
946  !
947  rd1=rd10 - dt * real(iter(ik,ith)-it)/real(iter(ik,ith))
948  rd2=rd20
949  IF ( rd2 .GT. 0.001 ) THEN
950  rd2 = min(1.,max(0.,rd1/rd2))
951  rd1 = 1. - rd2
952  ELSE
953  rd1 = 0.
954  rd2 = 1.
955  END IF
956  !
957  ! Overwrites only the incoming energy ( IOBPD(ITH,IP) = 0)
958  !
959  DO ibi=1, nbi
960  ip = mapsf(isbpi(ibi),1)
961  ac(ip) = ( rd1*bbpi0(isp,ibi) + rd2*bbpin(isp,ibi) ) &
962  / cg(ik,isbpi(ibi)) * clats(isbpi(ibi))
963  END DO
964 
965  ENDIF
966  !
967  END DO ! End of loop on time steps
968  ! CALL EXTCDE ( 99 )
969  !/
970  !/ End of W3XYPFSN ----------------------------------------------------- /
971  !/

References w3odatmd::bbpi0, w3odatmd::bbpin, w3gdatmd::ccon, w3adatmd::cg, w3gdatmd::clats, w3timemd::dsec21(), w3odatmd::flbpi, w3gdatmd::ie_cell, w3gdatmd::ien, w3gdatmd::iobdp, w3gdatmd::iobp, w3gdatmd::iobpa, w3gdatmd::iobpd, w3odatmd::isbpi, w3adatmd::iter, w3gdatmd::mapsf, w3odatmd::nbi, w3odatmd::ndse, w3odatmd::ndst, w3gdatmd::nk, w3gdatmd::nnz, w3gdatmd::nth, w3gdatmd::ntri, w3gdatmd::nx, w3gdatmd::pos_cell, w3gdatmd::refpars, w3gdatmd::si, w3servmd::strace(), w3odatmd::tbpi0, w3odatmd::tbpin, w3wdatmd::time, and w3gdatmd::trigp.

Referenced by w3xypug().

◆ w3xypug()

subroutine w3profsmd::w3xypug ( integer, intent(in)  ISP,
real, intent(in)  FACX,
real, intent(in)  FACY,
real, intent(in)  DTG,
real, dimension(1-ny:ny*(nx+2)), intent(inout)  VQ,
real, intent(in)  VGX,
real, intent(in)  VGY,
logical, intent(in)  LCALC 
)

Definition at line 63 of file w3profsmd.F90.

63  !/
64  !/ +-----------------------------------+
65  !/ | WAVEWATCH III NOAA/NCEP |
66  !/ | Aron Roland |
67  !/ | FORTRAN 90 |
68  !/ | Last update : 10-Jan-2011 |
69  !/ +-----------------------------------+
70  !/
71  !/ 10-Jan-2008 : Origination. ( version 3.13 )
72  !/ 10-Jan-2011 : Addition of implicit scheme ( version 3.14.4 )
73  !/
74  ! 1. Purpose :
75  !
76  ! Propagation in physical space for a given spectral component.
77  ! Gives the choice of scheme on unstructured grid
78  !
79  ! 2. Method :
80  !
81  !
82  !
83  ! 3. Parameters :
84  !
85  ! Parameter list
86  ! ----------------------------------------------------------------
87  ! ISP Int. I Number of spectral bin (IK-1)*NTH+ITH
88  ! FACX/Y Real I Factor in propagation velocity.
89  ! ( 1 or 0 * DT / DX )
90  ! DTG Real I Total time step.
91  ! VQ R.A. I/O Field to propagate.
92  ! VGX/Y Real I Speed of grid.
93  ! ----------------------------------------------------------------
94  !
95  ! Local variables.
96  ! ----------------------------------------------------------------
97  ! VCFL0X R.A. Local courant numbers for absolute group vel.
98  ! using local X-grid step.
99  ! VCFL0Y R.A. Id. in Y.
100  ! ----------------------------------------------------------------
101  !
102  ! 4. Subroutines used :
103  !
104 
105  ! 5. Called by :
106  !
107  ! W3WAVE Wave model routine.
108  !
109  ! 6. Error messages :
110  !
111  ! None.
112  !
113  ! 7. Remarks :
114  ! make the interface between the WAVEWATCH and the WWM code.
115  !
116  ! 8. Structure :
117  !
118  !
119  ! 9. Switches :
120  !
121  ! !/S Enable subroutine tracing.
122  !
123  !
124  ! 10. Source code :
125  !/ ------------------------------------------------------------------- /
126  !/
127  !
128  USE constants
129  !
130  USE w3timemd, ONLY: dsec21
131  !
132  USE w3gdatmd, ONLY: nx, ny, nsea, mapsf, mapfs, dtcfl, clats, &
133  flcx, flcy, nk, nth, dth, xfr, &
134  ecos, esin, sig, pfmove,ien, &
135  ntri, trigp, ccon , &
138 
139  USE w3wdatmd, ONLY: time
140  USE w3odatmd, ONLY: tbpi0, tbpin, flbpi
141  USE w3adatmd, ONLY: cg, cx, cy, atrnx, atrny, itime, cflxymax, dw
142  USE w3idatmd, ONLY: flcur
143  ! USE W3ODATMD, ONLY: NDSE, NDST, FLBPI, NBI, TBPI0, TBPIN, &
144  ! ISBPI, BBPI0, BBPIN
145 #ifdef W3_S
146  USE w3servmd, ONLY: strace
147 #endif
148 
149  IMPLICIT NONE
150  !/ ------------------------------------------------------------------- /
151  !/ Parameter list
152  !/
153  INTEGER, INTENT(IN) :: ISP
154  REAL, INTENT(IN) :: FACX, FACY, DTG, VGX, VGY
155  REAL, INTENT(INOUT) :: VQ(1-NY:NY*(NX+2))
156  LOGICAL, INTENT(IN) :: LCALC
157  !/
158  !/ ------------------------------------------------------------------- /
159  !/ Local parameters
160  !/
161  INTEGER :: ITH, IK, ISEA, IXY
162  INTEGER :: IX
163 #ifdef W3_S
164  INTEGER, SAVE :: IENT = 0
165 #endif
166  REAL :: CCOS, CSIN, CCURX, CCURY
167  REAL :: C(NX,2)
168  REAL :: RD1, RD2
169  !/
170  !/ Automatic work arrays
171  !/
172  REAL :: VLCFLX((NX+1)*NY), VLCFLY(NX*NY)
173  DOUBLE PRECISION :: AC(NX)
174  !/ ------------------------------------------------------------------- /
175  !
176  ! 1. Preparations --------------------------------------------------- *
177  ! 1.a Set constants
178  !
179 
180 #ifdef W3_S
181  CALL strace (ient, 'W3XYPUG')
182 #endif
183  ith = 1 + mod(isp-1,nth)
184  ik = 1 + (isp-1)/nth
185 
186  ccos = facx * ecos(ith)
187  csin = facy * esin(ith)
188  ccurx = facx
189  ccury = facy
190  !
191  ! 1.b Initialize arrays
192  !
193  vlcflx = 0.
194  vlcfly = 0.
195  !
196  ! 1.c Set depth
197  !
198  CALL setdepth
199  !
200  !
201  ! 2. Calculate velocities ---------------- *
202  !
203  DO isea = 1, nsea
204  ixy = mapsf(isea,3)
205  vq(ixy) = vq(ixy) / cg(ik,isea) * clats(isea)
206  vlcflx(ixy) = ccos * cg(ik,isea) / clats(isea)
207  vlcfly(ixy) = csin * cg(ik,isea)
208 #ifdef W3_MGP
209  vlcflx(ixy) = vlcflx(ixy) - ccurx*vgx/clats(isea)
210  vlcfly(ixy) = vlcfly(ixy) - ccury*vgy
211 #endif
212  END DO
213 
214  IF ( flcur ) THEN
215  DO isea=1, nsea
216  ixy = mapsf(isea,3)
217  !
218  ! Currents are not included on coastal boundaries (IOBP(IXY).EQ.0)
219  !
220  IF (iobp(ixy) .EQ. 1) THEN
221  vlcflx(ixy) = vlcflx(ixy) + ccurx*cx(isea)/clats(isea)
222  vlcfly(ixy) = vlcfly(ixy) + ccury*cy(isea)
223  END IF
224  END DO
225  END IF
226 
227  !
228  ! 3. initialize fluctuation splitting arrays ( to fit with WWM notations)
229  !
230  ac(1:nx) = dble(vq(1:nx)) * iobdp(1:nx)
231  c(1:nx,1) = vlcflx(1:nx) * iobdp(1:nx)
232  c(1:nx,2) = vlcfly(1:nx) * iobdp(1:nx)
233 
234  !
235  ! 4. Prepares boundary update
236  !
237  IF ( flbpi ) THEN
238  rd1 = dsec21( tbpi0, time )
239  rd2 = dsec21( tbpi0, tbpin )
240  ELSE
241  rd1=1.
242  rd2=0.
243  END IF
244  !
245  ! 4. propagate using the selected scheme
246  !
247  IF (fsn) THEN
248  CALL w3xypfsn2 (isp, c, lcalc, rd1, rd2, dtg, ac)
249  ELSE IF (fspsi) THEN
250  CALL w3xypfspsi2 (isp, c, lcalc, rd1, rd2, dtg, ac)
251  ELSE IF (fsfct) THEN
252  CALL w3xypfsfct2 (isp, c, lcalc, rd1, rd2, dtg, ac)
253  ELSE IF (fsnimp) THEN
254  CALL w3xypfsnimp(isp, c, lcalc, rd1, rd2, dtg, ac)
255  ENDIF
256  !
257  DO ix=1,nx
258  isea=mapfs(1,ix)
259  vq(ix)=real(ac(ix))
260  ENDDO
261 
262  ! 6. Store results in VQ in proper format --------------------------- *
263  !
264  DO isea=1, nsea
265  ixy = mapsf(isea,3)
266  vq(ixy) = max( 0. , cg(ik,isea)/clats(isea)*vq(ixy) )
267  END DO

References w3adatmd::atrnx, w3adatmd::atrny, w3gdatmd::ccon, w3adatmd::cflxymax, w3adatmd::cg, w3gdatmd::clats, w3adatmd::cx, w3adatmd::cy, w3timemd::dsec21(), w3gdatmd::dtcfl, w3gdatmd::dth, w3adatmd::dw, w3gdatmd::ecos, w3gdatmd::esin, w3odatmd::flbpi, w3idatmd::flcur, w3gdatmd::flcx, w3gdatmd::flcy, w3gdatmd::fsfct, w3gdatmd::fsn, w3gdatmd::fsnimp, w3gdatmd::fspsi, w3gdatmd::gtype, w3gdatmd::ie_cell, w3gdatmd::ien, w3gdatmd::iobdp, w3gdatmd::iobp, w3gdatmd::iobpd, w3adatmd::itime, w3gdatmd::mapfs, w3gdatmd::mapsf, w3gdatmd::nk, w3gdatmd::nsea, w3gdatmd::nth, w3gdatmd::ntri, w3gdatmd::nx, w3gdatmd::ny, w3gdatmd::pfmove, w3gdatmd::pos_cell, setdepth(), w3gdatmd::sig, w3servmd::strace(), w3odatmd::tbpi0, w3odatmd::tbpin, w3wdatmd::time, w3gdatmd::trigp, w3gdatmd::ungtype, w3xypfsfct2(), w3xypfsn2(), w3xypfsnimp(), w3xypfspsi2(), and w3gdatmd::xfr.

Referenced by w3wavemd::w3wave().

w3gdatmd::trigp
integer, dimension(:,:), pointer trigp
Definition: w3gdatmd.F90:1111
w3gdatmd::nseal
integer, pointer nseal
Definition: w3gdatmd.F90:1097
w3odatmd::tbpi0
integer, dimension(:), pointer tbpi0
Definition: w3odatmd.F90:464
w3timemd::dsec21
real function dsec21(TIME1, TIME2)
Definition: w3timemd.F90:333
w3gdatmd::iaa
integer, dimension(:), pointer iaa
Definition: w3gdatmd.F90:1124
w3gdatmd::dth
real, pointer dth
Definition: w3gdatmd.F90:1232
w3gdatmd::fspsi
logical, pointer fspsi
Definition: w3gdatmd.F90:1405
w3adatmd
Define data structures to set up wave model auxiliary data for several models simultaneously.
Definition: w3adatmd.F90:26
w3gdatmd::ungtype
integer, parameter ungtype
Definition: w3gdatmd.F90:626
w3gdatmd::dmin
real, pointer dmin
Definition: w3gdatmd.F90:1183
w3gdatmd::ntri
integer, pointer ntri
Definition: w3gdatmd.F90:1109
w3wdatmd
Define data structures to set up wave model dynamic data for several models simultaneously.
Definition: w3wdatmd.F90:18
w3adatmd::atrnx
real, dimension(:,:), pointer atrnx
Definition: w3adatmd.F90:578
w3gdatmd::ie_cell
integer, dimension(:), pointer ie_cell
Definition: w3gdatmd.F90:1124
w3gdatmd::fsn
logical, pointer fsn
Definition: w3gdatmd.F90:1405
w3adatmd::atrny
real, dimension(:,:), pointer atrny
Definition: w3adatmd.F90:578
w3gdatmd::sig
real, dimension(:), pointer sig
Definition: w3gdatmd.F90:1234
w3wdatmd::time
integer, dimension(:), pointer time
Definition: w3wdatmd.F90:172
w3gdatmd::ecos
real, dimension(:), pointer ecos
Definition: w3gdatmd.F90:1234
w3odatmd::bbpi0
real, dimension(:,:), pointer bbpi0
Definition: w3odatmd.F90:541
w3odatmd::tbpin
integer, dimension(:), pointer tbpin
Definition: w3odatmd.F90:464
w3odatmd::nbi
integer, pointer nbi
Definition: w3odatmd.F90:530
w3gdatmd::iobpa
integer *1, dimension(:), pointer iobpa
Definition: w3gdatmd.F90:1130
w3odatmd::flbpi
logical, pointer flbpi
Definition: w3odatmd.F90:546
w3idatmd::flcur
logical, pointer flcur
Definition: w3idatmd.F90:261
scrip_constants::tiny
real(kind=scrip_r8), parameter tiny
Definition: scrip_constants.f:50
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
w3gdatmd::esin
real, dimension(:), pointer esin
Definition: w3gdatmd.F90:1234
constants::lpdlib
logical lpdlib
LPDLIB Logical for using the PDLIB library.
Definition: constants.F90:101
w3servmd
Definition: w3servmd.F90:3
w3gdatmd::tria
real(8), dimension(:), pointer tria
Definition: w3gdatmd.F90:1131
w3gdatmd::fsfct
logical, pointer fsfct
Definition: w3gdatmd.F90:1405
bcgstab
subroutine bcgstab(n, rhs, sol, ipar, fpar, w)
Definition: w3profsmd.F90:2044
w3odatmd
Definition: w3odatmd.F90:3
w3gdatmd::clats
real, dimension(:), pointer clats
Definition: w3gdatmd.F90:1196
w3gdatmd::ien
real(8), dimension(:,:), pointer ien
Definition: w3gdatmd.F90:1122
w3gdatmd::mapsf
integer, dimension(:,:), pointer mapsf
Definition: w3gdatmd.F90:1163
w3gdatmd::fsnimp
logical, pointer fsnimp
Definition: w3gdatmd.F90:1405
w3gdatmd::fsbccfl
logical, pointer fsbccfl
Definition: w3gdatmd.F90:1406
w3gdatmd::countri
integer, pointer countri
Definition: w3gdatmd.F90:1109
w3gdatmd::iobpd
integer *1, dimension(:,:), pointer iobpd
Definition: w3gdatmd.F90:1130
w3gdatmd::nnz
integer, pointer nnz
Definition: w3gdatmd.F90:1109
w3gdatmd::jaa
integer, dimension(:), pointer jaa
Definition: w3gdatmd.F90:1124
ilu0
subroutine ilu0(n, a, ja, ia, alu, jlu, ju, iw, ierr)
Definition: w3profsmd.F90:4177
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3gdatmd::gtype
integer, pointer gtype
Definition: w3gdatmd.F90:1094
w3idatmd
Define data structures to set up wave model input data for several models simultaneously.
Definition: w3idatmd.F90:16
w3gdatmd::iobdp
integer *1, dimension(:), pointer iobdp
Definition: w3gdatmd.F90:1130
w3gdatmd::xfr
real, pointer xfr
Definition: w3gdatmd.F90:1232
w3gdatmd::flcy
logical, pointer flcy
Definition: w3gdatmd.F90:1217
w3gdatmd::ccon
integer, dimension(:), pointer ccon
Definition: w3gdatmd.F90:1124
w3gdatmd::iobp
integer *2, dimension(:), pointer iobp
Definition: w3gdatmd.F90:1129
w3gdatmd::si
real(8), dimension(:), pointer si
Definition: w3gdatmd.F90:1122
w3odatmd::ndst
integer, pointer ndst
Definition: w3odatmd.F90:456
w3gdatmd::flcx
logical, pointer flcx
Definition: w3gdatmd.F90:1217
constants
Define some much-used constants for global use (all defined as PARAMETER).
Definition: constants.F90:20
w3adatmd::iter
integer, dimension(:,:), pointer iter
Definition: w3adatmd.F90:654
w3gdatmd
Definition: w3gdatmd.F90:16
w3gdatmd::refpars
real, dimension(:), pointer refpars
Definition: w3gdatmd.F90:1139
w3gdatmd::pfmove
real, pointer pfmove
Definition: w3gdatmd.F90:1183
w3adatmd::itime
integer, pointer itime
Definition: w3adatmd.F90:686
w3gdatmd::index_cell
integer, dimension(:), pointer index_cell
Definition: w3gdatmd.F90:1124
runrc
subroutine runrc(n, rhs, sol, ipar, fpar, wk, guess, a, ja, ia, au, jau, ju, solver)
Definition: w3profsmd.F90:3748
w3odatmd::isbpi
integer, dimension(:), pointer isbpi
Definition: w3odatmd.F90:535
w3timemd
Definition: w3timemd.F90:3
w3gdatmd::dtcfl
real, pointer dtcfl
Definition: w3gdatmd.F90:1183
w3gdatmd::pos_cell
integer, dimension(:), pointer pos_cell
Definition: w3gdatmd.F90:1124
w3gdatmd::posi
integer, dimension(:,:), pointer posi
Definition: w3gdatmd.F90:1124
w3odatmd::bbpin
real, dimension(:,:), pointer bbpin
Definition: w3odatmd.F90:541