Skip to content
Snippets Groups Projects
Commit 1eddbca6 authored by Gabriel Barajas's avatar Gabriel Barajas Committed by Andrew Heather
Browse files

INT: waveMaker boundary condition - added dynamic wave paddle of a solitary wave

Based on Goring et al., 1980
parent fc2add40
No related branches found
No related tags found
No related merge requests found
Showing
with 1038 additions and 16 deletions
......@@ -3,9 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2018 IH-Cantabria
\\/ M anipulation | Copyright (C) 2018 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -38,7 +36,8 @@ const Foam::Enum<Foam::waveMakerPointPatchVectorField::motionTypes>
Foam::waveMakerPointPatchVectorField::motionTypeNames
({
{ motionTypes::piston, "piston" },
{ motionTypes::flap, "flap" }
{ motionTypes::flap, "flap" },
{ motionTypes::solitary, "solitary" }
});
......@@ -60,9 +59,9 @@ const Foam::vector& Foam::waveMakerPointPatchVectorField::g()
}
Foam::scalar Foam::waveMakerPointPatchVectorField::waveLength
Foam::scalar Foam::waveMakerPointPatchVectorField::waveLength
(
const scalar h,
const scalar h,
const scalar T
)
{
......@@ -104,7 +103,7 @@ Foam::waveMakerPointPatchVectorField::waveMakerPointPatchVectorField
waveHeight_(0),
wavePhase_(0),
waveLength_(0),
rampTime_(0),
rampTime_(1),
secondOrder_(false)
{}
......@@ -117,7 +116,7 @@ Foam::waveMakerPointPatchVectorField::waveMakerPointPatchVectorField
)
:
fixedValuePointPatchField<vector>(p, iF, dict, false),
motionType_(motionTypeNames.get("motionType", dict)),
motionType_(motionTypeNames.lookup("motionType", dict)),
n_(dict.get<vector>("n")),
gHat_(Zero),
initialDepth_(dict.get<scalar>("initialDepth")),
......@@ -216,7 +215,7 @@ void Foam::waveMakerPointPatchVectorField::updateCoeffs()
if (secondOrder_)
{
motionX +=
motionX +=
sqr(waveHeight_)/(16*initialDepth_)
*(3*cosh(kh)/pow3(sinh(kh)) - 2/m1)
*sin(2*sigma*t);
......@@ -240,7 +239,7 @@ void Foam::waveMakerPointPatchVectorField::updateCoeffs()
if (secondOrder_)
{
motionX +=
motionX +=
sqr(waveHeight_)
/(32*initialDepth_)*(3*cosh(kh)
/pow3(sinh(kh)) - 2/m1);
......@@ -250,6 +249,54 @@ void Foam::waveMakerPointPatchVectorField::updateCoeffs()
break;
}
case motionTypes::solitary:
{
const scalar kappa_ = sqrt(3.0/4.0*waveHeight_/(pow(initialDepth_,3)));
const scalar waveCelerity_ = sqrt(mag(g())*(initialDepth_+waveHeight_));
const scalar stroke_ = sqrt(16.0*waveHeight_*initialDepth_/3.0);
wavePeriod_ = (2.0 / ( kappa_*waveCelerity_ ))*(3.8 + waveHeight_/
initialDepth_);
scalar motionX = 0;
const scalar error=0.001;
if (onlyFirst==0)
{
tAux = -wavePeriod_/2.0 + (t-tOld);
}
else
{
tAux = tAuxOld + (t-tOld);
}
//Newton-Rapshon
scalar theta1OF=0;
scalar theta2OF=0;
scalar er=10000;
while (er>error)
{
theta2OF = theta1OF - (theta1OF - kappa_*waveCelerity_*tAux
+ (waveHeight_/initialDepth_)*tanh(theta1OF) )
/ ( 1.0 + (waveHeight_/initialDepth_)*(1.0/cosh(theta1OF))*(1.0/cosh(theta1OF)));
er=fabs(theta1OF-theta2OF);
theta1OF=theta2OF;
}
motionX = waveHeight_ / (kappa_*initialDepth_)*tanh(theta1OF) + stroke_/2.0;
if (tAux != 0)
{
onlyFirst = 1;
}
tOld = t;
tAuxOld = tAux;
Field<vector>::operator=(n_*motionX);
break;
}
default:
{
FatalErrorInFunction
......@@ -257,7 +304,7 @@ void Foam::waveMakerPointPatchVectorField::updateCoeffs()
<< abort(FatalError);
}
}
fixedValuePointPatchField<vector>::updateCoeffs();
}
......
......@@ -3,9 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2018 IH-Cantabria
\\/ M anipulation | Copyright (C) 2018 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -42,7 +40,7 @@ Usage
\verbatim
leftwall
{
type waveMaker;
type waveMaker;
motionType flap;
n (1 0 0);
initialDepth 0.25;
......@@ -100,7 +98,8 @@ class waveMakerPointPatchVectorField
enum motionTypes
{
piston,
flap
flap,
solitary
};
//- Names for motion types
......@@ -141,6 +140,13 @@ class waveMakerPointPatchVectorField
//- On/off second order calculation switch
scalar secondOrder_;
//- Solitary time [-T/2, T/2]
scalar tOld = 0;
scalar tAux = 0;
scalar tAuxOld = 0;
scalar onlyFirst = 0;
// Protected Member Functions
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.7.x |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type movingWallVelocity;
value uniform (0 0 0);
}
outlet
{
type waveVelocity;
value uniform (0 0 0);
}
front1
{
type empty;
}
back1
{
type empty;
}
front2
{
type empty;
}
back2
{
type empty;
}
ground1
{
type fixedValue;
value uniform (0 0 0);
}
ground2
{
type fixedValue;
value uniform (0 0 0);
}
top1
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
top2
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5-dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
ground1
{
type zeroGradient;
}
ground2
{
type zeroGradient;
}
front1
{
type empty;
}
back1
{
type empty;
}
front2
{
type empty;
}
back2
{
type empty;
}
top1
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
top2
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5-dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type fixedFluxPressure;
value uniform 0;
}
outlet
{
type fixedFluxPressure;
value uniform 0;
}
ground1
{
type fixedFluxPressure;
value uniform 0;
}
ground2
{
type fixedFluxPressure;
value uniform 0;
}
front1
{
type empty;
}
back1
{
type empty;
}
front2
{
type empty;
}
back2
{
type empty;
}
top1
{
type totalPressure;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
p0 uniform 0;
value uniform 0;
}
top2
{
type totalPressure;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
p0 uniform 0;
value uniform 0;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class pointVectorField;
object pointDisplacement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 0 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
ground1
{
type zeroGradient;
}
ground2
{
type fixedValue;
value uniform (0 0 0);
}
inlet
{
type waveMaker;
value uniform (0 0 0);
motionType solitary;
x0 (0 0 0);
n (1 0 0);
waveHeight 0.1;
initialDepth 0.2;
wavePeriod 1.0;
rampTime 1.0;
wavePhase 0;
}
back1
{
type empty;
}
back2
{
type empty;
}
front1
{
type empty;
}
front2
{
type empty;
}
outlet
{
type fixedValue;
value uniform (0 0 0);
}
top1
{
type zeroGradient;
}
top2
{
type zeroGradient;
}
}
// ************************************************************************* //
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
cleanCase0
#------------------------------------------------------------------------------
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
restore0Dir
runApplication blockMesh
runApplication decomposePar
runParallel setFields
runParallel $(getApplication)
#------------------------------------------------------------------------------
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs ("libfvMotionSolvers.so");
solver displacementLaplacian;
displacementLaplacianCoeffs
{
diffusivity inverseDistance (inlet);
}
// ************************************************************************* //
/*--------------------------------*- C++-*----------------------------------*\\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value ( 0.0 0.0 -9.81 );
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.3 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phases (water air);
water
{
transportModel Newtonian;
nu [0 2 -1 0 0 0 0] 1e-06;
rho [1 -3 0 0 0 0 0] 1000;
}
air
{
transportModel Newtonian;
nu [0 2 -1 0 0 0 0] 1.48e-05;
rho [1 -3 0 0 0 0 0] 1;
}
sigma [1 0 -2 0 0 0 0] 0.07;
// ************************************************************************* //
/*--------------------------------*- C++-*----------------------------------*\\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object wavesProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
outlet
{
alpha alpha.water;
waveModel shallowWaterAbsorption;
nPaddle 1;
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
//mov
( 0 0 0)
( 4 0 0)
( 4 0.008 0)
( 0 0.008 0)
( 0 0 0.6)
( 4 0 0.6)
( 4 0.008 0.6)
( 0 0.008 0.6)
//static
( 6 0 0)
( 6 0.008 0)
( 6 0.008 0.6)
( 6 0 0.6)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (250 1 38) simpleGrading (1 1 1)
hex (1 8 9 2 5 11 10 6) (125 1 38) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
outlet
{
type patch;
faces
(
(8 11 10 9)
);
}
ground1
{
type wall;
faces
(
(0 1 2 3)
);
}
ground2
{
type wall;
faces
(
(1 8 9 2)
);
}
top1
{
type patch;
faces
(
(4 5 6 7)
);
}
top2
{
type patch;
faces
(
(5 11 10 6)
);
}
front1
{
type empty;
faces
(
(0 1 5 4)
);
}
back1
{
type empty;
faces
(
(3 2 6 7)
);
}
front2
{
type empty;
faces
(
(1 8 11 5)
);
}
back2
{
type empty;
faces
(
(2 9 10 6)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application interFoam;
startFrom latestTime;
startTime 0.0;
stopAt endTime;
endTime 10;
deltaT 0.01;
writeControl adjustableRunTime;
writeInterval 0.05;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.65;
maxAlphaCo 0.65;
maxDeltaT 0.05;
functions
{
lineMOVING
{
type sets;
libs ("libsampling.so");
enabled true;
writeControl writeTime;
outputInterval 1;
interpolationScheme cellPoint;
setFormat raw;
sets
(
line1
{
type uniform;
axis distance;
start ( 1.33 0.004 0.0 );
end ( 1.33 0.004 0.6 );
nPoints 101;
}
line2
{
type uniform;
axis distance;
start ( 3.33 0.004 0.0 );
end ( 3.33 0.004 0.6 );
nPoints 101;
}
);
fixedLocations false;
fields
(
p p_rgh U alpha.water
);
}
lineFIXED
{
type sets;
libs ("libsampling.so");
enabled true;
writeControl writeTime;
outputInterval 1;
interpolationScheme cellPoint;
setFormat raw;
sets
(
line3
{
type uniform;
axis distance;
start ( 5.33 0.004 0.0 );
end ( 5.33 0.004 0.6 );
nPoints 101;
}
line4
{
type uniform;
axis distance;
start ( 5.66 0.004 0.0 );
end ( 5.66 0.004 0.6 );
nPoints 101;
}
);
fixedLocations true;
fields
(
p p_rgh U alpha.water
);
}
}
// ************************************************************************* /
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
method hierarchical;
hierarchicalCoeffs
{
n (2 1 1);
delta 0.001;
order xyz;
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
div(rhoPhi,U) Gauss linearUpwind grad(U);
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear;;
div(phi,R) Gauss upwind;
div(R) Gauss linear;
div(phi,nuTilda) Gauss upwind;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
wallDist
{
method meshWave;
}
fluxRequired
{
default no;
p_rgh;
pcorr;
alpha;
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"(cellDisplacement|cellDisplacementFinal)"
{
solver GAMG;
tolerance 1e-5;
relTol 0;
smoother GaussSeidel;
cacheAgglomeration false;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
}
"alpha.water.*"
{
nAlphaCorr 1;
nAlphaSubCycles 2;
alphaOuterCorrectors yes;
cAlpha 1;
MULESCorr no;
nLimiterIter 3;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-8;
relTol 0;
}
"(pcorr|pcorrFinal)"
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
}
p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
}
p_rghFinal
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
}
UFinal
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
}
R
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
}
nuTilda
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
}
}
PIMPLE
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //
/*--------------------------------*- C++-*----------------------------------*\\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue alpha.water 0
volVectorFieldValue U (0 0 0)
);
regions
(
boxToCell
{
box ( -10.000 -10.000 -10.000 ) ( 250.000 250.000 0.2 );
fieldValues ( volScalarFieldValue alpha.water 1 );
}
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment