Merge branch 'integration-ihcantabria' into 'develop'

Integration of ihcantabria wave models

Integration of functionality produced by The Environmental Hydraulics Institute "IHCantabria" (http://www.ihcantabria.com/en/)

- Original code introduced in commit 95e9467e
- Restructured and updated by OpenCFD into a new `waveModels` library available to the interFoam family of solvers

Main source:
`$FOAM_SRC/waveModels`

Tutorials:
`$FOAM_TUTORIALS/multiphase/interFoam/waveExample*`

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

IHCantabria Authors:
- Javier Lopez Lara (jav.lopez@unican.es)
- Gabriel Barajas (barajasg@unican.es)
- Inigo Losada (losadai@unican.es)

See merge request !88
This commit is contained in:
Andrew Heather
2016-12-15 13:38:13 +00:00
109 changed files with 9224 additions and 3 deletions

View File

@ -17,4 +17,5 @@ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lfvOptions \ -lfvOptions \
-lmeshTools \ -lmeshTools \
-lsampling -lsampling \
-lwaveModels

View File

@ -24,4 +24,5 @@ EXE_LIBS = \
-ltopoChangerFvMesh \ -ltopoChangerFvMesh \
-lmeshTools \ -lmeshTools \
-lfvOptions \ -lfvOptions \
-lsampling -lsampling \
-lwaveModels

View File

@ -23,4 +23,5 @@ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-lfvOptions \ -lfvOptions \
-lsampling -lsampling \
-lwaveModels

View File

@ -70,6 +70,7 @@ lagrangian/Allwmake $targetType $*
mesh/Allwmake $targetType $* mesh/Allwmake $targetType $*
renumber/Allwmake $targetType $* renumber/Allwmake $targetType $*
fvAgglomerationMethods/Allwmake $targetType $* fvAgglomerationMethods/Allwmake $targetType $*
wmake $targetType waveModels
wmake $targetType engine wmake $targetType engine
wmake $targetType fvOptions wmake $targetType fvOptions

20
src/waveModels/Make/files Normal file
View File

@ -0,0 +1,20 @@
waveModel/waveModel.C
waveModel/waveModelNew.C
waveGenerationModels/base/waveGenerationModel/waveGenerationModel.C
waveGenerationModels/base/regularWaveModel/regularWaveModel.C
waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.C
waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.C
waveGenerationModels/derived/cnoidal/cnoidalWaveModel.C
waveGenerationModels/derived/StokesII/StokesIIWaveModel.C
waveGenerationModels/derived/StokesI/StokesIWaveModel.C
waveGenerationModels/derived/StokesV/StokesVWaveModel.C
waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.C
waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.C
derivedFvPatchFields/waveVelocity/waveVelocityFvPatchVectorField.C
derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libwaveModels

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lfiniteVolume

View File

@ -0,0 +1,142 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "waveAlphaFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "waveModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchField<scalar>(p, iF),
waveDictName_(waveModel::dictName)
{}
Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField
(
const waveAlphaFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
waveDictName_(ptf.waveDictName_)
{}
Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<scalar>(p, iF, dict),
waveDictName_(dict.lookupOrDefault<word>("waveDict", waveModel::dictName))
{}
Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField
(
const waveAlphaFvPatchScalarField& ptf
)
:
fixedValueFvPatchField<scalar>(ptf),
waveDictName_(ptf.waveDictName_)
{}
Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField
(
const waveAlphaFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchField<scalar>(ptf, iF),
waveDictName_(ptf.waveDictName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::waveAlphaFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
tmp<waveModel> tmodel
(
waveModel::lookupOrCreate
(
patch().patch(),
internalField().mesh(),
waveDictName_
)
);
waveModel& model = const_cast<waveModel&>(tmodel());
model.correct(db().time().value());
operator == (model.alpha());
fixedValueFvPatchField<scalar>::updateCoeffs();
}
void Foam::waveAlphaFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("waveDictName") << waveDictName_
<< token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
waveAlphaFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,165 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveAlphaFvPatchScalarField
Description
Example of the boundary condition specification:
\verbatim
inlet
{
type waveAlpha;
value uniform (0 0 0);
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
type | type: waveAlpha | yes |
waveDict | Dictionary specifying wave variables | no | waveProperties
\endtable
Note
- The value is positive inwards
- May not work correctly for transonic inlets
- Strange behaviour with potentialFoam since the U equation is not solved
SourceFiles
waveAlphaFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef waveAlphaFvPatchScalarField_H
#define waveAlphaFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
class waveAlphaFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class waveAlphaFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
//- Dictionary name
word waveDictName_;
public:
//- Runtime type information
TypeName("waveAlpha");
// Constructors
//- Construct from patch and internal field
waveAlphaFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
waveAlphaFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// waveAlphaFvPatchScalarField
// onto a new patch
waveAlphaFvPatchScalarField
(
const waveAlphaFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
waveAlphaFvPatchScalarField
(
const waveAlphaFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new waveAlphaFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
waveAlphaFvPatchScalarField
(
const waveAlphaFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new waveAlphaFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,142 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "waveVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "waveModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(p, iF),
waveDictName_(waveModel::dictName)
{}
Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField
(
const waveVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
waveDictName_(ptf.waveDictName_)
{}
Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict),
waveDictName_(dict.lookupOrDefault<word>("waveDict", waveModel::dictName))
{}
Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField
(
const waveVelocityFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
waveDictName_(ptf.waveDictName_)
{}
Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField
(
const waveVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(ptf, iF),
waveDictName_(ptf.waveDictName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::waveVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
tmp<waveModel> tmodel
(
waveModel::lookupOrCreate
(
patch().patch(),
internalField().mesh(),
waveDictName_
)
);
waveModel& model = const_cast<waveModel&>(tmodel());
model.correct(db().time().value());
operator == (model.U());
fixedValueFvPatchField<vector>::updateCoeffs();
}
void Foam::waveVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchField<vector>::write(os);
os.writeKeyword("waveDictName") << waveDictName_
<< token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
waveVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,165 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveVelocityFvPatchVectorField
Description
Example of the boundary condition specification:
\verbatim
inlet
{
type waveVelocity;
value uniform (0 0 0);
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
type | type: waveVelocity | yes |
waveDict | Dictionary specifying wave variables | no | waveProperties
\endtable
Note
- The value is positive inwards
- May not work correctly for transonic inlets
- Strange behaviour with potentialFoam since the U equation is not solved
SourceFiles
waveVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef waveVelocityFvPatchVectorField_H
#define waveVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class waveVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class waveVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Dictionary name
word waveDictName_;
public:
//- Runtime type information
TypeName("waveVelocity");
// Constructors
//- Construct from patch and internal field
waveVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
waveVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// waveVelocityFvPatchVectorField
// onto a new patch
waveVelocityFvPatchVectorField
(
const waveVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
waveVelocityFvPatchVectorField
(
const waveVelocityFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new waveVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
waveVelocityFvPatchVectorField
(
const waveVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new waveVelocityFvPatchVectorField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,92 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "waveAbsorptionModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
defineTypeNameAndDebug(waveAbsorptionModel, 0);
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::scalar Foam::waveModels::waveAbsorptionModel::timeCoeff
(
const scalar t
) const
{
// No time ramping applied applied for absorption
return 1;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::waveAbsorptionModel::waveAbsorptionModel
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
waveModel(dict, mesh, patch, false)
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::waveAbsorptionModel::~waveAbsorptionModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::waveAbsorptionModel::read(const dictionary& overrideDict)
{
if (waveModel::read(overrideDict))
{
// Note: always set to true
activeAbsorption_ = true;
return true;
}
return false;
}
// ************************************************************************* //

View File

@ -0,0 +1,93 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveAbsorptionModel
Description
\*---------------------------------------------------------------------------*/
#ifndef waveModels_waveAbsorptionModel_H
#define waveModels_waveAbsorptionModel_H
#include "waveModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
/*---------------------------------------------------------------------------*\
Class waveAbsorptionModel Declaration
\*---------------------------------------------------------------------------*/
class waveAbsorptionModel
:
public waveModel
{
protected:
// Protected Member Functions
//- Return the time scaling coefficient
virtual scalar timeCoeff(const scalar t) const;
public:
//- Runtime type information
TypeName("waveAbsorptionModel");
//- Constructor
waveAbsorptionModel
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields = true
);
//- Destructor
virtual ~waveAbsorptionModel();
// Public Member Functions
//- Read from dictionary
virtual bool read(const dictionary& overrideDict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "shallowWaterAbsorption.H"
#include "volFields.H"
#include "fvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
defineTypeNameAndDebug(shallowWaterAbsorption, 0);
addToRunTimeSelectionTable(waveModel, shallowWaterAbsorption, patch);
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::waveModels::shallowWaterAbsorption::setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const
{
level = waterDepthRef_;
}
void Foam::waveModels::shallowWaterAbsorption::setVelocity
(
const scalar t,
const scalar tCoeff,
const scalarField& level
)
{
U_ = vector::zero;
}
void Foam::waveModels::shallowWaterAbsorption::setAlpha
(
const scalarField& level
)
{
// Set alpha as zero-gradient
const volScalarField& alpha =
mesh_.lookupObject<volScalarField>(alphaName_);
alpha_ = alpha.boundaryField()[patch_.index()].patchInternalField();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::shallowWaterAbsorption::shallowWaterAbsorption
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
waveAbsorptionModel(dict, mesh, patch, false)
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::shallowWaterAbsorption::~shallowWaterAbsorption()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::shallowWaterAbsorption::read
(
const dictionary& overrideDict
)
{
return waveAbsorptionModel::read(overrideDict);
}
// ************************************************************************* //

View File

@ -0,0 +1,110 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::shallowWaterAbsorption
Description
\*---------------------------------------------------------------------------*/
#ifndef waveModels_shallowWaterAbsorption_H
#define waveModels_shallowWaterAbsorption_H
#include "waveAbsorptionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
/*---------------------------------------------------------------------------*\
Class shallowWaterAbsorption Declaration
\*---------------------------------------------------------------------------*/
class shallowWaterAbsorption
:
public waveAbsorptionModel
{
protected:
// Protected Member Functions
//- Set the water level
virtual void setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const;
//- Calculate the wave model velocity
virtual void setVelocity
(
const scalar t,
const scalar tCoeff,
const scalarField& level
);
//- Set the alpha field based on the water level
virtual void setAlpha(const scalarField& level);
public:
//- Runtime type information
TypeName("shallowWaterAbsorption");
//- Constructor
shallowWaterAbsorption
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields = true
);
//- Destructor
virtual ~shallowWaterAbsorption();
// Public Member Functions
//- Read from dictionary
virtual bool read(const dictionary& overrideDict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,139 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "regularWaveModel.H"
#include "mathematicalConstants.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
defineTypeNameAndDebug(regularWaveModel, 0);
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::scalar Foam::waveModels::regularWaveModel::timeCoeff
(
const scalar t
) const
{
return max(0, min(t/rampTime_, 1));
}
Foam::word Foam::waveModels::regularWaveModel::waveType() const
{
scalar waveK = 2.0*mathematical::pi/waveLength_;
word generation = "Intermediate";
if (waveK*waterDepthRef_ > mathematical::pi)
{
generation = "Deep";
}
else if (waveK*waterDepthRef_ < 0.1*mathematical::pi)
{
generation = "Shallow";
}
return generation;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::regularWaveModel::regularWaveModel
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
waveGenerationModel(dict, mesh, patch, false),
rampTime_(VSMALL),
wavePeriod_(0),
waveLength_(0),
wavePhase_(1.5*mathematical::pi)
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::regularWaveModel::~regularWaveModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::regularWaveModel::read(const dictionary& overrideDict)
{
if (waveGenerationModel::read(overrideDict))
{
lookup("rampTime") >> rampTime_;
lookup("wavePeriod") >> wavePeriod_;
if (wavePeriod_ < 0)
{
FatalIOErrorInFunction(*this)
<< "Wave period must be greater than zero. Supplied"
<< " value wavePeriod = " << wavePeriod_
<< exit(FatalIOError);
}
readIfPresent("wavePhase", wavePhase_);
// Note: waveLength to be set in derived classes
return true;
}
return false;
}
void Foam::waveModels::regularWaveModel::info(Ostream& os) const
{
waveGenerationModel::info(os);
os << " Ramp time : " << rampTime_ << nl
<< " Wave period : " << wavePeriod_ << nl
<< " Wave length : " << waveLength_ << nl
<< " Wave phase : " << wavePhase_ << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,123 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveModels::regularWaveModel
Description
\*---------------------------------------------------------------------------*/
#ifndef waveModels_reguarWaveModel_H
#define waveModels_reguarWaveModel_H
#include "waveGenerationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
/*---------------------------------------------------------------------------*\
Class regularWaveModel Declaration
\*---------------------------------------------------------------------------*/
class regularWaveModel
:
public waveGenerationModel
{
// Private Member Functions
//- Disallow default bitwise copy construct
regularWaveModel(const regularWaveModel&);
//- Disallow default bitwise assignment
void operator=(const regularWaveModel&);
protected:
// Protected data
//- Ramp time
scalar rampTime_;
//- Wave period
scalar wavePeriod_;
//- Wavelength
scalar waveLength_;
//- Wave phase
scalar wavePhase_;
// Protected Member Functions
//- Return the time scaling coefficient
virtual scalar timeCoeff(const scalar t) const;
//- Return word description of wave type
virtual word waveType() const;
public:
//- Runtime type information
TypeName("regularWaveModel");
//- Constructor
regularWaveModel
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields = true
);
//- Destructor
virtual ~regularWaveModel();
// Public Member Functions
//- Read from dictionary
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "solitaryWaveModel.H"
#include "polyPatch.H"
#include "SubField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
defineTypeNameAndDebug(solitaryWaveModel, 0);
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::scalar Foam::waveModels::solitaryWaveModel::timeCoeff
(
const scalar t
) const
{
// Ramping not applicable to solitary waves
return 1;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::solitaryWaveModel::solitaryWaveModel
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
waveGenerationModel(dict, mesh, patch, false),
x_
(
patch.faceCentres().component(0)*cos(waveAngle_)
+ patch.faceCentres().component(1)*sin(waveAngle_)
),
x0_(gMin(x_))
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::solitaryWaveModel::~solitaryWaveModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::solitaryWaveModel::read(const dictionary& overrideDict)
{
if (waveGenerationModel::read(overrideDict))
{
return true;
}
return false;
}
void Foam::waveModels::solitaryWaveModel::info(Ostream& os) const
{
waveGenerationModel::info(os);
os << " x0: " << x0_ << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveModels::solitaryWaveModel
Description
\*---------------------------------------------------------------------------*/
#ifndef waveModels_solitaryWaveModel_H
#define waveModels_solitaryWaveModel_H
#include "waveGenerationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
/*---------------------------------------------------------------------------*\
Class solitaryWaveModel Declaration
\*---------------------------------------------------------------------------*/
class solitaryWaveModel
:
public waveGenerationModel
{
protected:
// Protected data
//-
const scalarField& x_;
const scalar x0_;
// Protected Member Functions
//- Return the time scaling coefficient
virtual scalar timeCoeff(const scalar t) const;
public:
//- Runtime type information
TypeName("solitaryWaveModel");
//- Constructor
solitaryWaveModel
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields = true
);
//- Destructor
virtual ~solitaryWaveModel();
// Public Member Functions
//- Read from dictionary
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "waveGenerationModel.H"
#include "mathematicalConstants.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
defineTypeNameAndDebug(waveGenerationModel, 0);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::waveGenerationModel::waveGenerationModel
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
waveModel(dict, mesh, patch, false),
waveHeight_(0),
waveAngle_(0)
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::waveGenerationModel::~waveGenerationModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::waveGenerationModel::read(const dictionary& overrideDict)
{
if (waveModel::read(overrideDict))
{
lookup("activeAbsorption") >> activeAbsorption_;
lookup("waveHeight") >> waveHeight_;
if (waveHeight_ < 0)
{
FatalIOErrorInFunction(*this)
<< "Wave height must be greater than zero. Supplied"
<< " value waveHeight = " << waveHeight_
<< exit(FatalIOError);
}
lookup("waveAngle") >> waveAngle_;
waveAngle_ *= mathematical::pi/180;
return true;
}
return false;
}
void Foam::waveModels::waveGenerationModel::info(Ostream& os) const
{
waveModel::info(os);
os << " Wave height : " << waveHeight_ << nl
<< " Wave angle : " << 180/mathematical::pi*waveAngle_ << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveGenerationModel
Description
\*---------------------------------------------------------------------------*/
#ifndef waveModels_waveGenerationModel_H
#define waveModels_waveGenerationModel_H
#include "waveModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
/*---------------------------------------------------------------------------*\
Class waveGenerationModel Declaration
\*---------------------------------------------------------------------------*/
class waveGenerationModel
:
public waveModel
{
protected:
// Protected data
//- Wave height / [m]
scalar waveHeight_;
//- Wave angle / [rad] (read in degrees)
scalar waveAngle_;
public:
//- Runtime type information
TypeName("waveGenerationModel");
//- Constructor
waveGenerationModel
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields = true
);
//- Destructor
virtual ~waveGenerationModel();
// Public Member Functions
//- Read from dictionary
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,251 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "BoussinesqWaveModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
defineTypeNameAndDebug(Boussinesq, 0);
addToRunTimeSelectionTable
(
waveModel,
Boussinesq,
patch
);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
Foam::scalar Foam::waveModels::Boussinesq::eta
(
const scalar H,
const scalar h,
const scalar x,
const scalar y,
const scalar theta,
const scalar t,
const scalar X0
) const
{
scalar C = sqrt(mag(g_)*(H + h));
scalar ts = 3.5*h/sqrt(H/h);
scalar aux = sqrt(3.0*H/(4.0*h))/h;
scalar Xa = -C*t + ts - X0 + x*cos(theta) + y*sin(theta);
return H*1.0/sqr(cosh(aux*Xa));
}
Foam::vector Foam::waveModels::Boussinesq::Deta
(
const scalar H,
const scalar h,
const scalar x,
const scalar y,
const scalar theta,
const scalar t,
const scalar X0
) const
{
vector deta(vector::zero);
scalar C = sqrt(mag(g_)*(H + h));
scalar ts = 3.5*h/sqrt(H/h);
scalar a = sqrt(3*H/(4*h))/h;
scalar Xa = -C*t + ts - X0 + x*cos(theta) + y*sin(theta);
scalar expTerm = exp(2*a*Xa);
scalar b = 8*a*h*expTerm;
deta[0] =
b*(1 - expTerm)
/pow3(1 + expTerm);
deta[1] =
2*a*b*(exp(4*a*Xa) - 4*expTerm + 1)
/pow4(1 + expTerm);
deta[2] =
-4*sqr(a)*b*(exp(6*a*Xa) - 11*exp(4*a*Xa) + 11*expTerm - 1)
/pow5(1 + expTerm);
return deta;
}
Foam::vector Foam::waveModels::Boussinesq::U
(
const scalar H,
const scalar h,
const scalar x,
const scalar y,
const scalar theta,
const scalar t,
const scalar X0,
const scalar z
) const
{
scalar C = sqrt(mag(g_)*(H + h));
scalar eta = this->eta(H, h, x, y, theta, t, X0);
vector Deta = this->Deta(H, h, x, y, theta, t, X0);
scalar u =
C*eta/h
*(
1.0
- eta/(4.0*h)
+ sqr(h)/(3.0*eta)*(1.0 - 3.0/2.0*sqr(z/h))*Deta[1]
);
scalar w =
-C*z/h
*(
(1.0 - eta/(2.0*h))*Deta[0]
+ sqr(h)/3.0*(1.0 - 1.0/2.0*sqr(z/h))*Deta[2]
);
scalar v = u*sin(waveAngle_);
u *= cos(waveAngle_);
return vector(u, v, w);
}
void Foam::waveModels::Boussinesq::setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const
{
forAll(level, paddlei)
{
const scalar eta =
this->eta
(
waveHeight_,
waterDepthRef_,
xPaddle_[paddlei],
yPaddle_[paddlei],
waveAngle_,
t,
x0_
);
level[paddlei] = waterDepthRef_ + tCoeff*eta;
}
}
// * * * * * * * * * * * * * * * * 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
(
const scalar t,
const scalar tCoeff,
const scalarField& level
)
{
forAll(U_, facei)
{
// Fraction of geometry represented by paddle - to be set
scalar fraction = 1;
// Height - to be set
scalar z = 0;
setPaddlePropeties(level, facei, fraction, z);
if (fraction > 0)
{
const label paddlei = faceToPaddle_[facei];
const vector Uf = U
(
waveHeight_,
waterDepthRef_,
xPaddle_[paddlei],
yPaddle_[paddlei],
waveAngle_,
t,
x0_,
z
);
U_[facei] = fraction*Uf*tCoeff;
}
}
}
void Foam::waveModels::Boussinesq::info(Ostream& os) const
{
solitaryWaveModel::info(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,146 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveModels::Boussinesq
Description
Boussinesq wave model
\*---------------------------------------------------------------------------*/
#ifndef waveModels_Boussinesq_H
#define waveModels_Boussinesq_H
#include "solitaryWaveModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
/*---------------------------------------------------------------------------*\
Class Boussinesq Declaration
\*---------------------------------------------------------------------------*/
class Boussinesq
:
public solitaryWaveModel
{
protected:
// Protected Member Functions
//- Wave height
virtual scalar eta
(
const scalar H,
const scalar h,
const scalar x,
const scalar y,
const scalar theta,
const scalar t,
const scalar X0
) const;
//- Wave
virtual vector Deta
(
const scalar H,
const scalar h,
const scalar x,
const scalar y,
const scalar theta,
const scalar t,
const scalar X0
) const;
//- Wave velocity
virtual vector U
(
const scalar H,
const scalar h,
const scalar x,
const scalar y,
const scalar theta,
const scalar t,
const scalar X0,
const scalar z
) const;
//- Set the water level
virtual void setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const;
//- Calculate the wave model velocity
virtual void setVelocity
(
const scalar t,
const scalar tCoeff,
const scalarField& level
);
public:
//- Runtime type information
TypeName("Boussinesq");
//- Constructor
Boussinesq
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields = true
);
//- Destructor
virtual ~Boussinesq();
// Public Member Functions
//- Read from dictionary
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,238 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "StokesIWaveModel.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
defineTypeNameAndDebug(StokesI, 0);
addToRunTimeSelectionTable
(
waveModel,
StokesI,
patch
);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
Foam::scalar Foam::waveModels::StokesI::waveLength
(
const scalar h,
const scalar T
) const
{
scalar L0 = mag(g_)*T*T/(2.0*mathematical::pi);
scalar L = L0;
for (int i=1; i<=100; i++)
{
L = L0*tanh(2.0*mathematical::pi*h/L);
}
return L;
}
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);
}
Foam::vector Foam::waveModels::StokesI::U
(
const scalar H,
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 z
) const
{
scalar k = sqrt(Kx*Kx + Ky*Ky);
scalar phaseTot = Kx*x + Ky*y - omega*t + phase;
scalar u = H*0.5*omega*cos(phaseTot)*cosh(k*z)/sinh(k*h);
scalar w = H*0.5*omega*sin(phaseTot)*sinh(k*z)/sinh(k*h);
scalar v = u*sin(waveAngle_);
u *= cos(waveAngle_);
return vector(u, v, w);
}
void Foam::waveModels::StokesI::setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const
{
const scalar waveOmega = mathematical::twoPi/wavePeriod_;
const scalar waveK = mathematical::twoPi/waveLength_;
const scalar waveKx = waveK*cos(waveAngle_);
const scalar waveKy = waveK*sin(waveAngle_);
forAll(level, paddlei)
{
const scalar eta =
this->eta
(
waveHeight_,
waveKx,
xPaddle_[paddlei],
waveKy,
yPaddle_[paddlei],
waveOmega,
t,
wavePhase_
);
level[paddlei] = waterDepthRef_ + tCoeff*eta;
}
}
// * * * * * * * * * * * * * * * * 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
(
const scalar t,
const scalar tCoeff,
const scalarField& level
)
{
const scalar waveOmega = mathematical::twoPi/wavePeriod_;
const scalar waveK = mathematical::twoPi/waveLength_;
const scalar waveKx = waveK*cos(waveAngle_);
const scalar waveKy = waveK*sin(waveAngle_);
forAll(U_, facei)
{
// Fraction of geometry represented by paddle - to be set
scalar fraction = 1;
// Height - to be set
scalar z = 0;
setPaddlePropeties(level, facei, fraction, z);
if (fraction > 0)
{
const label paddlei = faceToPaddle_[facei];
const vector Uf = U
(
waveHeight_,
waterDepthRef_,
waveKx,
xPaddle_[paddlei],
waveKy,
yPaddle_[paddlei],
waveOmega,
t,
wavePhase_,
z
);
U_[facei] = fraction*Uf*tCoeff;
}
}
}
void Foam::waveModels::StokesI::info(Ostream& os) const
{
regularWaveModel::info(os);
os << " Wave type: " << waveType() << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,141 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveModels::StokesI
Description
Stokes I wave model
\*---------------------------------------------------------------------------*/
#ifndef waveModels_StokesI_H
#define waveModels_StokesI_H
#include "regularWaveModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
/*---------------------------------------------------------------------------*\
Class StokesI Declaration
\*---------------------------------------------------------------------------*/
class StokesI
:
public regularWaveModel
{
protected:
// Protected Member Functions
//- Return the wavelength
virtual scalar waveLength(const scalar h, const scalar T) const;
//- Wave height
virtual scalar 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;
//- Wave velocity
virtual vector U
(
const scalar H,
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 z
) const;
//- Set the water level
virtual void setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const;
//- Calculate the wave model velocity
virtual void setVelocity
(
const scalar t,
const scalar tCoeff,
const scalarField& level
);
public:
//- Runtime type information
TypeName("StokesI");
//- Constructor
StokesI
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields = true
);
//- Destructor
virtual ~StokesI();
// Public Member Functions
//- Read from dictionary
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,181 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "StokesIIWaveModel.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
defineTypeNameAndDebug(StokesII, 0);
addToRunTimeSelectionTable
(
waveModel,
StokesII,
patch
);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
Foam::scalar Foam::waveModels::StokesII::eta
(
const scalar H,
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
{
const scalar k = sqrt(Kx*Kx + Ky*Ky);
const scalar sigma = tanh(k*h);
const scalar phaseTot = Kx*x + Ky*y - omega*t + phase;
return
H*0.5*cos(phaseTot)
+ k*H*H/4.0*(3.0 - sigma*sigma)/(4.0*pow3(sigma))*cos(2.0*phaseTot);
}
Foam::vector Foam::waveModels::StokesII::U
(
const scalar H,
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 z
) const
{
const scalar k = sqrt(Kx*Kx + Ky*Ky);
const scalar phaseTot = Kx*x + Ky*y - omega*t + phase;
scalar u =
H*0.5*omega*cos(phaseTot)*cosh(k*z)/sinh(k*h)
+ 3.0/4.0*H*H/4.0*omega*k*cosh(2.0*k*z)/pow4(sinh(k*h))*cos(2.0*phaseTot);
scalar w =
H*0.5*omega*sin(phaseTot)*sinh(k*z)/sinh(k*h)
+ 3.0/4.0*H*H/4.0*omega*k*sinh(2.0*k*z)/pow4(sinh(k*h))*sin(2.0*phaseTot);
scalar v = u*sin(waveAngle_);
u *= cos(waveAngle_);
return vector(u, v, w);
}
void Foam::waveModels::StokesII::setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const
{
const scalar waveOmega = mathematical::twoPi/wavePeriod_;
const scalar waveK = mathematical::twoPi/waveLength_;
const scalar waveKx = waveK*cos(waveAngle_);
const scalar waveKy = waveK*sin(waveAngle_);
forAll(level, paddlei)
{
const scalar eta =
this->eta
(
waveHeight_,
waterDepthRef_,
waveKx,
xPaddle_[paddlei],
waveKy,
yPaddle_[paddlei],
waveOmega,
t,
wavePhase_
);
level[paddlei] = waterDepthRef_ + tCoeff*eta;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModels::StokesII::StokesII
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
StokesI(dict, mesh, patch, false)
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::StokesII::~StokesII()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesII::read(const dictionary& overrideDict)
{
if (StokesI::read(overrideDict))
{
return true;
}
return false;
}
void Foam::waveModels::StokesII::info(Ostream& os) const
{
StokesI::info(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,130 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveModels::StokesII
Description
Stokes II wave model
\*---------------------------------------------------------------------------*/
#ifndef waveModels_StokesII_H
#define waveModels_StokesII_H
#include "StokesIWaveModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
/*---------------------------------------------------------------------------*\
Class StokesII Declaration
\*---------------------------------------------------------------------------*/
class StokesII
:
public StokesI
{
protected:
// Protected Member Functions
//- Wave height
virtual scalar eta
(
const scalar H,
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;
//- Wave velocity
virtual vector U
(
const scalar H,
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 z
) const;
//- Set the water level
virtual void setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const;
public:
//- Runtime type information
TypeName("StokesII");
//- Constructor
StokesII
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields = true
);
//- Destructor
virtual ~StokesII();
// Public Member Functions
//- Read from dictionary
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,895 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "StokesVWaveModel.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
defineTypeNameAndDebug(StokesV, 0);
addToRunTimeSelectionTable
(
waveModel,
StokesV,
patch
);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
Foam::scalar Foam::waveModels::StokesV::A11
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
return 1.0/s;
}
Foam::scalar Foam::waveModels::StokesV::A13
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return -sqr(c)*(5*sqr(c) + 1)/(8*pow5(s));
}
Foam::scalar Foam::waveModels::StokesV::A15
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return
-(
1184*pow(c, 10)
- 1440*pow(c, 8)
- 1992*pow6(c)
+ 2641*pow4(c)
- 249*sqr(c) + 18
)
/(1536*pow(s, 11));
}
Foam::scalar Foam::waveModels::StokesV::A22
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
return 3/(8*pow4(s));
}
Foam::scalar Foam::waveModels::StokesV::A24
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return
(192*pow(c, 8) - 424*pow(c, 6) - 312*pow4(c) + 480*sqr(c) - 17)
/(768*pow(s, 10));
}
Foam::scalar Foam::waveModels::StokesV::A33
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return (13 - 4*sqr(c))/(64*pow(s, 7));
}
Foam::scalar Foam::waveModels::StokesV::A35
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return
(
512*pow(c, 12)
+ 4224*pow(c, 10)
- 6800*pow(c, 8)
- 12808*pow(c, 6)
+ 16704.0*pow4(c)
- 3154*sqr(c)
+ 107
)
/(4096*pow(s, 13)*(6*sqr(c) - 1));
}
Foam::scalar Foam::waveModels::StokesV::A44
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return
(80*pow(c, 6) - 816*pow4(c) + 1338*sqr(c) - 197)
/(1536*pow(s, 10)*(6*sqr(c) - 1));
}
Foam::scalar Foam::waveModels::StokesV::A55
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return
-(
2880*pow(c, 10)
- 72480*pow(c, 8)
+ 324000*pow(c, 6)
- 432000*pow4(c)
+ 163470*sqr(c)
- 16245
)
/(61440*pow(s, 11)*(6*sqr(c) - 1)*(8*pow4(c) - 11*sqr(c) + 3));
}
Foam::scalar Foam::waveModels::StokesV::B22
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return (2*sqr(c) + 1)*c/(4*pow3(s));
}
Foam::scalar Foam::waveModels::StokesV::B24
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return
(272*pow(c, 8) - 504*pow(c, 6) - 192*pow4(c) + 322*sqr(c) + 21)*c
/(384*pow(s, 9));
}
Foam::scalar Foam::waveModels::StokesV::B33
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return (8*pow6(c) + 1)*3/(64*pow6(s));
}
Foam::scalar Foam::waveModels::StokesV::B33k
(
const scalar h,
const scalar k
) const // d B33 / d k
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
const scalar sk = h*s;
const scalar ck = h*c;
return 9.*pow5(c)*ck/(4*pow6(s)) - (9*(8*pow6(c) + 1))/(32*pow(s, 7))*sk;
}
Foam::scalar Foam::waveModels::StokesV::B35
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return
(
88128*pow(c, 14)
- 208224*pow(c, 12)
+ 70848*pow(c, 10)
+ 54000*pow(c, 8)
- 21816*pow6(c)
+ 6264*pow4(c)
- 54*sqr(c)
- 81
)
/(12288*pow(s, 12)*(6*sqr(c) - 1));
}
Foam::scalar Foam::waveModels::StokesV::B35k
(
const scalar h,
const scalar k
) const // d B35 / d k
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
const scalar sk = h*s;
const scalar ck = h*c;
return
(
14*88128*pow(c, 13)*ck
- 12*208224*pow(c, 11)*ck
+ 10*70848*pow(c, 9)*ck
+ 8*54000.0*pow(c, 7)*ck
- 6*21816*pow5(c)*ck
+ 4*6264*pow3(c)*ck
- 2*54*c*ck
)
/(12288*pow(s, 12)*(6*sqr(c) - 1))
- (
88128*pow(c, 14)
- 208224*pow(c, 12)
+ 70848*pow(c, 10)
+ 54000*pow(c, 8)
- 21816*pow6(c)
+ 6264*pow4(c)
- 54*sqr(c)
- 81
)*12
/(12288*pow(s, 13)*(6*sqr(c) - 1))*sk
- (
88128*pow(c,14)
- 208224*pow(c, 12)
+ 70848*pow(c, 10)
+ 54000*pow(c, 8)
- 21816*pow6(c)
+ 6264*pow4(c)
- 54*sqr(c)
- 81
)*12*c*ck
/(12288*pow(s, 12)*sqr(6*sqr(c) - 1));
}
Foam::scalar Foam::waveModels::StokesV::B44
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return
(
768*pow(c, 10)
- 448*pow(c, 8)
- 48*pow6(c)
+ 48*pow4(c)
+ 106*sqr(c)
- 21
)*c
/(384*pow(s, 9)*(6*sqr(c) - 1));
}
Foam::scalar Foam::waveModels::StokesV::B55
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return
(
192000*pow(c, 16)
- 262720*pow(c, 14)
+ 83680*pow(c, 12)
+ 20160*pow(c, 10)
- 7280*pow(c, 8)
+ 7160*pow(c, 6)
- 1800*pow(c, 4)
- 1050*sqr(c)
+ 225
)
/(12288*pow(s, 10)*(6*sqr(c) - 1)*(8*pow4(c) - 11*sqr(c) + 3));
}
Foam::scalar Foam::waveModels::StokesV::B55k
(
const scalar h,
const scalar k
) const // d B55 / d k
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
const scalar sk = h*s;
const scalar ck = h*c;
return
(
16*192000*pow(c, 15)*ck
- 14*262720*pow(c, 13)*ck
+ 12*83680*pow(c, 11)*ck
+ 10*20160*pow(c, 9)*ck
- 8*7280*pow(c, 7)*ck
+ 6*7160*pow(c, 5)*ck
- 4*1800*pow(c, 3)*ck
- 2*1050*pow(c, 1)*ck
)
/(12288*pow(s, 10)*(6*sqr(c) - 1)*(8*pow(c, 4) - 11*sqr(c) + 3))
- (
192000*pow(c, 16)
- 262720*pow(c, 14)
+ 83680*pow(c, 12)
+ 20160*pow(c, 10)
- 7280*pow(c, 8)
+ 7160*pow(c, 6)
- 1800*pow(c, 4)
- 1050*pow(c, 2)
+ 225
)*10.0
/(12288*pow(s, 11)*(6*sqr(c) - 1)*(8*pow4(c) - 11*sqr(c) + 3))*sk
- (
192000*pow(c, 16)
- 262720*pow(c, 14)
+ 83680*pow(c, 12)
+ 20160*pow(c,10)
- 7280*pow(c, 8)
+ 7160*pow(c, 6)
- 1800*pow(c,4)
- 1050*pow(c, 2)
+ 225
)*12*c*ck
/(12288*pow(s, 10)*sqr(6*sqr(c) - 1)*(8*pow4(c) - 11*sqr(c) + 3))
- (
192000*pow(c, 16)
- 262720*pow(c, 14)
+ 83680*pow(c, 12)
+ 20160*pow(c, 10)
- 7280*pow(c, 8)
+ 7160*pow(c, 6)
- 1800*pow(c, 4)
- 1050*pow(c, 2)
+ 225
)*(32*pow3(c) - 22*c)*ck
/(12288*pow(s, 10)*(6*sqr(c) - 1)*sqr(8*pow4(c) - 11*sqr(c) + 3));
}
Foam::scalar Foam::waveModels::StokesV::C1
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return (8*pow4(c) - 8*sqr(c) + 9)/(8*pow4(s));
}
Foam::scalar Foam::waveModels::StokesV::C1k
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
const scalar sk = h*s;
const scalar ck = h*c;
return
(4*8*pow3(c)*ck - 2*8*c*ck)/(8*pow4(s))
- (8*pow4(c) - 8*sqr(c) + 9)*4*sk/(8*pow5(s));
}
Foam::scalar Foam::waveModels::StokesV::C2
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return
(
3840*pow(c, 12)
- 4096*pow(c, 10)
+ 2592*pow(c, 8)
- 1008*pow(c, 6)
+ 5944*pow(c, 4)
- 1830*pow(c, 2)
+ 147
) // - 2592
/(512*pow(s, 10)*(6*sqr(c) - 1));
}
Foam::scalar Foam::waveModels::StokesV::C2k
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
const scalar sk = h*s;
const scalar ck = h*c;
return
(
12*3840*pow(c, 11)*ck
- 10*4096*pow(c,9)*ck
+ 8*2592*pow(c, 7)*ck
- 6*1008*pow(c, 5)*ck
+ 4*5944*pow(c, 3)*ck
- 2*1830*c*ck
)
/(512*pow(s, 10)*(6*sqr(c) - 1))
- (
3840*pow(c, 12)
- 4096*pow(c, 10)
+ 2592*pow(c, 8)
- 1008*pow(c, 6)
+ 5944*pow(c, 4)
- 1830*pow(c, 2)
+ 147
)*10*sk
/(512*pow(s, 11)*(6*sqr(c) - 1))
- (
3840*pow(c, 12)
- 4096*pow(c, 10)
+ 2592*pow(c, 8)
- 1008*pow(c, 6)
+ 5944*pow(c, 4)
- 1830*pow(c, 2)
+ 147
)*12*c*ck
/(512*pow(s, 10)*sqr(6*sqr(c) - 1));
}
Foam::scalar Foam::waveModels::StokesV::C3
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return -1/(4*s*c);
}
Foam::scalar Foam::waveModels::StokesV::C4
(
const scalar h,
const scalar k
) const
{
const scalar s = sinh(k*h);
const scalar c = cosh(k*h);
return
(12*pow(c, 8) + 36*pow(c, 6) - 162*pow(c, 4) + 141*sqr(c) - 27)
/(192*c*pow(s, 9));
}
void Foam::waveModels::StokesV::initialise
(
const scalar H,
const scalar d,
const scalar T,
scalar& kOut,
scalar& LambdaOut,
scalar& f1Out,
scalar& f2Out
) const
{
scalar f1 = 1;
scalar f2 = 1;
const scalar pi = mathematical::pi;
scalar k = 2.0*pi/(sqrt(mag(g_)*d)*T);
scalar lambda = H/2.0*k;
label n = 0;
static const scalar tolerance = 1e-12;
static const label iterMax = 10000;
while ((mag(f1) > tolerance || mag(f2) > tolerance) && (n < iterMax))
{
const scalar b33 = B33(d, k);
const scalar b35 = B35(d, k);
const scalar b55 = B55(d, k);
const scalar c1 = C1(d, k);
const scalar c2 = C2(d, k);
const scalar b33k = B33k(d, k);
const scalar b35k = B35k(d, k);
const scalar b55k = B55k(d, k);
const scalar c1k = C1k(d, k);
const scalar c2k = C2k(d, k);
const scalar l2 = sqr(lambda);
const scalar l3 = l2*lambda;
const scalar l4 = l3*lambda;
const scalar l5 = l4*lambda;
const scalar Bmat11 =
2*pi/(sqr(k)*d)*(lambda + l3*b33 + l5*(b35 + b55))
- 2*pi/(k*d)*(l3*b33k + l5*(b35k + b55k));
const scalar Bmat12 =
- 2*pi/(k*d)*(1 + 3*l2*b33 + 5*l4*(b35 + b55));
const scalar Bmat21 =
- d/(2*pi)*tanh(k*d)*(1 + l2*c1 + l4*c2)
- k*d/(2*pi)*(1 - sqr(tanh(k*d)))*d*(1 + l2*c1 + l4*c2)
- k*d/(2*pi)*tanh(k*d)*(l2*c1k + l4*c2k);
const scalar Bmat22 = - k*d/(2.0*pi)*tanh(k*d)*(2*lambda*c1 + 4*l3*c2);
f1 = pi*H/d - 2*pi/(k*d)*(lambda + l3*b33 + l5*(b35 + b55));
f2 = (2*pi*d)/(mag(g_)*sqr(T)) - k*d/(2*pi)*tanh(k*d)*(1 + l2*c1 + l4*c2);
const scalar lambdaPr =
(f1*Bmat21 - f2*Bmat11)/(Bmat11*Bmat22 - Bmat12*Bmat21);
const scalar kPr =
(f2*Bmat12 - f1*Bmat22)/(Bmat11*Bmat22 - Bmat12*Bmat21);
lambda += lambdaPr;
k += kPr;
n++;
}
kOut = k;
LambdaOut = lambda;
f1Out = mag(f1);
f2Out = mag(f2);
}
Foam::scalar Foam::waveModels::StokesV::eta
(
const scalar h,
const scalar kx,
const scalar ky,
const scalar lambda,
const scalar T,
const scalar x,
const scalar y,
const scalar t,
const scalar phase
) const
{
const scalar k = sqrt(kx*kx + ky*ky);
const scalar b22 = B22(h, k);
const scalar b24 = B24(h, k);
const scalar b33 = B33(h, k);
const scalar b35 = B35(h, k);
const scalar b44 = B44(h, k);
const scalar b55 = B55(h, k);
const scalar l2 = sqr(lambda);
const scalar l3 = l2*lambda;
const scalar l4 = l3*lambda;
const scalar l5 = l4*lambda;
const scalar amp1 = lambda/k;
const scalar amp2 = (b22*l2 + b24*l4)/k;
const scalar amp3 = (b33*l3 + b35*l5)/k;
const scalar amp4 = b44*l4/k;
const scalar amp5 = b55*l5/k;
const scalar theta = kx*x + ky*y - 2.0*mathematical::pi/T*t + phase;
return
amp1*cos(theta)
+ amp2*cos(2*theta)
+ amp3*cos(3*theta)
+ amp4*cos(4*theta)
+ amp5*cos(5*theta);
}
Foam::vector Foam::waveModels::StokesV::U
(
const scalar d,
const scalar kx,
const scalar ky,
const scalar lambda,
const scalar T,
const scalar x,
const scalar y,
const scalar t,
const scalar phase,
const scalar z
) const
{
const scalar k = sqrt(kx*kx + ky*ky);
const scalar a11 = A11(d, k);
const scalar a13 = A13(d, k);
const scalar a15 = A15(d, k);
const scalar a22 = A22(d, k);
const scalar a24 = A24(d, k);
const scalar a33 = A33(d, k);
const scalar a35 = A35(d, k);
const scalar a44 = A44(d, k);
const scalar a55 = A55(d, k);
const scalar pi = mathematical::pi;
const scalar l2 = sqr(lambda);
const scalar l3 = l2*lambda;
const scalar l4 = l3*lambda;
const scalar l5 = l4*lambda;
const scalar a1u = 2*pi/T/k*(lambda*a11 + l3*a13 + l5*a15);
const scalar a2u = 2*2*pi/T/k*(l2*a22 + l4*a24);
const scalar a3u = 3*2*pi/T/k*(l3*a33 + l5*a35);
const scalar a4u = 4*2*pi/T/k*(l4*a44);
const scalar a5u = 5*2*pi/T/k*(l5*a55);
const scalar theta = kx*x + ky*y - 2*pi/T*t + phase;
scalar u =
a1u*cosh(k*z)*cos(theta)
+ a2u*cosh(2.0*k*z)*cos(2.0*(theta))
+ a3u*cosh(3.0*k*z)*cos(3.0*(theta))
+ a4u*cosh(4.0*k*z)*cos(4.0*(theta))
+ a5u*cosh(5.0*k*z)*cos(5.0*(theta));
scalar w =
a1u*sinh(k*z)*sin(theta)
+ a2u*sinh(2.0*k*z)*sin(2.0*(theta))
+ a3u*sinh(3.0*k*z)*sin(3.0*(theta))
+ a4u*sinh(4.0*k*z)*sin(4.0*(theta))
+ a5u*sinh(5.0*k*z)*sin(5.0*(theta));
scalar v = u*sin(waveAngle_);
u *= cos(waveAngle_);
return vector(u, v, w);
}
void Foam::waveModels::StokesV::setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const
{
const scalar waveK = mathematical::twoPi/waveLength_;
const scalar waveKx = waveK*cos(waveAngle_);
const scalar waveKy = waveK*sin(waveAngle_);
forAll(level, paddlei)
{
const scalar eta =
this->eta
(
waterDepthRef_,
waveKx,
waveKy,
lambda_,
wavePeriod_,
xPaddle_[paddlei],
yPaddle_[paddlei],
t,
wavePhase_
);
level[paddlei] = waterDepthRef_ + tCoeff*eta;
}
}
// * * * * * * * * * * * * * * * * 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
(
const scalar t,
const scalar tCoeff,
const scalarField& level
)
{
const scalar waveK = mathematical::twoPi/waveLength_;
const scalar waveKx = waveK*cos(waveAngle_);
const scalar waveKy = waveK*sin(waveAngle_);
forAll(U_, facei)
{
// Fraction of geometry represented by paddle - to be set
scalar fraction = 1;
// Height - to be set
scalar z = 0;
setPaddlePropeties(level, facei, fraction, z);
if (fraction > 0)
{
const label paddlei = faceToPaddle_[facei];
const vector Uf = U
(
waterDepthRef_,
waveKx,
waveKy,
lambda_,
wavePeriod_,
xPaddle_[paddlei],
yPaddle_[paddlei],
t,
wavePhase_,
z
);
U_[facei] = fraction*Uf*tCoeff;
}
}
}
void Foam::waveModels::StokesV::info(Ostream& os) const
{
regularWaveModel::info(os);
os << " Lambda : " << lambda_ << nl
<< " Wave type : " << waveType() << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,214 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveModels::StokesV
Description
Stokes V wave model
Reference
\verbatim
Skjelbreia, L., Hendrickson, J. (1960).
Fifth order gravity wave theory.
Proc. Coastal Engineering Conf., pp. 184-196.
\endverbatim
\*---------------------------------------------------------------------------*/
#ifndef waveModels_StokesV_H
#define waveModels_StokesV_H
#include "regularWaveModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
/*---------------------------------------------------------------------------*\
Class StokesV Declaration
\*---------------------------------------------------------------------------*/
class StokesV
:
public regularWaveModel
{
protected:
// Proteced Data
//-
scalar lambda_;
// Protected Member Functions
// Model coefficients
virtual scalar A11(const scalar h, const scalar k) const;
virtual scalar A13(const scalar h, const scalar k) const;
virtual scalar A15(const scalar h, const scalar k) const;
virtual scalar A22(const scalar h, const scalar k) const;
virtual scalar A24(const scalar h, const scalar k) const;
virtual scalar A33(const scalar h, const scalar k) const;
virtual scalar A35(const scalar h, const scalar k) const;
virtual scalar A44(const scalar h, const scalar k) const;
virtual scalar A55(const scalar h, const scalar k) const;
virtual scalar B22(const scalar h, const scalar k) const;
virtual scalar B24(const scalar h, const scalar k) const;
virtual scalar B33(const scalar h, const scalar k) const;
virtual scalar B33k(const scalar h, const scalar k) const;
virtual scalar B35(const scalar h, const scalar k) const;
virtual scalar B35k(const scalar h, const scalar k) const;
virtual scalar B44(const scalar h, const scalar k) const;
virtual scalar B55(const scalar h, const scalar k) const;
virtual scalar B55k(const scalar h, const scalar k) const;
virtual scalar C1(const scalar h, const scalar k) const;
virtual scalar C1k(const scalar h, const scalar k) const;
virtual scalar C2(const scalar h, const scalar k) const;
virtual scalar C2k(const scalar h, const scalar k) const;
virtual scalar C3(const scalar h, const scalar k) const;
virtual scalar C4(const scalar h, const scalar k) const;
//- Model intialisation
virtual void initialise
(
const scalar H,
const scalar d,
const scalar T,
scalar& kOut,
scalar& LambdaOut,
scalar& f1Out,
scalar& f2Out
) const;
//- Wave height
virtual scalar eta
(
const scalar h,
const scalar kx,
const scalar ky,
const scalar lambda,
const scalar T,
const scalar x,
const scalar y,
const scalar t,
const scalar phase
) const;
//- Wave velocity
virtual vector U
(
const scalar d,
const scalar kx,
const scalar ky,
const scalar lambda,
const scalar T,
const scalar x,
const scalar y,
const scalar t,
const scalar phase,
const scalar z
) const;
//- Set the water level
virtual void setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const;
//- Calculate the wave model velocity
virtual void setVelocity
(
const scalar t,
const scalar tCoeff,
const scalarField& level
);
public:
//- Runtime type information
TypeName("StokesV");
//- Constructor
StokesV
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields = true
);
//- Destructor
virtual ~StokesV();
// Public Member Functions
//- Read from dictionary
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::Elliptic
Description
\*---------------------------------------------------------------------------*/
#include "mathematicalConstants.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace Elliptic
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void ellipticIntegralsKE(const scalar m, scalar& K, scalar& E)
{
if (m == 0)
{
K = 0.5*mathematical::pi;
E = 0.5*mathematical::pi;
return;
}
scalar a = 1;
scalar g = Foam::sqrt(1 - m);
scalar ga = g*a;
scalar aux = 1;
scalar sum = 2 - m;
while (true)
{
scalar aOld = a;
scalar gOld = g;
ga = gOld*aOld;
a = 0.5*(gOld + aOld);
aux += aux;
sum -= aux*(a*a - ga);
if (mag(aOld - gOld) < SMALL)
{
break;
}
g = sqrt(ga);
}
K = 0.5*mathematical::pi/a;
E = 0.25*mathematical::pi/a*sum;
}
Foam::scalar JacobiAmp(const scalar u, const scalar mIn)
{
static const label ITER = 25;
FixedList<scalar, ITER + 1> a, g, c;
scalar aux, amp;
label n;
const scalar m = mag(mIn);
if (m == 0)
{
return u;
}
if (m == 1)
{
return 2*atan(exp(u)) - mathematical::pi/2;
}
a[0] = 1.0;
g[0] = Foam::sqrt(1.0 - m);
c[0] = Foam::sqrt(m);
aux = 1.0;
for (n = 0; n < ITER; n++)
{
if (mag(a[n] - g[n]) < SMALL)
{
break;
}
aux += aux;
a[n+1] = 0.5*(a[n] + g[n]);
g[n+1] = Foam::sqrt(a[n]*g[n]);
c[n+1] = 0.5*(a[n] - g[n]);
}
amp = aux*a[n]*u;
for (; n > 0; n--)
{
amp = 0.5*(amp + asin(c[n]*sin(amp)/a[n]));
}
return scalar(amp);
}
void JacobiSnCnDn
(
const scalar u,
const scalar m,
scalar& Sn,
scalar& Cn,
scalar& Dn
)
{
const scalar amp = Elliptic::JacobiAmp(u, m);
Sn = sin(amp);
Cn = cos(amp);
Dn = sqrt(1.0 - m*sin(amp)*sin(amp));
return;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Elliptic
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,367 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cnoidalWaveModel.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
#include "Elliptic.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
defineTypeNameAndDebug(cnoidal, 0);
addToRunTimeSelectionTable
(
waveModel,
cnoidal,
patch
);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::waveModels::cnoidal::initialise
(
const scalar H,
const scalar d,
const scalar T,
scalar& mOut,
scalar& LOut
) const
{
const scalar mTolerance = 0.0001;
scalar mElliptic = 0.5;
scalar LElliptic = 0;
scalar phaseSpeed = 0;
scalar mError = 0.0;
scalar mMinError = GREAT;
while (mElliptic < 1.0)
{
scalar KElliptic, EElliptic;
Elliptic::ellipticIntegralsKE(mElliptic, KElliptic, EElliptic);
LElliptic = KElliptic*sqrt(16.0*pow3(d)*mElliptic/(3.0*H));
phaseSpeed =
sqrt(mag(g_)*d)
*(1.0 - H/d/2.0 + H/d/mElliptic*(1.0 - 3.0/2.0*EElliptic/KElliptic));
mError = mag(T - LElliptic/phaseSpeed);
if (mError <= mMinError)
{
mOut = mElliptic;
LOut = LElliptic;
mMinError = mError;
}
mElliptic += mTolerance;
}
}
Foam::scalar Foam::waveModels::cnoidal::eta
(
const scalar H,
const scalar m,
const scalar kx,
const scalar ky,
const scalar T,
const scalar x,
const scalar y,
const scalar t
) const
{
scalar K, E;
Elliptic::ellipticIntegralsKE(m, K, E);
const scalar uCnoidal =
K/mathematical::pi*(kx*x + ky*y - 2.0*mathematical::pi*t/T);
scalar sn, cn, dn;
Elliptic::JacobiSnCnDn(uCnoidal, m, sn, cn, dn);
return H*((1.0 - E/K)/m - 1.0 + sqr(cn));
}
Foam::scalar Foam::waveModels::cnoidal::eta1D
(
const scalar H,
const scalar m,
const scalar t,
const scalar T
) const
{
scalar K, E;
Elliptic::ellipticIntegralsKE(m, K, E);
const scalar uCnoidal = -2.0*K*(t/T);
scalar sn, cn, dn;
Elliptic::JacobiSnCnDn(uCnoidal, m, sn, cn, dn);
return H*((1.0 - E/K)/m - 1.0 + sqr(cn));
}
Foam::scalar Foam::waveModels::cnoidal::etaMeanSq
(
const scalar H,
const scalar m,
const scalar T
) const
{
scalar eta = 0;
scalar etaSumSq = 0;
for (int i=0; i<1000; i++)
{
eta = eta1D(H, m, i*T/(1000.0), T);
etaSumSq += eta*eta;
}
etaSumSq /= 1000.0;
return etaSumSq;
}
Foam::vector Foam::waveModels::cnoidal::dEtaDx
(
const scalar H,
const scalar m,
const scalar uCnoidal,
const scalar L,
const scalar K,
const scalar E
) const
{
const scalar dudx = 2.0*K/L;
const scalar dudxx = 2.0*K/L*dudx;
const scalar dudxxx = 2.0*K/L*dudxx;
scalar sn, cn, dn;
Elliptic::JacobiSnCnDn(uCnoidal, m, sn, cn, dn);
scalar d1 = -2.0*H*cn*dn*sn*dudx;
scalar d2 = 2.0*H*(dn*dn*sn*sn - cn*cn*dn*dn + m*cn*cn*sn*sn)*dudxx;
scalar d3 =
8.0*H
*(
cn*sn*dn*dn*dn*(-4.0 - 2.0*m)
+ 4.0*m*cn*sn*sn*sn*dn
- 2.0*m*cn*cn*cn*sn*dn
)
*dudxxx;
return vector(d1, d2, d3);
}
Foam::vector Foam::waveModels::cnoidal::U
(
const scalar H,
const scalar h,
const scalar m,
const scalar kx,
const scalar ky,
const scalar T,
const scalar x,
const scalar y,
const scalar t,
const scalar z
) const
{
scalar K, E;
Elliptic::ellipticIntegralsKE(m, K, E);
const scalar uCnoidal =
K/mathematical::pi*(kx*x + ky*y - 2.0*mathematical::pi*t/T);
const scalar k = sqrt(kx*kx + ky*ky);
const scalar L = 2.0*mathematical::pi/k;
const scalar c = L/T;
const scalar etaCN = eta(H, m, kx, ky, T, x, y, t);
const vector etaX = this->dEtaDx(H, m, uCnoidal, L, K, E);
const scalar etaMS = etaMeanSq(H, m, T);
scalar u =
c*etaCN/h
- c*(etaCN*etaCN/h/h + etaMS*etaMS/h/h)
+ 1.0/2.0*c*h*(1.0/3.0 - z*z/h/h)*etaX[1];
scalar w =
-c*z*(etaX[0]/h*(1.0 - 2.0*etaCN/h) + 1.0/6.0*h*(1.0 - z*z/h/h)*etaX[2]);
scalar v = u*sin(waveAngle_);
u *= cos(waveAngle_);
return vector(u, v, w);
}
void Foam::waveModels::cnoidal::setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const
{
const scalar waveK = mathematical::twoPi/waveLength_;
const scalar waveKx = waveK*cos(waveAngle_);
const scalar waveKy = waveK*sin(waveAngle_);
forAll(level, paddlei)
{
const scalar eta =
this->eta
(
waveHeight_,
m_,
waveKx,
waveKy,
wavePeriod_,
xPaddle_[paddlei],
yPaddle_[paddlei],
t
);
level[paddlei] = waterDepthRef_ + tCoeff*eta;
}
}
// * * * * * * * * * * * * * * * * 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
(
const scalar t,
const scalar tCoeff,
const scalarField& level
)
{
const scalar waveK = mathematical::twoPi/waveLength_;
const scalar waveKx = waveK*cos(waveAngle_);
const scalar waveKy = waveK*sin(waveAngle_);
forAll(U_, facei)
{
// Fraction of geometry represented by paddle - to be set
scalar fraction = 1;
// Height - to be set
scalar z = 0;
setPaddlePropeties(level, facei, fraction, z);
if (fraction > 0)
{
const label paddlei = faceToPaddle_[facei];
const vector Uf = U
(
waveHeight_,
waterDepthRef_,
m_,
waveKx,
waveKy,
wavePeriod_,
xPaddle_[paddlei],
yPaddle_[paddlei],
t,
z
);
U_[facei] = fraction*Uf*tCoeff;
}
}
}
void Foam::waveModels::cnoidal::info(Ostream& os) const
{
regularWaveModel::info(os);
os << " Cnoidal m parameter : " << m_ << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveModels::cnoidal
Description
Cnoidal wave model
\*---------------------------------------------------------------------------*/
#ifndef waveModels_cnoidal_H
#define waveModels_cnoidal_H
#include "regularWaveModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace waveModels
{
/*---------------------------------------------------------------------------*\
Class cnoidal Declaration
\*---------------------------------------------------------------------------*/
class cnoidal
:
public regularWaveModel
{
protected:
// Protected data
//- `m' coefficient
scalar m_;
// Protected Member Functions
void initialise
(
const scalar H,
const scalar d,
const scalar T,
scalar& mOut,
scalar& LOut
) const;
//- Wave height
virtual scalar 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 eta1D
(
const scalar H,
const scalar m,
const scalar t,
const scalar T
) const;
scalar etaMeanSq
(
const scalar H,
const scalar m,
const scalar T
) const;
vector dEtaDx
(
const scalar H,
const scalar m,
const scalar uCnoidal,
const scalar L,
const scalar K,
const scalar E
) const;
//- Wave velocity
virtual vector U
(
const scalar H,
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 z
) const;
//- Set the water level
virtual void setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const;
//- Calculate the wave model velocity
virtual void setVelocity
(
const scalar t,
const scalar tCoeff,
const scalarField& level
);
public:
//- Runtime type information
TypeName("cnoidal");
//- Constructor
cnoidal
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields = true
);
//- Destructor
virtual ~cnoidal();
// Public Member Functions
//- Read from dictionary
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace waveModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,433 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "waveModel.H"
#include "fvMesh.H"
#include "polyPatch.H"
#include "uniformDimensionedFields.H"
#include "volFields.H"
#include "fvPatchFields.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(waveModel, 0);
defineRunTimeSelectionTable(waveModel, patch);
}
const Foam::word Foam::waveModel::dictName("waveProperties");
Foam::word Foam::waveModel::modelName(const word& patchName)
{
return dictName + '.' + patchName;
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::waveModel::initialiseGeometry()
{
// Determine local patch co-ordinate system given by:
// - X: streamwise: patch normal
// - Y: spanwise: Z^X
// - Z: up: (negative) gravity direction
vector x(-gAverage(patch_.faceAreas()));
x /= mag(x) + ROOTVSMALL;
vector z = -g_/mag(g_);
vector y = z^x;
// Rotation from global<->local about global origin
Rlg_ = tensor(x, y, z);
Rgl_ = Rlg_.T();
// Global patch extents
const vectorField& Cp = patch_.localPoints();
const vectorField CpLocal(Rgl_ & Cp);
boundBox bb(CpLocal, true);
const scalar xMin = bb.min().x();
const scalar xMax = bb.max().x();
const scalar yMin = bb.min().y();
const scalar yMax = bb.max().y();
zSpan_ = bb.max().z() - bb.min().z();
// Global x, y positions of the paddle centres
xPaddle_.setSize(nPaddle_, 0);
yPaddle_.setSize(nPaddle_, 0);
const scalar xMid = xMin + 0.5*(xMax - xMin);
const scalar paddleDy = (yMax - yMin)/scalar(nPaddle_);
for (label paddlei = 0; paddlei < nPaddle_; ++paddlei)
{
xPaddle_[paddlei] = xMid;
yPaddle_[paddlei] = paddlei*paddleDy + yMin + 0.5*paddleDy;;
}
// Local face centres
const vectorField& Cf = patch_.faceCentres();
const vectorField CfLocal(Rgl_ & Cf);
z_ = CfLocal.component(2);
// Local face extents in z-direction
zMin_.setSize(patch_.size());
zMax_.setSize(patch_.size());
const faceList& faces = patch_.localFaces();
forAll(faces, facei)
{
const face& f = faces[facei];
const label nPoint = f.size();
zMin_[facei] = CpLocal[f[0]].z();
zMax_[facei] = CpLocal[f[0]].z();
for (label fpi = 1; fpi < nPoint; ++fpi)
{
const label pointi = f[fpi];
zMin_[facei] = min(zMin_[facei], CpLocal[pointi].z());
zMax_[facei] = max(zMax_[facei], CpLocal[pointi].z());
}
}
// Local paddle-to-face addressing
faceToPaddle_.setSize(patch_.size(), -1);
forAll(faceToPaddle_, facei)
{
faceToPaddle_[facei] = floor((CfLocal[facei].y() - yMin)/paddleDy);
}
}
Foam::tmp<Foam::scalarField> Foam::waveModel::waterLevel() const
{
// Note: initialising as initial depth
tmp<scalarField> tlevel(new scalarField(nPaddle_, initialDepth_));
scalarField& level = tlevel.ref();
const volScalarField& alpha =
mesh_.lookupObject<volScalarField>(alphaName_);
const fvPatchScalarField& alphap = alpha.boundaryField()[patch_.index()];
const scalarField alphac(alphap.patchInternalField());
const scalarField& magSf = alphap.patch().magSf();
scalarList paddleMagSf(nPaddle_, 0.0);
scalarList paddleWettedMagSf(nPaddle_, 0.0);
forAll(alphac, facei)
{
label paddlei = faceToPaddle_[facei];
paddleMagSf[paddlei] += magSf[facei];
paddleWettedMagSf[paddlei] += magSf[facei]*alphac[facei];
}
forAll(paddleMagSf, paddlei)
{
reduce(paddleMagSf[paddlei], sumOp<scalar>());
reduce(paddleWettedMagSf[paddlei], sumOp<scalar>());
level[paddlei] +=
paddleWettedMagSf[paddlei]
/(paddleMagSf[paddlei]*zSpan_ + ROOTVSMALL);
}
return tlevel;
}
void Foam::waveModel::setAlpha(const scalarField& level)
{
forAll(alpha_, facei)
{
const label paddlei = faceToPaddle_[facei];
const scalar paddleCalc = level[paddlei];
if (zMax_[facei] < paddleCalc)
{
alpha_[facei] = 1.0;
}
else if (zMin_[facei] > paddleCalc)
{
alpha_[facei] = 0.0;
}
else
{
scalar dz = paddleCalc - zMin_[facei];
alpha_[facei] = dz/zSpan_;
}
}
}
void Foam::waveModel::setPaddlePropeties
(
const scalarField& level,
const label facei,
scalar& fraction,
scalar& z
) const
{
const label paddlei = faceToPaddle_[facei];
const scalar paddleCalc = level[paddlei];
const scalar paddleHeight = min(paddleCalc, waterDepthRef_);
const scalar zMin = zMin_[facei];
const scalar zMax = zMax_[facei];
fraction = 1;
z = 0;
if (zMax < paddleHeight)
{
z = z_[facei];
}
else if (zMin > paddleCalc)
{
fraction = -1;
}
else
{
if (paddleCalc < waterDepthRef_)
{
if ((zMax > paddleCalc) && (zMin < paddleCalc))
{
scalar dz = paddleCalc - zMin;
fraction = dz/zSpan_;
z = z_[facei];
}
}
else
{
if (zMax < paddleCalc)
{
z = waterDepthRef_;
}
else if ((zMax > paddleCalc) && (zMin < paddleCalc))
{
scalar dz = paddleCalc - zMin;
fraction = dz/zSpan_;
z = waterDepthRef_;
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveModel::waveModel
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields
)
:
IOdictionary
(
IOobject
(
modelName(patch.name()),
Time::timeName(mesh.time().startTime().value()),
"uniform",
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
)
),
mesh_(mesh),
patch_(patch),
g_(mesh.lookupObject<uniformDimensionedVectorField>("g").value()),
UName_("U"),
alphaName_("alpha"),
Rgl_(tensor::I),
Rlg_(tensor::I),
nPaddle_(1),
xPaddle_(),
yPaddle_(),
z_(),
zSpan_(0),
zMin_(),
zMax_(),
waterDepthRef_(0),
initialDepth_(0),
currTimeIndex_(-1),
activeAbsorption_(false),
U_(patch.size(), vector::zero),
alpha_(patch.size(), 0)
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModel::~waveModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModel::read(const dictionary& overrideDict)
{
readOpt() = IOobject::READ_IF_PRESENT;
if (headerOk())
{
IOdictionary::regIOobject::read();
}
merge(overrideDict);
readIfPresent("U", UName_);
readIfPresent("alpha", alphaName_);
lookup("nPaddle") >> nPaddle_;
if (nPaddle_ < 1)
{
FatalIOErrorInFunction(*this)
<< "Number of paddles must be greater than zero. Supplied"
<< " value nPaddles = " << nPaddle_
<< exit(FatalIOError);
}
readIfPresent("initialDepth", initialDepth_);
// Need to intialise the geometry before calling waterLevel()
initialiseGeometry();
// Set the reference water depth
if (!readIfPresent("waterDepthRef", waterDepthRef_))
{
scalar waterDepth = 0;
if (readIfPresent("waterDepth", waterDepth))
{
waterDepthRef_ = waterDepth;
}
else
{
const scalarField level(waterLevel());
if (level.size())
{
waterDepthRef_ = level.first();
}
}
// Avoid potential zero...
waterDepthRef_ += SMALL;
// Insert the reference water depth into [this] to enable restart
add("waterDepthRef", waterDepthRef_);
}
return true;
}
void Foam::waveModel::correct(const scalar t)
{
if (mesh_.time().timeIndex() != currTimeIndex_)
{
Info<< "Updating " << type() << " wave model for patch "
<< patch_.name() << endl;
// Time ramp weight
const scalar tCoeff = timeCoeff(t);
// Reset the velocity and phase fraction fields
U_ = vector::zero;
alpha_ = 0;
// Update the calculated water level field
scalarField calculatedLevel(nPaddle_, 0);
if (patch_.size())
{
// Set wave level
setLevel(t, tCoeff, calculatedLevel);
// Update the velocity field
setVelocity(t, tCoeff, calculatedLevel);
// Update the phase fraction field
setAlpha(calculatedLevel);
}
if (activeAbsorption_)
{
const scalarField activeLevel(this->waterLevel());
forAll(U_, facei)
{
const label paddlei = faceToPaddle_[facei];
if (zMin_[facei] < activeLevel[paddlei])
{
scalar UCorr =
(calculatedLevel[paddlei] - activeLevel[paddlei])
*sqrt(mag(g_)/activeLevel[paddlei]);
U_[facei].x() += UCorr;
}
else
{
U_[facei].x() = 0;
}
}
}
// Transform velocity into global co-ordinate system
U_ = Rlg_ & U_;
currTimeIndex_ = mesh_.time().timeIndex();
}
}
const Foam::vectorField& Foam::waveModel::U() const
{
return U_;
}
const Foam::scalarField& Foam::waveModel::alpha() const
{
return alpha_;
}
void Foam::waveModel::info(Ostream& os) const
{
os << "Wave model: patch " << patch_.name() << nl
<< " Type : " << type() << nl
<< " Velocity field name : " << UName_ << nl
<< " Phase fraction field name : " << alphaName_ << nl
<< " Transformation from local to global system : " << Rlg_ << nl
<< " Number of paddles: " << nPaddle_ << nl
<< " Reference water depth : " << waterDepthRef_ << nl
<< " Active absorption: " << activeAbsorption_ << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,258 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::waveModel
Description
Base class for waveModels
\*---------------------------------------------------------------------------*/
#ifndef waveModel_H
#define waveModel_H
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "IOdictionary.H"
#include "dictionary.H"
#include "scalarField.H"
#include "vectorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
class polyPatch;
/*---------------------------------------------------------------------------*\
Class waveModel Declaration
\*---------------------------------------------------------------------------*/
class waveModel
:
public refCount,
public IOdictionary
{
protected:
// Protected data
//- Reference to the mesh database
const fvMesh& mesh_;
//- Reference to the polyPatch
const polyPatch& patch_;
//- Gravity
const vector& g_;
//- Name of velocity field, default = "U"
word UName_;
//- Name of phase fraction field, default = "alpha"
word alphaName_;
//- Rotation tensor from global to local system
tensor Rgl_;
//- Rotation tensor from local to global system
tensor Rlg_;
//- Number of paddles
label nPaddle_;
//- Paddle x co-ordinates / [m]
scalarField xPaddle_;
//- Paddle y co-ordinates / [m]
scalarField yPaddle_;
//- Addressing from patch face index to paddle index
labelList faceToPaddle_;
//- Patch face centre z co-ordinates / [m]
scalarField z_;
//- Overall (point) span in z-direction / [m]
scalar zSpan_;
//- Minimum z (point) height per patch face / [m]
scalarField zMin_;
//- Maximum z (point) height per patch face / [m]
scalarField zMax_;
//- Reference water depth / [m]
scalar waterDepthRef_;
//- Initial depth / [m]
scalar initialDepth_;
//- Time index used for updating
label currTimeIndex_;
//- Active wave absorption switch
bool activeAbsorption_;
// Current values
//- Velocity field
vectorField U_;
//- Wave indicator field
scalarField alpha_;
// Protected Member Functions
//- Initialise
virtual void initialiseGeometry();
//- Water level
virtual tmp<scalarField> waterLevel() const;
//- Return the time scaling coefficient
virtual scalar timeCoeff(const scalar t) const = 0;
//- Set the water level
virtual void setLevel
(
const scalar t,
const scalar tCoeff,
scalarField& level
) const = 0;
//- Calculate the wave model velocity
virtual void setVelocity
(
const scalar t,
const scalar tCoeff,
const scalarField& level
) = 0;
//- Set the alpha field based on the water level
virtual void setAlpha(const scalarField& level);
//- Set the paddle coverage fraction and reference height
virtual void setPaddlePropeties
(
const scalarField& level,
const label facei,
scalar& fraction,
scalar& z
) const;
public:
//- Runtime type information
TypeName("waveModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
waveModel,
patch,
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch
),
(dict, mesh, patch)
);
//- Constructor
waveModel
(
const dictionary& dict,
const fvMesh& mesh,
const polyPatch& patch,
const bool readFields = true
);
// Selectors
//- Return a reference to the selected wave model
static autoPtr<waveModel> New
(
const word& dictName,
const fvMesh& mesh,
const polyPatch& patch
);
//- Lookup waveModel from database, or create new
static tmp<waveModel> lookupOrCreate
(
const polyPatch& patch,
const fvMesh& mesh,
const word& waveDictName
);
//- Destructor
virtual ~waveModel();
//- Dictionary name
static const word dictName;
// Public Member Functions
//- Utility function to construct the model name
static word modelName(const word& patchName);
//- Read from dictionary
virtual bool read(const dictionary& overrideDict);
//- Return the latest wave velocity prediction
virtual const vectorField& U() const;
//- Return the latest wave indicator field prediction
virtual const scalarField& alpha() const;
//- Correct the model for time, t[s]
virtual void correct(const scalar t);
//- Info
virtual void info(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "waveModel.H"
#include "fvMesh.H"
Foam::autoPtr<Foam::waveModel> Foam::waveModel::New
(
const word& dictName,
const fvMesh& mesh,
const polyPatch& patch
)
{
IOdictionary waveDict
(
IOobject
(
dictName,
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false // Not registering
)
);
word modelType = "none";
dictionary patchDict;
if (waveDict.found(patch.name()))
{
patchDict = waveDict.subDict(patch.name());
patchDict.lookup("waveModel") >> modelType;
}
else
{
FatalIOErrorInFunction(waveDict)
<< "Dictionary entry for patch " << patch.name() << " not found"
<< exit(FatalIOError);
}
Info<< "Selecting waveModel " << modelType << endl;
patchConstructorTable::iterator cstrIter =
patchConstructorTablePtr_->find(modelType);
if (cstrIter == patchConstructorTablePtr_->end())
{
FatalIOErrorInFunction(waveDict)
<< "Unknown waveModel type "
<< modelType << nl << nl
<< "Valid waveModel types are:" << nl
<< patchConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
return autoPtr<waveModel>(cstrIter()(patchDict, mesh, patch));
}
Foam::tmp<Foam::waveModel> Foam::waveModel::lookupOrCreate
(
const polyPatch& patch,
const fvMesh& mesh,
const word& waveDictName
)
{
const word modelName = waveModel::modelName(patch.name());
if (!mesh.foundObject<waveModel>(modelName))
{
autoPtr<waveModel> model(waveModel::New(waveDictName, mesh, patch));
waveModel* waveModelPtr = model.ptr();
waveModelPtr->store();
waveModelPtr->info(Info);
}
return mesh.lookupObject<waveModel>(modelName);
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type waveVelocity;
value uniform (0 0 0);
}
outlet
{
type waveVelocity;
value uniform (0 0 0);
}
sides
{
type empty;
}
ground
{
type fixedValue;
value uniform (0 0 0);
}
top
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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 waveAlpha;
value uniform 0;
}
outlet
{
type zeroGradient;
}
ground
{
type zeroGradient;
}
sides
{
type empty;
}
top
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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;
}
ground
{
type fixedFluxPressure;
value uniform 0;
}
sides
{
type empty;
}
top
{
type totalPressure;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
p0 uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
rm -rf 0
cleanCase

View File

@ -0,0 +1,15 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
restore0Dir
runApplication blockMesh
runApplication decomposePar
runParallel setFields
runParallel $(getApplication)

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value ( 0 0 -9.81 );
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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;
// ************************************************************************* //

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object wavesProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inlet
{
alpha alpha.water;
waveModel cnoidal;
nPaddle 1;
waveHeight 0.1;
waveAngle 0.0;
rampTime 6.0;
activeAbsorption yes;
wavePeriod 4.0;
}
outlet
{
alpha alpha.water;
waveModel shallowWaterAbsorption;
nPaddle 1;
}
// ************************************************************************* //

View File

@ -0,0 +1,90 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
( 0.0 0.0 0.0)
( 30.0 0.0 0.0)
( 30.0 0.04 0.0)
( 0.0 0.04 0.0)
( 0.0 0.0 0.7)
( 30.0 0.0 0.7)
( 30.0 0.04 0.7)
( 0.0 0.04 0.7)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (750 1 70) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
outlet
{
type patch;
faces
(
(1 5 6 2)
);
}
ground
{
type wall;
faces
(
(0 1 2 3)
);
}
top
{
type patch;
faces
(
(4 5 6 7)
);
}
sides
{
type empty;
faces
(
(0 1 5 4)
(3 2 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,146 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application interFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 50.0;
deltaT 0.01;
writeControl adjustableRunTime;
writeInterval 0.033;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.65;
maxAlphaCo 0.65;
maxDeltaT 0.05;
functions
{
line
{
type sets;
libs ("libsampling.so");
enabled true;
writeControl writeTime;
writeInterval 1;
interpolationScheme cellPoint;
setFormat raw;
sets
(
line1
{
type uniform;
axis distance;
start ( 1.0 0.005 0.0 );
end ( 1.0 0.005 0.8 );
nPoints 1001;
}
line2
{
type uniform;
axis distance;
start ( 2.0 0.005 0.0 );
end ( 2.0 0.005 0.8 );
nPoints 1001;
}
line3
{
type uniform;
axis distance;
start ( 3.0 0.005 0.0 );
end ( 3.0 0.005 0.8 );
nPoints 1001;
}
line4
{
type uniform;
axis distance;
start ( 5.0 0.005 0.0 );
end ( 5.0 0.005 0.8 );
nPoints 1001;
}
line5
{
type uniform;
axis distance;
start ( 7.5 0.005 0.0 );
end ( 7.5 0.005 0.8 );
nPoints 1001;
}
line6
{
type uniform;
axis distance;
start ( 10.0 0.005 0.0 );
end ( 10.0 0.005 0.8 );
nPoints 1001;
}
line7
{
type uniform;
axis distance;
start ( 12.0 0.005 0.0 );
end ( 12.0 0.005 0.8 );
nPoints 1001;
}
line8
{
type uniform;
axis distance;
start ( 14.0 0.005 0.0 );
end ( 14.0 0.005 0.8 );
nPoints 1001;
}
);
fixedLocations false;
fields
(
U alpha.water
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
method hierarchical;
hierarchicalCoeffs
{
n (2 1 1);
delta 0.001;
order xyz;
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "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(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //

View File

@ -0,0 +1,93 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"alpha.water.*"
{
nAlphaCorr 1;
nAlphaSubCycles 3;
alphaOuterCorrectors yes;
cAlpha 1;
MULESCorr no;
nLimiterIter 3;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-8;
relTol 0;
}
pcorr
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
}
p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0.1;
}
p_rghFinal
{
solver GAMG;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration on;
agglomerator faceAreaPair;
nCellsInCoarsestLevel 10;
mergeLevels 1;
tolerance 1e-7;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0.1;
}
UFinal
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
}
}
PIMPLE
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,36 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue alpha.water 0
);
regions
(
boxToCell
{
box (0 0 0) (30.0 1.0 0.4);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type waveVelocity;
value uniform (0 0 0);
}
outlet
{
type waveVelocity;
value uniform (0 0 0);
}
sides
{
type empty;
}
ground
{
type fixedValue;
value uniform (0 0 0);
}
top
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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 waveAlpha;
value uniform 0;
}
outlet
{
type zeroGradient;
}
ground
{
type zeroGradient;
}
sides
{
type empty;
}
top
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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;
}
ground
{
type fixedFluxPressure;
value uniform 0;
}
sides
{
type empty;
}
top
{
type totalPressure;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
p0 uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
rm -rf 0
cleanCase

View File

@ -0,0 +1,15 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
restore0Dir
runApplication blockMesh
runApplication decomposePar
runParallel setFields
runParallel $(getApplication)

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value ( 0 0 -9.81 );
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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;
// ************************************************************************* //

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,45 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object wavesProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inlet
{
alpha alpha.water;
waveModel Boussinesq;
nPaddle 1;
waveHeight 0.3;
waveAngle 0.0;
activeAbsorption yes;
wavePeriod 0.0;
}
outlet
{
alpha alpha.water;
waveModel shallowWaterAbsorption;
nPaddle 1;
}
// ************************************************************************* //

View File

@ -0,0 +1,90 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
( 0.0 0.0 0.0)
( 10.0 0.0 0.0)
( 10.0 0.02 0.0)
( 0.0 0.02 0.0)
( 0.0 0.0 1.5)
( 10.0 0.0 1.5)
( 10.0 0.02 1.5)
( 0.0 0.02 1.5)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (500 1 150) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
outlet
{
type patch;
faces
(
(1 5 6 2)
);
}
ground
{
type wall;
faces
(
(0 1 2 3)
);
}
top
{
type patch;
faces
(
(4 5 6 7)
);
}
sides
{
type empty;
faces
(
(0 1 5 4)
(3 2 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,130 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application interFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 7.0;
deltaT 0.01;
writeControl adjustableRunTime;
writeInterval 0.033;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.65;
maxAlphaCo 0.65;
maxDeltaT 0.05;
functions
{
line
{
type sets;
libs ("libsampling.so");
enabled true;
writeControl writeTime;
writeInterval 1;
interpolationScheme cellPoint;
setFormat raw;
sets
(
line1
{
type uniform;
axis distance;
start ( 1.0 0.01 0.0 );
end ( 1.0 0.01 1.5 );
nPoints 1001;
}
line2
{
type uniform;
axis distance;
start ( 2.0 0.01 0.0 );
end ( 2.0 0.01 1.5 );
nPoints 1001;
}
line3
{
type uniform;
axis distance;
start ( 3.0 0.01 0.0 );
end ( 3.0 0.01 1.5 );
nPoints 1001;
}
line4
{
type uniform;
axis distance;
start ( 5.0 0.01 0.0 );
end ( 5.0 0.01 1.5 );
nPoints 1001;
}
line5
{
type uniform;
axis distance;
start ( 7.5 0.01 0.0 );
end ( 7.5 0.01 1.5 );
nPoints 1001;
}
line6
{
type uniform;
axis distance;
start ( 9.0 0.01 0.0 );
end ( 9.0 0.01 1.5 );
nPoints 1001;
}
);
fixedLocations false;
fields
(
U alpha.water
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
method hierarchical;
hierarchicalCoeffs
{
n (2 1 1);
delta 0.001;
order xyz;
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "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(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //

View File

@ -0,0 +1,93 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"alpha.water.*"
{
nAlphaCorr 1;
nAlphaSubCycles 3;
alphaOuterCorrectors yes;
cAlpha 1;
MULESCorr no;
nLimiterIter 3;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-8;
relTol 0;
}
pcorr
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
}
p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0.1;
}
p_rghFinal
{
solver GAMG;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration on;
agglomerator faceAreaPair;
nCellsInCoarsestLevel 10;
mergeLevels 1;
tolerance 1e-7;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0.1;
}
UFinal
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
}
}
PIMPLE
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,36 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue alpha.water 0
);
regions
(
boxToCell
{
box (0 0 0) (30.0 1.0 0.7);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type waveVelocity;
value uniform (0 0 0);
}
outlet
{
type waveVelocity;
value uniform (0 0 0);
}
sides
{
type empty;
}
ground
{
type fixedValue;
value uniform (0 0 0);
}
top
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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 waveAlpha;
value uniform 0;
}
outlet
{
type zeroGradient;
}
ground
{
type zeroGradient;
}
sides
{
type empty;
}
top
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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;
}
ground
{
type fixedFluxPressure;
value uniform 0;
}
sides
{
type empty;
}
top
{
type totalPressure;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
p0 uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
rm -rf 0
cleanCase

View File

@ -0,0 +1,15 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
restore0Dir
runApplication blockMesh
runApplication decomposePar
runParallel setFields
runParallel $(getApplication)

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value ( 0 0 -9.81 );
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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;
// ************************************************************************* //

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object wavesProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inlet
{
alpha alpha.water;
waveModel StokesI;
nPaddle 1;
waveHeight 0.05;
waveAngle 0.0;
rampTime 3.0;
activeAbsorption yes;
wavePeriod 3.0;
}
outlet
{
alpha alpha.water;
waveModel shallowWaterAbsorption;
nPaddle 1;
}
// ************************************************************************* //

View File

@ -0,0 +1,90 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
( 0.0 0.0 0.0)
( 20.0 0.0 0.0)
( 20.0 0.04 0.0)
( 0.0 0.04 0.0)
( 0.0 0.0 0.75)
( 20.0 0.0 0.75)
( 20.0 0.04 0.75)
( 0.0 0.04 0.75)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (500 1 75) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
outlet
{
type patch;
faces
(
(1 5 6 2)
);
}
ground
{
type wall;
faces
(
(0 1 2 3)
);
}
top
{
type patch;
faces
(
(4 5 6 7)
);
}
sides
{
type empty;
faces
(
(0 1 5 4)
(3 2 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,146 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application interFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 20.0;
deltaT 0.01;
writeControl adjustableRunTime;
writeInterval 0.033;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.65;
maxAlphaCo 0.65;
maxDeltaT 0.05;
functions
{
line
{
type sets;
libs ("libsampling.so");
enabled true;
writeControl writeTime;
writeInterval 1;
interpolationScheme cellPoint;
setFormat raw;
sets
(
line1
{
type uniform;
axis distance;
start ( 1.0 0.02 0.0 );
end ( 1.0 0.02 0.75 );
nPoints 1001;
}
line2
{
type uniform;
axis distance;
start ( 2.0 0.02 0.0 );
end ( 2.0 0.02 0.75 );
nPoints 1001;
}
line3
{
type uniform;
axis distance;
start ( 3.0 0.02 0.0 );
end ( 3.0 0.02 0.75 );
nPoints 1001;
}
line4
{
type uniform;
axis distance;
start ( 5.0 0.02 0.0 );
end ( 5.0 0.02 0.75 );
nPoints 1001;
}
line5
{
type uniform;
axis distance;
start ( 7.5 0.02 0.0 );
end ( 7.5 0.02 0.75 );
nPoints 1001;
}
line6
{
type uniform;
axis distance;
start ( 10.0 0.02 0.0 );
end ( 10.0 0.02 0.75 );
nPoints 1001;
}
line7
{
type uniform;
axis distance;
start ( 12.0 0.005 0.0 );
end ( 12.0 0.005 0.75 );
nPoints 1001;
}
line8
{
type uniform;
axis distance;
start ( 14.0 0.005 0.0 );
end ( 14.0 0.005 0.75 );
nPoints 1001;
}
);
fixedLocations false;
fields
(
U alpha.water
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
method hierarchical;
hierarchicalCoeffs
{
n (2 1 1);
delta 0.001;
order xyz;
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "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(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //

View File

@ -0,0 +1,93 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"alpha.water.*"
{
nAlphaCorr 1;
nAlphaSubCycles 3;
alphaOuterCorrectors yes;
cAlpha 1;
MULESCorr no;
nLimiterIter 3;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-8;
relTol 0;
}
pcorr
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
}
p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0.1;
}
p_rghFinal
{
solver GAMG;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration on;
agglomerator faceAreaPair;
nCellsInCoarsestLevel 10;
mergeLevels 1;
tolerance 1e-7;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0.1;
}
UFinal
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
}
}
PIMPLE
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,36 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue alpha.water 0
);
regions
(
boxToCell
{
box (0 0 0) (20.0 1.0 0.6);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type waveVelocity;
value uniform (0 0 0);
}
outlet
{
type waveVelocity;
value uniform (0 0 0);
}
sides
{
type empty;
}
ground
{
type fixedValue;
value uniform (0 0 0);
}
top
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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 waveAlpha;
value uniform 0;
}
outlet
{
type zeroGradient;
}
ground
{
type zeroGradient;
}
sides
{
type empty;
}
top
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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;
}
ground
{
type fixedFluxPressure;
value uniform 0;
}
sides
{
type empty;
}
top
{
type totalPressure;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
p0 uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
rm -rf 0
cleanCase

View File

@ -0,0 +1,15 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
restore0Dir
runApplication blockMesh
runApplication decomposePar
runParallel setFields
runParallel $(getApplication)

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value ( 0 0 -9.81 );
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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;
// ************************************************************************* //

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object wavesProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inlet
{
alpha alpha.water;
waveModel StokesII;
nPaddle 1;
waveHeight 0.05;
waveAngle 0.0;
rampTime 3.0;
activeAbsorption yes;
wavePeriod 3.0;
}
outlet
{
alpha alpha.water;
waveModel shallowWaterAbsorption;
nPaddle 1;
}
// ************************************************************************* //

View File

@ -0,0 +1,90 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
( 0.0 0.0 0.0)
( 20.0 0.0 0.0)
( 20.0 0.04 0.0)
( 0.0 0.04 0.0)
( 0.0 0.0 0.55)
( 20.0 0.0 0.55)
( 20.0 0.04 0.55)
( 0.0 0.04 0.55)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (500 1 55) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
outlet
{
type patch;
faces
(
(1 5 6 2)
);
}
ground
{
type wall;
faces
(
(0 1 2 3)
);
}
top
{
type patch;
faces
(
(4 5 6 7)
);
}
sides
{
type empty;
faces
(
(0 1 5 4)
(3 2 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,146 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application interFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 20.0;
deltaT 0.01;
writeControl adjustableRunTime;
writeInterval 0.033;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.65;
maxAlphaCo 0.65;
maxDeltaT 0.05;
functions
{
line
{
type sets;
libs ("libsampling.so");
enabled true;
writeControl writeTime;
writeInterval 1;
interpolationScheme cellPoint;
setFormat raw;
sets
(
line1
{
type uniform;
axis distance;
start ( 1.0 0.02 0.0 );
end ( 1.0 0.02 0.55 );
nPoints 1001;
}
line2
{
type uniform;
axis distance;
start ( 2.0 0.02 0.0 );
end ( 2.0 0.02 0.55 );
nPoints 1001;
}
line3
{
type uniform;
axis distance;
start ( 3.0 0.02 0.0 );
end ( 3.0 0.02 0.55 );
nPoints 1001;
}
line4
{
type uniform;
axis distance;
start ( 5.0 0.02 0.0 );
end ( 5.0 0.02 0.55 );
nPoints 1001;
}
line5
{
type uniform;
axis distance;
start ( 7.5 0.02 0.0 );
end ( 7.5 0.02 0.55 );
nPoints 1001;
}
line6
{
type uniform;
axis distance;
start ( 10.0 0.02 0.0 );
end ( 10.0 0.02 0.55 );
nPoints 1001;
}
line7
{
type uniform;
axis distance;
start ( 12.0 0.005 0.0 );
end ( 12.0 0.005 0.55 );
nPoints 1001;
}
line8
{
type uniform;
axis distance;
start ( 14.0 0.005 0.0 );
end ( 14.0 0.005 0.55 );
nPoints 1001;
}
);
fixedLocations false;
fields
(
U alpha.water
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
method hierarchical;
hierarchicalCoeffs
{
n (2 1 1);
delta 0.001;
order xyz;
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "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(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //

View File

@ -0,0 +1,93 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"alpha.water.*"
{
nAlphaCorr 1;
nAlphaSubCycles 3;
alphaOuterCorrectors yes;
cAlpha 1;
MULESCorr no;
nLimiterIter 3;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-8;
relTol 0;
}
pcorr
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
}
p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0.1;
}
p_rghFinal
{
solver GAMG;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration on;
agglomerator faceAreaPair;
nCellsInCoarsestLevel 10;
mergeLevels 1;
tolerance 1e-7;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0.1;
}
UFinal
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
}
}
PIMPLE
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,36 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue alpha.water 0
);
regions
(
boxToCell
{
box (0 0 0) (30.0 1.0 0.4);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type waveVelocity;
value uniform (0 0 0);
}
outlet
{
type waveVelocity;
value uniform (0 0 0);
}
sides
{
type empty;
}
ground
{
type fixedValue;
value uniform (0 0 0);
}
top
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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 waveAlpha;
value uniform 0;
}
outlet
{
type zeroGradient;
}
ground
{
type zeroGradient;
}
sides
{
type empty;
}
top
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: http://www.OpenFOAM.com |
| \\/ 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;
}
ground
{
type fixedFluxPressure;
value uniform 0;
}
sides
{
type empty;
}
top
{
type totalPressure;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
p0 uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
rm -rf 0
cleanCase

View File

@ -0,0 +1,15 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
restore0Dir
runApplication blockMesh
runApplication decomposePar
runParallel setFields
runParallel $(getApplication)

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value ( 0 0 -9.81 );
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More