100% found this document useful (1 vote)
347 views

IHFoam Tutorial

This document summarizes the OpenFOAM workflow for simulating regular wave interaction with a floating structure. The key steps are: 1. Create separate meshes for the floating object and background using blockMesh. 2. Use snappyHexMesh to refine the meshes and conform them to the object and domain geometries. 3. Check that the meshes are concordant before merging. 4. Merge the meshes using mergeMeshes to create the final simulation mesh.

Uploaded by

Fandy Sipata
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
347 views

IHFoam Tutorial

This document summarizes the OpenFOAM workflow for simulating regular wave interaction with a floating structure. The key steps are: 1. Create separate meshes for the floating object and background using blockMesh. 2. Use snappyHexMesh to refine the meshes and conform them to the object and domain geometries. 3. Check that the meshes are concordant before merging. 4. Merge the meshes using mergeMeshes to create the final simulation mesh.

Uploaded by

Fandy Sipata
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

applied to Coastal Engineering

Regular waves interaction with a floating structure


Gabriel Barajas, Javier L. Lara, María Maza
Regular waves interaction
with a floating body

• We are going to create the case from an existing tutorial:


 Copy the 3D case and change the folder name:
$ cp –r ~/OpenFOAM-
v1812/tutorials/multiphase/overInterDyMFoam/floatingBody ~/IHFoamCourse/

• Rename the case:


 Rename the case:
$ mv ~/IHFoamCourse/floatingBody ~/IHFoamCourse/overSetWaves
 Set OpenFOAM environment:
$ source ~/OpenFOAM/OpenFOAM-v1812/etc/bashrc
 Ensure everything you don’t need is deleted
$ cd ~/IHFoamCourse/overSetWaves
$ ./Allclean
Regular waves interaction
with a floating body

Geometric Domain Geometric Domain


Mesh generation
(object and background)
Numeric Domain Numeric Domain
OpenFOAM workflow

Merge meshes, Boundary conditions,


Numerical Setup Initial conditions, Numerical
parameters, Pre-processing

Solver Execute serial or parallel

Post-processing Wave gauges, run-up, etc.


Regular waves interaction
with a floating body

OpenFOAM case

floatingBody background

constant constant

system system
Regular waves interaction
OpenFOAM case with a floating body

floatingBody background

0
- alpha.water - zoneID
- p_rgh - k
- U - epislon
- pointDisplacement - nut

constant constant
- g - waveProperties
- transportProperties
- turbulenceProperties
- dynamicMeshDict

system system
- blockMeshDict - topoSetDict
- blockMeshDict
- setFieldsDict - decomposeParDict
- setFieldsDict
- fvSchemes - controlDict
- snappyHexMeshDict
- fvSolution
Regular waves interaction
with a floating body

• First, create the mesh for the floating object.


• Edit floatingBody/system/blockMeshDict:

• Create the floating object base mesh:


$ blockMesh
• Check the floating object base mesh quality:
$ checkMesh
Regular waves interaction
with a floating body

• Define and create a mild slope (using Autocad, Rhino, etc.).


• Check the .stl file; open Paraview, load the .stl file and check that the geometry fits the
base mesh:
$ touch ih.foam && paraview

0.8 m.

0.6 m.
0.6 m.
• Update the case to take into account the new geometry:
$ mkdir constant/triSurface
$ cp body.stl constant/triSurface/.
Regular waves interaction
with a floating body

• Using snappyHexMesh, as mesh generator to take the existing base mesh and remesh it to
fit the real geometry of the experiments.

• Copy snappyHexMeshDict from a tutorial:


$ cp –r ~/OpenFOAM-v1806/tutorials/multiphase/interFoam/RAS/mixerVesselAMI/system/
snappyHexMeshDict ~/IHFoamCourse/overSetWaves/system/.

• This intermediate mesh, is created from the dictionary system/snappyHexMeshDict:

- CastellatedMesh:
 Mesh Refinement in prescribed regions.
 Detection of the domain (surface and volume).
 Removal of cells outside the domain.

- Snap:
 Mesh morphing to follow the provided geometry.
 Layer addition could also be done.
Regular waves interaction
with a floating body

Definition of the a new boundary (mesh refinement and removal of cells


around it).

Minimun number of cells before going to the next level of resolution


(Number of buffer layers between different levels.)

List of feature edges, that describe Sharp cornes, for refinement.

Surface based refinements, based on two levels for every surface


(the first is the minimum level, the second level is the maximum level).
Regular waves interaction
with a floating body

• Refinement levels in OpenFOAM: increase in the refinement level reduces the cell size by half.

Level 0 Level 1 Level 2 Level 3


Regular waves interaction
with a floating body

Cartesian points (x, y, z) to identify the volumen to


retain the final mesh.

• Create the intermediate mesh:


$ snappyHexMesh -overwrite.

• Check the floating object base mesh quality:


$ checkMesh

• Check your final mesh with Paraview:


$ paraview

• Load the ih.foam file. and press “Apply”.


(Remember to tick “Skip Zero Time”, as the
boundary conditions in the 0 folder have not been
updated yet.)
Regular waves interaction
with a floating body

• Next, create the mesh for the background.


• Edit background/system/blockMeshDict:

• Create the background base mesh:


$ blockMesh
• Check the background base mesh quality:
$ checkMesh
Regular waves interaction
with a floating body

• Check if the floating object and the background mesh are in concordance before merging.
Use Paraview:
$ touch ih.foam && paraview

• Load background/ih.foam file and press “Apply”. (Remember to tick “Skip Zero Time”, as the
boundary conditions in the 0 folder have not been updated yet.). Load floatingBody/ih.foam too
and press “Apply”. Both meshes can be seen together.
atmosphere
outlet

2.0 m. inlet
ground
10.0 m.
Floating object
2.6 m.
Regular waves interaction
with a floating body

• Finally, merge both meshes to create the final and unique mesh:
$ mergeMeshes . ../floatingBody –overwrite

• Use Paraview to visualize the final mesh:


$ paraview

• Load the ih.foam file and press “Apply”. (Remember to tick “Skip Zero Time”, as the boundary
conditions in the 0 folder have not been updated yet.)
Regular waves interaction
with a floating body

• The final boundaries can be checked with Paraview (in the Mesh Regions dialog box) or they can
be checked in the constant/polyMesh/boundary file.
Regular waves interaction
with a floating body

• Once the final boundaries are known, update 0.org folder: VoF(alpha.water), velocity (U),
pressure (p_rgh), mesh ID (ZoneID) and cell motion (pointDisplacement).

• The case is defined as turbulent in:


$ more constant/turbulenceProperties

• Therefore, the turbulent kinematic energy (k), the turbulent dissipation (epsilon) and the
turbulent viscosity (nut) variables must be defined and added to the 0.org folder:
Regular waves interaction
with a floating body
alpha.water: U: p_rgh:
Regular waves interaction
zoneID: pointDisplacement: with a floating body
Regular waves interaction
with a floating body
k epsilon nut
Regular waves interaction
with a floating body

• Using system/topoSet, generate a set of cells to define the different mesh zones: $ topoSet

regionToCell: select cells in a region; if started inside,


the subCellSet keeps to it, and if outside, stays
outside.

CellToCell: select cells in cellSet.

invert: select cells not in the cellSet (rest of the


domain).
Regular waves interaction
with a floating body

• Update the initial set-up in system/setFieldsDict:


$ cp -r 0.org 0
$ setFields

Set initial water depth

Set zone identifiers


Regular waves interaction
with a floating body

• Open Paraview and plot the initial set-up to ensure eveything is correct:
$ paraview
Regular waves interaction
with a floating body

• Copy the wavePropertiesDict from a tutorial:


cp ~/OpenFOAM-v1806/tutorials/multiphase/interFoam/laminar/
waveExampleStokesII/constant/waveProperties constant/.

• Update the wave conditions in constant/waveProperties:


 WaveModel: Stokes II regular waves
 nPaddle: 2 wavepaddles (3d)
- waveHeight: H = 0.1 m.
- waveAngle: 0 (in degrees)
- rampTime: 2.0 s, smoothing time
- activeAbsorption: absorption at generation
- wavePeriod: T= 2.0 s.

- At the outlet we also define 2 wavepaddles.


Regular waves interaction
with a floating body

• Water and air properties are defined in: • Gravity is defined in:
$ more constant/transportProperties $ more constant/g

• Laminar or turbulent case is defined in:


$ more constant/turbulenceProperties
Regular waves interaction
with a floating body

• Dynamic Motion Solver:


- Deformation and morphing of the mesh is defined in constant/dynamicMeshDict:

Import library for the motion solver


Selection of class to handle mesh motion and
topology changes

Motion solver
Regular waves interaction
with a floating body
Definition of the floating object and the zone within the
mesh moves as a rigid body, the zone where the mesh is
morphed and the zone with no morphing.

Centre of mass of the floating object


Mass of the floating object
Density of the floating object
Mass of the floating object

Moment of inertia of the floating object


Regular waves interaction
with a floating body

Control the output of the solver (report) and definition of a


parameter to help maintain the stability of the solver
(accelerationRelaxation is a direct reduction of the acceleration)
Definition of the body motion solver (Newmark is a second-
order time-integrator)
Definition of a constraint of the motion of the floating object
(the line constraint defines a direction where the movement of
the floatying object is only permited).
Regular waves interaction
with a floating body

Numerical Schemes:

• In system/fvSchemes, is the file that sets the numerical scheme for the different terms.

Temporal discretization (Euler is a first order implicit


discretisation scheme).
Gradient derivative terms, that is surface normal gradient
terms (Gauss linear is second order discretisation
scheme)
Divergence terms, such as advection terms and other
terms that are often diffusive in nature (Gauss
limitedLinearV 1 is second order, Gauss vanLeer is
second order and Gauss upwind is a first order
numerical scheme)
Regular waves interaction
with a floating body

Numerical Schemes: Laplacian terms, such as the diffusion term in the momentum
equation ( values between 0 and 1 to handle a non-orthogonal
mesh)

Cell to face interpolations of values (linear is second order


discretisation scheme)

Component of gradient normal to a cell face (values between


0 and 1 to handle a non-orthogonal mesh)
Define overset interpolation method (cellVolumeWeight,
inverseDistance, leastSquares, trackingInverseDistance)

Variables needed to calculate fluxes in the pressure equation.


Regular waves interaction
with a floating body

Algorithm control:

• In system/fvSolutions are defined the equations solvers, tolerances and algorithms.

• Controls for MULES, solver of the VoF equation:


- nAlphaCorr: loops over VoF equation
- nAlphaSubcycles: number of sub-cycles within the VoF
equation
- cAlpha: artificial compression velocity.
- cAlpha: artificial compression velocity.
- MULESCorr: switches on semi-implicit MULES.
- nLimiterIter: number of MULES iterations over the
limiter.
- solver, smoother, tolerance and relTol: define the solver
to solve the matrix equation (symmetric gauss seidel
smoother) and tolerances.
Regular waves interaction
with a floating body

Algorithm control:

• For each variable solved in the


particular equation, the type of solver,
preconditioner and parameters
(tolerance, relTol, maxIter) that are
used by the solver must be defined.

• Normally, the last iteration (variables


are solved multiple times within a
solution step ) is solved with different
parameters.
Regular waves interaction
with a floating body

Algorithm control:

• PIMPLE algorithm solves the pressure-velocity coupling in the Navier-Stokes equations.

• PIMPLE algorithm combines PISO and SIMPLE.


- momentumPredictor: switch the control for solving the
momentum predictor.
- nOuterCorrectors: number of times the total system of
equations is solved on time step.
- nCorrectors: number of times the algorithm solves the pressure
equation and momentum corrector in each step
- nOrthogonalCorrectors: specifies repeated solutions of the
pressure equation, used to update the explicit non-ortogonal
correction.
- ddtCorr: if set yes, reduces the the decoupling between
pressure, velocity and velocity flux.
Regular waves interaction
with a floating body

Algorithm control:

• RelaxationFactor: controls of the under-relaxation, a technique used


to for improving stability.

• Cache: controls data storage to make future requests faster


Regular waves interaction
with a floating body

• Define simulation parameters in system/controlDict


 Solver: overInterDyMFoam (incompressible two
phase Flow, with optional mesh moving and mesh
topology changes)
 startTime (start time for the simulation),
endTime (end time for the simulation), deltaT
(time step of the simulation).
 writeInterval (controls the timing of write output),
purgeWrite (integer representing a limit on the
number of time directories that are stored).
 maxCo (maximun Courant Number),
maxAlphaCo (maximun Courant number for the
pase fields), maxDeltaT (upper limit of the time
step).
Regular waves interaction
with a floating body

• Update the runtime postprocessing sensors


(system/controlDict)
 to get the iso-Surface of the free surface
elevation:
Regular waves interaction
with a floating body

• Decompose case:
- system/decomposeParDict: if we want to run our simulation in parallel we can
decompose it using this file:
 numberOfSubdomains: set the number of parts in which we are going to split
our domain.
 n: it should be equal to the number of subdomains
• Run the command:
$ decomposePar
Regular waves interaction
with a floating body

• Run the case!


$ mpirun –np 4 overInterDyMFoam –parallel > log.OverWaves &
$ tail –f log.OverWaves
$ kill PID number

• Postprocessing with Paraview:


$ paraFoam –touch
Regular waves interaction
with a floating body

• Postprocessing using Matlab (six degrees of freedom, taken from log.OverWaves):


Gabriel Barajas, Javier L. Lara, María Maza

([email protected])

You might also like