Merge branch 'master' into develop

This commit is contained in:
Andrew Heather
2017-02-03 12:29:49 +00:00
33 changed files with 418 additions and 363 deletions

View File

@ -148,8 +148,9 @@ runParallel()
# Store any parsed additional arguments e.g. decomposeParDict # Store any parsed additional arguments e.g. decomposeParDict
APP_PARARGS= APP_PARARGS=
# Check the default decomposeParDict if available
nProcs=$(getNumberOfProcessors system/decomposeParDict) # Initialise number of procs to unset value
nProcs=-1
# Parse options and executable # Parse options and executable
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
@ -185,6 +186,8 @@ runParallel()
shift shift
done done
[ "$nProcs" -eq -1 ] && nProcs=$(getNumberOfProcessors system/decomposeParDict)
if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ] if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
then then
echo "$APP_NAME already run on $PWD:" \ echo "$APP_NAME already run on $PWD:" \
@ -213,7 +216,7 @@ cloneCase()
else else
echo "Cloning $2 case from $1" echo "Cloning $2 case from $1"
mkdir $2 mkdir $2
cpfiles="0 system constant" cpfiles="0.orig 0 system constant"
for f in $cpfiles for f in $cpfiles
do do
\cp -r $1/$f $2 \cp -r $1/$f $2

View File

@ -32,7 +32,7 @@ Description
Note: cannot access the state dictionary until after construction of the Note: cannot access the state dictionary until after construction of the
function objects, since the owner container functionObjectList is owned function objects, since the owner container functionObjectList is owned
by time, and time owns the state dictionary. I.e. need to wait for time by time, and time owns the state dictionary. I.e. need to wait for time
to be fully consttucted. to be fully constructed.
See also See also
Foam::functionObject Foam::functionObject

View File

@ -51,7 +51,7 @@ namespace functionObjects
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class functionObjectFile Declaration Class writeFile Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class writeFile class writeFile

View File

@ -34,7 +34,7 @@ Description
Usage Usage
\table \table
Property | Description | Required | Default value Property | Description | Required | Default value
valueFraction | fraction od value used for boundary [0-1] | yes | valueFraction | fraction of value used for boundary [0-1] | yes |
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:

View File

@ -34,7 +34,7 @@ Foam::slipFvPatchField<Type>::slipFvPatchField
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
) )
: :
basicSymmetryFvPatchField<Type>(p, iF) basicSymmetryFvPatchField<Type>(p, iF)
{} {}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::functionObjects::runTimePostProcessing Foam::functionObjects::runTimePostPro::runTimePostProcessing
Group Group
grpGraphicsFunctionObjects grpGraphicsFunctionObjects

View File

@ -27,7 +27,7 @@ License
#include "dictionary.H" #include "dictionary.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "volFields.H" #include "volFields.H"
#include "coordinateSystem.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -63,7 +63,6 @@ SourceFiles
#include "surfaceFieldsFwd.H" #include "surfaceFieldsFwd.H"
#include "surfaceMesh.H" #include "surfaceMesh.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "coordinateSystems.H"
#include "interpolation.H" #include "interpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -27,6 +27,7 @@ License
#include "dictionary.H" #include "dictionary.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "volFields.H" #include "volFields.H"
#include "coordinateSystem.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -52,7 +52,6 @@ SourceFiles
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H" #include "surfaceFieldsFwd.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "coordinateSystems.H"
#include "interpolation.H" #include "interpolation.H"
#include "error.H" #include "error.H"
#include "IOobjectList.H" #include "IOobjectList.H"

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -264,15 +264,13 @@ void Foam::faceShading::calculate()
{ {
includeAllFacesPerPatch[patchI].insert includeAllFacesPerPatch[patchI].insert
( (
faceI //pp.start() faceI
); );
} }
} }
} }
} }
labelList triSurfaceToAgglom(5*nFaces);
triSurface localSurface = triangulate triSurface localSurface = triangulate
( (
includePatches, includePatches,
@ -294,9 +292,10 @@ void Foam::faceShading::calculate()
dict dict
); );
surfacesMesh.searchableSurface::write(); if (debug)
{
triSurfaceToAgglom.resize(surfacesMesh.size()); surfacesMesh.searchableSurface::write();
}
scalar maxBounding = 5.0*mag(mesh_.bounds().max() - mesh_.bounds().min()); scalar maxBounding = 5.0*mag(mesh_.bounds().max() - mesh_.bounds().min());
@ -324,7 +323,7 @@ void Foam::faceShading::calculate()
const vector d(direction_*maxBounding); const vector d(direction_*maxBounding);
start.append(fc - SMALL*d); start.append(fc - 0.001*d);
startIndex.append(myFaceId); startIndex.append(myFaceId);
@ -355,7 +354,7 @@ void Foam::faceShading::calculate()
( (
mesh_.time().path()/"allVisibleFaces.obj", mesh_.time().path()/"allVisibleFaces.obj",
end, end,
Cfs start
); );
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,7 +62,7 @@ Foam::waveModels::waveAbsorptionModel::waveAbsorptionModel
{ {
if (readFields) if (readFields)
{ {
read(dict); readDict(dict);
} }
} }
@ -75,9 +75,12 @@ Foam::waveModels::waveAbsorptionModel::~waveAbsorptionModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::waveAbsorptionModel::read(const dictionary& overrideDict) bool Foam::waveModels::waveAbsorptionModel::readDict
(
const dictionary& overrideDict
)
{ {
if (waveModel::read(overrideDict)) if (waveModel::readDict(overrideDict))
{ {
// Note: always set to true // Note: always set to true
activeAbsorption_ = true; activeAbsorption_ = true;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -77,7 +77,7 @@ public:
// Public Member Functions // Public Member Functions
//- Read from dictionary //- Read from dictionary
virtual bool read(const dictionary& overrideDict); virtual bool readDict(const dictionary& overrideDict);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -96,7 +96,7 @@ Foam::waveModels::shallowWaterAbsorption::shallowWaterAbsorption
{ {
if (readFields) if (readFields)
{ {
read(dict); readDict(dict);
} }
} }
@ -109,12 +109,12 @@ Foam::waveModels::shallowWaterAbsorption::~shallowWaterAbsorption()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::shallowWaterAbsorption::read bool Foam::waveModels::shallowWaterAbsorption::readDict
( (
const dictionary& overrideDict const dictionary& overrideDict
) )
{ {
return waveAbsorptionModel::read(overrideDict); return waveAbsorptionModel::readDict(overrideDict);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -94,7 +94,7 @@ public:
// Public Member Functions // Public Member Functions
//- Read from dictionary //- Read from dictionary
virtual bool read(const dictionary& overrideDict); virtual bool readDict(const dictionary& overrideDict);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -86,7 +86,7 @@ Foam::waveModels::regularWaveModel::regularWaveModel
{ {
if (readFields) if (readFields)
{ {
read(dict); readDict(dict);
} }
} }
@ -99,9 +99,12 @@ Foam::waveModels::regularWaveModel::~regularWaveModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::regularWaveModel::read(const dictionary& overrideDict) bool Foam::waveModels::regularWaveModel::readDict
(
const dictionary& overrideDict
)
{ {
if (waveGenerationModel::read(overrideDict)) if (waveGenerationModel::readDict(overrideDict))
{ {
lookup("rampTime") >> rampTime_; lookup("rampTime") >> rampTime_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -105,12 +105,13 @@ public:
// Public Member Functions // Public Member Functions
//- Read from dictionary //- Read from dictionary
virtual bool read(const dictionary& overrideDict); virtual bool readDict(const dictionary& overrideDict);
//- Info //- Info
virtual void info(Ostream& os) const; virtual void info(Ostream& os) const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels } // End namespace waveModels

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -70,7 +70,7 @@ Foam::waveModels::solitaryWaveModel::solitaryWaveModel
{ {
if (readFields) if (readFields)
{ {
read(dict); readDict(dict);
} }
} }
@ -83,9 +83,12 @@ Foam::waveModels::solitaryWaveModel::~solitaryWaveModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::solitaryWaveModel::read(const dictionary& overrideDict) bool Foam::waveModels::solitaryWaveModel::readDict
(
const dictionary& overrideDict
)
{ {
if (waveGenerationModel::read(overrideDict)) if (waveGenerationModel::readDict(overrideDict))
{ {
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -87,12 +87,13 @@ public:
// Public Member Functions // Public Member Functions
//- Read from dictionary //- Read from dictionary
virtual bool read(const dictionary& overrideDict); virtual bool readDict(const dictionary& overrideDict);
//- Info //- Info
virtual void info(Ostream& os) const; virtual void info(Ostream& os) const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels } // End namespace waveModels

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -55,7 +55,7 @@ Foam::waveModels::waveGenerationModel::waveGenerationModel
{ {
if (readFields) if (readFields)
{ {
read(dict); readDict(dict);
} }
} }
@ -68,9 +68,12 @@ Foam::waveModels::waveGenerationModel::~waveGenerationModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::waveGenerationModel::read(const dictionary& overrideDict) bool Foam::waveModels::waveGenerationModel::readDict
(
const dictionary& overrideDict
)
{ {
if (waveModel::read(overrideDict)) if (waveModel::readDict(overrideDict))
{ {
lookup("activeAbsorption") >> activeAbsorption_; lookup("activeAbsorption") >> activeAbsorption_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -80,7 +80,7 @@ public:
// Public Member Functions // Public Member Functions
//- Read from dictionary //- Read from dictionary
virtual bool read(const dictionary& overrideDict); virtual bool readDict(const dictionary& overrideDict);
//- Info //- Info
virtual void info(Ostream& os) const; virtual void info(Ostream& os) const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -101,7 +101,7 @@ Foam::vector Foam::waveModels::Boussinesq::Deta
} }
Foam::vector Foam::waveModels::Boussinesq::U Foam::vector Foam::waveModels::Boussinesq::Uf
( (
const scalar H, const scalar H,
const scalar h, const scalar h,
@ -139,6 +139,8 @@ Foam::vector Foam::waveModels::Boussinesq::U
} }
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
void Foam::waveModels::Boussinesq::setLevel void Foam::waveModels::Boussinesq::setLevel
( (
const scalar t, const scalar t,
@ -165,44 +167,6 @@ void Foam::waveModels::Boussinesq::setLevel
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::Boussinesq::Boussinesq
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
solitaryWaveModel(dict, mesh, patch, false)
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::Boussinesq::~Boussinesq()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::Boussinesq::read(const dictionary& overrideDict)
{
if (solitaryWaveModel::read(overrideDict))
{
return true;
}
return false;
}
void Foam::waveModels::Boussinesq::setVelocity void Foam::waveModels::Boussinesq::setVelocity
( (
const scalar t, const scalar t,
@ -224,7 +188,7 @@ void Foam::waveModels::Boussinesq::setVelocity
{ {
const label paddlei = faceToPaddle_[facei]; const label paddlei = faceToPaddle_[facei];
const vector Uf = U const vector Uf = this->Uf
( (
waveHeight_, waveHeight_,
waterDepthRef_, waterDepthRef_,
@ -242,6 +206,44 @@ void Foam::waveModels::Boussinesq::setVelocity
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::Boussinesq::Boussinesq
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
solitaryWaveModel(dict, mesh, patch, false)
{
if (readFields)
{
readDict(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::Boussinesq::~Boussinesq()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::Boussinesq::readDict(const dictionary& overrideDict)
{
if (solitaryWaveModel::readDict(overrideDict))
{
return true;
}
return false;
}
void Foam::waveModels::Boussinesq::info(Ostream& os) const void Foam::waveModels::Boussinesq::info(Ostream& os) const
{ {
solitaryWaveModel::info(os); solitaryWaveModel::info(os);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,12 +49,12 @@ class Boussinesq
: :
public solitaryWaveModel public solitaryWaveModel
{ {
protected: private:
// Protected Member Functions // Private Member Functions
//- Wave height //- Wave height
virtual scalar eta scalar eta
( (
const scalar H, const scalar H,
const scalar h, const scalar h,
@ -66,7 +66,7 @@ protected:
) const; ) const;
//- Wave //- Wave
virtual vector Deta vector Deta
( (
const scalar H, const scalar H,
const scalar h, const scalar h,
@ -78,7 +78,7 @@ protected:
) const; ) const;
//- Wave velocity //- Wave velocity
virtual vector U vector Uf
( (
const scalar H, const scalar H,
const scalar h, const scalar h,
@ -90,6 +90,11 @@ protected:
const scalar z const scalar z
) const; ) const;
protected:
// Protected Member Functions
//- Set the water level //- Set the water level
virtual void setLevel virtual void setLevel
( (
@ -128,12 +133,13 @@ public:
// Public Member Functions // Public Member Functions
//- Read from dictionary //- Read from dictionary
virtual bool read(const dictionary& overrideDict); virtual bool readDict(const dictionary& overrideDict);
//- Info //- Info
virtual void info(Ostream& os) const; virtual void info(Ostream& os) const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels } // End namespace waveModels

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -48,6 +48,26 @@ namespace waveModels
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
Foam::scalar Foam::waveModels::StokesI::eta
(
const scalar H,
const scalar Kx,
const scalar x,
const scalar Ky,
const scalar y,
const scalar omega,
const scalar t,
const scalar phase
) const
{
scalar phaseTot = Kx*x + Ky*y - omega*t + phase;
return H*0.5*cos(phaseTot);
}
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
Foam::scalar Foam::waveModels::StokesI::waveLength Foam::scalar Foam::waveModels::StokesI::waveLength
( (
const scalar h, const scalar h,
@ -66,24 +86,7 @@ Foam::scalar Foam::waveModels::StokesI::waveLength
} }
Foam::scalar Foam::waveModels::StokesI::eta Foam::vector Foam::waveModels::StokesI::UfBase
(
const scalar H,
const scalar Kx,
const scalar x,
const scalar Ky,
const scalar y,
const scalar omega,
const scalar t,
const scalar phase
) const
{
scalar phaseTot = Kx*x + Ky*y - omega*t + phase;
return H*0.5*cos(phaseTot);
}
Foam::vector Foam::waveModels::StokesI::U
( (
const scalar H, const scalar H,
const scalar h, const scalar h,
@ -141,46 +144,6 @@ void Foam::waveModels::StokesI::setLevel
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::StokesI::StokesI
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
regularWaveModel(dict, mesh, patch, false)
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::StokesI::~StokesI()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesI::read(const dictionary& overrideDict)
{
if (regularWaveModel::read(overrideDict))
{
waveLength_ = waveLength(waterDepthRef_, wavePeriod_);
return true;
}
return false;
}
void Foam::waveModels::StokesI::setVelocity void Foam::waveModels::StokesI::setVelocity
( (
const scalar t, const scalar t,
@ -207,7 +170,7 @@ void Foam::waveModels::StokesI::setVelocity
{ {
const label paddlei = faceToPaddle_[facei]; const label paddlei = faceToPaddle_[facei];
const vector Uf = U const vector Uf = UfBase
( (
waveHeight_, waveHeight_,
waterDepthRef_, waterDepthRef_,
@ -227,6 +190,46 @@ void Foam::waveModels::StokesI::setVelocity
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::StokesI::StokesI
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
regularWaveModel(dict, mesh, patch, false)
{
if (readFields)
{
readDict(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::StokesI::~StokesI()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesI::readDict(const dictionary& overrideDict)
{
if (regularWaveModel::readDict(overrideDict))
{
waveLength_ = waveLength(waterDepthRef_, wavePeriod_);
return true;
}
return false;
}
void Foam::waveModels::StokesI::info(Ostream& os) const void Foam::waveModels::StokesI::info(Ostream& os) const
{ {
regularWaveModel::info(os); regularWaveModel::info(os);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,15 +49,12 @@ class StokesI
: :
public regularWaveModel public regularWaveModel
{ {
protected: private:
// Protected Member Functions // Private Member Functions
//- Return the wavelength
virtual scalar waveLength(const scalar h, const scalar T) const;
//- Wave height //- Wave height
virtual scalar eta scalar eta
( (
const scalar H, const scalar H,
const scalar Kx, const scalar Kx,
@ -69,8 +66,16 @@ protected:
const scalar phase const scalar phase
) const; ) const;
protected:
// Protected Member Functions
//- Return the wavelength
virtual scalar waveLength(const scalar h, const scalar T) const;
//- Wave velocity //- Wave velocity
virtual vector U virtual vector UfBase
( (
const scalar H, const scalar H,
const scalar h, const scalar h,
@ -84,7 +89,6 @@ protected:
const scalar z const scalar z
) const; ) const;
//- Set the water level //- Set the water level
virtual void setLevel virtual void setLevel
( (
@ -123,12 +127,13 @@ public:
// Public Member Functions // Public Member Functions
//- Read from dictionary //- Read from dictionary
virtual bool read(const dictionary& overrideDict); virtual bool readDict(const dictionary& overrideDict);
//- Info //- Info
virtual void info(Ostream& os) const; virtual void info(Ostream& os) const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels } // End namespace waveModels

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -71,7 +71,9 @@ Foam::scalar Foam::waveModels::StokesII::eta
} }
Foam::vector Foam::waveModels::StokesII::U // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
Foam::vector Foam::waveModels::StokesII::UfBase
( (
const scalar H, const scalar H,
const scalar h, const scalar h,
@ -148,7 +150,7 @@ Foam::waveModels::StokesII::StokesII
{ {
if (readFields) if (readFields)
{ {
read(dict); readDict(dict);
} }
} }
@ -161,9 +163,9 @@ Foam::waveModels::StokesII::~StokesII()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesII::read(const dictionary& overrideDict) bool Foam::waveModels::StokesII::readDict(const dictionary& overrideDict)
{ {
if (StokesI::read(overrideDict)) if (StokesI::readDict(overrideDict))
{ {
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,12 +49,12 @@ class StokesII
: :
public StokesI public StokesI
{ {
protected: private:
// Protected Member Functions // Private Member Functions
//- Wave height //- Wave height
virtual scalar eta scalar eta
( (
const scalar H, const scalar H,
const scalar h, const scalar h,
@ -67,8 +67,13 @@ protected:
const scalar phase const scalar phase
) const; ) const;
protected:
// Protected Member Functions
//- Wave velocity //- Wave velocity
virtual vector U virtual vector UfBase
( (
const scalar H, const scalar H,
const scalar h, const scalar h,
@ -112,12 +117,13 @@ public:
// Public Member Functions // Public Member Functions
//- Read from dictionary //- Read from dictionary
virtual bool read(const dictionary& overrideDict); virtual bool readDict(const dictionary& overrideDict);
//- Info //- Info
virtual void info(Ostream& os) const; virtual void info(Ostream& os) const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels } // End namespace waveModels

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -680,7 +680,7 @@ Foam::scalar Foam::waveModels::StokesV::eta
} }
Foam::vector Foam::waveModels::StokesV::U Foam::vector Foam::waveModels::StokesV::Uf
( (
const scalar d, const scalar d,
const scalar kx, const scalar kx,
@ -722,17 +722,17 @@ Foam::vector Foam::waveModels::StokesV::U
scalar u = scalar u =
a1u*cosh(k*z)*cos(theta) a1u*cosh(k*z)*cos(theta)
+ a2u*cosh(2.0*k*z)*cos(2.0*(theta)) + a2u*cosh(2*k*z)*cos(2*theta)
+ a3u*cosh(3.0*k*z)*cos(3.0*(theta)) + a3u*cosh(3*k*z)*cos(3*theta)
+ a4u*cosh(4.0*k*z)*cos(4.0*(theta)) + a4u*cosh(4*k*z)*cos(4*theta)
+ a5u*cosh(5.0*k*z)*cos(5.0*(theta)); + a5u*cosh(5*k*z)*cos(5*theta);
scalar w = scalar w =
a1u*sinh(k*z)*sin(theta) a1u*sinh(k*z)*sin(theta)
+ a2u*sinh(2.0*k*z)*sin(2.0*(theta)) + a2u*sinh(2*k*z)*sin(2*theta)
+ a3u*sinh(3.0*k*z)*sin(3.0*(theta)) + a3u*sinh(3*k*z)*sin(3*theta)
+ a4u*sinh(4.0*k*z)*sin(4.0*(theta)) + a4u*sinh(4*k*z)*sin(4*theta)
+ a5u*sinh(5.0*k*z)*sin(5.0*(theta)); + a5u*sinh(5*k*z)*sin(5*theta);
scalar v = u*sin(waveAngle_); scalar v = u*sin(waveAngle_);
u *= cos(waveAngle_); u *= cos(waveAngle_);
@ -741,6 +741,8 @@ Foam::vector Foam::waveModels::StokesV::U
} }
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
void Foam::waveModels::StokesV::setLevel void Foam::waveModels::StokesV::setLevel
( (
const scalar t, const scalar t,
@ -773,71 +775,6 @@ void Foam::waveModels::StokesV::setLevel
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::StokesV::StokesV
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
regularWaveModel(dict, mesh, patch, false),
lambda_(0)
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::StokesV::~StokesV()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesV::read(const dictionary& overrideDict)
{
if (regularWaveModel::read(overrideDict))
{
scalar f1;
scalar f2;
scalar waveK;
initialise
(
waveHeight_,
waterDepthRef_,
wavePeriod_,
waveK,
lambda_,
f1,
f2
);
if (f1 > 0.001 || f2 > 0.001)
{
FatalErrorInFunction
<< "No convergence for Stokes V wave theory" << nl
<< " f1: " << f1 << nl
<< " f2: " << f2 << nl
<< exit(FatalError);
}
waveLength_ = 2.0*mathematical::pi/waveK;
return true;
}
return false;
}
void Foam::waveModels::StokesV::setVelocity void Foam::waveModels::StokesV::setVelocity
( (
const scalar t, const scalar t,
@ -863,7 +800,7 @@ void Foam::waveModels::StokesV::setVelocity
{ {
const label paddlei = faceToPaddle_[facei]; const label paddlei = faceToPaddle_[facei];
const vector Uf = U const vector Uf = this->Uf
( (
waterDepthRef_, waterDepthRef_,
waveKx, waveKx,
@ -883,9 +820,72 @@ void Foam::waveModels::StokesV::setVelocity
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::StokesV::StokesV
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
StokesI(dict, mesh, patch, false),
lambda_(0)
{
if (readFields)
{
readDict(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::StokesV::~StokesV()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesV::readDict(const dictionary& overrideDict)
{
if (StokesI::readDict(overrideDict))
{
scalar f1;
scalar f2;
scalar waveK;
initialise
(
waveHeight_,
waterDepthRef_,
wavePeriod_,
waveK,
lambda_,
f1,
f2
);
if (f1 > 0.001 || f2 > 0.001)
{
FatalErrorInFunction
<< "No convergence for Stokes V wave theory" << nl
<< " f1: " << f1 << nl
<< " f2: " << f2 << nl
<< exit(FatalError);
}
return true;
}
return false;
}
void Foam::waveModels::StokesV::info(Ostream& os) const void Foam::waveModels::StokesV::info(Ostream& os) const
{ {
regularWaveModel::info(os); StokesI::info(os);
os << " Lambda : " << lambda_ << nl os << " Lambda : " << lambda_ << nl
<< " Wave type : " << waveType() << nl; << " Wave type : " << waveType() << nl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -39,7 +39,7 @@ Description
#ifndef waveModels_StokesV_H #ifndef waveModels_StokesV_H
#define waveModels_StokesV_H #define waveModels_StokesV_H
#include "regularWaveModel.H" #include "StokesIWaveModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,71 +54,65 @@ namespace waveModels
class StokesV class StokesV
: :
public regularWaveModel public StokesI
{ {
protected: private:
// Proteced Data // Private Member Functions
//-
scalar lambda_;
// Protected Member Functions
// Model coefficients // Model coefficients
virtual scalar A11(const scalar h, const scalar k) const; scalar A11(const scalar h, const scalar k) const;
virtual scalar A13(const scalar h, const scalar k) const; scalar A13(const scalar h, const scalar k) const;
virtual scalar A15(const scalar h, const scalar k) const; scalar A15(const scalar h, const scalar k) const;
virtual scalar A22(const scalar h, const scalar k) const; scalar A22(const scalar h, const scalar k) const;
virtual scalar A24(const scalar h, const scalar k) const; scalar A24(const scalar h, const scalar k) const;
virtual scalar A33(const scalar h, const scalar k) const; scalar A33(const scalar h, const scalar k) const;
virtual scalar A35(const scalar h, const scalar k) const; scalar A35(const scalar h, const scalar k) const;
virtual scalar A44(const scalar h, const scalar k) const; scalar A44(const scalar h, const scalar k) const;
virtual scalar A55(const scalar h, const scalar k) const; scalar A55(const scalar h, const scalar k) const;
virtual scalar B22(const scalar h, const scalar k) const; scalar B22(const scalar h, const scalar k) const;
virtual scalar B24(const scalar h, const scalar k) const; scalar B24(const scalar h, const scalar k) const;
virtual scalar B33(const scalar h, const scalar k) const; scalar B33(const scalar h, const scalar k) const;
virtual scalar B33k(const scalar h, const scalar k) const; scalar B33k(const scalar h, const scalar k) const;
virtual scalar B35(const scalar h, const scalar k) const; scalar B35(const scalar h, const scalar k) const;
virtual scalar B35k(const scalar h, const scalar k) const; scalar B35k(const scalar h, const scalar k) const;
virtual scalar B44(const scalar h, const scalar k) const; scalar B44(const scalar h, const scalar k) const;
virtual scalar B55(const scalar h, const scalar k) const; scalar B55(const scalar h, const scalar k) const;
virtual scalar B55k(const scalar h, const scalar k) const; scalar B55k(const scalar h, const scalar k) const;
virtual scalar C1(const scalar h, const scalar k) const; scalar C1(const scalar h, const scalar k) const;
virtual scalar C1k(const scalar h, const scalar k) const; scalar C1k(const scalar h, const scalar k) const;
virtual scalar C2(const scalar h, const scalar k) const; scalar C2(const scalar h, const scalar k) const;
virtual scalar C2k(const scalar h, const scalar k) const; scalar C2k(const scalar h, const scalar k) const;
virtual scalar C3(const scalar h, const scalar k) const; scalar C3(const scalar h, const scalar k) const;
virtual scalar C4(const scalar h, const scalar k) const; scalar C4(const scalar h, const scalar k) const;
//- Model intialisation //- Model intialisation
virtual void initialise void initialise
( (
const scalar H, const scalar H,
const scalar d, const scalar d,
@ -130,7 +124,7 @@ protected:
) const; ) const;
//- Wave height //- Wave height
virtual scalar eta scalar eta
( (
const scalar h, const scalar h,
const scalar kx, const scalar kx,
@ -144,7 +138,7 @@ protected:
) const; ) const;
//- Wave velocity //- Wave velocity
virtual vector U vector Uf
( (
const scalar d, const scalar d,
const scalar kx, const scalar kx,
@ -158,6 +152,17 @@ protected:
const scalar z const scalar z
) const; ) const;
protected:
// Proteced Data
//-
scalar lambda_;
// Protected Member Functions
//- Set the water level //- Set the water level
virtual void setLevel virtual void setLevel
( (
@ -196,12 +201,13 @@ public:
// Public Member Functions // Public Member Functions
//- Read from dictionary //- Read from dictionary
virtual bool read(const dictionary& overrideDict); virtual bool readDict(const dictionary& overrideDict);
//- Info //- Info
virtual void info(Ostream& os) const; virtual void info(Ostream& os) const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels } // End namespace waveModels

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -189,7 +189,7 @@ Foam::vector Foam::waveModels::cnoidal::dEtaDx
} }
Foam::vector Foam::waveModels::cnoidal::U Foam::vector Foam::waveModels::cnoidal::Uf
( (
const scalar H, const scalar H,
const scalar h, const scalar h,
@ -231,6 +231,8 @@ Foam::vector Foam::waveModels::cnoidal::U
} }
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
void Foam::waveModels::cnoidal::setLevel void Foam::waveModels::cnoidal::setLevel
( (
const scalar t, const scalar t,
@ -262,55 +264,6 @@ void Foam::waveModels::cnoidal::setLevel
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::cnoidal::cnoidal
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
regularWaveModel(dict, mesh, patch, false),
m_(0)
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::cnoidal::~cnoidal()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::cnoidal::read(const dictionary& overrideDict)
{
if (regularWaveModel::read(overrideDict))
{
// Initialise m parameter and wavelength
initialise
(
waveHeight_,
waterDepthRef_,
wavePeriod_,
m_,
waveLength_
);
return true;
}
return false;
}
void Foam::waveModels::cnoidal::setVelocity void Foam::waveModels::cnoidal::setVelocity
( (
const scalar t, const scalar t,
@ -336,7 +289,7 @@ void Foam::waveModels::cnoidal::setVelocity
{ {
const label paddlei = faceToPaddle_[facei]; const label paddlei = faceToPaddle_[facei];
const vector Uf = U const vector Uf = this->Uf
( (
waveHeight_, waveHeight_,
waterDepthRef_, waterDepthRef_,
@ -356,6 +309,55 @@ void Foam::waveModels::cnoidal::setVelocity
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::cnoidal::cnoidal
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
regularWaveModel(dict, mesh, patch, false),
m_(0)
{
if (readFields)
{
readDict(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::cnoidal::~cnoidal()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::cnoidal::readDict(const dictionary& overrideDict)
{
if (regularWaveModel::readDict(overrideDict))
{
// Initialise m parameter and wavelength
initialise
(
waveHeight_,
waterDepthRef_,
wavePeriod_,
m_,
waveLength_
);
return true;
}
return false;
}
void Foam::waveModels::cnoidal::info(Ostream& os) const void Foam::waveModels::cnoidal::info(Ostream& os) const
{ {
regularWaveModel::info(os); regularWaveModel::info(os);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,16 +49,11 @@ class cnoidal
: :
public regularWaveModel public regularWaveModel
{ {
protected: private:
// Protected data // Private Member Functions
//- `m' coefficient
scalar m_;
// Protected Member Functions
//- Initialise
void initialise void initialise
( (
const scalar H, const scalar H,
@ -69,7 +64,7 @@ protected:
) const; ) const;
//- Wave height //- Wave height
virtual scalar eta scalar eta
( (
const scalar H, const scalar H,
const scalar Kx, const scalar Kx,
@ -107,7 +102,7 @@ protected:
) const; ) const;
//- Wave velocity //- Wave velocity
virtual vector U vector Uf
( (
const scalar H, const scalar H,
const scalar h, const scalar h,
@ -121,6 +116,18 @@ protected:
const scalar z const scalar z
) const; ) const;
protected:
// Protected data
//- `m' coefficient
scalar m_;
// Protected Member Functions
//- Set the water level //- Set the water level
virtual void setLevel virtual void setLevel
( (
@ -159,12 +166,13 @@ public:
// Public Member Functions // Public Member Functions
//- Read from dictionary //- Read from dictionary
virtual bool read(const dictionary& overrideDict); virtual bool readDict(const dictionary& overrideDict);
//- Info //- Info
virtual void info(Ostream& os) const; virtual void info(Ostream& os) const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels } // End namespace waveModels

View File

@ -277,7 +277,7 @@ Foam::waveModel::waveModel
{ {
if (readFields) if (readFields)
{ {
read(dict); readDict(dict);
} }
} }
@ -290,7 +290,7 @@ Foam::waveModel::~waveModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModel::read(const dictionary& overrideDict) bool Foam::waveModel::readDict(const dictionary& overrideDict)
{ {
readOpt() = IOobject::READ_IF_PRESENT; readOpt() = IOobject::READ_IF_PRESENT;
if (headerOk()) if (headerOk())

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria \\/ M anipulation | Copyright (C) 2015 IH-Cantabria
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -231,7 +231,7 @@ public:
static word modelName(const word& patchName); static word modelName(const word& patchName);
//- Read from dictionary //- Read from dictionary
virtual bool read(const dictionary& overrideDict); virtual bool readDict(const dictionary& overrideDict);
//- Return the latest wave velocity prediction //- Return the latest wave velocity prediction
virtual const vectorField& U() const; virtual const vectorField& U() const;