The following code is the main loop of the main program written in Fortran 90.
We learned a lot things from Numerical Recipes series [58, 59], and some subprograms and ideas used in our program are based on the series.
1 IF( i n i t .EQ. 1 ) CALL p e r t u r b _ s o l ( t h e t a , dpt , e t a , a , h1 , h2 ) 2 ! 3 rd−o r d e r p e r t u r b a t i o n s o l u t i o n
3
4 DO WHILE( s m a l l .LE. maxF .AND. maxF .LE. 1 . E0 .AND. j .LE. maxloop ) 5 ! s m a l l i s s e t t o be 1 0 . E0−10.
6 ! maxloop i s s e t t o be 2 0 . 7 pre_maxF=maxF
8 j=j +1
9 CALL p o t e n t l ( t h e t a , dpt , e t a , a , Gx , Gy , Gz , Gyx , Gzx , Gyz , Gxt , Gyy , Gzz , Qz ) 10 ! Base on i n p u t s : t h e t a , dpt , and a ( : ) , subprogram , p o t e n t l ,
11 ! c a l c u l a t e s t h e wave h e i g h t e t a ( : , : ) , d e r i v a t i v e s o f G ( : , : ) 12 ! t h e v e l o c i t y p o t e n t i a l , and Qz ( : , : ) t h e d e r i v a t i v e o f
13 ! t h e k i n e m a t i c c o n d i t i o n a t e a c h g r i d p o i n t . 14
15 f b ( : ) = weakform ( t h e t a , dpt , e t a , a , Gx , Gy , Gz , Gyx , Gzx , Gyz , Gxt , Gyy , Gzz , h1 , h2 ) 16 ! f b ( : ) r e p r e s e n t s e q s i n weak form d e r i v e d mainly by G a l e r k i n ’ s method . 17
18 f a ( : , : ) = j a c o b i a n ( t h e t a , dpt , e t a , a , Gx , Gy , Gz , Gyx , Gzx , Gyz , Gxt , Gyy , Gzz , Qz , h1 , h2 ) 19 ! f a ( : , : ) r e p r e s e n t s a J a c o b i a n m a t r i x which w i l l be used t o c a l c u l a t e
20 ! t h e Newton s t e p , NS ( : ) . 21
22 NS( : ) = f b ( : )
23 CALL ludcmp ( f a , ind , d ) ! t h e a l g o r i t h m from NUMERICAL RECIPES i n F90 24 CALL l u b k s b ( f a , ind , NS) ! t h e a l g o r i t h m from NUMERICAL RECIPES i n F90 25
26 lam = ( / 1 . 0 , 0 . 5 / ) 27 DO k = 1 , n _ t e s t
28 a_comp ( : , k ) = a ( : )−NS ( : )∗lam ( k )
29 CALL p o t e n t l ( t h e t a , dpt , e t a , a_comp ( : , k ) ,&
30 Gt, Gy , Gz , Gyt , Gzt , Gyz , Gtt , Gyy , Gzz , Qz ) 31 fb_comp ( : , k)=weakform ( t h e t a , dpt , e t a , a_comp ( : , k ) , &
32 Gt, Gy , Gz , Gyt , Gzt , Gyz , Gtt , Gyy , Gzz , h1 , h2 ) 33 maxF_test ( k)=MAXVAL(ABS( fb_comp ( 1 : n , k ) ) )
34 maxF_loc_test ( k)=MAXVAL(MAXLOC(ABS( fb_comp ( 1 : n , k ) ) ) ) 35 IF(LOG10( pre_maxF)−LOG10( maxF_test ( k ) ) .GE. 1 . E0 )THEN
36 kk=k
37 EXIT
38 END IF 39 END DO
40 ! I f t h e o r d i n a r y Newton s t e p NS ( : )∗lam where lam =1.0 can ’ t make 41 ! Max | f b ( : ) | s u f f i c i e n t l y s m a l l , we modify t h e Newton s t e p
42 ! by u s i n g lam =0.5 which we found a l m o s t a l w a y s 43 ! t h e b e s t m o d i f i c a t i o n .
44 ! ( s e e s e c t i o n 9 . 7 o f NUMERICAL RECIPE) 45
46 IF( k .EQ. 3 ) kk=MINVAL(MINLOC(ABS( maxF_test ( 1 : n _ t e s t ) ) ) ) 47 a ( 1 : n ) = a ( 1 : n)−NS ( 1 : n )∗lam ( kk )
48
49 maxF = maxF_test ( kk )
50 maxF_loc = maxF_loc_test ( kk ) 51 END DO
When our initial guess for Newton’s method is sufficiently close to the root, New-ton’s method converges quadratically. However if equations have inflection points, following estimations bouncing around and do not converge. In the asymmetric wave case,r̸= 1, we found it is difficult to set an initial solution that is “sufficiently close to the root” (at least, 3rd-order perturbation solutions are not always sufficiently close to the root).
Almost globally convergent methods for nonlinear systems of equations is intro-duced in Numerical Recipes series [58, 59]. Provide that we are finding a new point xnew based on current point xold using Newton’s method:
xnew =xold+λp 0< λ≤1, (A.20) where p is the full Newton step, and the constant λ modifies it. The aim is to find λ so that F(x) had decreased sufficiently. The value λ can be determined by more sophisticated way according to the books though we found that only two values λ= 1,0.5 are enough to converge solutions in this problem.
Appendix B
Perturbation Expansion
B.1 Mathematica script for mth order perturba-tion and Taylor expansions
Mathematica is a useful tool to deal with equations. Perturbation methods often require us to do simple but tedious calculations. The following Mathematica script derives arbitrary mth order perturbation and Taylor expanded equation, which may be the most tiresome part in the perturbation method.
In[1]:= rng[a_[u_],n_,m_]:=Flatten@{a[u],1,m-(n-u)-Sum[a[i],{i,1,u-1}]};
rngE[a_[u_],m_]:=Flatten@{a[u],(m-Sum[a[i],{i,1,u-1}]), (m-Sum[a[i],{i,1,u-1}])};
f[n_,m_]:= Module[{a,ranges,range0,tmp}, ranges = Table[rng[a[u],n,m],{u,1,n-1}];
range0 = {rngE[a[n],m]};
tmp = Table[Table[a[u],{u,1,n}],##]&@@Evaluate@Join[ranges,range0];
Flatten[tmp,n-1]]
g[Φ_,H_,list0_]:=Module[{x,len0,len1,len2,list1,list2,tmp,derv}, len0 = Length[list0];
x = 0;
Do[list1 = Evaluate[Slot[n]]&@@ list0; len1 = Length[list1];
Do[list2 = Evaluate[Slot[m]]&@@ list1; len2 = Length[list2];
x = x + 1;
derv = len2-1;
tmp[x] = Evaluate[ΦSlot[1],derv]/derv!
Product[HSlot[i],{i,2,len2}]]&@@list2;
,{m,1,len1}]
,{n,1,len0}];
Table[tmp[i],{i,1,x}]
];
Using functionsf[]andg[]defined above, we define following functions. Φ[Φ_[H_],m_], calculates mth order perturbation and Taylor expansion of Φ(H) aroundZ = 0.
In[2]:= (*1st-order term*)
Φ[Φ_[H_],m_]:=Total@g[Φ,H,Table[f[n,m],n,1,m],]];
(*2nd-order terms*)
HG[H_,G_,m_]:=Total[H#1*G#1&@@@f[2,m]]+Hm*G0;
ΦΦ[Φ1_[H1_],Φ2_[H2_],m_]:=Total[Φ[Φ1[H1],#1]*Φ[Φ2[H2],#2]&@@@f[2,m]];
ΦG[Φ1_[H1_],G_,m_]:=Total[Φ[Φ1[H1],#1]*G#2&@@@f[2,m]]+Φ[Φ1[H1],m]*G0; GG[G1_,G2_,m_]:=If[m==0,G10*G20,
If[m==1,Total[(G1#1*20+G10*G2#1]&@@@f[1,m]], If[m> 1,Total[G1#1*G2#2&@@@f[2,m]]
+Total[(G1#1*G20+G10*G2#1]&@@@f[1,m]]]]];
(*3rd-order terms*)
ΦΦΦ[Φ1_[H1_],Φ2_[H2_],Φ3_[H3_],m_]:=
Total[ΦΦ[Φ1[H1],Φ2[H2],#1]Φ[Φ3[H3],#2]&@@@f[2,m]];
ΦΦG[Φ1_[H1_],Φ2_[H2_],G_,m_]:=
Total[Φ[Φ1[H1],#1]ΦG[Φ2[H2],G,#2]&@@@f[2,m]];
ΦGG[Φ1_[H1_],G1_,G2_,m_]:=Total[Φ[Φ1[H1],#1]
GG[G1,G2,#2]&@@@f[2,m]]+Total[Φ[Φ1[H1],#1]GG[G1,G2,0]&@@@f[1,m]];
(*4th-order terms*)
ΦΦΦΦ[Φ1_[H1_],Φ2_[H2_],Φ3_[H3_],Φ4_[H4_],m_]:=
Total[Φ[Φ1[H1],#1]ΦΦΦ[Φ2[H2],Φ3[H3],Φ4[H4],#2]&@@@f[2,m]];
ΦΦΦG[Φ1_[H1_],Φ2_[H2_],Φ3_[H3_],G_,m_]:=
Total[Φ[Φ1[H1],#1]ΦΦG[Φ2[H2],Φ3[H3],G,#2]&@@@f[2,m]];
ΦΦGG[Φ1_[H1_],Φ2_[H2_],G1_,G2_,m_]:=
Total[Φ[Φ1[H1],#1]ΦGG[Φ2[H2],G1,G2,#2]&@@@f[2,m]];
The following examples show that perturbation and Taylor expansion of Φ(H) around Z = 0. Φm,n and Hm respectively mean ∂nΦ(m)
∂Zn and H(m).
In[3]:= Φ[Φ[H],1]
Φ[Φ[H],2]
Φ[Φ[H],3]
Φ[Φ[H],4]
Out[3]= Φ1,0
Out[4]= H1Φ1,1 +Φ2,0
Out[5]= H2Φ1,1+1
2Φ21,2Φ1,2+H1Φ2,1+Φ3,0
Out[6]= H3Φ1,1+H1H2Φ1,2+1
6H31Φ1,3+H2Φ2,1+1
2H21Φ2,2+H1Φ3,1+Φ4,0
Appendix C
The singly periodic KP and KdV solution
C.1 KP and KdV solutions of Jacobian elliptic function
The singly periodic KP solution to (3.3) can be written as
U( ˆX,Y ,ˆ Tˆ) = Adn2(Θ;m) +U0, Θ =MXˆ +NYˆ + Ω ˆT . (C.1) Here, we determine parameters A, M, N,Ω, U0 based on direct numerical solutions.
The Jacobian elliptic function dn(Θ;m) is defined as x= dn(Θ;m), dn−1(x;m) = Θ =
∫ 1
x
√ dx
(1−x2) (x2+m−1) ,
which has a period of2K(m), whereK(m)is the complete elliptic integral of the first kind, and m is the modulus. For the singly periodic KP solution, the amplitude A and dispersion relation become
A = 2M2, Ω
M =−4M2(2−m)−6U0 −3
(N M
)2
. (C.2)
SettingM, N so that the period of the solutions is 2π in both direction X,ˆ Yˆ gives (M, N) =
(K(m)
π Dsinθ,K(m)
π Dcosθ
)
. (C.3)
where D = κh is the non-dimensional mean water depth. Similarly to (3.6), we consider the free-surface displacement of a traveling waveU∗on the moving coordinate system T∗ and define the wave height of singly periodic KP solution:
HsKP(T, Y) = 2D 3 U∗
(K(m)
π T,K(m) π Y
)
, U∗(T∗,Yˆ) =U( ˆX,Y ,ˆ Tˆ), T∗ = ˆX+ Ω
M T .ˆ
(C.4)
Using dn2(0;m) = 1 and dn2(K(m);m) = 1−m, the relation that corresponds to (4.4) becomes
ε−4
3mM2 = 0. (C.5)
We solve (C.5) for the modulusm. Note thatK(m)has logarithmic singularity atm= 1, and the convergence of the hypergeometric series to computeK(m)becomes slow with increasing m; therefore, we first transform variable by using m= 1−exp(−w), and we recover m after computing w [60]. The relation that corresponds to (4.3) is
AE(m) +U0K(m) = 0. (C.6)
Here, we used the formula
∫ 2K(m)
0
dn (Θ;m)dΘ =E(m),
where E(m) = E(π/2;m) is the complete elliptic integral of the second kind. The wave frequency WsKP and the maximum wave height αsKP of the singly periodic KP solutions are
αsKP =HsKP(0,0)/D, (C.7)
WsKP = sinθ
(
1 +ε
(1 m − 1
2− 3ε 2
E(m) K(m)
)
+ 1 2cot2θ
)
. (C.8)
The periodic KdV solutions HKdV(T) can be calculated in a similar manner setting θ = 90◦.
Bibliography
[1] N. Rott, Advances in Applied Mechanics Volume 20, vol. 20. Academic Press, 1980.
[2] A. Reviews and T. R. Akylas, “Three-Dimensional Long Water-Wave Phenom-ena,” Annu. Rev. Fluid Mech, vol. 26, no. 1981, pp. 191–210, 1994.
[3] D. J. Korteweg and G. De Vries, “On the change of form of long waves advancing in a rectangular canal, and on a new type of long stationary waves,”Philos. Mag., vol. 39, no. 5, pp. 422–443, 1895.
[4] J. W. Miles, “The Korteweg-de Vries equation: a historical essay,” J. Fluid Mech., vol. 106, pp. 131–147, may 1981.
[5] B. B. Kadomtsev and V. I. Petviashvili, “On the stability of solitary waves in weakly dispersive media,” Sov. Phys. Dokl., vol. 15, pp. 539–541, 1970.
[6] B. A. Dubrovin, “Theta functions and non-linear equations,”Russ. Math. Surv., vol. 36, pp. 11–92, apr 1981.
[7] A. Nakamura, “A direct method of calculating periodic wave solutions to non-linear evolution equations. I. Exact two-periodic wave solution,” J. Phys. Soc.
Japan, vol. 47, pp. 1701–1705, 1979.
[8] Wikipedia, “KadomtsevâĂŞPetviashvili equation,” 2016.
[9] M. Okamura, “Almost Limiting Short-Crested Gravity Waves in Deep Water,”
J. Fluid Mech., vol. 646, pp. 481–503, mar 2010.
[10] C. P. Tsai, D. S. Jeng, and J. R. C. Hsu, “Computations of the almost highest short-crested waves in deep water,” Appl. Ocean Res., vol. 16, pp. 317–326, jan 1994.
[11] M. Ioualalen, M. Okamura, S. Cornier, C. Kharif, and A. J. Roberts, “Computa-tion of Short-Crested Deepwater Waves,”J. Waterw. Port, Coastal, Ocean Eng., vol. 132, pp. 157–165, may 2006.
[12] A. J. Roberts and L. W. Schwartz, “The Calculation of Nonlinear Short-Crested Gravity Waves,” Phys. Fluids, vol. 26, no. 9, pp. 2388–2392, 1983.
[13] M. Ioualalen, A. J. Roberts, and C. Kharif, “On the observability of finite-depth short-crested water waves,” J. Fluid Mech., vol. 322, p. 1, sep 1996.
[14] P. J. Bryant, “Two-dimensional periodic permanent waves in shallow water,” J.
Fluid Mech., vol. 115, pp. 525–532, feb 1982.
[15] T. R. Marchant and A. J. Roberts, “Properties of short-crested waves in water of finite depth,” J. Aust. Math. Soc. Ser. B. Appl. Math., vol. 29, pp. 103–125, jul 1987.
[16] J. D. Fenton and M. M. Rienecker, “A Fourier method for solving nonlinear water-wave problems: application to solitary-wave interactions,”J. Fluid Mech., vol. 118, p. 411, may 1982.
[17] M. Okamura, “Notes on Short-Crested Waves in Deep Water,” J. Phys. Soc.
Japan, vol. 65, pp. 2841–2845, sep 1996.
[18] J. R. C. Hsu, Y. Tsuchiya, and R. Silvester, “Third-order approximation to short-crested waves,” J. Fluid Mech., vol. 90, pp. 179–196, jan 1979.
[19] D. P. Nicholls and F. Reitich, “Stable, high-order computation of traveling water waves in three dimensions,” Eur. J. Mech. B/Fluids, vol. 25, pp. 406–424, jul 2006.
[20] D. P. Nicholls and F. Reitich, “On analyticity of travelling water waves,” Proc.
R. Soc. A Math. Phys. Eng. Sci., vol. 461, no. 2057, pp. 1283–1309, 2005.
[21] A. J. Roberts and D. H. Peregrine, “Notes on long-crested water waves,”J. Fluid Mech., vol. 135, pp. 323–335, oct 1983.
[22] J. Satsuma, “N-Soliton Solution of the Two-Dimensional Korteweg-Devries Equa-tion,” J. Phys. Soc. Japan, vol. 40, pp. 286–290, jan 1976.
[23] M. J. Ablowitz and C. Curtis, “Conservation Laws and Web-Solutions for the Benney–Luke Equation,” dec 2012.
[24] H. Segur and A. Finkel, “An analytical model of periodic waves in shallow water,”
Stud. Appl. Math., vol. 73, pp. 183–220, 1985.
[25] T. R. Akylas, “Three-dimensional long water-wave phenomena,” Annu. Rev.
Fluid Mech., vol. 26, pp. 191–210, jan 1994.
[26] J. L. Hammack, D. Mccallister, N. Scheffner, and H. Segur, “Two-dimensional periodic waves in shallow water. Part 2. Asymmetric waves,” J. Fluid Mech., vol. 285, pp. 95–122, feb 1995.
[27] H. Segur, “Integrable Models of Waves in Shallow Water,” Probability, vol. 55, 2007.
[28] J. L. Hammack, “Two-dimensional periodic waves in shallow water,” J. Fluid Mech., vol. 209, pp. 567–589, 1989.
[29] J. W. Miles, “Obliquely interacting solitary waves,” J. Fluid Mech., vol. 79, pp. 157–167, jan 1977.
[30] J. W. Miles, “Note on a solitary wave in a slowly varying channel,” J. Fluid Mech., vol. 80, p. 149, apr 1977.
[31] H. Yeh, W. Li, and Y. Kodama, “Mach reflection and KP solitons in shallow water,” Eur. Phys. J. Spec. Top., vol. 185, pp. 97–111, jul 2010.
[32] W. Li, H. Yeh, and Y. Kodama, “On the Mach reflection of a solitary wave:
revisited,” J. Fluid Mech., vol. 672, pp. 326–357, apr 2011.
[33] M. Funakoshi, “Reflection of Obliquely Incident Solitary Waves,” J. Phys. Soc.
Japan, vol. 49, pp. 2371–2379, dec 1980.
[34] M. Tanaka, “Mach Reflection of a Large-Amplitude Solitary Wave,” J. Fluid Mech., vol. 248, p. 637, mar 1993.
[35] R. A. Morse, “The Politics of Japan’s Energy Strategy Resources-Diplomacy-Security,” Inst. East Asian Stud. Univ. Calif., pp. 1–166, 1981.
[36] Ministry of Economy Trade and Industry, “Japan’s Energy White Paper 2016,”
pp. 1–6, 2016.
[37] M. A. Mustapa, O. B. Yaakob, Y. M. Ahmed, C. K. Rheem, K. K. Koh, and F. A. Adnan, “Wave Energy Device and Breakwater Integration: A Review,”
Renew. Sustain. Energy Rev., vol. 77, pp. 43–58, sep 2017.
[38] REN21, “Renewables 2017 Global Status Report,” pp. 1–302, 2017.
[39] H. Maeda and T. Kinoshita, “Wave Power Absorption,” Inst. Ind. Sci. Univ.
Tokyo, vol. 31, no. 11, pp. 1–10, 1979.
[40] J. Fukuda, “Trends of Extreme Wave Bending Moment According to Long-Term Predictions,” J. Soc. Nav. Archit. Japan, pp. 109–119, jun 1968.
[41] H. Maeda, T. Kinoshita, and S. Kato, “Fundamental Research on Absorbing Energy from Ocean Waves (2nd report),” J. Soc. Nav. Archit. Japan, no. 149, pp. 65–72, 1981.
[42] T. Tabata, T. Yagyu, and I. Fukuda, “Wave Energy on Japanese Coast,” Rep.
Port Harb. Res. Inst., no. 364, pp. 1–15, 1980.
[43] S. Takahashi and T. Adachi, “Wave Power around Japan from a Viewpoint of Its Utilization,”Rep. Port Harb. Res. Inst., no. 654, pp. 1–19, 1989.
[44] T. Waseda, A. Webb, K. Kiyomatsu, W. Fujimoto, Y. Miyazasa, V. Sergey, K. Horiuchi, T. Fujiwara, T. Taniguchi, K. Matsuda, and J. Yoshikawa, “Marine Energy Resource Assessment at Reconnaissance to Feasibility Study Stages,”J.
Japan Soc. Nav. Archit. Ocean Eng., vol. 23, pp. 189–198, 2016.
[45] J. Wilkening and J. Yu, “Overdetermined shooting methods for computing stand-ing water waves with spectral accuracy,” vol. 014017, pp. 0–38, 2012.
[46] J. W. Miles, “Resonantly interacting solitary waves,” J. Fluid Mech., vol. 79, p. 171, jan 1977.
[47] M. Okamura, “Standing gravity waves of large amplitude in deep water,” Wave Motion, vol. 37, pp. 173–182, feb 2003.
[48] G. B. Whitham, “Nonlinear Effects in Edge Waves,” J. Fluid Mech., vol. 74, pp. 353–368, 1976.
[49] P. A. Milewski and J. B. Keller, “Three-Dimensional Water Waves,” Stud. Appl.
Math., vol. 97, pp. 149–166, aug 1996.
[50] N. Booij, R. C. Ris, and L. H. Holthuijsen, “A Third-Generation Wave Model for Coastal Regions: 1. Model Description and Validation,” J. Geophys. Res., vol. 104, pp. 7649–7666, apr 1999.
[51] R. C. Ris, L. H. Holthuijsen, and N. Booij, “A Third-generation Wave Model for Coastal Regions: 2. Verification,” J. Geophys. Res., vol. 104, pp. 7667–7681, apr 1999.
[52] S. O. Rice, “Mathematical Analysis of Random Noise,” Bell Syst. Tech. J., vol. 23, pp. 282–332, jul 1944.
[53] Y. Goda, “Reanalysis of Breaking Wave Statistics for Engineering Applications,”
Proc. Coast. Eng. JSCE, no. 54, pp. 81–85, 2007.
[54] Y. Goda, “A Unified Nonlinearity Parameter of Water Waves,” Rep. Port Harb.
Res. Inst., vol. 22, no. 3, pp. 3–30, 1983.
[55] I. López, J. Andreu, S. Ceballos, I. Martínez De Alegría, and I. Kortabarria,
“Review of Wave Energy Technologies and the Necessary Power-equipment,”
Renew. Sustain. Energy Rev., vol. 27, pp. 413–434, 2013.
[56] C. Iuppa, L. Cavallaro, E. Foti, and D. Vicinanza, “Potential Wave Energy Pro-duction by Different Wave Energy Converters around Sicily,” J. Renew. Sustain.
Energy, vol. 7, p. 061701, nov 2015.
[57] W. H. Press, W. T. Vetterling, S. A. Teukolsky, and B. P. Flannery, Numer-ical recipes in C : the Art of Scientific Computing Third Edition. Cambridge University Press, 2007.