iccsa-20-waves

Virtual Testbed: Simulation of Ocean Wave Reflection from the Ship Hull
git clone https://git.igankevich.com/iccsa-20-waves.git
Log | Files | Refs

main.tex (27724B)


      1 \documentclass[runningheads]{llncs}
      2 
      3 \usepackage{amsmath}
      4 \usepackage{amssymb}
      5 \usepackage{booktabs}
      6 \usepackage{cite}
      7 \usepackage{graphicx}
      8 \usepackage{url}
      9 
     10 \newcommand{\Jacobian}{\mathbb{J}}
     11 \newcommand{\Real}[1]{\operatorname{Re}#1}
     12 \newcommand{\Imag}[1]{\operatorname{Im}#1}
     13 \newcommand{\VectorL}[1]{\left[\begin{array}{l}#1\end{array}\right]}
     14 \newcommand{\VectorR}[1]{\left[\begin{array}{r}#1\end{array}\right]}
     15 \newcommand{\DerivativeT}[1]{\frac{\partial{#1}}{\partial{}t}}
     16 
     17 \begin{document}
     18 
     19 \title{Virtual testbed: Simulation of ocean wave reflection from the ship
     20     hull\thanks{Supported by Saint Petersburg State University (grants
     21     no.~51129371 and~51129725) and Council for grants of the President of the Russian
     22     Federation (grant no.~\mbox{MK-383.2020.9}).}}
     23 \author{%
     24     Ivan Petriakov\orcidID{0000-0001-5835-9313}\and\\
     25     Alexander Degtyarev\orcidID{0000-0003-0967-2949} \and\\
     26     Denis Egorov\orcidID{0000-0001-5478-2798}\and\\
     27     Ivan Gankevich\textsuperscript{*}\orcidID{0000-0001-7067-6928} \and\\
     28     Anton Gavrikov\orcidID{0000-0003-2128-8368} \and\\
     29     Artemii Grigorev\orcidID{0000-0003-0501-7656} \and\\
     30     Vasily Khramushin\orcidID{0000-0002-3357-169X}
     31 }
     32 
     33 \titlerunning{Simulation of ocean wave reflection from the ship hull}
     34 \authorrunning{I.\,Petriakov et al.}
     35 
     36 \institute{Saint Petersburg State University\\
     37     7-9 Universitetskaya Emb., St Petersburg 199034, Russia\\
     38     \email{st049350@student.spbu.ru},\\
     39     \email{a.degtyarev@spbu.ru},\\
     40     \email{st047824@student.spbu.ru},\\
     41     \email{i.gankevich@spbu.ru},\\
     42     \email{st047437@student.spbu.ru},\\
     43     \email{st016177@student.spbu.ru},\\
     44     \email{v.khramushin@spbu.ru}\\
     45     \url{https://spbu.ru/}}
     46 
     47 \maketitle
     48 
     49 \begin{abstract}
     50 
     51     Diffraction and radiation forces result from the interaction between the
     52     ship hull and the moving fluid. These forces are typically simulated using
     53     added masses, a method that uses mass to compensate for not computing these
     54     forces directly. In this paper we propose simple mathematical model to
     55     compute diffraction force. The model is based on Lagrangian description of
     56     the flow and uses law of reflection to include diffraction term in the
     57     solution. The solution satisfies continuity equation and equation of
     58     motion, but is restricted to the boundary of the ship hull. The solution
     59     was implemented in velocity potential solver in Virtual testbed~--- a
     60     programme for workstations that simulates ship motions in extreme
     61     conditions. Performance benchmarks of the solver showed that it is
     62     particularly efficient on graphical accelerators.
     63 
     64 \keywords{%
     65 ocean wave diffraction
     66 \and ocean wave radiation
     67 \and fluid velocity field
     68 \and law of reflection
     69 \and OpenCL
     70 \and OpenMP
     71 \and GPGPU.
     72 }
     73 \end{abstract}
     74 
     75 \section{Introduction}
     76 
     77 There are two mathematical models that describe rigid body motion and fluid
     78 particle motion: equations of translational and angular motion of the rigid
     79 body (Newton's Second Law) and Gerstner equations for ocean waves (which are
     80 solutions to linearised equations of motions for fluid particles). Usually, we
     81 use these models independently to generate incident ocean waves and then
     82 compute body motions caused by these waves. To measure the effect of still
     83 fluid on an oscillating rigid body (radiation forces) and the effect of fluid
     84 particles hitting the body (diffraction forces), we use added masses and
     85 damping coefficients~--- simplified formulae derived for small-amplitude
     86 oscillatory motion.
     87 
     88 But, what if we want to simulate large-amplitude rigid body motion with greater
     89 accuracy? There are two possible ways. First, we may use numerical methods such
     90 as Reynolds-Averaged Navier Stokes (RANS) method~\cite{wackers2011rans}.  This
     91 method is accurate, can be used for viscous fluid, but not the most
     92 computationally efficient. Second, we may solve Gerstner equations with
     93 appropriate boundary condition and use the solution to compute both rigid body
     94 and fluid particle motion around it. This paper explores this second option.
     95 Similar approach was followed by Fenton
     96 in~\cite{fenton1978vertical,fenton1993shoaling,fenton1994spectral}, but the
     97 distinctive feature of our approach is the use of law of reflection to derive
     98 analytic expressions for reflected waves and fluid particles.
     99 
    100 %and compares the results to the results of the method of added masses and numerical solver.
    101 
    102 
    103 
    104 \section{Methods}
    105 
    106 \subsection{Equations of motions with a moving surface boundary}
    107 
    108 An oscillating rigid body that floats in the water and experiences incident
    109 waves both reflects existing waves and generates new waves:
    110 \begin{itemize}
    111 \item fluid particles hit the body, causing it to move, and then reflect from it;
    112 \item moving body hits fluid particles and makes them move.
    113 \end{itemize}
    114 Both wave reflection and generation have the same nature~--- they are
    115 caused by the collision of the particles and the body~--- hence we
    116 describe them by the same set of formulae. Hereinafter we borrow the
    117 mathematical notation for Lagrangian description of the flow
    118 from~\cite{nouguier2015}.
    119 
    120 In Lagrangian description of flow instantaneous particle coordinates
    121 \(\vec{R}=(x,y,z)\) depend on particle positions at rest (independent initial
    122 coordinates) \(\vec{\zeta}=(\alpha,\beta,\delta)\) and time \(t\),
    123 i.e.~\(\vec{R}=\vec{R}(\alpha,\beta,\delta,t)\).  Using this notation
    124 equation of motion (conservation of momentum) is written as
    125 \begin{equation}
    126 \vec{R}_{tt} + g \hat{z} + \frac{1}{\rho} \nabla_{\vec{R}} p = 0,
    127 \label{eq-momentum}
    128 \end{equation}
    129 where \(\vec{R}\)~--- particle coordinates, \(\hat{z}\)~---
    130 unit vector in the direction of positive \(z\), \(p\)~--- pressure,
    131 \(\rho\)~--- fluid density, \(g\)~--- gravitational acceleration.
    132 Continuity equation (conservation of mass) is written as
    133 \begin{equation*}
    134 \left|\Jacobian\right| = 1, \qquad
    135 \frac{\partial}{\partial t}\left|\Jacobian\right| = 0, \qquad
    136 \Jacobian = \left[
    137 \begin{array}{lll}
    138 x_\alpha & y_\alpha & z_\alpha \\
    139 x_\beta & y_\beta & z_\beta \\
    140 x_\delta & y_\delta & z_\delta \\
    141 \end{array}
    142 \right].
    143 \end{equation*}
    144 Multiplying both sides of \eqref{eq-momentum} by \(\Jacobian\) and noting that
    145 \(\nabla_{\vec{\zeta}}p =\Jacobian\nabla_{\vec{R}}p\) gives
    146 \begin{equation*}
    147 \Jacobian\vec{R}_{tt} +
    148 g\vec\nabla\left( \vec{R} \cdot \hat{z} \right) +
    149 \frac{1}{\rho}\vec\nabla p
    150 \end{equation*}
    151 Following \cite{nouguier2015} we seek solution to this equation in the form
    152 of a simultaneous perturbation expansion for position, pressure, and the
    153 vorticity function:
    154 \begin{equation*}
    155 \begin{aligned}
    156 \vec{R} &= \vec{R}_0 + \vec{R}_1 + \vec{R}_2 + ... \\
    157 p &= p_a - \rho g \delta + p_1 + p_2 + ...
    158 \end{aligned}
    159 \end{equation*}
    160 Zeroth order terms are related to particles positions at rest:
    161 \begin{equation*}
    162 \begin{aligned}
    163 \vec{R}_0 &= \vec{\zeta} \\
    164 p_0 &= p_a - \rho g \delta
    165 \end{aligned}
    166 \end{equation*}
    167 First-order terms are solutions to linearised equation of motion and equation of
    168 continuity:
    169 \begin{equation*}
    170 \begin{aligned}
    171 & \vec{R}_{1tt} + g\vec\nabla\left( \vec{R}_1 \cdot \hat{z} \right) +
    172 \frac{1}{\rho}\vec\nabla p_1 = 0 \\
    173 & \vec\nabla \cdot \vec{R}_1 = 0
    174 \end{aligned}
    175 \end{equation*}
    176 We seek solutions of the form \(\vec{R}_1=\nabla w\) to make the flow
    177 irrotational. Plugging this form into the equations gives
    178 \begin{equation}
    179 \label{eq-mass-momentum}
    180 \begin{aligned}
    181 & \vec\nabla\left( w_{tt} + g w_\delta + p_1/\rho \right) = 0 \\
    182 & \Delta w = 0
    183 \end{aligned}
    184 \end{equation}
    185 The first equation denotes conservation of momentum (Newton's second law,
    186 equation of motion) and the second equation denotes conservation of mass
    187 (equation of continuity).
    188 
    189 When we have no boundary condition we seek solutions of the form
    190 \begin{equation}
    191 \label{eq-inverse-fourier}
    192 w\left(\alpha,\beta,\delta\right) =
    193 \Real{
    194 f(u,v)\exp\left(iu\alpha+iv\beta+k\delta-i\omega{}t\right)
    195 },
    196 \end{equation}
    197 where \(u\) and \(v\) are wave numbers.  We plug \eqref{eq-inverse-fourier} into
    198 continuity equation \eqref{eq-mass-momentum} where \(p_1\) is constant and get
    199 \(k=\sqrt{u^2+v^2}\).  That means that expression~\eqref{eq-inverse-fourier}
    200 is the solution to this equation when \(k\) is wave vector magnitude,
    201 i.e.~\(w\) decays exponentially with increasing water depth multiplied by
    202 wave vector magnitude.
    203 
    204 Then we plug \eqref{eq-inverse-fourier} into equation of motion
    205 \eqref{eq-mass-momentum} and get \(\omega^2=gk\), which is dispersion relation
    206 from classic linear wave theory.  That means that the expression is the solution
    207 to this equation when angular frequency depends on the wave number,
    208 i.e.~waves of different lengths have different phase velocities.
    209 
    210 Before solving this system of equations for an arbitrary moving surface
    211 boundary, we consider particular cases to substantiate the choice of the form of
    212 the solution.
    213 
    214 We use \(\Real{\exp\left(iu\alpha+iv\beta+k\delta-i\omega{}t\right)}\) to
    215 describe fluid particle potential. Here \(u\) and \(v\) are wave numbers,
    216 \(\omega\) is angular frequency, and \(k\) is wave vector.  This notation makes
    217 formulae short and is equivalent to the description that uses traditional
    218 harmonic functions.  This notation allows for easy transition to irregular
    219 waves via Fourier transforms which are essential for fast computations.  Such
    220 solutions will be studied in future work.
    221 
    222 \subsection{Stationary surface boundary}
    223 
    224 In this section we explore solutions stationary surface boundary in a form of
    225 infinite plane surface.  On such a boundary the projection of particle velocity
    226 to the surface normal is nought.  We write boundary conditions and
    227 corresponding solutions for different orientations of this boundary and then
    228 generalise these solutions to a parametric surface.
    229 
    230 \subsubsection{Infinite wall}
    231 
    232 On a vertical surface the boundary condition is written as
    233 \begin{equation*}
    234 \frac{d}{d t} \vec\nabla w \cdot \vec{n} =
    235 \frac{d}{d t} \frac{\partial}{\partial\alpha} w = 0;
    236 \qquad
    237 \alpha = \alpha_0;
    238 \qquad
    239 \vec{n} = \VectorR{1\\0\\0}.
    240 \end{equation*}
    241 Here we consider only \(\alpha\) coordinate, the derivations for \(\beta\) are
    242 similar. The potential of incident fluid particle has the form
    243 \begin{equation*}
    244 w\left(\alpha,\beta,\delta,t\right) =
    245 \exp\left(k\delta - i\omega t\right)
    246 \exp\left(iu\alpha + iv\beta\right).
    247 \end{equation*}
    248 Velocity vector of this particle is
    249 \begin{equation*}
    250 \begin{aligned}
    251 &
    252 \frac{d}{dt} \vec\nabla w =
    253 i\omega \left( \vec{d}_k+i\vec{d}_i \right)
    254 \exp\left(k\delta - i\omega t\right)
    255 \exp\left(iu\alpha + iv\beta\right);
    256 \\
    257 &
    258 \vec{d}_k = \VectorR{0\\0\\k};
    259 \qquad
    260 \vec{d}_i = \VectorR{u\\v\\0}.
    261 \end{aligned}
    262 \end{equation*}
    263 where \(\vec{d}_i\) is horizontal incident wave direction and \(\vec{d}_k\) is
    264 a vector that contains amplitude damping coefficient. (We use the vector
    265 instead of the scalar to shorten mathematical notation, otherwise we would have write a
    266 separate formula for vertical coordinate.)
    267 %In addition to this, it makes the solution for finite depth look the same
    268 %way as all other solutions.
    269 The law of reflection
    270 states that the angle of incidence equals the angle of reflection. Then
    271 the direction of reflected wave is%
    272 \footnote{Initially, we included the third
    273 component of incident wave direction making the
    274 vector complex-valued, however, the solution blew up as a result of mixing real
    275 and imaginary parts in dot products involving complex-valued vectors. The
    276 problem was solved by reflecting in two dimensions which is intuitive for
    277 ocean waves, but not for particles.}
    278 \begin{equation*}
    279 \vec{d}_r =
    280 \vec{d}_i-\vec{d}_s =
    281 \vec{d}_i-2\vec{n}\left(\vec{d}_i\cdot\vec{n}\right) =
    282 \VectorR{-u\\v\\0}.
    283 \end{equation*}
    284 We seek solutions of the form
    285 \begin{equation}
    286 \label{eq-w-alpha-0}
    287 w\left(\alpha,\beta,\delta,t\right) =
    288 \left[ C_1 \exp\left(iu\alpha\right) + C_2 \exp\left(-iu\alpha\right) \right]
    289 \exp\left(k\delta - i\omega t\right) \exp\left(iv\beta\right).
    290 \end{equation}
    291 We plug this expression into the boundary condition and get
    292 \begin{equation*}
    293 C_1\exp\left(i u\alpha_0 \right) -
    294 C_2\exp\left(-i u\alpha_0 \right) = 0,
    295 \end{equation*}
    296 hence \(C_1=C\exp(-iu\alpha_0)\) and \(C_2=-C\exp(iu\alpha_0)\).
    297 Constant \(C\) may take arbitrary values, here we set it to 1.
    298 Plugging \(C_1\) and \(C_2\) into~\eqref{eq-w-alpha-0} gives the final solution
    299 \begin{equation*}
    300 w\left(\alpha,\beta,\delta,t\right) =
    301 \cosh\left(iu\left(\alpha_0-\alpha\right)\right)
    302 \exp\left(k\delta - i\omega t\right)
    303 \exp\left(iv\beta\right).
    304 \end{equation*}
    305 There are two exponents in this solution with the opposite signs before
    306 horizontal coordinate \(\alpha\). These exponents denote
    307 incident and reflected wave respectively.
    308 The amplitude of the reflected wave does not decay as we go farther
    309 from the boundary, but decay only when we go deeper in the ocean. This behaviour
    310 corresponds to the real-world ocean waves.
    311 
    312 \subsubsection{Infinite plate}
    313 
    314 On a horizontal surface the boundary condition is written as
    315 \begin{equation*}
    316 \frac{d}{d t} \vec\nabla w \cdot \vec{n} =
    317 \frac{d}{d t} \frac{\partial}{\partial\delta} w = 0;
    318 \qquad
    319 \delta = \delta_0;
    320 \qquad
    321 \vec{n} = \VectorR{0\\0\\1}.
    322 \end{equation*}
    323 Analogously to wave direction we write vector form of the incident particle
    324 trajectory radius damping coefficient as \((0,0,k)\), hence vector form of the
    325 reflected coefficient is \((0,0,-k)\). We seek solutions of the
    326 form
    327 \begin{equation}
    328 \label{eq-w-delta-0}
    329 w\left(\alpha,\beta,\delta,t\right) =
    330 \left[ C_1\exp\left(k\delta\right) + C_2\exp\left(-k\delta\right) \right]
    331 \exp\left(- i\omega t\right) \exp\left(iu\alpha + iv\beta\right).
    332 \end{equation}
    333 We plug this expression into the boundary condition and get
    334 \begin{equation*}
    335 C_1\exp\left(k\delta_0\right) - C_2\exp\left(-k\delta_0\right) = 0.
    336 \end{equation*}
    337 Hence \(C_1=C\exp\left(-k\delta_0\right)\) and
    338 \(C_2=C\exp\left(k\delta_0\right)\).  Constant \(C\) may take arbitrary values,
    339 here we set it to \(1/2\). Plugging \(C_1\) and \(C_2\)
    340 into~\eqref{eq-w-delta-0} gives the final solution
    341 \begin{equation*}
    342 w\left(\alpha,\beta,\delta,t\right) =
    343 \cosh\left(k\left(\delta-\delta_0\right)\right)
    344 \exp\left(-i\omega t\right)
    345 \exp\left(iu\alpha + iv\beta\right).
    346 \end{equation*}
    347 There are two exponents in this solution with opposite signs before
    348 vertical coordinate \(\delta\). These exponents make the radius of
    349 the particle trajectories decay exponentially while approaching the boundary 
    350 \(\delta_0\) (i.e.~with increasing water depth). This is known
    351 solution from linear wave theory.
    352 
    353 \subsubsection{Infinite panel}
    354 
    355 On an arbitrary aligned infinite surface the boundary condition is written as
    356 \begin{equation*}
    357 \frac{d}{d t} \vec\nabla w \cdot \vec{n} = 0;
    358 \qquad
    359 \vec{n} \cdot \left(\vec\zeta - \vec\zeta_0\right) = 0,
    360 \end{equation*}
    361 where \(\vec{\zeta_0}\) is the point on the boundary plane and the third
    362 component of the normal vector is nought: \(\vec{n}=(n_1,n_2,0)\),
    363 \(\left|\vec{n}\right|=1\).
    364 The direction of incident wave is \(\vec{d}_i=(u,v,0)\) and the
    365 direction of reflected wave is \(\vec{d}_r\).  We seek solutions of the form
    366 \begin{equation}
    367 \label{eq-solution-diffraction}
    368 \begin{aligned}
    369 w\left(\alpha,\beta,\delta,t\right) = &\:
    370 C_1\exp\left( \left(i\vec{d}_i+\vec{d}_{k}\right)\cdot\vec\zeta - i\omega_1
    371 t\right) \\ + &\:
    372 C_2\exp\left( \left(i\vec{d}_r+\vec{d}_{k}\right)\cdot\vec\zeta - i\omega_2 t\right).
    373 \end{aligned}
    374 \end{equation}
    375 We plug this expression into the boundary condition and get
    376 \begin{equation*}
    377 \left( i\vec{d_i}\cdot\vec{n} \right) C_1
    378 +
    379 \left( i\vec{d_r}\cdot\vec{n} \right) C_2
    380 \exp\left( -i\vec{d}_s\cdot\vec\zeta_0 \right) = 0.
    381 \end{equation*}
    382 Here we substitute \(\vec{d}_r\cdot\vec{n}\) with \(-\vec{d}_i\cdot\vec{n}\)
    383 which is derived from the formula for \(\vec{d}_r\).
    384 Hence, the boundary condition reduces to
    385 \begin{equation*}
    386 C_1 - C_2 \exp\left( -i\vec{d}_s\cdot\vec\zeta_0 \right) = 0.
    387 \end{equation*}
    388 Hence
    389 \(C_1=\frac{1}{2}\exp\left(-\frac{1}{2}i\vec{d}_s\cdot\vec\zeta_0\right)\)
    390 and \(C_2=\frac{1}{2}\exp\left(\frac{1}{2}i\vec{d}_s\cdot\vec\zeta_0\right)\).
    391 This solution reduces to the solution for the wall when \(\vec{n}=(0,0,1)\).
    392 
    393 In a computer programme it is more practical to set \(C_1=1\) and
    394 \(C_2=\exp\left(i\vec{d}_s\cdot\zeta_0\right)\): that way you have to integrate
    395 only the second term in the solution over all ship hull panels
    396 (see~sec.~\ref{sec-results-diffraction}).
    397 
    398 %\input{stationary-surface.tex}
    399 %\input{progressively-moving-surface.tex}
    400 
    401 %\subsection{Non-stationary surface boundary}
    402 
    403 \subsection{OpenCL implementation}
    404  
    405 Solution for fluid velocity field was implemented in velocity potential solver
    406 in the framework of Virtual testbed.  Virtual testbed is a programme for
    407 workstations that simulates ship motions in extreme conditions and physical
    408 phenomena that causes them: ocean waves, wind, compartment flooding etc.  The
    409 main feature of this programme is to perform all calculations nearly in real
    410 time, paying attention to the high accuracy of calculations, which is partially
    411 achieved using graphical accelerators.
    412 
    413 Virtual testbed uses several solvers to simulate ship motions.
    414 The algorithm for velocity potential solver is the following.
    415 \begin{itemize}
    416     \item First of all, we generate wavy surface, according to our solution and using
    417         wetted ship panels from the previous time step (if any).
    418     \item Second, we compute wetted panels for the current time step, which are
    419         located under the surface calculated on the previous step.
    420     \item Finally, we calculate Froude---Krylov forces, acting on a ship hull.
    421 \end{itemize}
    422 These steps are repeated in infinite loop. Consequently, wavy surface is 
    423 always one time step behind the wetted panels. This inconsistency is a result
    424 of the decision not to solve ship motions and fluid motions in one system of
    425 equations, which would be too difficult to do.
    426 
    427 Let us consider process of computing wavy surface in more detail.  Since wavy
    428 surface grid is irregular (i.e.~we store a matrix of fluid particle positions
    429 that describe the surface), we compute the same formula for each point of the
    430 surface.  It is easy to do with C++ for CPU computation, but it takes some
    431 effort to efficiently run this algorithm with GPU acceleration.  Our first
    432 naive implementation was inefficient, but the second implementation that used
    433 local memory to optimise memory loads and stores proved to be much more
    434 performant.
    435 
    436 First, we optimised storage order of points making it fully sequential.
    437 Sequential storage order leads to sequential loads and stores from the global
    438 memory and greatly improves performance of the graphical accelerator.  Second,
    439 we use as many built-in vector functions as we can in our computations, since
    440 they are much more efficient than manually written ones and compiler knows how
    441 to optimise them. This also decreases code size and prevents possible mistakes
    442 in the manual implementation. Finally, we optimised how ship hull panels are
    443 read from the global memory. One way to think about panels is that they are
    444 coefficients in our model, as array of coefficients is typically read-only and
    445 constant. This type of array is best placed in the constant memory of the
    446 graphical accelerator that provides L2 cache for faster loads by parallel
    447 threads. However, our panel array is too large to fit in constant memory, so we
    448 simulated constant memory using local memory: we copied a small block of the
    449 array into local memory of the multiprocessor, computed sum using this block
    450 and then proceeded to the next block. This approach allowed to achieve almost
    451 200-fold speedup over CPU version of the solver.
    452 
    453 A distinctive feature of the local memory is that it has the smallest latency,
    454 at the same time sharing its contents between all computing units of the
    455 multiprocessor.  Using local memory we reduce the number of load/store
    456 operations to global memory, which has larger latency.  As far as global memory
    457 bandwidth remains a bottleneck, this kind of optimisation would improve
    458 performance.  To summarise, our approach to write code for graphical
    459 accelerators is the following:
    460 \begin{itemize}
    461     \item make storage order linear,
    462     \item use as many built-in vector operations as is possible,
    463     \item use local memory of the multiprocessor to optimise global memory
    464         load and stores.
    465 \end{itemize}
    466 Following these simple rules, we can easily implement efficient algorithms.
    467 
    468 \section{Results}
    469 
    470 \subsection{Diffraction}
    471 \label{sec-results-diffraction}
    472 
    473 In the first experiment we use solution for infinite panel to simulate wave
    474 diffraction around Aurora's ship hull (see~fig.~\ref{fig-ships}). In order to
    475 apply~\eqref{eq-solution-diffraction} to this problem we use smoothing kernel
    476 that accumulates influence of every panel on a particular point of ocean
    477 surface:
    478 \begin{equation*}
    479     w = \sum\limits_{j} K_j w_j;
    480     \qquad
    481     K_j = \frac{1}{1 + \left|\zeta-\zeta_0\right|^2}
    482 \end{equation*}
    483 Here \(w_j\) is solution~\eqref{eq-solution-diffraction} written for panel
    484 \(j\), \(K_j\) is smoothing kernel, \(\zeta_0\) is the centre of the panel.
    485 In the centre of the panel \(K_j=0\) and far from the ship hull
    486 \(K_j\rightarrow{}0\).
    487 
    488 \begin{figure}
    489 	\centering
    490 	\includegraphics{build/ships/diogen.eps}\hfill
    491 	\includegraphics{build/ships/aurora.eps}\hfill
    492 	\includegraphics{build/ships/micw.eps}
    493 	\caption{Diogen, Aurora and MICW three-dimensional ship hull
    494 	models.\label{fig-ships}}
    495 \end{figure}
    496 
    497 In the experiment waves with amplitude 1 approach the ship from the aft.  The
    498 results of the experiment are shown in fig.~\ref{fig-diffraction}.  Near the
    499 aft waves change their direction to be tangent to the waterline curve, follow
    500 the curve to the bow, and then restore their original direction.  The amplitude
    501 of waves near the hull is also increased.
    502 
    503 \begin{figure}
    504     \centering
    505     \includegraphics{build/gnuplot/surface.eps}
    506     \caption{Wave diffraction around Aurora's hull (the hull is not
    507     shown). Top view.\label{fig-diffraction}}
    508 \end{figure}
    509 
    510 
    511 \subsection{Performance benchmarks}
    512 
    513 We implemented velocity potential solver using OpenMP for parallel computations
    514 on a processor and OpenCL for graphical accelerator.  The solver uses single
    515 precision floating point numbers. Benchmark results are presented in
    516 tab.~\ref{tab-benchmark}.
    517 
    518 We performed benchmarks for three ships: Diogen, Aurora and MICW.  Diogen is a
    519 small-size fishing vessel, Aurora is mid-size cruiser and MICW is a large-size
    520 ship with small moment of inertia for the current waterline
    521 (fig.~\ref{fig-ships}). The main difference between the ships that affects
    522 benchmarks is the number of panels into which the hull is decomposed. These
    523 numbers are shown in tab.~\ref{tab-ships}.
    524 
    525 \begin{table}
    526 	\centering
    527 	\caption{Parameters of ship hulls that were used in the
    528 	benchmarks.\label{tab-ships}}
    529 	\begin{tabular}{lrrr}
    530 		\toprule
    531 					  & Diogen & Aurora & MICW  \\
    532 		\midrule               
    533 		Length, m     &   60   & 126.5  &   260 \\
    534 		Beam, m       &   15   &  16.8  &    32 \\
    535 		Depth, m      &   15   &  14.5  &    31 \\
    536 		No. of panels & 4346   &  6335  &  9252 \\
    537 		\bottomrule
    538 	\end{tabular}
    539 \end{table}
    540 
    541 Benchmarks were performed using three workstations: DarkwingDuck, GPUlab,
    542 Capybara. DarkwingDuck is a laptop, GPUlab is a desktop workstation, and
    543 Capybara is a desktop with professional graphical accelerator server-grade
    544 processor (tab.~\ref{tab-config}). 
    545 
    546 \begin{table}
    547     \centering
    548     \caption{Performance benchmarks results. Numbers represent average time in milliseconds
    549     that is needed to generate waves with reflection.\label{tab-benchmark}}
    550     \begin{tabular}{l@{\hskip 3mm}r@{\hskip 2mm}r@{\hskip 3mm}r@{\hskip 2mm}r@{\hskip 3mm}r@{\hskip 2mm}r}
    551 		\toprule
    552 				 & \multicolumn{2}{l}{Diogen}
    553 				 & \multicolumn{2}{l}{Aurora}
    554 				 & \multicolumn{2}{l}{MICW} \\
    555 		\cmidrule(r){2-3}
    556 		\cmidrule(r){4-5}
    557 		\cmidrule(r){6-7}
    558 		Node     & MP & CL 
    559                  & MP & CL 
    560                  & MP & CL  \\
    561 		\midrule
    562 		DarkwingDuck  
    563                  &    5462   & 48
    564                  &    7716   & 41
    565                  &    7725   & 11   
    566                  \\
    567 		GPUlab  
    568 		         &    5529   & 11                    
    569                  &    8222   & 10   
    570 		         &    6481   & 3
    571                  \\
    572 		Capybara &    2908   & 16                    
    573 		         &    2091   & 8     
    574 		         &    2786   & 4     
    575                  \\
    576 		\bottomrule
    577 	\end{tabular}
    578 \end{table}
    579 
    580 \begin{table}
    581 	\centering
    582 	\caption{Hardware configurations for benchmarks. For all benchmarks we
    583 	used GCC version 9.1.0 compiler and optimisation flags \texttt{-O3
    584 	-march=native}.\label{tab-config}}
    585 	\begin{tabular}{lllrr}
    586 		\toprule
    587 		     &     &     & \multicolumn{2}{c}{GPU GFLOPS} \\
    588 		\cmidrule(r){4-5}
    589 		Node           & CPU              & GPU            & Single & Double \\
    590 		\midrule
    591         DarkwingDuck   & Intel i7-3630QM  & NVIDIA GT740M  &  622   &     \\
    592 		GPUlab         & AMD FX-8370      & NVIDIA GTX1060 & 4375   & 137 \\
    593 		Capybara       & Intel E5-2630 v4 & NVIDIA P5000   & 8873   & 277 \\
    594 		\bottomrule
    595 	\end{tabular}
    596 \end{table}
    597 
    598 
    599 \section{Discussion}
    600 
    601 All the solutions obtained for various boundaries in this papre satisfy
    602 continuity equation and equation of motion, but they are all written for
    603 \emph{plane} surface boundaries with different orientations. Typical ship hull
    604 three-dimensional model is represented by triangulated surface, and in the
    605 centre of each triangular panel fluid particle velocity vector does not depend
    606 on the surface normal of the other panels. So, the solution for plane surface
    607 boundary is enough to compute fluid velocity field directly \emph{on} the
    608 surface boundary.
    609 
    610 In order to generalise the solution for fluid velocity field \emph{near} the
    611 surface boundary, we need to calculate weighted average of reflection terms of
    612 each underwater panel of the surface. Using inverse squared distance as the
    613 weight gives acceptable results in our experiments, but may not be appropriate
    614 in others.
    615 
    616 It is not clear how much we have to increase wave amplitude near the boundary.
    617 One way to control the amptlitude increase is to introduce the coefficient
    618 \(C\) into the reflection formula \(\vec{d}_r=\vec{d}_i-C\vec{d}_s\) and before
    619 reflection term in~\eqref{eq-solution-diffraction}.  When \(C=1\) the wave is
    620 fully reflected from the boundary and the amplitude is doubled, when \(C=0\) no
    621 reflection occurres and the amplitude does not change.
    622 
    623 Performance benchmarks showed that graphical accelerator greatly improves
    624 performance of velocity potential solver. Linear memory access patterns and
    625 large amount of floating point operations make this solver an ideal candidate
    626 for running on a graphical accelerator, and these features are the result of
    627 deriving explicit solution for fluid motions near the ship hull boundary.
    628 
    629 \section{Conclusion}
    630 
    631 This paper proposes a new model for ocean wave diffraction near ship hull.
    632 This model uses law of reflection to simulate incident and reflected waves and
    633 fluid particle motion. Although, the solutions are written for infinite plane
    634 surfaces, they can be used to compute fluid velocity at the centre of each
    635 triangle of the triangulated ship hull surface and can be generalised to
    636 compute fluid velocity near the ship hull using weighted sum over all panels.
    637 
    638 The model was implemented in Virtual testbed velocity potential solver and was
    639 found to be highly efficient on a graphical accelerator.  Future work is to
    640 incorporate radiation into the model and compare the solution to existing
    641 empirical approaches.
    642 
    643 \subsubsection*{Acknowledgements.}
    644 Research work is supported by Saint Petersburg State University (grants
    645 no.~51129371 and~51129725) and Council for grants of the President of the
    646 Russian Federation (grant no.~MK-383.2020.9).
    647 
    648 \bibliographystyle{splncs04}
    649 \bibliography{references}
    650 
    651 \end{document}