From 95e9467e849b2afc0a9dacf4ed5fbd184ac2acbe Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Wed, 16 Nov 2016 14:02:14 +0000 Subject: [PATCH 01/18] INT: Integration of functionality produced by The Environmental Hydraulics Institute "IHCantabria" (http://www.ihcantabria.com/en/) Capabilities include: - Wave generation - Solitary wave using Boussinesq theory - Cnoidal wave theory - StokesI, StokesII, StokesV wave theory - Active wave absorption at the inflow/outflow boundaries based on shallow water theory Authors: - Javier Lopez Lara (jav.lopez@unican.es) - Gabriel Barajas (barajasg@unican.es) - Inigo Losada (losadai@unican.es) --- integration/genAbs/allMake | 33 + .../calculatedLevelRegular.H | 88 ++ .../calculatedLevelRegularNormal.H | 76 ++ .../calculatedLevelSolitary.H | 30 + .../common/checks/checkInputErrorsRegular.H | 159 +++ .../common/checks/checkInputErrorsSolitary.H | 41 + integration/genAbs/common/memberFun.H | 355 +++++++ integration/genAbs/common/waveFun.C | 980 ++++++++++++++++++ integration/genAbs/common/waveFun.H | 95 ++ ...sorption_InletVelocityFvPatchVectorField.C | 339 ++++++ ...sorption_InletVelocityFvPatchVectorField.H | 199 ++++ integration/genAbs/waveAbsorption/Make/files | 3 + .../genAbs/waveAbsorption/Make/options | 7 + integration/genAbs/waveAbsorption/localMake | 25 + .../IH_Waves_InletAlphaFvPatchScalarField.C | 460 ++++++++ .../IH_Waves_InletAlphaFvPatchScalarField.H | 226 ++++ ...IH_Waves_InletVelocityFvPatchVectorField.C | 495 +++++++++ ...IH_Waves_InletVelocityFvPatchVectorField.H | 238 +++++ .../velProfiles/profileBoussinesq.H | 170 +++ .../velProfiles/profileCnoidal.H | 184 ++++ .../velProfiles/profileGENAB.H | 20 + .../velProfiles/profileStokesI.H | 187 ++++ .../velProfiles/profileStokesII.H | 186 ++++ .../velProfiles/profileStokesV.H | 186 ++++ .../velProfiles/velocityProfile.H | 36 + integration/genAbs/waveGeneration/Make/files | 5 + .../genAbs/waveGeneration/Make/options | 16 + integration/genAbs/waveGeneration/localMake | 25 + 28 files changed, 4864 insertions(+) create mode 100755 integration/genAbs/allMake create mode 100644 integration/genAbs/common/calculateWaterLevel/calculatedLevelRegular.H create mode 100644 integration/genAbs/common/calculateWaterLevel/calculatedLevelRegularNormal.H create mode 100644 integration/genAbs/common/calculateWaterLevel/calculatedLevelSolitary.H create mode 100644 integration/genAbs/common/checks/checkInputErrorsRegular.H create mode 100644 integration/genAbs/common/checks/checkInputErrorsSolitary.H create mode 100644 integration/genAbs/common/memberFun.H create mode 100644 integration/genAbs/common/waveFun.C create mode 100644 integration/genAbs/common/waveFun.H create mode 100644 integration/genAbs/waveAbsorption/IH_3D_3DAbsorption_InletVelocity/IH_3D_3DAbsorption_InletVelocityFvPatchVectorField.C create mode 100644 integration/genAbs/waveAbsorption/IH_3D_3DAbsorption_InletVelocity/IH_3D_3DAbsorption_InletVelocityFvPatchVectorField.H create mode 100644 integration/genAbs/waveAbsorption/Make/files create mode 100644 integration/genAbs/waveAbsorption/Make/options create mode 100755 integration/genAbs/waveAbsorption/localMake create mode 100644 integration/genAbs/waveGeneration/IH_Waves_InletAlpha/IH_Waves_InletAlphaFvPatchScalarField.C create mode 100644 integration/genAbs/waveGeneration/IH_Waves_InletAlpha/IH_Waves_InletAlphaFvPatchScalarField.H create mode 100644 integration/genAbs/waveGeneration/IH_Waves_InletVelocity/IH_Waves_InletVelocityFvPatchVectorField.C create mode 100644 integration/genAbs/waveGeneration/IH_Waves_InletVelocity/IH_Waves_InletVelocityFvPatchVectorField.H create mode 100644 integration/genAbs/waveGeneration/IH_Waves_InletVelocity/velProfiles/profileBoussinesq.H create mode 100644 integration/genAbs/waveGeneration/IH_Waves_InletVelocity/velProfiles/profileCnoidal.H create mode 100644 integration/genAbs/waveGeneration/IH_Waves_InletVelocity/velProfiles/profileGENAB.H create mode 100644 integration/genAbs/waveGeneration/IH_Waves_InletVelocity/velProfiles/profileStokesI.H create mode 100644 integration/genAbs/waveGeneration/IH_Waves_InletVelocity/velProfiles/profileStokesII.H create mode 100644 integration/genAbs/waveGeneration/IH_Waves_InletVelocity/velProfiles/profileStokesV.H create mode 100644 integration/genAbs/waveGeneration/IH_Waves_InletVelocity/velProfiles/velocityProfile.H create mode 100644 integration/genAbs/waveGeneration/Make/files create mode 100644 integration/genAbs/waveGeneration/Make/options create mode 100755 integration/genAbs/waveGeneration/localMake diff --git a/integration/genAbs/allMake b/integration/genAbs/allMake new file mode 100755 index 0000000000..defec71d8c --- /dev/null +++ b/integration/genAbs/allMake @@ -0,0 +1,33 @@ +#!/bin/bash + +if [ $WM_PROJECT == "foam" ]; then + ofversion=`echo $WM_PROJECT_VERSION | sed -e 's/\.x/-9/' -e 's/\./\'$'\n/g' -e 's/-/\'$'\n/g' | grep "[0-9]" | head -2 | tr -d '\n'` +else + ofversion=`echo $WM_PROJECT_VERSION"-0" | sed -e 's/\.x/-9/' -e 's/\./\'$'\n/g' -e 's/-/\'$'\n/g' -e 's/+/\'$'\n/g' -e 's/v/\'$'\n/g' | grep "[0-9]" | head -3 | tr -d '\n'` +fi + +#IHC_dbg +echo $ofversion +#---- + +export OF_VERSION=$ofversion + +wclean all > /dev/null + +wmake libso waveGeneration + +if (( $? )) ; then + echo "\n\nWave generation boundary conditions (V2.0-ESI) compilation failed" + exit; else + echo -e "\n\nIH Wave generationV2.0 boundary conditions (V2.0-ESI) compiled successfully for $WM_PROJECT $WM_PROJECT_VERSION\n\n\n"; +fi + +wmake libso waveAbsorption + +if (( $? )) ; then + echo "\n\nWave absorption boundary conditions (V2.0-ESI) compilation failed" + exit; else + echo -e "\n\nIH Wave absorption boundary conditions (V2.0-ESI) compiled successfully for $WM_PROJECT $WM_PROJECT_VERSION\n\n\n"; +fi + +wclean all > /dev/null diff --git a/integration/genAbs/common/calculateWaterLevel/calculatedLevelRegular.H b/integration/genAbs/common/calculateWaterLevel/calculatedLevelRegular.H new file mode 100644 index 0000000000..3c4f92b7b9 --- /dev/null +++ b/integration/genAbs/common/calculateWaterLevel/calculatedLevelRegular.H @@ -0,0 +1,88 @@ +/*---------------------------------------------------------------------------*\ + IH-Cantabria 2015 (http://www.ihcantabria.com/en/) + IHFOAM 2015 (http://ihfoam.ihcantabria.com/) + + Author(s): Javier Lopez Lara (jav.lopez@unican.es) + Gabriel Barajas (barajasg@unican.es) +\*---------------------------------------------------------------------------*/ + + if ( waveTheory_ == "StokesI" ) + { + forAll(calculatedLevel, itS1) + { + calculatedLevel[itS1] = RealwaterDepth_ + + timeMult * StokesIFun :: eta + ( + waveHeight_, + waveKx, + xGroup[itS1], + waveKy, + yGroup[itS1], + waveOmega, + currTime, + wavePhase_ + ); + } + } + else if ( waveTheory_ == "StokesII" ) + { + forAll(calculatedLevel, itS2) + { + calculatedLevel[itS2] = RealwaterDepth_ + + timeMult * StokesIIFun :: eta + ( + waveHeight_, + RealwaterDepth_, + waveKx, + xGroup[itS2], + waveKy, + yGroup[itS2], + waveOmega, + currTime, + wavePhase_ + ); + } + } + else if ( waveTheory_ == "StokesV" ) + { + forAll(calculatedLevel, it1) + { + calculatedLevel[it1] = RealwaterDepth_ + + timeMult * stokesVFun :: eta + ( + RealwaterDepth_, + waveKx, + waveKy, + lambdaStokesV_, + wavePeriod_, + xGroup[it1], + yGroup[it1], + currTime, + wavePhase_ + ); + } + } + else if ( waveTheory_ == "Cnoidal" ) + { + forAll(calculatedLevel, it3) + { + calculatedLevel[it3] = RealwaterDepth_ + + timeMult * cnoidalFun :: eta + ( + waveHeight_, + mCnoidal_, + waveKx, + waveKy, + wavePeriod_, + xGroup[it3], + yGroup[it3], + currTime + ); + } + } + else + { + FatalError << "Wave theory not supported, use:\n" + << "StokesI, StokesII, StokesV, Cnoidal, SolitaryBoussinesq" + << exit(FatalError); + } diff --git a/integration/genAbs/common/calculateWaterLevel/calculatedLevelRegularNormal.H b/integration/genAbs/common/calculateWaterLevel/calculatedLevelRegularNormal.H new file mode 100644 index 0000000000..09fa19c5ed --- /dev/null +++ b/integration/genAbs/common/calculateWaterLevel/calculatedLevelRegularNormal.H @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + IH-Cantabria 2015 (http://www.ihcantabria.com/en/) + IHFOAM 2015 (http://ihfoam.ihcantabria.com/) + + Author(s): Javier Lopez Lara (jav.lopez@unican.es) + Gabriel Barajas (barajasg@unican.es) +\*---------------------------------------------------------------------------*/ + + if ( waveTheory_ == "StokesI" ) + { + calculatedLevel = RealwaterDepth_ + + timeMult * StokesIFun :: eta + ( + waveHeight_, + waveKx, + xGroup[1], + waveKy, + yGroup[1], + waveOmega, + currTime, + wavePhase_ + ); + } + else if ( waveTheory_ == "StokesII" ) + { + calculatedLevel = RealwaterDepth_ + + timeMult * StokesIIFun :: eta + ( + waveHeight_, + RealwaterDepth_, + waveKx, + xGroup[1], + waveKy, + yGroup[1], + waveOmega, + currTime, + wavePhase_ + ); + } + else if ( waveTheory_ == "StokesV" ) + { + calculatedLevel = RealwaterDepth_ + + timeMult * stokesVFun :: eta + ( + RealwaterDepth_, + waveKx, + waveKy, + lambdaStokesV_, + wavePeriod_, + xGroup[1], + yGroup[1], + currTime, + wavePhase_ + ); + } + else if ( waveTheory_ == "Cnoidal" ) + { + calculatedLevel = RealwaterDepth_ + + timeMult * cnoidalFun :: eta + ( + waveHeight_, + mCnoidal_, + waveKx, + waveKy, + wavePeriod_, + xGroup[1], + yGroup[1], + currTime + ); + } + else + { + FatalError << "Wave theory not supported, use:\n" + << "StokesI, StokesII, StokesV, Cnoidal, SolitaryBoussinesq." + << exit(FatalError); + } diff --git a/integration/genAbs/common/calculateWaterLevel/calculatedLevelSolitary.H b/integration/genAbs/common/calculateWaterLevel/calculatedLevelSolitary.H new file mode 100644 index 0000000000..10ee599eb0 --- /dev/null +++ b/integration/genAbs/common/calculateWaterLevel/calculatedLevelSolitary.H @@ -0,0 +1,30 @@ +/*---------------------------------------------------------------------------*\ + IH-Cantabria 2015 (http://www.ihcantabria.com/en/) + IHFOAM 2015 (http://ihfoam.ihcantabria.com/) + + Author(s): Javier Lopez Lara (jav.lopez@unican.es) + Gabriel Barajas (barajasg@unican.es) +\*---------------------------------------------------------------------------*/ + + if ( waveTheory_ == "Boussinesq" ) + { + forAll(calculatedLevel, it2) + { + calculatedLevel[it2] = RealwaterDepth_ + + BoussinesqFun :: eta + ( + waveHeight_, + RealwaterDepth_, + xGroup[it2], + yGroup[it2], + waveAngle, + currTime, + X0 + ); + } + } + else + { + FatalError << "Wave theory not supported, use:\n" + << "Boussinesq" << exit(FatalError); + } diff --git a/integration/genAbs/common/checks/checkInputErrorsRegular.H b/integration/genAbs/common/checks/checkInputErrorsRegular.H new file mode 100644 index 0000000000..293ad83116 --- /dev/null +++ b/integration/genAbs/common/checks/checkInputErrorsRegular.H @@ -0,0 +1,159 @@ +/*---------------------------------------------------------------------------*\ + IH-Cantabria 2015 (http://www.ihcantabria.com/en/) + IHFOAM 2015 (http://ihfoam.ihcantabria.com/) + + Author(s): Javier Lopez Lara (jav.lopez@unican.es) + Gabriel Barajas (barajasg@unican.es) +\*---------------------------------------------------------------------------*/ + +if (nPaddles_ < 1) +{ + FatalError << "Check nPaddles value." << exit(FatalError); +} + +if ( nPaddles_ > 1 ) +{ + nPaddles_ = decreaseNPaddles( nPaddles_, patchD, dMin, dSpan ); + reduce(nPaddles_, minOp