Commit 1eddbca6 authored by Gabriel Barajas's avatar Gabriel Barajas Committed by Andrew Heather

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

Based on Goring et al., 1980
parent fc2add40
......@@ -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