OpenFOAM‎ > ‎

How To: couple waves2Foam with dynamic mesh motion

This ‘how to’ pretend to be a guide step-by-step about how to couple the CFD ToolBox waves2Foam developed by Niels G. Jacobsen with dynamic mesh motion (more info:


Let’s start: 

1.    Copy the folder of solver interDyMFoam in the wave2Foam solver folder for version which you use, for example, for version 1.7.1:

cp -r $WM_PROJECT_DIR/applications/solvers/multiphase/interFoam/interDyMFoam $WM_PROJECT_USER_DIR/applications/solvers/waves2Foam/applications/solvers/solvers17/waveFoam/

2.    Now modify the name of copied folder to waveDyMFoam (or whatever name you want... but it looks fine):

cd $WM_PROJECT_USER_DIR/applications/solvers/waves2Foam/applications/solvers/solvers17/waveFoam

mv interDyMFoam/ waveDyMFoam

3.    Clean the compiled solver and modify the name of C file:

cd waveDyMFoam


mv interDyMFoam.C waveDyMFoam.C

4.    Now we must follow the guidelines in section 3.2 of waves2Foam wiki (but with some difference, as for example, we don’t need modify createFields.H since it’s read from one level-up):

Go to: Or follow the next copy&paste instructions ‘adapted’ to waveDyMFoam:


§  Add the following line in waveDyMFoam.C

#include "relaxationZone.H"

§  Inside main in waveDyMFoam.C add the following two lines just below #include "initContinuityErrs.H" and above createFields.H

#include "readGravitationalAcceleration.H"

#include "readWaveProperties.H"

§  After the line in waveDyMFoam.C stating #include "alphaEqnSubCycle.H" add


5.    Now we need set properly the Make files. First, open and modify ‘Make/files’:



6.    And in ‘Make/options’ do:

§  After -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ add:


§  And add the following lines at the very bottom



§  REMEMBER to add the two new needed \ at the end of lines:



7.    At main directory, compile the new solver typing:


8.    It’s done ;)

waveDyMFoam tutorial example

The case showed in the video is available in the attached file.

Jordi Muela,
19 feb. 2012 23:22