Running Nemoh

Workflow

Nemoh provides 4 main programs that need to be run in sequence:

  • preProc: to read the input data, setup the computations, and compute the Froude-Krylov forces

  • [optional] hydrosCal: to compute the hydrostatic stiffness and estimated inertia matrices

  • solver: to solve the linear system of equations for each frequency and direction

  • postProc: to compute the radiation and diffraction forces from the results of the solver

Additionally, Nemoh provides a 5th program called mesh that does the same as hydrosCal but also refines the mesh with a target number of panels.

Warning

In a standard workflows, avoid using the mesh program. A dedicated meshing tool like GMSH will always provide better meshes.

Details oubout the input and output files of each program can be found in the Nemoh documentation.

Main input files

Nemoh.cal

The main input file for Nemoh is the Nemoh.cal file. A template is provided at the root of the project.

--- Environment ------------------------------------------------------------------------------------------------------------------
1000.0                  ! Fluid specific volume (kg/m^3)
9.81                    ! Gravity acceleration (m/s^2)
0.                      ! Water depth (m)
0. 0.                   ! Wave reference point (m)
--- Description of floating bodies -----------------------------------------------------------------------------------------------
1                       ! Number of bodies
--- Body 1 -----------------------------------------------------------------------------------------------------------------------
Buoy.mar                ! Name of mesh file
470 872                 ! Number of points and number of panels
6                       ! Number of degrees of freedom
1 1. 0. 0. 0. 0. 0.     ! Surge
1 0. 1. 0. 0. 0. 0.     ! Sway
1 0. 0. 1. 0. 0. 0.     ! Heave
2 1. 0. 0. 0. 0. -1.    ! Roll about CdG
2 0. 1. 0. 0. 0. -1.    ! Pitch about CdG
2 0. 0. 1. 0. 0. -1.    ! Yaw about CdG
6                       ! Number of resulting generalised forces
1 1. 0. 0. 0. 0. 0.     ! Force in x direction
1 0. 1. 0. 0. 0. 0.     ! Force in y direction
1 0. 0. 1. 0. 0. 0.     ! Force in z direction
2 1. 0. 0. 0. 0. -1.    ! Moment force in x direction about CdG
2 0. 1. 0. 0. 0. -1.    ! Moment force in y direction about CdG
2 0. 0. 1. 0. 0. -1.    ! Moment force in z direction about CdG
0                       ! Number of lines of additional information
--- Load cases to be solved -------------------------------------------------------------------------------------------------------
1 50 0.1 2.0            ! Frequency/period input unit (1: rad/s, 2: Hz, 3: s), Number of wave frequencies/periods, Min, and Max
3 0. 90.                 ! Number of wave directions, Min and Max (degrees)
--- Post processing ---------------------------------------------------------------------------------------------------------------
0 0.1 10.               ! IRF computation switch (0/1), time step and duration
0                       ! Body pressure output switch (0/1)
0 0. 180.               ! Kochin function: Number of directions of calculation (0 for no calculations), Min and Max (degrees)
0 10 100. 100.          ! Free surface elevation: Number of points in x direction (0 for no calcutions) and y direction and dimensions of domain in x and y direction
0                       ! Response Amplitude Operator (RAO) switch (0/1)
1                       ! Output frequency/period unit (1: rad/s, 2: Hz, 3: s)
--- QTF ---------------------------------------------------------------------------------------------------------------------------
0                       ! QTF switch (0/1)

Important

The number of vertices and panels must be specified in the Nemoh.cal file. They can easily be obtained with Meshmagick:

$ meshmagick Buoy.mar --info

Mesh.cal

The Mesh.cal file is dedicated to the mesh and hydrosCal programs. It is used to specify parameters for mesh refinement and hydrostatics calculations.

Note

This tutorial does not use the mesh program, so most of the parameters in the Mesh.cal file are not used.

meshbox                         ! [mesh program only] Name of the geomInput file
0                               ! [mesh program only] Symmetry switch about xOz (0/1)
0. 0.                           ! [mesh program only] Translation along x and y (respectively)
0.000000 0.000000 0.000000      ! [used by hydrosCal] Coordinates of the center of mass
634                             ! [mesh program only] Target number of panels
2                               ! [mesh program only] Minimum subdivision of a panel
0.                              ! [mesh program only] Keep at 0.
1.                              ! [mesh program only] Scaling factor
1025.                           ! [mesh program only] Water density (kg/m^3)
9.81                            ! [mesh program only] Gravity acceleration (m/s^2)

input_solver.txt

The input_solver.txt file is used to specify numerical parameters for the solver.

Hint

The default values are usually sufficient for most cases.

2                 ! Gauss quadrature order N=[1,4] for surface integration, resulting in N^2 nodes
0.001             ! eps_zmin for determining minimum z of flow and source points of panel, zmin=eps_zmin*body_diameter
1                 ! Linear system solver (0: Gauss elimination, 1: LU decomposition, 2: GMRES)
10 1e-9 1000      ! [GMRES only] Restart parameter, Relative Tolerance, max number of iterations

Running the programs

To run the programs, open a terminal and navigate to the project folder:

$ cd <path/to/project>

Then, run the following commands.

Note

Instead of moving to the project folder, you can also specify the full path to the project directory in the commands, e.g.:

$ preProc <path/to/project>

For brevity, the following will assume that your terminal is in the project directory.

Pre-processor

$ preProc

This outputs a summary of the computations:

Summary of calculation

->  Infinite water depth
->   50 wave frequencies from  0.1000 to  2.0000
->    1 wave directions from   0.0000 to  0.0000
->    6 radiation problems
->    6 forces
->  Half-body mesh (symmetric) with Npanels=  872

Hydrostatics calculator

$ hydrosCal

This program displays the buoyancy center and other hydrostatic properties.

-> Calculate hull mass and inertia

 - Coordinates of buoyancy centre
   XB =  -0.000m
   YB =   0.000m
   ZB =  -0.953m
  - Displacement  =  0.5314125E+02 m^3
  - Waterplane area  =  0.2822894E+02 m^2
  - Mass = 0.5314125E+05 Kg

Warning

The inertia matrix computed by hydrosCal is only an estimation, under the assumption that the weight of the body perfectly conpensates the buoyancy force, and that the resulting mass is distributed evenly on a infinitely thin skin on the mesh (shell model). For accurate results, the inertia matrix should be computed using the actual weight distribution of the rigid body, including the emerged part.

Solver

$ solver

The progress of the solver is displayed in the terminal:

-> Initialisation
NP Gauss Quadrature Integ.:            4
EPS min z                 :    1.00000005E-03
. Done !

-> Solve BVPs and calculate forces
Linear Solver: LU DECOMPOSITION
STARTING TIME:
Date:           23 -           1 -        2025
Time:           15 :          26 :          18

Problem    1 /   350

[...]

Computation time   79.9782486      [s]
. Done !

Post-processor

$ postProc

The post-processor outputs a brief message in the terminal:

-> Initialisation . . Done !

-> Save results

Results

The Nemoh programs output files in several directories:

  • mesh: contains copies of the mesh files and other intermediate files used by the solver and post-processor

  • Mechanics: contains the results of the hydrostatics calculations as well as input files for the RAO computation

  • results: contains the main results of the computations: added mass, radiation damping and excitation (diffraction + Froude-Krylov) forces

There are also several output files in the root of the project:

  • logfile.txt: a log file with information about the solver

  • Normalvelocities.dat: the normal velocities on the body surface (for each panel)

Details about the output files can be found in the Nemoh documentation.