{'fraction_non_alphanumeric': 0.019682099423938552, 'fraction_numerical': 0.004907190100277363, 'mean_word_length': 4.738904193449648, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Virtual Testbed: Simulation of Air Flow Around Ship Hull and Its Effect on Ship Motions

Strong wind causes heavy load on the ship in a seaway bending and pushing it in the direction of the wind. In this paper we investigate how wind can be simulated in the framework of Virtual testbed—a near real-time ship motion simulator. We propose simple model that describes air flow around ship hull with constant initial speed and direction which is based on the law of reflection. On the boundary the model reduces to the known model for potential flow around a cylinder, and near the boundary they are not equivalent, but close enough to visualise the effect of the hull on the flow. Then we apply this model to simulate air flow around real-world ship hull and conclude that for any real-world situation ship roll angle and ship speed caused by the wind is small to not cause capsizing, but large enough to be considered in onboard intelligent systems that determine real roll, pitch and yaw angles during ship operation and similar applications.


Introduction
Ship motion simulation studies focus on interaction between the ship and ocean waves-a physical phenomena that gives the largest contribution to oscillatory motion-however, intelligent onboard systems require taking other forces into account. One of the basic functionality of such a system is determination of initial static ship stability parameters (roll angle, pitch angle and draught) from the recordings of various ship motion parameters, such as instantaneous roll, pitch Supported by Saint Petersburg State University (grants no. 51129371 and 51129725) and Council for grants of the President of the Russian Federation (grant no. MK-383.2020.9). and yaw angles, and their first and second instantaneous derivatives (e.g. angular velocity and angular acceleration). During ship operation these initial static ship stability parameters deviate from the original values as a result of moving cargo between compartments, damaging the hull, compartment flooding etc. These effects are especially severe for fishing and military vessels, but can occur with any vessel operating in extreme conditions.
Intelligent onboard system needs large amount of synchronous recordings of ship motions parameters to operate, mainly angular displacement, velocity and acceleration and draught, but these parameters depend on the shape of the ship hull and obtaining them in model tests is complicated, let alone field tests. Field tests are too expensive to perform and do not allow to simulate particular phenomena such as compartment flooding. Model tests are too time-consuming for such a task and there is no reliable way to obtain all the derivatives for a particular parameter: sensors measure one particular derivative and all other derivatives have to be calculated by numerical differentiation or integration, and integration has low accuracy for time series of measurements [3]. The simplest way to obtain those parameters is to simulate ship motion on the computer and save all the parameters in the file for future analysis.
Arguably, the largest contribution to ship motion besides ocean waves is given by wind forces: air has lesser density than water, but air motion acts on the area of ship hull which may be greater than underwater area due to ship superstructure. Steady wind may produce non-nought roll angle, and thus have to be taken into account when determining initial static ship stability parameters. In this paper we investigate how wind velocity field can be simulated on the boundary and near the boundary of the ship hull. We derive a simple mathematical model for uniform translational motion of the air on the above-water boundary of the ship hull. Then we generalise this model to calculate wind velocity near the boundary still taking into account the shape of the above-water part of the ship hull. Finally, we measure the effect of wind velocity on the ship roll angle and carry out computational performance analysis of our programme.

Related Work
Studies on the effect of the wind on ship motions mostly focus on capsizing probability [2,4], whereas our work focuses on the direct effect of wind on ship motions and on how to incorporate ship roll angle change due to wind in onboard intelligent systems. As a result, we do not use probabilistic methods, but we use direct simulation of air flow.
Similar simulations can be performed in a wind tunnel [1] but in the case of onboard intelligent systems we need to gather a lot of statistical data to be able to tune the system for each ship hull shape. Performing large number of simulations in a wind tunnel is time-consuming and a computer programme is the most efficient option for this task.

Analytic Representation of Wind Velocity Field
Air motion without turbulence can be decomposed into two components: translational motion-air particles travel in the same direction with constant velocity, and circular motion-air particles travel on a circle. Translational motion describe sea breeze, that occurs on the shore on the sunrise and after the sunset. Circular motion describe storms such as typhoons and hurricanes. Translational motion is a particular case of circular motion when the radius of the circle is infinite. Due to the fact that the scale of circular motion is much larger than the size of a typical ship hull we consider only translational motion in this paper.
Since there is no rotational component, air flow is described by equations for irrotational inviscid incompressible fluid. In this context fluid velocity υ is determined as a vector gradient ∇ of scalar velocity potential φ and continuity equation and equation of motion are written as Here p 0 is atmospheric pressure, g is gravitational acceleration, ρ is air density, p is pressure. We seek solutions to this system of equations for velocity potential φ. Continuity equation restricts the type of the function that can be used as the solution, and equation of motion gives the pressure for a particular velocity potential value. Ship hull boundary is defined by a parametric surface S and surface normal n: The simplest parametric surface is infinite plane with constant normal. The computer model of a real ship hull is composed of many triangular panels with different areas and different orientations that approximate continuous surface. On the boundary the projection of wind velocity on the surface normal is nought: The solutions to the governing system of equations differ in how boundary is incorporated into them: in our model the boundary is taken into account by adding velocity of a reflected air particle in the solution. Velocity υ r of the particle that is reflected from the surface with surface normal n is given by the law of reflection ( Fig. 1): When we add velocity of incident and reflected air particles we get a vector that is parallel to the boundary. As we move away from the boundary its impact on the velocity decays quadratically with the distance. The reason for using the law of reflection to describe air flow on the boundary is that the corresponding solution reduces to the known analytic solution for the potential flow around a cylinder (see Sect. 4.1). Quadratic decay term is borrowed from this known solution. In the following subsections we describe the solution that we obtained for the velocity field on the boundary and near the boundary.

Uniform Translational Motion on the Static Body Surface
On the surface we neglect the impact of neighbouring panels on the velocity field on the ground that the real ship hull surface is smooth, i.e. neighbouring panels have approximately the same normals. This assumption does not hold for aft and bow of some ships, and, as a result, velocity field near these features has stream lines with sharp edges. We consider this effect negligible for the determination of roll angle caused by the wind, since the area of panels that distort wind field is small compared to the area of all other panels.
We seek solutions to the governing system of Eq. (1) with boundary condition (2) of the form Here r is spatial coordinate, C is the coefficient, and υ r is velocity of reflected air particle defined in (3). This solution is independent for each panel. Plugging the solution into boundary condition (2) gives and velocity is written simply as This solution satisfies continuity equation. It gives velocity only at the centre of each ship hull panel, but this is sufficient to calculate pressure and force moments acting on the ship hull.

Uniform Translational Motion Near the Static Body Surface
Near the surface there are no neighbouring panels, the impact of which we can neglect, instead we add reflected particle velocities for all the panels and decay the velocity quadratically with the distance to the panel. Here we can neglect panels surface normals of which has large angles with the wind direction for efficiency, but they do not blow up the solution.
We seek solutions of the form where · denotes vector length. Plugging the solution into boundary condition and assuming that neighbouring panels do not affect each other (this allows removing the integral) gives the same coefficient C = 1, but velocity vector is written differently as Besides the term for reflected air particle velocity that decays quadratically with the distance to the panel, there is a term that decays quaternary with the distance and that can be neglected. This solution reduces to the solution on the boundary when r = S and takes into account impact of each panel on the velocity direction which decays quadratically with the distance to the panel.

Verification of the Solution on the Example of Potential Flow Around a Cylinder
Potential flow around a cylinder in two dimensions is described by the following well-known formula: Here r and θ are polar coordinates, R is cylinder radius and U is x component of the velocity. Cylinder is placed at the origin. To prove that our solution on the boundary (4) reduces to this solution we write it in Cartesian form using polar coordinate identities Then in Cartesian coordinates the solution is written as and the velocity is written as On the boundary x 2 + y 2 = R 2 and the velocity is written as Now if we write surface normal as n = (x/R, y/R) and let υ = (U, 0), our solution (4) quite surprisingly reduces to the same expression.
To reduce solution near the boundary (5) to the solution for potential flow around a cylinder, we let s = r 2 / S 2 (here r is the radius vector in Cartesian coordinates). Then the solution is written as ∇φ = υ + 1 s υ r and reduces to general form of the solution for potential flow around a cylinder given in (6). We compared both solutions (see Fig. 2) for a cylinder with R = 27.4429, and discovered that maximum distance between velocity fields produced from both of them is 11% of the maximum velocity. Our formula shows slightly smaller decay near the boundary, but this problem cannot be solved by introducing coefficients. Perhaps, comparing our solution to the solution produced by CFD methods may shed light on which one is closer to the reality. On the ship hull boundary the solutions are equivalent.

Ship Roll Angle and Velocity
Wind causes non-nought force moment and force acting on a ship that bend and move the ship in the direction of the wind. This effect is stronger for the ships with large hull areas exposed to the wind, like fully-loaded containerships, but other ships are also affected.
We measured how wind speed affects Aurora's transversal velocity and roll angle. For that purpose we made wind blow directly in the starboard of the ship and varied wind speed. We stopped the experiment after 60 s and measured maximum roll angle and maximum transversal velocity. We have found that in order to produce 1°static roll angle we need wind speed of ≈35 m/s (Fig. 3), and wind with that speed makes the ship move in transversal direction with the speed of ≈0.2 m/s. We expect these numbers to be smaller for smaller ships.
We have found that the law of reflection (3) in its original form does not allow to calculate the effect of wind on the symmetric ship hull: it happens because the pressure on the leeward and windward side of the ship is the same-which is not the case for real-world phenomena where the pressure is different due to turbulence. To overcome this problem we introduce a coefficient α that controls reflection ratio: When α = 1 this formula equals (3), when α = 0 there is no reflection and the wind velocity does not change its direction near the ship hull. In our tests we used α = 0.5. A better solutions would be to incorporate turbulence in the model which is one of the directions of future research.

Computational Performance Analysis
We implemented solutions (4) and (5) in Virtual testbed wind solver. Virtual testbed is a programme for workstations that simulates ship motions in extreme conditions and physical phenomena that causes them: ocean waves, wind, compartment flooding etc. We performed benchmarks for three ships: Diogen, Aurora and MICW. Diogen is a small-size fishing vessel, Aurora is mid-size cruiser and MICW is a large-size ship with small moment of inertia for the current waterline (Fig. 4). Ships in our database do not have superstructures, they have only hulls and compartments. The main difference between them that affects benchmarks is the number of panels into which the hull is decomposed. These numbers and sizes are shown in Table 1. Benchmarks were performed using three workstations: DarkwingDuck, GPUlab, Capybara. DarkwingDuck is a laptop, GPUlab is a desktop workstation, and Capybara is a desktop with professional graphical accelerator server-grade processor ( Table 2). All of the workstations are equipped with graphical accelerators that allow to greatly increase their performance.
Wind solver was written for both OpenMP and OpenCL to make use of graphical accelerator available on most modern workstations. The solvers use single precision floating point numbers. Benchmark results are presented in Table 3.

Discussion
Solution on the boundary (4) provides simple explanation of areas with the highest and lowest pressure for potential flow around a cylinder. At left-most and  right-most points on the cylinder boundary (Fig. 2) velocity is nought because incident and reflected particle velocities have opposite directions and cancel each other out. At top-most and bottom-most points incident and reflected particle velocities have the same direction and total velocity is two times larger than the velocity of the flow. In order to be compatible with the surface of any object, solution near the boundary (5) uses different term s than the solution for potential flow around a cylinder which makes reflected velocity term reach maximum value for the point on the boundary, and for the point near the boundary the solution includes reflected velocity vectors for each panel.
Wind speed of 35 m/s that we obtained in ship roll angle experiments matches hurricane with 14 m high waves on the Beaufort scale which would affect the ship more severely than the wind. The main reason for such a large value is that ships in our database do not have superstructures and hence the surface area affected by the wind is much smaller than in reality. Nevertheless, in intelligent onboard systems even small variations in static roll at less severe weather conditions have to be considered for the correct operation of the system.
The introduction of the coefficient α that controls reflection ratio is the simplest way of taking turbulence into account. α < 1 increases the wind speed on the leeward side of the ship as a result of wind "going around" the ship hull. More sophisticated turbulence model would give more accurate results.
Performance benchmarks showed that performance of both OpenMP and OpenCL solvers increases from the least powerful (DarkwingDuck) workstation to the most powerful one (Capybara). In addition to this, performance of OpenCL is always better than of OpenMP by a factor of 16-58. Our solver uses explicit analytic formula to compute wind field and to compute wind field at each point iterates over all panels of the ship. All panels are stored and accessed sequentially and all points of wind field are stored sequentially and accessed in parallel, which makes the solver easy to implement in OpenCL and allows to achieve high performance on the graphical accelerator. Finally, as expected performance increases and the ratio between OpenCL and OpenMP performance decreases from the large-size to small-size ship. The only exception from the above-mentioned observations is the performance of OpenCL on Capybara for MICW hull. This behaviour requires further investigation.

Conclusion
This paper proposes a new simple mathematical model for wind field around the ship hull. On the ship hull boundary this model is equivalent to the known formula for potential flow around a cylinder. Near the boundary this model is close to this formula, but has slightly smaller decay. In both cases the model satisfies boundary conditions and continuity equation (conservation of mass), which makes it suitable for physical simulations. The main advantage of the model is its simplicity, the use of Cartesian coordinates and its applicability to bodies of any form, not just cylinders. We applied this model to simulate ship motions under the effect of wind with constant speed and direction (and in the absence of all other effects except buoyancy force), and discovered that to get static roll angle of 1°we need wind speed of a hurricane (12 on the Beaufort scale). Also, simulation of ship motions due to wind is not possible without taking into account turbulence, but in the absence of turbulence model we used the simple coefficient that controls reflection ratio to adapt the model for this kind of simulation.
From the computational standpoint the proposed model shows high performance on modern processors as well as graphical accelerators due to linear memory access pattern and absence of synchronisation and data transfer between parallel processes. Using any up-to-date workstation is enough to perform realworld simulations.
Future work is to include stratification and circular motion in the model. Stratification-an increase of wind speed with height-is known phenomena in atmosphere which affects wind field around tall ships, and thus may improve accuracy of our solver. The motivation behind including circular motion is to better understand air motion around object and the fact that linear motion is a special case of it when the circle radius is infinite. Another possible direction of future work is to use more advanced turbulence model.