My Project
Functions/Subroutines
serv_xnl4v5 Module Reference

Functions/Subroutines

subroutine y_gauleg (x1, x2, x, w, n)
 
subroutine z_cmpcg (sigma, depth, grav_w, cg)
 
subroutine z_intp1 (x1, y1, x2, y2, n1, n2, ierr)
 
subroutine z_polyarea (xpol, ypol, npol, area)
 
subroutine z_steps (x, dx, nx)
 
real function z_root2 (func, x1, x2, xacc, iprint, ierr)
 
subroutine z_upper (str)
 
real function z_wnumb (w, d, grav_w)
 

Function/Subroutine Documentation

◆ y_gauleg()

subroutine serv_xnl4v5::y_gauleg ( real, intent(in)  x1,
real, intent(in)  x2,
real, dimension(n), intent(out)  x,
real, dimension(n), intent(out)  w,
integer, intent(in)  n 
)

Definition at line 670 of file swmod3.f90.

670 !-------------------------------------------------------------------
671  INTEGER, intent(in) :: n ! Number of intervals
672  real, intent(in) :: x1 ! lower limit of integration interval
673  real, intent(in) :: x2 ! upper limit of integration interval
674  real, intent(out) :: x(n) ! Positions for function evaluations
675  real, intent(out) :: w(n) ! Weights
676 !-----------------------------------------------------------------------
677  DOUBLE PRECISION EPS
678  parameter(eps=3.d-14)
679  INTEGER i,j,m
680  DOUBLE PRECISION p1,p2,p3,pp,xl,xm,z,z1
681 !-----------------------------------------------------------------------
682  m=(n+1)/2
683  xm=0.5d0*(x2+x1)
684  xl=0.5d0*(x2-x1)
685  do i=1,m
686  z=cos(3.141592654d0*(i-.25d0)/(n+.5d0))
687  1 continue
688  p1=1.d0
689  p2=0.d0
690  do j=1,n
691  p3=p2
692  p2=p1
693  p1=((2.d0*j-1.d0)*z*p2-(j-1.d0)*p3)/j
694  end do
695  pp=n*(z*p1-p2)/(z*z-1.d0)
696  z1=z
697  z=z1-p1/pp
698  if(abs(z-z1).gt.eps)goto 1
699  x(i)=xm-xl*z
700  x(n+1-i)=xm+xl*z
701  w(i)=2.d0*xl/((1.d0-z*z)*pp*pp)
702  w(n+1-i)=w(i)
703  end do
704 !
705  return
real(sp), dimension(:), allocatable, target d
Definition: mod_main.f90:1132
real(sp), dimension(:,:), allocatable, target w
Definition: mod_main.f90:1279
integer m
Definition: mod_main.f90:56
integer n
Definition: mod_main.f90:55
real(kind=dbl_kind), parameter p2
real(sp), dimension(:), allocatable, target xm
Definition: mod_main.f90:991
real(kind=dbl_kind), parameter p1
real(sp), dimension(:,:), allocatable, target z
Definition: mod_main.f90:1090
real(sp), dimension(:,:), allocatable, target z1
Definition: mod_main.f90:1094
Here is the caller graph for this function:

◆ z_cmpcg()

subroutine serv_xnl4v5::z_cmpcg ( real, intent(in)  sigma,
real, intent(in)  depth,
real, intent(in)  grav_w,
real, intent(out)  cg 
)

Definition at line 710 of file swmod3.f90.

710 !-----------------------------------------------------------------------------!
711 !
712 ! +-------+ ALKYON Hydraulic Consultancy & Research
713 ! | | Gerbrant van Vledder
714 ! | +---+
715 ! | | +---+
716 ! +---+ | |
717 ! +---+
718 !
719 !
720 ! SWAN (Simulating WAves Nearshore); a third generation wave model
721 ! Copyright (C) 2004-2005 Delft University of Technology
722 !
723 ! This program is free software; you can redistribute it and/or
724 ! modify it under the terms of the GNU General Public License as
725 ! published by the Free Software Foundation; either version 2 of
726 ! the License, or (at your option) any later version.
727 !
728 ! This program is distributed in the hope that it will be useful,
729 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
730 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
731 ! GNU General Public License for more details.
732 !
733 ! A copy of the GNU General Public License is available at
734 ! http://www.gnu.org/copyleft/gpl.html#SEC3
735 ! or by writing to the Free Software Foundation, Inc.,
736 ! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
737 !
738 !
739  implicit none
740 !
741 ! 0. Update history
742 !
743 ! 12/01/2001 Initial version
744 ! 11/04/2001 Check included for the cases tat sigma < 0 or depth <0
745 ! Result is cg = -10
746 !
747 ! 1. Purpose:
748 !
749 ! Compute group velocity for a given radian frequency and depth
750 !
751 ! 2. Method
752 !
753 ! Linear wave theory
754 !
755 ! 3. Parameter list:
756 !
757 !Type I/O Name Description
758 !------------------------------------------------------------------------------
759  real, intent(in) :: sigma ! radian frequency (rad)
760  real, intent(in) :: depth ! water depth (m)
761  real, intent(in) :: grav_w ! gravitational acceleration (m/s^2)
762  real, intent(out) :: cg ! group velocity (m/s)
763 !
764  real k ! wave number
765 !/A
766 !! real z_wnumb ! compute wave number
767 !/Z
768 !-----------------------------------------------------------------------------
769  k = z_wnumb(sigma,depth,grav_w)
770 !
771  if(depth <= 0. .or. sigma <= 0.) then
772  cg = -10.
773  else
774  if(depth*k > 30.) then
775  cg = grav_w/(2.*sigma)
776  else
777  cg = sigma/k*(0.5+depth*k/sinh(2.*depth*k))
778  end if
779  end if
780 !
781  return
real function z_wnumb(w, d, grav_w)
Definition: swmod3.f90:1467
Here is the call graph for this function:
Here is the caller graph for this function:

◆ z_intp1()

subroutine serv_xnl4v5::z_intp1 ( real, dimension(n1), intent(in)  x1,
real, dimension(n1), intent(in)  y1,
real, dimension(n2), intent(in)  x2,
real, dimension(n2), intent(out)  y2,
integer, intent(in)  n1,
integer, intent(in)  n2,
integer, intent(out)  ierr 
)

Definition at line 786 of file swmod3.f90.

786 !-----------------------------------------------------------------------------!
787 !
788 ! +-------+ ALKYON Hydraulic Consultancy & Research
789 ! | | Gerbrant van Vledder
790 ! | +---+
791 ! | | +---+
792 ! +---+ | |
793 ! +---+
794 !
795 !
796 ! SWAN (Simulating WAves Nearshore); a third generation wave model
797 ! Copyright (C) 2004-2005 Delft University of Technology
798 !
799 ! This program is free software; you can redistribute it and/or
800 ! modify it under the terms of the GNU General Public License as
801 ! published by the Free Software Foundation; either version 2 of
802 ! the License, or (at your option) any later version.
803 !
804 ! This program is distributed in the hope that it will be useful,
805 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
806 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
807 ! GNU General Public License for more details.
808 !
809 ! A copy of the GNU General Public License is available at
810 ! http://www.gnu.org/copyleft/gpl.html#SEC3
811 ! or by writing to the Free Software Foundation, Inc.,
812 ! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
813 !
814 !
815  implicit none
816 !
817 ! 0. Update history
818 !
819 ! 30/03/1999 Initical version
820 ! 9/04/1999 Check included for monotonicity of x-data
821 ! 11/10/1999 Error messages added and updated
822 ! 18/01/2001 Check include if n1==1
823 ! 24/01/2001 Check for equality of y2 data loosened if n2==1
824 ! 13/09/2001 Documentation updated
825 !
826 ! 1. Purpose
827 !
828 ! Interpolate function values
829 !
830 ! 2. Method
831 !
832 ! Linear interpolation
833 
834 ! If a requested point falls outside the input domain, then
835 ! the nearest point is used (viz. begin or end point of x1/y1 array
836 !
837 ! If the input array has only one point. A constant value is assumed
838 !
839 ! 3. Parameter list
840 !
841 ! Name I/O Type Description
842 !
843  integer, intent(in) :: n1 ! number of data points in x1-y1 arrays
844  integer, intent(in) :: n2 ! number of data points in x2-y2 arrays
845  real, intent(in) :: x1(n1) ! x-values of input data
846  real, intent(in) :: y1(n1) ! y-values of input data
847  real, intent(in) :: x2(n2) ! x-values of output data
848  real, intent(out) :: y2(n2) ! y-values of output data
849  integer, intent(out) :: ierr ! Error indicator
850 !
851 ! 4. Subroutines used
852 !
853 ! 5. Error messages
854 !
855 ! ierr = 0 No errors detected
856 ! = 1 x1-data not monotonic increasing
857 ! = 10 x2-data not monotonic increasing
858 ! = 11 x1- and x2 data not monotonic increasing
859 ! = 2 x1-data not monotonic decreasing
860 ! = 20 x1-data not monotonic decreasing
861 ! = 22 x1- and x2 data not monotonic decreasing
862 !
863 ! = 2 No variation in x1-data
864 ! = 3 No variation in x2-data is allowed if n2=1
865 !
866 ! 6. Remarks
867 !
868 ! It is assumed that the x1- and x2-data are either
869 ! monotonic increasing or decreasing
870 !
871 ! If a requested x2-value falls outside the range of x1-values
872 ! it is assumed that the corresponding y2-value is equal to
873 ! the nearest boundary value of the y1-values
874 !
875 ! Example: x1 = [0 1 2 3]
876 ! y1 = [1 2 1 0]
877 !
878 ! x2 = -1, y2 = 1
879 ! x2 = 5, y2 = 0
880 !
881 !------------------------------------------------------------------------------
882  integer i1,i2 ! counters
883 !
884  real ds ! step size
885  real fac ! factor in linear interpolation
886  real s1,s2 ! search values
887  real xmin1,xmax1 ! minimum and maximum of x1-data
888  real xmin2,xmax2 ! minimum and maximum of x2-data
889 !
890  real, parameter :: eps=1.e-20
891 !------------------------------------------------------------------------------
892 ! initialisation
893 !
894  ierr = 0
895 !
896 ! check number of points of input array
897 !
898  if(n1==1) then
899  y2 = y1(1)
900  goto 9999
901  end if
902 !
903 ! check minimum and maximum data values
904 !
905  xmin1 = minval(x1)
906  xmax1 = maxval(x1)
907  xmin2 = minval(x2)
908  xmax2 = maxval(x2)
909 !
910  if (abs(xmin1-xmax1) < eps .or. abs(x1(1)-x1(n1)) < eps) then
911  ierr = 2
912  goto 9999
913  end if
914 !
915  if ((abs(xmin2-xmax2) < eps .or. abs(x2(1)-x2(n2)) < eps) .and. &
916  n2 > 1) then
917  ierr = 3
918  goto 9999
919  end if
920 !
921 ! check input data for monotonicity
922 !
923  if(x1(1) < x1(n1)) then ! data increasing
924  do i1=1,n1-1
925  if(x1(i1) > x1(i1+1)) then
926  ierr=1
927  write(*,*) 'z_intp1: i1 x1(i1) x1(i1+1):',i1,x1(i1),x1(i1+1)
928  goto 9999
929  end if
930  end do
931 !
932  do i2=1,n2-1
933  if(x2(i2) > x2(i2+1)) then
934  ierr=ierr+10
935  write(*,*) 'z_intp1: i2 x2(i2) x2(i2+1):',i2,x2(i2),x2(i2+1)
936  goto 9999
937  end if
938  end do
939 !
940  else ! data decreasing
941  do i1=1,n1-1
942  if(x1(i1) < x1(i1+1)) then
943  ierr=2
944  write(*,*) 'z_intp1: i1 x1(i1) x1(i1+1):',i1,x1(i1),x1(i1+1)
945  goto 9999
946  end if
947  end do
948 !
949  do i2=1,n2-1
950  if(x2(i2) < x2(i2+1)) then
951  ierr=ierr + 20
952  write(*,*) 'z_intp1: i2 x2(i2) x2(i2+1):',i2,x2(i2),x2(i2+1)
953  goto 9999
954  end if
955  end do
956  end if
957 !
958 !------------------------------------------------------------------------------
959 ! initialize
960 !------------------------------------------------------------------------------
961  if(ierr==0) then
962  i1 = 1
963  s1 = x1(i1)
964 !
965  do i2 = 1,n2
966  s2 = x2(i2)
967  do while (s1 <= s2 .and. i1 < n1)
968  i1 = i1 + 1
969  s1 = x1(i1)
970  end do
971 !
972 ! special point
973 ! choose lowest s1-value if x2(:) < x1(1)
974 !
975  if(i1 ==1) then
976  y2(i2) = y1(i1)
977  else
978  ds = s2 - x1(i1-1)
979  fac = ds/(x1(i1)-x1(i1-1))
980  y2(i2) = y1(i1-1) + fac*(y1(i1)-y1(i1-1))
981  end if
982 !
983 ! special case at end: choose s2(n2) > s1(n1), choose last value of y1(1)
984 !
985  if(i2==n2 .and. s2>s1) y2(n2) = y1(n1)
986  end do
987  end if
988 !
989  9999 continue
990 !
991  return
real(sp), dimension(:,:), allocatable, target s1
Definition: mod_main.f90:1308
real(sp), dimension(:,:), allocatable, target s2
Definition: mod_main.f90:1316
Here is the caller graph for this function:

◆ z_polyarea()

subroutine serv_xnl4v5::z_polyarea ( real, dimension(npol), intent(in)  xpol,
real, dimension(npol), intent(in)  ypol,
integer, intent(in)  npol,
real, intent(out)  area 
)

Definition at line 996 of file swmod3.f90.

996 !-----------------------------------------------------------------------------!
997 !
998 ! +-------+ ALKYON Hydraulic Consultancy & Research
999 ! | | P.O. Box 248
1000 ! | +---+ 8300 AE Emmeloord
1001 ! | | +---+ Tel: +31 527 620909
1002 ! +---+ | | Fax: +31 527 610020
1003 ! +---+ http://www.alkyon.nl
1004 !
1005 ! Gerbrant van Vledder
1006 !
1007 !
1008 ! SWAN (Simulating WAves Nearshore); a third generation wave model
1009 ! Copyright (C) 2004-2005 Delft University of Technology
1010 !
1011 ! This program is free software; you can redistribute it and/or
1012 ! modify it under the terms of the GNU General Public License as
1013 ! published by the Free Software Foundation; either version 2 of
1014 ! the License, or (at your option) any later version.
1015 !
1016 ! This program is distributed in the hope that it will be useful,
1017 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
1018 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1019 ! GNU General Public License for more details.
1020 !
1021 ! A copy of the GNU General Public License is available at
1022 ! http://www.gnu.org/copyleft/gpl.html#SEC3
1023 ! or by writing to the Free Software Foundation, Inc.,
1024 ! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1025 !
1026 !
1027 ! 0. Update history
1028 !
1029 ! 0.01 12/06/2003 Initial version
1030 !
1031 ! 1. Purpose
1032 !
1033 ! Computes area of a closed polygon
1034 !
1035 ! 2. Method
1036 !
1037 ! The area of the polygon
1038 !
1039 ! 3. Parameter list
1040 !
1041 ! Name I/O Type Description
1042 !
1043  integer, intent(in) :: npol ! Number of points of polygon
1044  real, intent(in) :: xpol(npol) ! x-coodinates of polygon
1045  real, intent(in) :: ypol(npol) ! y-coordinates of polygon
1046  real, intent(out) :: area ! area of polygon
1047 !
1048 ! 4. Subroutines used
1049 !
1050 ! 5. Error messages
1051 !
1052 ! 6. Remarks
1053 !
1054  integer ipol,ipol1 ! counters
1055  real xmin,xmax,ymin,ymax ! minima and maxima of polygon
1056  real xmean,ymean ! mean values
1057  real xa,ya,xb,yb ! temporary variables
1058  real sumx,sumy ! sums
1059  real darea ! piece of area
1060 !-------------------------------------------------------------------------------
1061  if(npol<=1) then
1062  crf = 0.
1063  xz = 0.
1064  yz = 0.
1065  area = 0.
1066  return
1067  end if
1068 !
1069 ! compute minimum and maximum coordinates
1070 !
1071  xmin = minval(xpol)
1072  xmax = maxval(xpol)
1073  ymin = minval(ypol)
1074  ymax = maxval(ypol)
1075 !
1076 ! compute mean of range of x- and y-coordinates
1077 !
1078  xmean = 0.5*(xmin + xmax)
1079  ymean = 0.5*(ymin + ymax)
1080 !
1081 ! compute area and center of gravity
1082 ! do loop over all line pieces of polygon
1083 !
1084  area = 0.
1085  sumx = 0.
1086  sumy = 0.
1087 !
1088  do ipol=1,npol
1089  ipol1 = ipol + 1
1090  if(ipol==npol) ipol1 = 1
1091  xa = xpol(ipol)
1092  ya = ypol(ipol)
1093  xb = xpol(ipol1)
1094  yb = ypol(ipol1)
1095 !
1096  darea = 0.5*((xa-xmean)*(yb-ymean) - (xb-xmean)*(ya-ymean))
1097  area = area + darea
1098  sumx = sumx + darea*(xa+xb+xmean)/3.
1099  sumy = sumy + darea*(ya+yb+ymean)/3.
1100  end do
1101 !
1102  return
Here is the caller graph for this function:

◆ z_root2()

real function serv_xnl4v5::z_root2 ( external  func,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(in)  xacc,
integer, intent(in)  iprint,
integer, intent(out)  ierr 
)

Definition at line 1177 of file swmod3.f90.

1177 !-----------------------------------------------------------------------------!
1178 !
1179 ! +-------+ ALKYON Hydraulic Consultancy & Research
1180 ! | |
1181 ! | +---+
1182 ! | | +---+
1183 ! +---+ | |
1184 ! +---+
1185 !
1186 !
1187 ! SWAN (Simulating WAves Nearshore); a third generation wave model
1188 ! Copyright (C) 2004-2005 Delft University of Technology
1189 !
1190 ! This program is free software; you can redistribute it and/or
1191 ! modify it under the terms of the GNU General Public License as
1192 ! published by the Free Software Foundation; either version 2 of
1193 ! the License, or (at your option) any later version.
1194 !
1195 ! This program is distributed in the hope that it will be useful,
1196 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
1197 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1198 ! GNU General Public License for more details.
1199 !
1200 ! A copy of the GNU General Public License is available at
1201 ! http://www.gnu.org/copyleft/gpl.html#SEC3
1202 ! or by writing to the Free Software Foundation, Inc.,
1203 ! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1204 !
1205 !
1206 ! 0. Update history
1207 !
1208 ! Version Date Modification
1209 !
1210 ! 0.01 29/11/1999 Initial version
1211 ! 0.02 07/11/1999 Test added to check boundaries, and reverse if necessary
1212 ! Bug fixed in assigning answer
1213 ! 0.03 02/09/2002 Maximum number of iterations set to 20, instead of 10
1214 !
1215 ! 1. Purpose
1216 !
1217 ! Find zero crossing point of function FUNC between the
1218 ! initial values on either side of zero crossing
1219 !
1220 ! 2. Method
1221 !
1222 ! Ridders method of root finding
1223 !
1224 ! adapted from routine zridddr
1225 ! Numerical Recipes
1226 ! The art if scientific computing, second edition, 1992
1227 ! W.H. Press, S.A. Teukolsky, W.T. Vetterling and B.P. Flannery
1228 !
1229 ! 3. Parameter list
1230 !
1231 ! Name I/O Type Description
1232 !
1233 ! func i r real function
1234 ! x1 i r initial x-value on left/right side of zero-crossing
1235 ! x2 i r initial x-value on right/left side of zero-crossing
1236 ! xacc i r accuracy, used as |x1(i)-x2(i)|< xacc
1237 ! iprint i i Output channel and test level
1238 ! ierr o i Error indicator
1239 !
1240 ! 4. Subroutines used
1241 !
1242 ! Func user supplied real function
1243 !
1244 ! 5. Error messages
1245 !
1246 ! ierr = 0 No errors occured during iteration process
1247 ! 1 Iteration halted in dead end, this combination may NEVER occur
1248 ! 2 Maximum number of iterations exceeded
1249 ! 3 Solution jumped outside interval
1250 !
1251 ! 6. Remarks
1252 !
1253 ! It is assumed that the x1- and x2-coordinate lie
1254 ! on different sides of the actual zero crossing
1255 !
1256 ! The input parameter IPRINT is used to generate test output.
1257 ! If IPRINT==0, no test output is created
1258 ! > 0, test output is directed to the file connected to unit LUPRINT=IPRINT
1259 ! if no file is connected to this unit, no output is written
1260 !
1261 !
1262  implicit none
1263 !
1264  real func ! external function
1265  real, intent (in) :: x1 ! x-value at one side of interval
1266  real, intent (in) :: x2 ! x-value at other side of interval
1267  real, intent (in) :: xacc ! requested accuracy
1268  integer, intent (in) :: iprint ! number of output channel, only used when
1269  integer, intent (out) :: ierr ! error indicator
1270 !
1271  real unused ! default value
1272  real zriddr ! intermediate function value
1273  real xx1,xx2,xx ! local boundaries during iteration
1274  integer maxit ! maximum number of iteration
1275  integer luprint ! unit of test output
1276  logical lopen ! check if a file is opened
1277 
1278  parameter(maxit = 20)
1279  external func
1280 !
1281  integer iter ! counter for number of iterations
1282  real fh ! function value FUNC(xh)
1283  real fl ! function value FUNC(xl)
1284  real fm ! function value FUNC(xm)
1285  real fnew ! function value FUNC(xnew)
1286  real s ! temp. function value, used for inverse quadratic interpolation
1287  real xh ! upper (high) boundary of interval
1288  real xl ! lower boundary of interval
1289  real xm ! middle point of interval
1290  real xnew ! new estimate according to Ridders method
1291 !
1292  ierr = 0 ! set error level
1293  unused =-1.11e30 ! set start value
1294 !
1295  xx1 = x1 ! copy boundaries of interval to local variables
1296  xx2 = x2
1297 !
1298  luprint = iprint
1299 !
1300  if(luprint > 0) then
1301  inquire(unit=luprint,opened=lopen)
1302  if(.not.lopen) then
1303  luprint = 0
1304  write(*,'(a,i4)') 'Z_ROOT2: invalid unit number:',iprint
1305  end if
1306  end if
1307 !
1308 ! check boundaries on requirement x2 > x1
1309 !
1310  if(xx1 > xx2) then
1311  xx = xx1
1312  xx1 = xx2
1313  xx2 = xx
1314  end if
1315 !
1316  fl = func(xx1)
1317  fh = func(xx2)
1318 !
1319 ! if(luprint > 0) write(luprint,'(a,4e13.5)')
1320 ! & 'Z_ROOT2: xx1 xx2 fl fh:',xx1,xx2,fl,fh
1321 !
1322  if((fl > 0. .and. fh < 0.) .or. (fl < 0. .and. fh > 0.))then
1323  xl = xx1
1324  xh = xx2
1325  zriddr = unused
1326 !
1327  do iter=1,maxit
1328  xm = 0.5*(xl+xh)
1329  fm = func(xm)
1330  s = sqrt(fm**2-fl*fh)
1331  if(s == 0.) goto 9000
1332  xnew = xm+(xm-xl)*(sign(1.,fl-fh)*fm/s)
1333 !
1334 ! if(luprint>0) write(luprint,'(a,4e13.5)')
1335 !& 'Z_ROOT2: xm,fm,s,xnew:',xm,fm,s,xnew
1336 !
1337  if (abs(xnew-zriddr) <= xacc) then
1338 ! if(luprint>0) write(luprint,'(a)') 'Z_ROOT2: xnew=zriddr'
1339  goto 9000
1340  end if
1341 !
1342  zriddr = xnew
1343  fnew = func(zriddr)
1344  if (fnew == 0.) goto 9000
1345 !
1346  if(sign(fm,fnew) /= fm) then
1347  xl = xm
1348  fl = fm
1349  xh = zriddr
1350  fh = fnew
1351  elseif(sign(fl,fnew) /= fl) then
1352  xh = zriddr
1353  fh = fnew
1354  elseif(sign(fh,fnew) /= fh) then
1355  xl = zriddr
1356  fl = fnew
1357  else
1358  ierr = 1
1359  goto 9000
1360  endif
1361 !
1362  if(abs(xh-xl) <= xacc) goto 9000
1363 !
1364  if(luprint > 0) write(luprint,'(a,i4,5e14.6)') &
1365  'Z_ROOT2: iter,x1,x2,|x1-x2|,xacc,z:', iter,xl,xh, &
1366  abs(xl-xh),xacc,fnew
1367 !
1368  end do
1369  ierr = 2
1370  if(luprint > 0) write(luprint,'(a)') 'Z_ROOT2: -> ierr=2'
1371  goto 9000
1372  else if (fl == 0.) then
1373  zriddr = xx1
1374  else if (fh == 0.) then
1375  zriddr = xx2
1376  else
1377  ierr = 3
1378  goto 9999
1379 ! 'root must be bracketed in zriddr'
1380  endif
1381 !
1382  9000 continue
1383 !
1384  z_root2 = zriddr
1385 !
1386  if(luprint > 0) write(luprint,'(a,2i3,5e13.5)') &
1387  'Z_ROOT2: ierr,iter,xl,xh,acc,x0,z0:', ierr,iter,xl,xh,xacc, &
1388  z_root2,func(z_root2)
1389 !
1390  9999 continue
1391 !
1392  return
real(sp), dimension(:,:), allocatable, target s
Definition: mod_main.f90:1288
real function z_root2(func, x1, x2, xacc, iprint, ierr)
Definition: swmod3.f90:1177
real(sp), dimension(:), allocatable, target xm
Definition: mod_main.f90:991
Here is the caller graph for this function:

◆ z_steps()

subroutine serv_xnl4v5::z_steps ( real, dimension(nx), intent(in)  x,
real, dimension(nx), intent(out)  dx,
integer, intent(in)  nx 
)

Definition at line 1107 of file swmod3.f90.

1107 !-----------------------------------------------------------------------------!
1108 !
1109 !
1110 ! +-------+ ALKYON Hydraulic Consultancy & Research
1111 ! | | Gerbrant van Vledder
1112 ! | +---+
1113 ! | | +---+ Creation date: September 28, 1998
1114 ! +---+ | | Last Update: march 19, 2003
1115 ! +---+
1116 !
1117 !
1118 ! SWAN (Simulating WAves Nearshore); a third generation wave model
1119 ! Copyright (C) 2004-2005 Delft University of Technology
1120 !
1121 ! This program is free software; you can redistribute it and/or
1122 ! modify it under the terms of the GNU General Public License as
1123 ! published by the Free Software Foundation; either version 2 of
1124 ! the License, or (at your option) any later version.
1125 !
1126 ! This program is distributed in the hope that it will be useful,
1127 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
1128 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1129 ! GNU General Public License for more details.
1130 !
1131 ! A copy of the GNU General Public License is available at
1132 ! http://www.gnu.org/copyleft/gpl.html#SEC3
1133 ! or by writing to the Free Software Foundation, Inc.,
1134 ! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1135 !
1136 !
1137 ! 0. Update history
1138 !
1139 ! 19/03/2003 Input argument defined using intent option
1140 ! check included nx > 0
1141 !
1142 ! 1. Purpose
1143 !
1144 ! Compute bandwidth of spectral discretization
1145 !
1146  implicit none
1147 !
1148  integer, intent(in) :: nx ! Number of elements in array
1149  real, intent(in) :: x(nx) ! Input data array with elements
1150  real, intent(out) :: dx(nx) ! Output array with step sizes
1151 !
1152  integer ix ! counter
1153 !------------------------------------------------------------------------------
1154  if (nx<1) then
1155  return
1156 !
1157  elseif (nx==1) then
1158  dx = 0
1159  else
1160  do ix=2,nx-1
1161  dx(ix) = 0.5 * (x(ix+1) - x(ix-1))
1162  end do
1163 !
1164  if (nx >= 4) then
1165  dx(1) = dx(2)*dx(2)/dx(3)
1166  dx(nx) = dx(nx-1)*dx(nx-1)/dx(nx-2)
1167  else
1168  dx(1) = dx(2)
1169  dx(nx) = dx(nx-1)
1170  end if
1171  end if
1172 !
1173  return
Here is the caller graph for this function:

◆ z_upper()

subroutine serv_xnl4v5::z_upper ( character(len=*), intent(inout)  str)

Definition at line 1397 of file swmod3.f90.

1397 !-----------------------------------------------------------------------------!
1398 !
1399 ! +-------+ ALKYON Hydraulic Consultancy & Research
1400 ! | | Gerbrant van Vledder
1401 ! | +---+
1402 ! | | +---+ Creation date: July 3,1998
1403 ! +---+ | | Last Update:
1404 ! +---+
1405 !
1406 !
1407 ! SWAN (Simulating WAves Nearshore); a third generation wave model
1408 ! Copyright (C) 2004-2005 Delft University of Technology
1409 !
1410 ! This program is free software; you can redistribute it and/or
1411 ! modify it under the terms of the GNU General Public License as
1412 ! published by the Free Software Foundation; either version 2 of
1413 ! the License, or (at your option) any later version.
1414 !
1415 ! This program is distributed in the hope that it will be useful,
1416 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
1417 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1418 ! GNU General Public License for more details.
1419 !
1420 ! A copy of the GNU General Public License is available at
1421 ! http://www.gnu.org/copyleft/gpl.html#SEC3
1422 ! or by writing to the Free Software Foundation, Inc.,
1423 ! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1424 !
1425 !
1426 ! 0. Update history
1427 !
1428 ! 1. Purpose
1429 !
1430 ! Transform all lower capitals to UPPER CAPITALS in string STR
1431 !
1432 ! 2. Method
1433 !
1434 ! 3. Parameter list
1435 !
1436 ! Name I/O Type Description
1437 !
1438  implicit none
1439  character(len=*), intent(inout) :: str ! Character string to be converted
1440 !
1441 ! 4. Subroutines used
1442 !
1443 ! 5. Error messages
1444 !
1445 ! 6. Remarks
1446 !
1447  integer nlen
1448  integer i,ial,iau,izl
1449 !
1450  nlen = len(str)
1451 !
1452  ial = ichar('a')
1453  iau = ichar('A')
1454  izl = ichar('z')
1455 !
1456  do i=1,nlen
1457  if(ichar(str(i:i)) >= ial.and. ichar(str(i:i)) <= izl) then
1458  str(i:i) = char(ichar(str(i:i))-ial+iau)
1459  end if
1460  end do
1461 !
1462  return
Here is the caller graph for this function:

◆ z_wnumb()

real function serv_xnl4v5::z_wnumb ( real, intent(in)  w,
real, intent(in)  d,
real, intent(in)  grav_w 
)

Definition at line 1467 of file swmod3.f90.

1467 !-----------------------------------------------------------------------------!
1468 !
1469 ! +-------+ ALKYON Hydraulic Consultancy & Research
1470 ! | | Gerbrant van Vledder
1471 ! | +---+
1472 ! | | +---+
1473 ! +---+ | |
1474 ! +---+
1475 !
1476 !
1477 ! SWAN (Simulating WAves Nearshore); a third generation wave model
1478 ! Copyright (C) 2004-2005 Delft University of Technology
1479 !
1480 ! This program is free software; you can redistribute it and/or
1481 ! modify it under the terms of the GNU General Public License as
1482 ! published by the Free Software Foundation; either version 2 of
1483 ! the License, or (at your option) any later version.
1484 !
1485 ! This program is distributed in the hope that it will be useful,
1486 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
1487 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1488 ! GNU General Public License for more details.
1489 !
1490 ! A copy of the GNU General Public License is available at
1491 ! http://www.gnu.org/copyleft/gpl.html#SEC3
1492 ! or by writing to the Free Software Foundation, Inc.,
1493 ! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1494 !
1495 !
1496  implicit none
1497 !
1498 ! 0. Update history
1499 !
1500 ! 01/04/1999 Initial version
1501 ! 12/01/2001 grav added as input parameter
1502 ! 11/04/2001 Check included for the case w < 0 or d < 0
1503 !
1504 ! 1. Purpose:
1505 !
1506 ! Compute wave number k for a given radian frequency and water depth
1507 !
1508 ! 2. Method
1509 !
1510 ! finite depth linear dispersion relation, using a Pade approximation
1511 !
1512 ! 3. Parameter list:
1513 !
1514 !Type I/O Name Description
1515 !------------------------------------------------------------------------------
1516  real, intent(in) :: w ! radian frequency (rad)
1517  real, intent(in) :: d ! water depth (m)
1518  real, intent(in) :: grav_w ! gravitational acceleration (m/s^2)
1519 !
1520 ! 4. Subroutines used
1521 !
1522 ! 5. Error messages
1523 !
1524 ! 6. Remarks
1525 !
1526 ! The Pade approximation has been described in Hunt, 198.
1527 !
1528  real x,xx,y,omega
1529 !
1530  if(d<=0 .or. w<= 0.) then
1531  z_wnumb = -10.
1532  else
1533  omega = w**2/grav_w
1534  y = omega*d
1535  xx = y*(y+1./(1.+y*(0.66667+y*(0.35550+y*(0.16084+y* &
1536  (0.06320+y*(0.02174+y*(0.00654+y*(0.00171+y* &
1537  (0.00039+y*0.00011))))))))))
1538  x = sqrt(xx)
1539  z_wnumb = x/d
1540  end if
1541 !
1542  return
real(sp), dimension(:), allocatable, target d
Definition: mod_main.f90:1132
real(sp), dimension(:,:), allocatable, target w
Definition: mod_main.f90:1279
real(kind=dbl_kind), parameter omega
real function z_wnumb(w, d, grav_w)
Definition: swmod3.f90:1467
Here is the caller graph for this function: