# NEMOH

Nemoh is a Boundary Element Methods (BEM) code dedicated to the computation of first order wave loads on offshore structures (added mass, radiation damping, diffraction forces). It has been developed by researchers at Ecole Centrale de Nantes for 30 years. It is still used in many of our research projects. Typical use is estimation of dynamic response of floating structures or performance assessment of wave energy converters.

Nemoh is the world first open source BEM code. Since January 2014, it has been released under the terms of the Apache 2 licence. Copy of the license may be obtained at http://www.apache.org/licenses/LICENSE-2.0.

Unlike other BEM softwares, Nemoh’s approach decouples the resolution of the linear free surface Boundary Value Problem (BVP) and the definition of the boundary condition on the body (body condition). This feature makes it easy to deal with flexible structure, hydroelasticity, generalised modes and unconventional degrees of freedom with Nemoh.

## News

• August 2015: A “developer group” is being created in order to improve Nemoh. The first meeting of this developer group will take place on Monday, September 7 during the EWTEC2015 conference in Nantes, France. More information on Nemoh’s forum http://lheea.ec-nantes.fr/redmine/projects/nemoh
• March 2015: Nemoh v2.02 has been released. It is now possible to specify water density and gravity in the meshing tools.
• July 2014: Nemoh v2.0 has been released. Major modifications are

* Code acceleration by a factor typically 7 when using the Matlab routine. Gain depends on the number of BVP per frequency.

• More logical conventions for wave elevation and excitation force.

## Overview

Nemoh is composed of three programs which are supposed to be run one after the other.

A Matlab wrapper Nemoh.m is provided in the Matlab routine folder. It makes it easy to use Nemoh from the Matlab environment. Meshing tools are also provided. See the matlab routines axiMesh.m, Mesh.m in the Matlab routine folder and the Mesh code.

Examples are shown in the example section below.

## Referencing Nemoh

Publication or report using NEMOH should refer to:

• A. Babarit, G. Delhommeau: Theoretical and numerical aspects of the open source BEM solver NEMOH. In Proc. of the 11th European Wave and Tidal Energy Conference (EWTEC2015), Nantes, France

## Installation

### Source code

To download the source code, the only requirement is to register here http://lheea.ec-nantes.fr/redmine/account/register. Then, the source code can be downloaded from http://lheea.ec-nantes.fr/cgi-bin/hgweb.cgi/nemoh/. Log in using your account information.

Code development uses Mercurial for version control. If you wish to contribute to code development, it is advised to clone this Mercurial repository and use the same version control tool.

### Win32 compatible environment

Executables version of the code (.exe) can be downloaded here.

Matlab routines for use of Nemoh in the Matlab environment can be downloaded here.

Alternatively, you may wish to compile your own version of the codes. Codes should compile without troubles with the Intel Fortran compiler ifort. Dependencies are:

• preProcessor: Common/Environment.f90; Common/Identification.f90; preProcessor/BodyConditions.f90; preProcessor/Integration.f90; preProcessor/Main.f90; preProcessor/Mesh.f90
• solver: Common/Mesh.f90; Common/Results.f90; Common/Identification.f90; Solver/Core/ALLOCATE_DATA.f90; Solver/Core/BODYCONDITIONS.f90; Solver/Core/COM_VAR.f90; Solver/Core/COMPUTE_GREEN.f90; Solver/Core/COMPUTE_GREEN_FREESURFACE.f90; Solver/Core/COMPUTE_KOCHIN.f90; Solver/Core/COMPUTE_POTENTIAL_DOMAIN.f90; Solver/Core/DEALLOCATE_DATA.f90; Solver/Core/ELEMENTARY_FNS.f90; Solver/Core/INITIALIZATION.f90; Solver/Core/M_SOLVER.f90; Solver/Core/OUTPUT.f90; Solver/Core/PREPARE_MESH.f90; Solver/Core/SOLVE_BEM.f90; Solver/Core/SOLVE_BEM_FD_DIRECT.f90; Solver/Core/SOLVE_BEM_INFD_DIRECT.f90; Solver/NEMOH.f90
• postProcessor: Common/Environment.f90; Common/Identification.f90; Common/Results.f90; postProcessor/Compute_RAOs.f90; postProcessor/IRF.f90; postProcessor/Main.f90; postProcessor/Plot_WaveElevation.f90
• mesh: Common/Identification.f90; Mesh/calCol.f90; Mesh/coque.f90; Mesh/ExMaillage.f90; Mesh/hydre.f90; Mesh/Mailleur.f90; mesh.f90

The Visual Studio solution Nemoh.sln may be used for easy compilation of Nemoh with Microsoft Visual Studio.

### Linux and Mac OS X environment

A makefile is provided with the source code for compiling Nemoh in Linux and Mac OS X environment. The Intel Fortran compiler ifort shall be used for Linux. The gfortran compiler should be used for Mac OS X. Some adjustments may be require for Mac, look at the OSXreadme.txt. Other compilers may compile with small adjustments to the libraries.

Dependencies are the same as for compiling in Win32 environment.

Thanks goes to Christophe Peyrard, Yi-Hsiang Hu and Eliot Quin for providing the makefile.

## Theory

### Notations and conventions

Notations and conventions are described here.

### General equations

Information on the general equations and theory can be found here (In French), here and here.

## Running Nemoh

### Running Nemoh with Matlab

It is the easiest way to start with Nemoh. In the folder Matlab routines/, one can find .m files for generating meshes and running Nemoh with them. Note that the code is expected to be run on a win32 compatible environment.

#### Mesh generation

One may use axiMesh.m to generate an axisymmetric mesh with Matlab. Non axisymmetric meshes may be generated using Mesh.m. Type help axiMesh or help Mesh in Matlab to obtain guidance in using these routines.

#### Nemoh

Both mesh generators will generate the appropriate folder structure and input files, so that Nemoh can be used right after having generated the mesh. The routine Nemoh.m is a Matlab wrapper for Nemoh. It takes care of the calculations and imports results (first order hydrodynamic coefficients) in the Matlab environment. Type help Nemoh in Matlab for guidance.

### Running Nemoh in command line

Running Nemoh in command line is necessary to make use of full capabilities of the code, such as generalized modes and non conventional degrees of freedom.

#### Input files

• ID.dat file: This file is used for identifying the calculation. It must be located in the working folder where the codes are run. Second line is a string of characters. It is the name of the working folder. First line is the length of this string. Here is an example:

|7 |number of characters in file name|

 example file name
• input.txt and Nemoh.cal files: These files are the input files for the Nemoh calculation. They must be located in the working folder, according to the ID.dat file. Here are examples.

input.txt

 Calculation parameters  0 Solver selection

Nemoh.cal

Environment
1025. Sea water density (kg/m3)
9.81 Gravity (m/s2)
0. Water depth (0 for deep water)
0.  0. Coordinates of wave measurement point
Description of bodies
1 Number of bodies
First body
example Name of mesh file
500 280 Number of nodes and panels
2 Number of DoFs
1 1. 0. 0. 0. 0. 0. DoF: 1 for translation (2 for roation), followed by direction vector (axis and center of rotation for rotation). This example is surge
2 0. 1. 0. 0. 0. -3. DoF: 1 for translation (2 for roation), followed by direction vector (axis and center of rotation for rotation). This example is pitch about gravity centre
2 Number of generalised forces to calculate
1 1. 0. 0. 0. 0. 0. 1 for force (2 for moment force), followed by direction vector (axis and center of rotation for rotation). This example is force in x direction
2 0. 1. 0. 0. 0. -3. 1 for force (2 for moment force), followed by direction vector (axis and center of rotation for rotation). This example is moment force along y axis about gravity centre
0 Number of additional lines
Load cases to solve
41 0.1 2. Number of wave frequencies, min, max (rad/s)
1 0. 0. Number of wave direction, min, max (degrees)
Post processing
1 0.1 10. IRF calculation (1 for yes), time step and duration
0 Save pressure on body surface (1 for yes)
0 0. 181. Kochin function calculation: nb of direction (0 for no), min, max (degrees)
0 50 500. 500. Free surface vizualization: nb of points in x (0 for no), y and dimensions of domain in x and y directions
End
• Mesh file: Of course, Nemoh requires an input mesh. The input mesh may be generated by hand, by using the Matlab routines axiMesh.m or Mesh.m, by using the Mesh.exe mesh generation program or by any other meshing software provided that the mesh format meets Nemoh requirements. The mesh format is explained in the mesh section.

#### preProcessor

The aim of the preProcessor is to prepare the mesh and to generate the body conditions for each calcuation case (radiation and diffraction). Calculation cases are defined in the input file Nemoh.cal which must be located in the working folder.

Once the preProcessor has been run successfully, the following files are created in the working folder:

• /Mesh/L12.dat, /Mesh/L10.dat and /Mesh/Mesh.tec files: They are the mesh files. The first one contains tables of nodes and connectivities. The second one contains additional geometrical information such as use of a symmetry about the (xOz) plane, number of nodes, number of panels, number of bodies, panel to body belonging, panel centres, panel normal vectors and panel areas. The last one is in Tecplot compatible format for vizualisation purpose.
• /Normalvelocities.dat file: This file contains the body conditions for each radiation and diffraction problem defined in the Nemoh.cal file.
• /Integration.dat file: This file contains the information about how the pressure has to be integrated over the body surfaces to obtain the requested forces (as defined in the Nemoh.cal file).
• /Results/FKForce.dat, /Results/FKForce.tec files: Froude Krylov forces for each of the diffraction problem. Format of the second file is compatible with Tecplot. It may be used for vizualisation of Froude Krylov forces.
• /Results/FreeSurface.dat file: This file contains the coordinates of the free surface where to calculate the wave elevation.
• /Results/Kochin.dat file: This file contains the angle for which the Kochin function will be calculated.
• /Results/index.dat file: This table gives correlatoin between force ID number, body ID number on which it applies and number if the Nemoh.cal file. It also contains the correlation between ID number of radiation problem, ID of body which is actually moving and the number of degree of freedom.

#### solver

The aim of the solver is to solve the linear BVP for each problem defined in the file Normalvelocities.dat. The calculation depends on parameters which are read in the file input.txt, located in the working folder.

Once run successfully, the following results files are created and stored in the working folder:

• /Results/Forces.dat: This file contains the forces resulting from each problem.
• /Results/freesurface.XX.dat: This file contains the free surface elevation for problem number XX.
• /Results/Kochin.XX.dat: This file contains the Kochin function for problem number XX. Follow this link for more information on notations and conventions used in Nemoh for calculation of the Kochin function.
• /Results/Pressure.XX.dat files: This file contains the pressure field on body surfaces for problem XX.

#### postProcessor

The aim of the postProcessor is to postprocess the results in order to provide the relevant quantities (added mass, radiation damping, excitation force) in the usual format. It also provides a framework to make relevant calculations.

Once run successfully, the following results files are created and stored in the working folder:

• /Results/RadiationCoefficients.tec: This file contains the added mass and damping forces for the radiation problems.
• /Results/DiffractionForce.tec: This file contains the diffraction force for the diffraction problems.
• /Results/ExcitationForce.tec: This file contains the excitation force for the diffraction problems.
• /Results/IRF.tec: This file contains the infinite frequency added mass and the impulse response function for the radiation force.

## Examples

### Vertical cylinder

This example is a floating vertical cylinder with usual 6 degrees of freedom (surge, sway, heave, roll, pitch, yaw). Input files may be downloaded here. Results are shown in the following figure. Comparison with results obtained using the BEM code Aquaplus are also shown in the same figure.

### Two interacting bodies

This example deals with the hydrodynamic interactions between two bodies. The bodies are cubes. One of the cube is rotated by 45° degrees around the z axis. Each body has the usual 6 degrees of freedom (surge, sway, heave, roll, pitch, yaw). Input files may be downloaded here. Results are shown in the following figure. Comparison with results obtained using the BEM code Aquaplus are also shown in the same figure.

### Non symmetrical body

This example deals with a body for which the (xOz) plane is not a symmetry plane. The body has the usual 6 degrees of freedom (surge, sway, heave, roll, pitch, yaw). Input files may be downloaded here. Results are shown in the following figure. Comparison with results obtained using the BEM code Aquaplus are also shown in the same figure.

### postprocessing

This example displays postprocessing capabilities of Nemoh. These capabilities are:

• Calculation of free surface elevation
• Calculation of far field coefficients (Kochin function)

The body is a cube with the usual 6 degrees of freedom (surge, sway, heave, roll, pitch, yaw). Input files may be downloaded here. Results are shown in the following figure. Comparison with results obtained using the BEM code Aquaplus are also shown in the same figure.

## Mesh

### Mesh format

The mesh is composed of flat quadrangular panels. Only the submerged part of the body must be described.

The format of a mesh file is:

 2  1  First number must be a 2. Second number is 1 if a symmetry about the (xOz) plane is used. 0 otherwise 1  5.  0.  -10.  Table of nodes. First number is the node ID. Other numbers are x y and z coordinates .  .  .  . 0  0.  0.  0. Last line of the table of nodes 1  2  3  4 Table of connectivities. Numbers of node IDs. .  .  .  . 0  0  0  0 Last line of table of connectivities

The sketch below shows the orientation convention used to describe the panel as seen looking from the fluid domain into the body.

It is possible to consider several bodies with different degrees of freedom with hydrodynamic interactions. This is obtained by meshing separetely each body. The assembled mesh will be defined in the Nemoh.cal input file and built by the preProcessor.

### Mesh generation

There are several alternatives to generate meshes for Nemoh. Some tools are provided in order to help. However, one may use any CAD software provided that one will be able to export the mesh to the correct format for Nemoh.

#### Mesh generation using the Matlab routines axiMesh.m or Mesh.m

One may use axiMesh.m to generate an axisymmetric mesh with Matlab. Only the line generating the profile needs to be described in this case. The axis will be necessarily vertical in this case. As an example, here is how to generate a vertical cylinder with 10m diameter and 5m draft:

>> n=4;>> r=[0 5 5 0];>> z=[5 5 -5 -5];>> [Mass,Inertia,KH,XB,YB,ZB]=axiMesh(r,z,n)

Non axisymmetric meshes may be generated using Mesh.m. However it is assumed that a symmetry about the (xOz) plane is used, thus only half of the body must be described. This routine also allows to generate meshes with several interacting bodies. In this case one will have to describe roughly the geometries. Mesh will be refined automatically and part above sea water level will be cut out. As an example, here is how to generate a mesh for a regular box with 10m length and 5m draft:

>> nBodies=1;>> n=5;>> X(1,1,:,:)=[-5. -5. 5.;-5 -5. -5.;5. -5. -5.;5. -5. 5.];>> X(1,2,:,:)=[-5. 0. 5.;-5 -5. 5.;5. -5. 5.;5. 0. 5.];>> X(1,3,:,:)=[-5. 0. -5.;5 0. -5.;5. -5. -5.;-5. -5. -5.];>> X(1,4,:,:)=[5. 0. 5.;5 -5. 5.;5. -5. -5.;5. 0. -5.];>> X(1,5,:,:)=[-5. 0. 5.;-5 0. -5.;-5. -5. -5.;-5. -5. 5.];>> tX(1)=0.;>> CG(1,:)=[0. 0. -2.5];>> nfobj(1)=300;>> [Mass,Inertia,KH,XB,YB,ZB]=Mesh(nBodies,n,X,tX,CG,nfobj)

#### Mesh generation using the Mesh code

The Mesh code is not a meshing software. Actually, it allows to refine a mesh and to calculate properties such as displacement, buoyancy center, hydrostatic stiffness. It also makes estimate of masses and inertia matrix. The concept with this software is to write by hand a coarse description of the body under consideration and to have Mesh make the refined mesh for Nemoh calculations.

Input files are:

• ID.dat file: identification file, as for Nemoh.
• Mesh file: this file contains the (coarse) description of the body. It is normally made by hand. The format is a little different than for Nemoh:
 100  Number of nodes 25  Number of panels 5.  0.  -10.  Table of nodes. Numbers are the x y and z coordinates .  .  .  1  2  3  4 Table of connectivities. Other numbers are node IDs. .  .  .  .
• Mesh.cal file: input file. The format is:

|test.dat |String of character: name of mesh file|

 0  1 if a symmetry about (xOz) is used. 0 otherwise 0.  0. Possible translation about x axis (first number) and y axis (second number) 0.  0. -3. Coordinates of gravity centre 500 Target for the number of panels in refined mesh 2  0. 1. 1025 Water density (kg/m3) 9.81 Gravity (m/s2)

Output files are:

• /Mesh/Hydrostatics.dat file: this file contains the coordinates of the buoyancy center, the displacement and the waterplane area.
• /Mesh/KH.dat file: hydrostatic stiffness matrix of the body.
• /Mesh/Description_Full.tec and /Mesh/Description_Wetted.tec: These files are in a Tecplot compatible format. They may be used for vizualisation of the input description of the body.
• /Mesh/GC_hull.dat and /Mesh/Inertia_hull.dat files: Coordinates of the gravity centre of the body and inertia matrix. These values are derived using the assumption that the mass of the body is equal to its displacement and that the mass is distributed on the surface of the body.
• /Mesh/mesh_file_name.dat and /Mesh/mesh_file_name.tec file: First file is the mesh to be used with Nemoh. Second file is for vizualisation with Tecplot.
• /Mesh/mesh_file_name_info.dat file: This file contains the information relative to the number of points and panels in the mesh file for Nemoh.

#### Using a CAD software

CAD softwares may be used to generate meshes for Nemoh, provided they can export surfacic meshes which can be further converter to Nemoh’s mesh file format. Some of them can generate .gdf mesh files, which may be used in combination with the nemoh2wamit_01a.m Matlab routine. It is also possible to use the meshmagick utility that is a converter between major mesh file formats used in hydrodynamics.

## Toolbox

### Mesh manipulation in Python with MESHMAGICK

MESHMAGICK is a mesh conversion tool whose goal is the interoperability between major mesh file formats being used for hydrodynamic softwares (NEMOH, WAMIT, DIODORE, HYDROSTAR), and visualization softwares (STL, TECPLOT, PARAVIEW). MESHMAGICK is also a mesh manipulation tool (translation, rotation, scaling…) for ease of mesh preparation. Since version 1.0, it also includes hydrostatics utilities to retrieve hydrostatics data (center of buoyancy, hydrostatic stiffness matrix…) and lid creation for irregular frequency removal in Nemoh (This Nemoh’s feature is not released yet).

The project is open source (under GPL-like CeCILL 2.1 licence) and it’s official web page is here (just like Nemoh, you need an account on the LHEEA’s redmine platform).

The mercurial repository to clone the project is :

### Mesh conversion in Matlab

#### Converting a Nemoh mesh to WAMIT

Nemoh mesh files may be converted to WAMIT .gdf files. One may use the nemoh2wamit_01a.m Matlab routine to do so. The routine has been developed and made available to the community by G. Payne.

#### Using a WAMIT mesh with Nemoh

WAMIT .gdf mesh files may be used with Nemoh. One may use the GDFMesh.m Matlab routine to do so. The routine has been developed and made available to the community by L. Banos.

Alternatively, one may use the runNemoh.m Matlab routine, which allows running Nemoh with .gdf files and only one routine. The routine has been developed and made available to the community by M. Thott Andersen.

### Mesh conversion from opensource Salome-Meca framework to Nemoh

This script may be used to convert meshes created in the opensource Salome-Meca framework to Nemoh format. The routine has been developed and made available to the community by P. Schmitt.

### Mean horizontal drift forces

A Matlab routine has been developed in order to calculate the mean horizontal drift forces on a body using the far field approach (Maruo,1960 and Newman,1967). The routine has been developed and made available to the community by V. Arnal.

### Nemoh to Orcaflex

A Matlab routine has been developed in order to export Nemoh’s outputs in Orcaflex’s format. The routine has been developed and made available to the community by V. Arnal.

For questions, comments or bug reports, please leave a post on Nemoh’s forum: http://lheea.ec-nantes.fr/redmine/projects/nemoh . You may have to register first (http://lheea.ec-nantes.fr/redmine/account/register).

For other queries, you may contact Dr. Aurélien Babarit, aurelien.babarit@ec-nantes.fr

#### SEMREV

• Une erreur s'est produite en récupérant ce flux : http://

/var/lib/dokuwiki/data/pages/emo/nemoh/start.txt · Dernière modification: 2016/09/19 13:51 par ababarit