Difference between revisions of "Contrib/IHFOAM"

From OpenFOAMWiki
(IHFOAM Documentation and Tutorials)
(Source Code Structure)
 
(27 intermediate revisions by 3 users not shown)
Line 6: Line 6:
 
[[Category:FeaturedArticle]]
 
[[Category:FeaturedArticle]]
 
== IHFOAM Overview ==
 
== IHFOAM Overview ==
The IHFOAM package includes:
 
* Individual boundary conditions for wave generation and active wave absorption for alpha1 and U fields. (libIHwaveGeneration.so)
 
** '''IH_Waves_InletAlpha'''
 
** '''IH_Waves_InletVelocity'''
 
* Boundary conditions for pure wave absorption applicable to U field. Based on 2D or 3D theories, both are applicable to 3D cases. (libIHwaveAbsorption.so)
 
** '''IH_3D_3DAbsorption_InletVelocity'''
 
** '''IH_3D_2DAbsorption_InletVelocity'''
 
* Solvers to be used with your favourite version of OpenFOAM or FOAM-extend. See compatibility below.
 
** '''ihFoam'''
 
** '''ihDyMFoam'''
 
* Brief reference manual
 
* Tutorials and validation cases
 
  
=== About IHFOAM solvers ===
 
ihFoam and ihDyMFoam solve two-phase incompressible flows within porous media by means of the VARANS (Volume-Averaged Reynolds-Averaged Navier-Stokes) equations. More information will be added, in the mean time check the [[#References_and_Citing | references]].
 
  
Both solvers are derived from interFoam and interDyMFoam. Furthermore, outside the porous media, the VARANS equations are identical to the classic RANS. Therefore, <u>ihFoam and ihDyMFoam can be used instead of interFoam and interDyMFoam even when the case presents no porous zones.</u>
+
IHFOAM is a newly developed three-dimensional numerical two-phase flow solver specially designed to simulate coastal, offshore and hydraulic engineering processes. Its core is based on OpenFOAM®, a very advanced multiphysics model, widely used in the industry. What makes IHFOAM different from the rest of solvers is a wide collection of boundary conditions which handle wave generation and active absorption at the boundaries.
  
=== Supported Versions ===
+
These specific boundary conditions allow to generate any type of wave in a 3D domain, from the most simple regular waves (Stokes I, II and V, streamfunction…) to complex, real and fully 3D irregular (random) directional sea states.
{{VersionInfo}}{{Version1.6-ext}}{{Version1.7.1}}{{Version2.1.1}}{{Version2.2.2}}{{Version2.3.0}}{{Version2.4.0}}{{Version3.0-ext}}{{Version3.1-ext}}
+
  
Known issues:
+
Active wave absorption has been programmed to work simultaneously with the wave generation to absorb any incident waves on the boundaries. These features do not increase the computational cost noticeably, and there is no need to extend the numerical domain, as it occurs with relaxation zones. Moreover, they allow for longer and more stable simulations without increasing water level or agitation. Currently the model can be applied to solve any impervious structures, both static and dynamic (floating structures). Some examples that have been simulated include: wave interaction with obstacles as vertical breakwaters, ships, offshore foundations, dam and spillway simulations, open channel flow…
  
{{Version1.6-ext}}{{Version3.0-ext}}{{Version3.1-ext}} the boundary conditions compile and everything works.
+
The simulations can be at laboratory or prototype scale, for which domains over 1 square kilometer have been calculated. Needless to say, a thorough validation with well-known laboratory tests has been carried out and is published in Coastal Engineering. IHFOAM can also solve two-phase flow within porous media by means of the VARANS equations. This new approach will extend the calculation range for any type of coastal structures (e.g. rubble mound breakwaters).
* Running in parallel yields an error.
+
** '''Solution:''' edit $WM_PROJECT_DIR/etc/controlDict and change commsType to nonBlocking. Reference [https://sourceforge.net/p/openfoam-extend/ticketsswak4foam/123/].
+
<pre>
+
[user:PID] *** An error occurred in MPI_Recv
+
[user:PID] *** on communicator MPI_COMM_WORLD
+
[user:PID] *** MPI_ERR_TRUNCATE: message truncated
+
[user:PID] *** MPI_ERRORS_ARE_FATAL: your MPI job will now abort
+
--------------------------------------------------------------------------
+
</pre>
+
* Running in parallel may produce unexpected results due to a bug in gMin and gMax functions. See [https://sourceforge.net/p/openfoam-extend/ticketsfoamextendrelease/251/]
+
** Fixed with commits c5a2b9d7 (master) and 02833621 (nextRelease).
+
** The '''solution''' can be found [http://www.cfd-online.com/Forums/openfoam-bugs/139466-fe-3-1-parallel-issues-bcs-gmax-reduce.html#post504033 here].  
+
  
{{Version1.7.1}} everything works when you compile OpenFOAM from source, as there is a problem with the precompiled installable pack. Reference [http://www.cfd-online.com/Forums/openfoam-solving/100091-waves2foam-related-topics.html#post339687].
+
OpenFOAM® is a registered trade mark of OpenCFD Limited, producer and distributor of the OpenFOAM software via www.openfoam.com.
* Otherwise:
+
** The solvers (even the regular version of interFoam) need to include "-linterfaceProperties" to compile.
+
** IHFOAM solvers compile and work. Despite the BCs being included, apparently they are not linked, as they are not recognized.
+
** If the boundary conditions are included dynamically in controlDict and used with the IHFOAM solvers, turbulence modelling does not work.
+
  
{{Version2.3.0}}{{Version2.4.0}}  everything is working now.
+
=== IHFOAM GUI ===
* We are experiencing severe problems with pressure calculations (not linked in any way to IHFOAM implementation) in this version.
+
** Find the bug report for the OpenFOAM developers [http://www.cfd-online.com/Forums/openfoam-bugs/139286-interfoam-pressure-miscalculation-2-3-wrt-previous-versions.html here].
+
* Although porous solvers and tutorials are now provided, we suggest you stay with prior OpenFOAM versions.
+
  
=== Ongoing Development ===
+
IHFOAM-GUI has been designed following the request of many IHFOAM users to decrease the learning curve in the use of OpenFOAM® for coastal and ocean engineering. It is more than a standard OpenFOAM® GUI since it is especially designed to deal with free surface flows. The user will be able to set-up, in a short time, a numerical wave tank to analyze the interaction of waves with coastal and offshore structures. IHFOAM-GUI builds up the folders and the files needed to set-up a case guiding the user along several menus. Additionally, numerical proves can be inserted and post-processed along the GUI menu.
* The current version is 2.0, as released in 15th July 2014.
+
* Bug fixes will be issued on a regular basis, while the development of version 3.0 is currently ongoing.  
+
* The new version will include major changes in the structure of the boundary conditions, which will not affect the use.
+
  
Future releases will include:
+
IHFOAM-GUI is freely downloadable from the following link including a tutorial:
* Volume-averaged turbulence models, as seen in [http://dx.doi.org/10.1016/j.coastaleng.2013.08.010 the third paper].
+
* Current generation (already pre-implemented but not referenced, as it needs further work and validation).
+
* Wave theories implemented as classes, gathered by an autoPtr.
+
  
Future releases may include:
+
http://ihfoam.ihcantabria.com/model/gui/
* Custom IHdynamicRefineFvMesh to enable dynamic mesh refinement on snappyHexMesh-generated meshes, as seen in [http://dx.doi.org/10.1016/j.coastaleng.2013.09.002 the fourth paper].
+
* Custom boundary condition to generate waves using moving boundaries, as presented in [http://registration.sdewes.org/ofw09/dfile.php?dm=Px66e485b2cbb21c4047057636a5a9b187cdb36989x2 OFW9].
+
  
=== References and Citing ===
+
IHFOAM-GUI has been designed within the Coastal Hydrodynamics and Infrastructures Group in IHCantabria comprised by ten members. Future IHFOAM developments will be included in OpenFOAM® to be released by ESI Group and included in IHFOAM-GUI.
IHFOAM is a product developed in the frame of a Master and PhD Thesis at the [http://www.ihcantabria.com/en/ Environmental Hydraulics Institute "IH Cantabria"] of the [http://www.unican.es University of Cantabria]. The PhD thesis can be found and downloaded for free here:
+
  
[http://www.tesisenred.net/handle/10803/288368 IHFOAM Pablo Higuera PhD Thesis]
+
IHCantabria developments has passed along a thorough validation with existing or tailored designed laboratory tests. Validation results are published in peer reviewed journals. Visit our web page for further details.
  
If you want to reference the model in your publications it should be called '''IHFOAM''', either if you are only using the wave generation and absorption capabilities (that was IHFOAM version 1.0) or the new porous media capabilities (that is IHFOAM version 2.0).
+
=== Ongoing Development ===
 +
* The current version is IHFOAM-v2.0.
 +
* In 2016, IHCantabria reached an agreement with ESI Group to include the IHFOAM developments in OpenFOAM® releases, which are presented every six months.
 +
 
 +
=== References and Citing ===
 +
IHFOAM is a product developed in the [http://www.ihcantabria.com/en/ Environmental Hydraulics Institute "IH Cantabria"] of the [http://www.unican.es University of Cantabria].. If you want to reference the model in your publications it should be called '''IHFOAM'''.
  
 
The implementation and validation details are published in the following references:
 
The implementation and validation details are published in the following references:
  
(2015) [http://www.sciencedirect.com/science/article/pii/S0029801815003649 Validation of OpenFOAM® for Oscillating Water Column three-dimensional modeling.]
+
    Solitary wave attenuation by vegetation patches.
<pre>
+
    Maza, M, Lara, J.L., & Losada, I.J. [2016]
Validation of OpenFOAM® for Oscillating Water Column three-dimensional modeling.
+
    Advances in Water Resources [Vol.98, pp. 159-172]
Iturrioz, A., Guanche, R., Lara, J.L., Vidal, C., & Losada, I.J. [2015]
+
    [http://www.sciencedirect.com/science/article/pii/S0309170816302196  http://doi.org/10.1016/j.advwatres.2016.10.021 ]
Ocean Engineering [Vol. 107, pp. 222-237]
+
http://dx.doi.org/10.1016/j.oceaneng.2015.07.051
+
</pre>
+
  
 +
    Validation of OpenFOAM® for Oscillating Water Column three-dimensional modeling.
 +
    Iturrioz, A., Guanche, R., Lara, J.L., Vidal, C., & Losada, I.J. [2015]
 +
    Ocean Engineering [Vol. 107, pp. 222-237]
 +
    http://dx.doi.org/10.1016/j.oceaneng.2015.07.051
  
(2015) [http://www.sciencedirect.com/science/article/pii/S0378383915000113 Tsunami wave interaction with mangrove forests: A 3-D numerical approach.]
+
    Tsunami wave interaction with mangrove forests: A 3-D numerical approach.
<pre>
+
    Maza, M, Lara, J.L., & Losada, I.J. [2015]
Tsunami wave interaction with mangrove forests: A 3-D numerical approach.
+
    Coastal Engineering [Vol.98, pp. 33-54]
Maza, M, Lara, J.L., & Losada, I.J. [2015]
+
    http://dx.doi.org/10.1016/j.oceaneng.2015.07.051
Coastal Engineering [Vol.98, pp. 33-54]
+
http://dx.doi.org/10.1016/j.oceaneng.2015.07.051
+
</pre>
+
  
 +
    Three-dimensional numerical wave generation with moving boundaries.
 +
    Higuera, P., Lara, J.L. & Losada, I.J. [2015]
 +
    Coastal Engineering [Vol.101, pp. 35-47]
 +
    http://dx.doi.org/10.1016/j.oceaneng.2015.07.051
  
(2015) [http://www.sciencedirect.com/science/article/pii/S0378383915000113 Three-dimensional numerical wave generation with moving boundaries.]
+
    Three-Dimensional Interaction of Waves and Porous Coastal Structures using OpenFOAM®. Part II: Application.
<pre>
+
    Higuera, P., Lara, J.L. & Losada, I.J. [2014]
Three-dimensional numerical wave generation with moving boundaries.
+
    Coastal Engineering [Vol. 83, pp. 259-270]
Higuera, P., Losada, I.J. and  Lara, J.L. (2015)
+
    http://dx.doi.org/10.1016/j.coastaleng.2013.09.002
Coastal Engineering, Vol. 101, pp. 35–47
+
</pre>
+
  
 +
    Three-Dimensional Interaction of Waves and Porous Coastal Structures using OpenFOAM®. Part I: Formulation and Validation.
 +
    Higuera, P., Lara, J.L. & Losada, I.J. [2014]
 +
    Coastal Engineering [Vol. 83, pp. 243-258]
 +
    http://dx.doi.org/10.1016/j.coastaleng.2013.08.010
  
(2014) [http://dx.doi.org/10.1016/j.coastaleng.2013.09.002 Three-dimensional interaction of waves and porous coastal structures using OpenFOAM. Part II: Application.]
+
    Simulating Coastal Engineering Processes with OpenFOAM®.
<pre>
+
    Higuera, P., Lara, J.L. & Losada, I.J. [2013]
Three-dimensional interaction of waves and porous coastal structures using OpenFOAM. Part II: Application.
+
    Coastal Engineering [Vol. 71, pp. 119-134]
Higuera, P., Lara, J.L. and Losada, I.J. (2014)
+
    http://dx.doi.org/10.1016/j.coastaleng.2012.06.002
Coastal Engineering, Vol. 83, pp. 259–270
+
</pre>
+
  
 
+
    Realistic Wave Generation and Active Wave Absorption for Navier-­Stokes Models. Application to OpenFOAM®.
(2014) [http://dx.doi.org/10.1016/j.coastaleng.2013.08.010 Three-dimensional interaction of waves and porous coastal structures using OpenFOAM. Part I: Formulation and validation.]
+
    Higuera, P., Lara, J.L. & Losada, I.J. [2013]
<pre>
+
    Coastal Engineering [Vol. 71, pp. 102-118]
Three-dimensional interaction of waves and porous coastal structures using OpenFOAM. Part I: Formulation and validation.
+
    http://dx.doi.org/10.1016/j.coastaleng.2012.07.002
Higuera, P., Lara, J.L. and Losada, I.J. (2014)
+
Coastal Engineering, Vol. 83, pp. 243-258
+
</pre>
+
 
+
 
+
(2013) [http://dx.doi.org/10.1016/j.coastaleng.2012.06.002 Simulating coastal engineering processes with OpenFOAM.]
+
<pre>
+
Simulating coastal engineering processes with OpenFOAM.
+
Higuera, P., Lara, J.L. and Losada, I.J. (2013)
+
Coastal Engineering, Vol. 71, pp. 119-134.
+
</pre>
+
 
+
 
+
(2013) [http://dx.doi.org/10.1016/j.coastaleng.2012.07.002 Realistic wave generation and active wave absorption for Navier-Stokes models: Application to OpenFOAM.]
+
<pre>
+
Realistic wave generation and active wave absorption for Navier-Stokes models: Application to OpenFOAM.
+
Higuera, P., Lara, J.L. and Losada, I.J. (2013)
+
Coastal Engineering, Vol. 71, pp. 102-118.
+
</pre>
+
 
+
=== Get Connected ===
+
To submit your feedback, suggestions, bugs... you have many options:
+
* The IHFOAM e-mail, found [http://ihfoam.ihcantabria.com/contact/ here].
+
* The e-mail found within the source code headers.
+
* The [https://www.linkedin.com/groups?home=&gid=4548979 IHFOAM LinkedIn group].
+
* At cfd-online forum, username Phicau.
+
 
+
IHFOAM at cfd-online
+
* [http://www.cfd-online.com/Forums/openfoam-news-announcements-other/138985-ihfoam-release.html IHFOAM Release Thread]
+
* [http://www.cfd-online.com/Forums/openfoam-solving/138987-ihfoam-thread.html IHFOAM Support Thread]
+
 
+
You can be informed and get all the latest news by joining our [http://ihfoam.ihcantabria.com/source-download/ mailing list]
+
 
+
While we create a Mantis bug tracker or similar, bug reports can be submitted using any of the methods shown above or through [https://github.com/phicau/IHFOAM/issues github issues].
+
  
 
== Source Download and Compilation ==
 
== Source Download and Compilation ==
Line 153: Line 83:
  
 
=== Source Code Download ===
 
=== Source Code Download ===
You can find IHFOAM in [https://github.com/phicau/IHFOAM GitHub], and it can be downloaded in zip format.
+
You can find IHFOAM in [https://github.com/IHFOAM/ihFOAM GitHub], and it can be downloaded in zip format.
  
 
For a more convenient download of the source code, run the following command:
 
For a more convenient download of the source code, run the following command:
  
 
<pre>
 
<pre>
git clone git://github.com/phicau/IHFOAM.git
+
git clone git://github.com/IHCantabria/ihFOAM.git
 
</pre>
 
</pre>
  
Line 164: Line 94:
  
 
<pre>
 
<pre>
git clone https://github.com/phicau/IHFOAM.git
+
git clone https://github.com/IHCantabria/ihFOAM.git
git clone http://github.com/phicau/IHFOAM.git
+
git clone https://github.com/IHCantabria/ihFOAM.git
 
</pre>
 
</pre>
  
Line 178: Line 108:
  
 
=== Source Code Structure ===
 
=== Source Code Structure ===
IHFOAM source code is divided in two main folders:
+
IHFOAM source code is divided in two main topics:
* '''genAbs''' --> Generation and absorption boundary conditions
+
* '''generation'''  
** '''waveAbsorption''' --> (BCs)
+
** Stokes-I
** '''waveGeneration''' --> (BCs)
+
** Stokes-II
** '''common''' --> Scripts shared by both BCs
+
** Stokes-V
* '''solvers''' --> Guess what's inside...
+
** Cnoidal
** '''ihFoamXXXXX''' --> One for each compatible version, including ihFoam and ihDyMFoam
+
** solitary Boussinesq
 +
** solitary Grimshaw
 +
** solitary McCowan
 +
* '''absorption'''
 +
** Shallow Water Absorption
  
=== Compilation ===
+
=== OpenFOAM version ===
Compilation has been automatized and needs to be performed only once. Since IHFOAM does not need any dependencies, the source code can be downloaded and compiled anywhere on your computer.
+
IHFOAM-v2.0 is a new set of boundary conditions, which are formulated using a new concept based on the introduction of mass and momentum along the boundaries, improves the ones initially develop by IHCantabria in 2014 and working with OpenCFD developers reduces the computational cost by around a 30%.
  
* '''First''' compile the boundary conditions:
+
IHCantabria has contributed to releases v1612+ and v1706, presented in December 2016 and June 2017, respectively. Both releases included a new set of boundary conditions to generate and absorb waves at the boundaries without the use of dissipation areas to damp wave energy
<pre>
+
cd genAbs
+
./allMake
+
</pre>
+
 
+
The script will figure out which version of OpenFOAM or FOAM-extend you are running and set a convenient preprocessor statement to adjust the code automatically to each flavour/version.
+
 
+
* '''Second''' compile the solvers: ihFoam and ihDyMFoam
+
<pre>
+
cd solvers/ihFoamXXXXX
+
./allMake
+
</pre>
+
 
+
Where XXXXX denotes your flavour (OpenFOAM - OF, FOAM-extend - FE) and your version. The currently supported versions have already been [[#Supported_Versions | shown]].
+
 
+
=== Dynamic Linking of the Boundary Conditions ===
+
In order to include the wave generation and active wave absorption boundary conditions without needing to re-compile a solver, write the following code in controlDict:
+
 
+
<pre>
+
libs
+
(
+
    "libIHwaveGeneration.so"
+
    "libIHwaveAbsorption.so"
+
);
+
</pre>
+
 
+
== IHFOAM Usage ==
+
'''IMPORTANT NOTES:'''
+
* IHFOAM is programmed in such a way that gravity has to act in the negative Z direction.
+
* Currently the X and Y coordinates of each boundary face are substituted by those of the centroid of the paddle to which the face belongs (similarly to what happens in the laboratory). Therefore, to obtain accurate directionality you need several paddles (''nPaddles'' >> 1). Next releases will change the implementation so you can choose.
+
* Angles such as ''waveDir'' and ''absDir'' are measured in degrees with respect to the positive X axis (0º), growing towards the positive Y axis (90º).
+
 
+
=== ihFoam and ihDyMFoam Solvers ===
+
'''IMPORTANT NOTE:'''
+
* IHFOAM has a slightly different formulation than the one published in the third [[#References_and_Citing | reference]], due to a volume-averaging approach with an ill-posed term. The results now, however, are as good as those shown on the validation, but with different friction factors. Check out the tutorials for the dam break validation case. The wrong term slightly changed the results where gradients of porosity appeared (i.e. at the interface between the porous medium and the clear fluid, or between porous media), where not many people measure, as the flow is very dependent on the local effects (the ones that we try to filter out by volume-averaging).
+
 
+
Porosity is introduced by setting an initial field. It can be done using the ''setFields'' utility, in a similar way to alpha1. This field is called ''porosityIndex'' and it features the index of the porous zone to which each cell belongs.
+
 
+
* If no ''porosityIndex'' field is found, ihFoam is identical to interFoam.
+
* Index 0 represents the clear region, outside any porous medium.
+
* Practical examples can be found in the training materials.
+
 
+
The porous media properties (i.e. a, b and c friction factors, mean rock size and porosity) are included in '''constant/porosityDict'''
+
 
+
<pre>
+
a               n(0.0 ... );
+
b              n(0.0 ... );
+
c              n(0.0 ... );
+
 
+
D50            n(1.0 ... );
+
porosity        n(1.0 ... );
+
</pre>
+
 
+
* The first values should always be as shown, as they represent the clear flow region.
+
* n is the number of materials.
+
 
+
=== Wave Generation BCs ===
+
To generate waves you have to set the following boundary conditions.
+
 
+
For alpha1:
+
<pre>
+
    inlet
+
    {
+
        type            IH_Waves_InletAlpha;
+
        waveDictName    IHWavesDict;
+
        value          uniform 0;
+
    }
+
</pre>
+
 
+
For U:
+
<pre>
+
    inlet
+
    {
+
        type            IH_Waves_InletVelocity;
+
        waveDictName    IHWavesDict;
+
        value          uniform (0 0 0);
+
    }
+
</pre>
+
 
+
* The other boundary condition needed is:
+
** ''buoyantPressure'' for ''p_rgh''
+
 
+
==== Wave Generation Dictionary ====
+
[[File:IHFOAM_generationOptions.png|thumbnail|400x280px|Wave generation dictionary options]]
+
 
+
* The wave conditions are read from a dictionary file located in the '''constant''' folder.
+
* By default it is named '''IHWavesDict''', however, you can name it differently setting '''waveDictName'''.
+
* This way you can even specify different wave conditions for different patches on your case.
+
 
+
All the options are gathered in the figure on the right. The rectangles indicate the different parameters and the rounded boxes denote the options available. A complete showcase for the different wave theories can be found in the '''reference/IHWavesDict''' folder.
+
 
+
Implemented wave theories:
+
 
+
{| class="wikitable" style="color:black"
+
|-
+
! waveType / waveTheory !! Reference !! Comments
+
|-
+
| regular / StokesI || Dean and Dalrymple (1991) ||
+
|-
+
| regular / StokesII || Dean and Dalrymple (1991) ||
+
|-
+
| regular / StokesV || Skjelbreia and Hendrickson (1960) ||
+
|-
+
| regular / cnoidal || Svendsen (2006) ||
+
|-
+
| regular / streamfunction || Fenton (1988) || No solver programmed. Use Fenton's [http://johndfenton.com/Steady-waves/Fourier.html Fourier solver] (old version tested only, distributed with the materials) to set all the parameters required.
+
|-
+
| solitary / Boussinesq || Lee et al. (1982) ||
+
|-
+
| wavemaker / (tx/tv/txeta/tveta) || Own development || waveTheory depending on what you provide: '''t''' (time series), '''x''' (paddle displacement), '''eta''' (free surface elevation). Note that this BC replicates the wavemaker (constant) profile, but it does not move.
+
|-
+
| irregular / () || Dean and Dalrymple (1991) || Linear summation of StokesI components. Second order by Longuet-Higgins and Stewart (1960) completed with Baldock et al. (1996)
+
|}
+
 
+
Active wave absorption can be connected on the wave generation boundary so that waves incident to it flow out while still generating the target waves. If no other boundary is absorbing it sould be connected, to avoid a mean water level increase due to the stokes drift.
+
* Controlled by ''genAbs'' bool variable: true/false
+
* Correction velocity applied in the ''absDir'' direction. When not set or set greater than 360, it defaults the perpendicular direction to the boundary. See the first [[#References_and_Citing | reference]] for a complete explanation on when it is convenient to set ''absDir''.
+
* You can select ''nPaddles'' greater than 1 to obtain a better directional absorption.
+
 
+
==== Wave Formulae Form ====
+
All the waves in IHFOAM are generated in a similar way to the following implementation (Stokes I):
+
 
+
<math>\eta = \frac{H}{2} cos \left( k_x x + k_y y - \omega t + \psi \right)</math>
+
 
+
This means that the free surface elevation (eta) is dependent of the patch location. If you want to keep the phase meaningful I would recommend you to locate the wave generation patch at X = 0, although this is not a must.
+
 
+
=== Wave Absorption BCs ===
+
Why pure active wave absorption conditions when wave generation already includes it? Pure active wave absorption, disregarding wave generation, allows a more sofisticated treatment and better performance.
+
 
+
To absorb waves you have to set the following boundary condition for U. This time nothing is read from a dictionary, so everything is set at the boundary condition level. The default values are shown, so the parameters that need no different value can be left out.
+
 
+
2D-theory version, applicable to 2D/3D:
+
<pre>
+
    outlet
+
    {
+
        type            IH_3D_2DAbsorption_InletVelocity;;
+
        nPaddles        1;
+
        nEdgeMin        0;
+
        nEdgeMax        0;
+
        absorptionDir  400;
+
        value          uniform (0 0 0);
+
    }
+
</pre>
+
 
+
* ''absorptionDir'' can be used to obtain Quasi-3D behaviour (see the first [[#References_and_Citing | reference]]). Its default value is greater than 360, so absorption is applied to the perpendicular direction to the patch.
+
 
+
3D-theory version, applicable to 3D:
+
<pre>
+
    outlet
+
    {
+
        type            IH_3D_3DAbsorption_InletVelocity;;
+
        nPaddles        1;
+
        nEdgeMin        0;
+
        nEdgeMax        0;
+
        value          uniform (0 0 0);
+
    }
+
</pre>
+
 
+
The differences between both are explained in the first [[#References_and_Citing | reference]]. If you are unsure whether to use the 2D or 3D version, use the 2D, as its range of applicability is wider.
+
 
+
* The rest of the boundary conditions needed are:
+
** ''zeroGradient'' for ''alpha1''
+
** ''buoyantPressure'' for ''p_rgh''
+
 
+
Similarly to wave generation, setting ''nPaddles'' > 1 will allow directional absorption, as each paddles (vertical slices of the patch) absorbs the waves independently. For stability reasons try to keep your paddles approximately 5 cells wide at least.
+
 
+
* The patch is splitted in ''nPaddles'' vertical transects according to its orientation
+
** If it is more perpendicular to the X axis, it uses the Y coordinates to divide the patch in ''nPaddles'' between YMin and YMax. nEdgeMin starts to count from YMin. nEdgeMax starts to count from YMax.
+
** If it is more perpendicular to the Y axis, it uses the X coordinates to divide the patch in ''nPaddles'' between XMin and XMax. nEdgeMin starts to count from XMin. nEdgeMax starts to count from XMax.
+
* ''nEdgeMin'' and ''nEdgeMax'' solve some issues that appear on the corners, selecting a number of paddles that are only capable of taking water out according to the 2D theory.
+
  
 
== IHFOAM Documentation and Tutorials ==
 
== IHFOAM Documentation and Tutorials ==
Line 367: Line 131:
  
 
Upon registration you will receive an e-mail with the download link. We kindly ask you to respect this procedure, and not to redistribute the download link, as the information regarding how many people, where and how are using the code is important for us. As stated on the Terms and Conditions, your personal information (i.e. name and e-mail) will never be shared. You can also sign up for the mailing list, to get the latest information about IHFOAM new releases and training courses.
 
Upon registration you will receive an e-mail with the download link. We kindly ask you to respect this procedure, and not to redistribute the download link, as the information regarding how many people, where and how are using the code is important for us. As stated on the Terms and Conditions, your personal information (i.e. name and e-mail) will never be shared. You can also sign up for the mailing list, to get the latest information about IHFOAM new releases and training courses.
 
=== Documentation ===
 
A brief reference document is included.
 
 
==== FourierFenton ====
 
Old version of Fenton's Fourier program to obtain the input parameters needed to set up streamfunction wave theory.
 
 
==== IHwavesDict ====
 
Directory that includes a sample of IHwavesDict file for each supported wave theory.
 
 
=== Tutorials ===
 
A set of tutorials, covering the use of ihFoam and the wave generation boundary conditions, is available. All the cases include a ''runCase'' and ''cleanCase''. The first one runs all the steps needed to simulate the case and sampling/validation (when available). The second one resets the case to its initial state (i.e. with a very small size).
 
 
The practical cases are as follows.
 
 
==== baseWaveFlume ====
 
A simple wave flume (i.e. 2D channel).
 
 
* Waves are generated on the left patch (inlet).
 
* Waves are absorbed on the right patch (outlet), according to the 2D theory.
 
* Water depth is set to 0.4 m.
 
* The wave conditions are specified in '''constant/IHwavesDict'''.
 
** Regular waves, 0.1 m high and with 3 s of period are generated according to the cnoidal theory.
 
* No porosity involved.
 
* The case can be run very fast in serial.
 
 
==== irreg45degTank ====
 
A more advanced wave case. This is a 3D wave tank with a peculiar shape, similar to the one used in the first [[#References_and_Citing | reference]]. An irregular sea state is generated at patch X = 0, and absorbed elsewhere.
 
 
* A directional, irregular sea state is generated (842 wave components).
 
** Note ''nPaddles'' value for directionality
 
* On the rest of the patches, the waves are absorbed according to the 3D theory.
 
** Note also ''nPaddles'', ''nEdgeMin'' and ''nEdgeMin'' values.
 
* No porosity involved.
 
* Case to be better run in parallel. Some [[#Supported_Versions | known issues]] exist for several OpenFOAM and FOAM-extend versions.
 
 
==== CR35_dambreak ====
 
A classic benchmark case to validate free surface flow through a porous medium. It is a 2D dam break in a tank.
 
 
* Porosity.
 
** Note the ''porosityIndex'' field at the 0 folder.
 
** ''porosityIndex'' is set using ''setFields'', check ''setFieldsDict'' out.
 
** The porous variables are set in '''constant/porosityDict'''.
 
* Validation is included.
 
** Sampling is not needed as free surface is obtained with a function object (included in controlDict).
 
** Requirement: matplotlib (a.k.a. pylab)
 
** A python script (''plotValidation.py'') can be run in the end to plot a comparison between the experimental and numerical data.
 
* The case can be run very fast in serial.
 
 
==== breakwater ====
 
A composite breakwater within a wave flume in 2D.
 
 
* Porosity.
 
** Note the ''porosityIndex'' field at the 0 folder.
 
** ''porosityIndex'' is set using ''setFields'', check ''setFieldsDict'' out for setting porosity inside STL files.
 
** The porous variables are set in '''constant/porosityDict'''. This time several porous media are included.
 
* Waves are generated in the left patch (inlet)
 
* Waves are absorbed on the right patch (outlet), according to the 2D theory.
 
* Water depth is set to 0.8 m.
 
* The wave conditions are specified in '''constant/IHwavesDict'''.
 
** Regular waves, 0.25 m high and with 3 s of period are generated according to the cnoidal theory.
 
* Samping of free surface elevation and pressure is included.
 
** Requirement: matplotlib (a.k.a. pylab)
 
** Python scripts are included for postprocessing OpenFOAM results: postSens*.py
 
** Python scripts are included for plotting postprocessed results: plotSens*.py
 
* The case can be run very fast in serial.
 
 
This case also involves turbulence modelling. In future releases it will include the volume-averaged k-epsilon model.
 
 
 
 
--[[User:IH CANTABRIA|IH CANTABRIA]] 14:00, .05 October 2015 (CEST)
 

Latest revision as of 13:43, 9 October 2017

IHFOAM is a set of solvers and boundary conditions to generate and absorb water waves actively at the boundaries and to simulate their interaction with porous coastal structures.

The main scope of these modelling tools is coastal, marine, hydraulic and offshore engineering.

1 IHFOAM Overview

IHFOAM is a newly developed three-dimensional numerical two-phase flow solver specially designed to simulate coastal, offshore and hydraulic engineering processes. Its core is based on OpenFOAM®, a very advanced multiphysics model, widely used in the industry. What makes IHFOAM different from the rest of solvers is a wide collection of boundary conditions which handle wave generation and active absorption at the boundaries.

These specific boundary conditions allow to generate any type of wave in a 3D domain, from the most simple regular waves (Stokes I, II and V, streamfunction…) to complex, real and fully 3D irregular (random) directional sea states.

Active wave absorption has been programmed to work simultaneously with the wave generation to absorb any incident waves on the boundaries. These features do not increase the computational cost noticeably, and there is no need to extend the numerical domain, as it occurs with relaxation zones. Moreover, they allow for longer and more stable simulations without increasing water level or agitation. Currently the model can be applied to solve any impervious structures, both static and dynamic (floating structures). Some examples that have been simulated include: wave interaction with obstacles as vertical breakwaters, ships, offshore foundations, dam and spillway simulations, open channel flow…

The simulations can be at laboratory or prototype scale, for which domains over 1 square kilometer have been calculated. Needless to say, a thorough validation with well-known laboratory tests has been carried out and is published in Coastal Engineering. IHFOAM can also solve two-phase flow within porous media by means of the VARANS equations. This new approach will extend the calculation range for any type of coastal structures (e.g. rubble mound breakwaters).

OpenFOAM® is a registered trade mark of OpenCFD Limited, producer and distributor of the OpenFOAM software via www.openfoam.com.

1.1 IHFOAM GUI

IHFOAM-GUI has been designed following the request of many IHFOAM users to decrease the learning curve in the use of OpenFOAM® for coastal and ocean engineering. It is more than a standard OpenFOAM® GUI since it is especially designed to deal with free surface flows. The user will be able to set-up, in a short time, a numerical wave tank to analyze the interaction of waves with coastal and offshore structures. IHFOAM-GUI builds up the folders and the files needed to set-up a case guiding the user along several menus. Additionally, numerical proves can be inserted and post-processed along the GUI menu.

IHFOAM-GUI is freely downloadable from the following link including a tutorial:

http://ihfoam.ihcantabria.com/model/gui/

IHFOAM-GUI has been designed within the Coastal Hydrodynamics and Infrastructures Group in IHCantabria comprised by ten members. Future IHFOAM developments will be included in OpenFOAM® to be released by ESI Group and included in IHFOAM-GUI.

IHCantabria developments has passed along a thorough validation with existing or tailored designed laboratory tests. Validation results are published in peer reviewed journals. Visit our web page for further details.

1.2 Ongoing Development

  • The current version is IHFOAM-v2.0.
  • In 2016, IHCantabria reached an agreement with ESI Group to include the IHFOAM developments in OpenFOAM® releases, which are presented every six months.

1.3 References and Citing

IHFOAM is a product developed in the Environmental Hydraulics Institute "IH Cantabria" of the University of Cantabria.. If you want to reference the model in your publications it should be called IHFOAM.

The implementation and validation details are published in the following references:

   Solitary wave attenuation by vegetation patches.
   Maza, M, Lara, J.L., & Losada, I.J. [2016]
   Advances in Water Resources [Vol.98, pp. 159-172]
   http://doi.org/10.1016/j.advwatres.2016.10.021 
   Validation of OpenFOAM® for Oscillating Water Column three-dimensional modeling.
   Iturrioz, A., Guanche, R., Lara, J.L., Vidal, C., & Losada, I.J. [2015]
   Ocean Engineering [Vol. 107, pp. 222-237]
   http://dx.doi.org/10.1016/j.oceaneng.2015.07.051
   Tsunami wave interaction with mangrove forests: A 3-D numerical approach.
   Maza, M, Lara, J.L., & Losada, I.J. [2015]
   Coastal Engineering [Vol.98, pp. 33-54]
   http://dx.doi.org/10.1016/j.oceaneng.2015.07.051
   Three-dimensional numerical wave generation with moving boundaries.
   Higuera, P., Lara, J.L. & Losada, I.J. [2015]
   Coastal Engineering [Vol.101, pp. 35-47]
   http://dx.doi.org/10.1016/j.oceaneng.2015.07.051
   Three-Dimensional Interaction of Waves and Porous Coastal Structures using OpenFOAM®. Part II: Application.
   Higuera, P., Lara, J.L. & Losada, I.J. [2014]
   Coastal Engineering [Vol. 83, pp. 259-270]
   http://dx.doi.org/10.1016/j.coastaleng.2013.09.002
   Three-Dimensional Interaction of Waves and Porous Coastal Structures using OpenFOAM®. Part I: Formulation and Validation.
   Higuera, P., Lara, J.L. & Losada, I.J. [2014]
   Coastal Engineering [Vol. 83, pp. 243-258]
   http://dx.doi.org/10.1016/j.coastaleng.2013.08.010
   Simulating Coastal Engineering Processes with OpenFOAM®.
   Higuera, P., Lara, J.L. & Losada, I.J. [2013]
   Coastal Engineering [Vol. 71, pp. 119-134]
   http://dx.doi.org/10.1016/j.coastaleng.2012.06.002
   Realistic Wave Generation and Active Wave Absorption for Navier-­Stokes Models. Application to OpenFOAM®.
   Higuera, P., Lara, J.L. & Losada, I.J. [2013]
   Coastal Engineering [Vol. 71, pp. 102-118]
   http://dx.doi.org/10.1016/j.coastaleng.2012.07.002

2 Source Download and Compilation

IHFOAM download site can be found here.

2.1 Source Code Download

You can find IHFOAM in GitHub, and it can be downloaded in zip format.

For a more convenient download of the source code, run the following command:

git clone git://github.com/IHCantabria/ihFOAM.git

If the git protocol is blocked in your network try either of the following commands:

git clone https://github.com/IHCantabria/ihFOAM.git
git clone https://github.com/IHCantabria/ihFOAM.git

Code updates can be downloaded in the future from the IHFOAM folder as follows:

git checkout
git pull

Recompilation is required to apply the changes.

2.2 Source Code Structure

IHFOAM source code is divided in two main topics:

  • generation
    • Stokes-I
    • Stokes-II
    • Stokes-V
    • Cnoidal
    • solitary Boussinesq
    • solitary Grimshaw
    • solitary McCowan
  • absorption
    • Shallow Water Absorption

2.3 OpenFOAM version

IHFOAM-v2.0 is a new set of boundary conditions, which are formulated using a new concept based on the introduction of mass and momentum along the boundaries, improves the ones initially develop by IHCantabria in 2014 and working with OpenCFD developers reduces the computational cost by around a 30%.

IHCantabria has contributed to releases v1612+ and v1706, presented in December 2016 and June 2017, respectively. Both releases included a new set of boundary conditions to generate and absorb waves at the boundaries without the use of dissipation areas to damp wave energy

3 IHFOAM Documentation and Tutorials

The IHFOAM documentation and tutorials are not included in the Github bundle. Instead, they can be downloaded under request in the following site:

http://ihfoam.ihcantabria.com/source-download/

Upon registration you will receive an e-mail with the download link. We kindly ask you to respect this procedure, and not to redistribute the download link, as the information regarding how many people, where and how are using the code is important for us. As stated on the Terms and Conditions, your personal information (i.e. name and e-mail) will never be shared. You can also sign up for the mailing list, to get the latest information about IHFOAM new releases and training courses.