The one I found was to split the boat in multiple vertical boxes (\(47 \times 7\) of \(0.1 \times 0.1~m\) in the implementation part).
The third approach works by creating a uniform mesh under the boat at a constant depth, each point of this mesh is the starting point of a vertical virtual box which ends at the deck height. For each box, it computes its intersection volume with the hull. After having the volume, it calculates the real height of the box from the deck. It returns this calculated point as well as the volume of the box computed.
The water depth is simply calculated by finding the difference between the bottom-centred point of the boxes and the sea level. With this distance known, the immersed volume is determined by proportioning the heights of the filled boxes to the water depth.
\[V_{im} = \dfrac{\text{water depth}}{\text{box height}}\]Where \(\text{water depth} = \text{sea level} - \text{box bottom-centred point}\).
Immersed volume allows to calculate the buoyancy force
\[\displaystyle \vec{F_A} = \rho_{water} V_{im} \vec{g}\]where \(\displaystyle \rho_{water} = 1026 kg.m^{-3}\) is the average sea water density, \(\displaystyle V_{im}\) is the immersed volume and \(\displaystyle \vec{g}\) is the standard acceleration of gravity \(\displaystyle \vec{g} = \begin{pmatrix}0 \\0 \\-9.81\end{pmatrix}\)
This method enables a fairly good distribution of buoyancy forces with few cells. Additionally, the computed force is continuous.
On average, it runs in \(\displaystyle 0.159~ms\), which allows running the simulation up to \(6,287~FPS\) (Frame Per Second) with Python using the NumPy library over \(\displaystyle 500,000\) iterations.
The centre of buoyancy is calculated by the formula below:
\[\displaystyle \vec{OB} = \dfrac{1}{\vec{F_A}} \sum \vec{F_{A_{box}}} \cdot \vec{OM}\]Where \(\displaystyle \vec{OB}\) is the buoyancy centre coordinates, \(\displaystyle \vec{F_A}\) the total buoyancy force vector, \(\displaystyle \vec{F_{A_{box}}}\) the boxes' buoyancy force vector and \(\displaystyle \vec{OM}\) the gravity centre coordinates of the immersed volume of boxes.
Moment due to Archimedes forces is defined as follows:
\[\displaystyle \vec{M_{buoy}} = \vec{GB} \times \vec{F_A}\]Where \(\displaystyle \vec{M_{buoy}}\) the moment vector due to buoyancy \(\displaystyle \vec{GB}\) the distance vector between centre of gravity and centre of buoyancy.
Gravity is calculated for each cell by the Newton's formula with density.
\[\displaystyle \vec{P} = \rho V \vec{g}\]where \(\displaystyle \rho\) and \(\displaystyle V\) are respectively the density and the volume of the cell being treated and \(\displaystyle \vec{g}\) is the standard acceleration of gravity \(\displaystyle \vec{g} = \begin{pmatrix}0 \\0 \\-9.81\end{pmatrix}\).
The centre of gravity is calculated by the formula below:
\[\displaystyle \vec{OG} = \dfrac{1}{\vec{P}} \sum \vec{P_{box}} \cdot \vec{OM}\]Where \(\displaystyle \vec{OG}\) is the gravity centre coordinates, \(\displaystyle \vec{P}\) the total gravity force vector, \(\displaystyle \vec{P_{box}}\) the boxes' gravity force vector and \(\displaystyle \vec{OM}\) the gravity centre coordinates of boxes.
There isn't moment due to gravity because moments are defined in the gravity centre of the boat.
To enhance this third method, I have defined sub-boxes that improve the distribution of mass within the boat. For example, boxes overlapping compartments in the boat have been divided into two separate groups to assign densities to hull-boxes and compartment-boxes individually.
Any remarks or improvements, leave a comment!