mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: waveModels - moved to main source tree and simplified
This commit is contained in:
@ -1,4 +0,0 @@
|
||||
waveInletVelocity/waveInletVelocityFvPatchVectorField.C
|
||||
waveInletAlpha/waveInletAlphaFvPatchScalarField.C
|
||||
|
||||
LIB = $(FOAM_USER_LIBBIN)/libwaveBCs
|
||||
@ -1,10 +0,0 @@
|
||||
DEV_PATH = ..
|
||||
|
||||
EXE_INC = \
|
||||
-I$(DEV_PATH)/waveModel/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-L$(FOAM_USER_LIBBIN) \
|
||||
-lwaveModels \
|
||||
-lfiniteVolume
|
||||
@ -1,150 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "waveAbsorptionOutletVelocityFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "waveModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::waveAbsorptionOutletVelocityFvPatchVectorField::
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
waveDictName_(waveModel::dictName)
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveAbsorptionOutletVelocityFvPatchVectorField::
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveAbsorptionOutletVelocityFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||
waveDictName_(ptf.waveDictName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveAbsorptionOutletVelocityFvPatchVectorField::
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||
waveDictName_(dict.lookupOrDefault<word>("waveDict", waveModel::dictName))
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveAbsorptionOutletVelocityFvPatchVectorField::
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveAbsorptionOutletVelocityFvPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf),
|
||||
waveDictName_(ptf.waveDictName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveAbsorptionOutletVelocityFvPatchVectorField::
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveAbsorptionOutletVelocityFvPatchVectorField& ptf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, iF),
|
||||
waveDictName_(ptf.waveDictName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::waveAbsorptionOutletVelocityFvPatchVectorField::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::waveAbsorptionOutletVelocityFvPatchVectorField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchField<vector>::write(os);
|
||||
|
||||
os.writeKeyword("waveDictName") << waveDictName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,165 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
|
||||
Description
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
inlet
|
||||
{
|
||||
type waveAbsorptionOutletVelocity;
|
||||
waveDict wavesDict;
|
||||
value uniform (0 0 0);
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type: waveAbsorptionOutletVelocity | 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
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef waveAbsorptionOutletVelocityFvPatchVectorField_H
|
||||
#define waveAbsorptionOutletVelocityFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class waveAbsorptionOutletVelocityFvPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
:
|
||||
public fixedValueFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Dictionary name
|
||||
word waveDictName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("waveAbsorptionOutletVelocity");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
// onto a new patch
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveAbsorptionOutletVelocityFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveAbsorptionOutletVelocityFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new waveAbsorptionOutletVelocityFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
waveAbsorptionOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveAbsorptionOutletVelocityFvPatchVectorField&,
|
||||
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 waveAbsorptionOutletVelocityFvPatchVectorField(*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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,142 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "waveInletAlphaFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "waveModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::waveInletAlphaFvPatchScalarField::waveInletAlphaFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF),
|
||||
waveDictName_(waveModel::dictName)
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveInletAlphaFvPatchScalarField::waveInletAlphaFvPatchScalarField
|
||||
(
|
||||
const waveInletAlphaFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
waveDictName_(ptf.waveDictName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveInletAlphaFvPatchScalarField::waveInletAlphaFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
waveDictName_(dict.lookupOrDefault<word>("waveDict", waveModel::dictName))
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveInletAlphaFvPatchScalarField::waveInletAlphaFvPatchScalarField
|
||||
(
|
||||
const waveInletAlphaFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf),
|
||||
waveDictName_(ptf.waveDictName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveInletAlphaFvPatchScalarField::waveInletAlphaFvPatchScalarField
|
||||
(
|
||||
const waveInletAlphaFvPatchScalarField& ptf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, iF),
|
||||
waveDictName_(ptf.waveDictName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::waveInletAlphaFvPatchScalarField::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::waveInletAlphaFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
|
||||
os.writeKeyword("waveDictName") << waveDictName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
waveInletAlphaFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,165 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::waveInletAlphaFvPatchScalarField
|
||||
|
||||
Description
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
inlet
|
||||
{
|
||||
type waveInletAlpha;
|
||||
value uniform (0 0 0);
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type: waveInletAlpha | 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
|
||||
waveInletAlphaFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef waveInletAlphaFvPatchScalarField_H
|
||||
#define waveInletAlphaFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
class waveInletAlphaFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class waveInletAlphaFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Dictionary name
|
||||
word waveDictName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("waveInletAlpha");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
waveInletAlphaFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
waveInletAlphaFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// waveInletAlphaFvPatchScalarField
|
||||
// onto a new patch
|
||||
waveInletAlphaFvPatchScalarField
|
||||
(
|
||||
const waveInletAlphaFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
waveInletAlphaFvPatchScalarField
|
||||
(
|
||||
const waveInletAlphaFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new waveInletAlphaFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
waveInletAlphaFvPatchScalarField
|
||||
(
|
||||
const waveInletAlphaFvPatchScalarField&,
|
||||
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 waveInletAlphaFvPatchScalarField(*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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,142 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "waveInletVelocityFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "waveModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::waveInletVelocityFvPatchVectorField::waveInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
waveDictName_(waveModel::dictName)
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveInletVelocityFvPatchVectorField::waveInletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveInletVelocityFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||
waveDictName_(ptf.waveDictName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveInletVelocityFvPatchVectorField::waveInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||
waveDictName_(dict.lookupOrDefault<word>("waveDict", waveModel::dictName))
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveInletVelocityFvPatchVectorField::waveInletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveInletVelocityFvPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf),
|
||||
waveDictName_(ptf.waveDictName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::waveInletVelocityFvPatchVectorField::waveInletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveInletVelocityFvPatchVectorField& ptf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, iF),
|
||||
waveDictName_(ptf.waveDictName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::waveInletVelocityFvPatchVectorField::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::waveInletVelocityFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<vector>::write(os);
|
||||
|
||||
os.writeKeyword("waveDictName") << waveDictName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
waveInletVelocityFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,164 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::waveInletVelocityFvPatchVectorField
|
||||
|
||||
Description
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
inlet
|
||||
{
|
||||
type waveInletVelocity;
|
||||
value uniform (0 0 0);
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type: waveInletVelocity | 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
|
||||
waveInletVelocityFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef waveInletVelocityFvPatchVectorField_H
|
||||
#define waveInletVelocityFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class waveInletVelocityFvPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class waveInletVelocityFvPatchVectorField
|
||||
:
|
||||
public fixedValueFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Dictionary name
|
||||
word waveDictName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("waveInletVelocity");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
waveInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
waveInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// waveInletVelocityFvPatchVectorField
|
||||
// onto a new patch
|
||||
waveInletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveInletVelocityFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
waveInletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveInletVelocityFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new waveInletVelocityFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
waveInletVelocityFvPatchVectorField
|
||||
(
|
||||
const waveInletVelocityFvPatchVectorField&,
|
||||
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 waveInletVelocityFvPatchVectorField(*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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,18 +0,0 @@
|
||||
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
|
||||
|
||||
|
||||
LIB = $(FOAM_USER_LIBBIN)/libwaveModels
|
||||
@ -1,5 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume
|
||||
@ -1,92 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,93 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,117 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,110 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,139 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,123 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,105 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,105 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,105 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,98 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,251 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,145 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,238 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,138 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#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;
|
||||
|
||||
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;
|
||||
|
||||
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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,181 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,128 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#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
|
||||
|
||||
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;
|
||||
|
||||
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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,895 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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;
|
||||
|
||||
const scalar tolerance = 1e-12;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,227 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#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
|
||||
|
||||
//-
|
||||
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;
|
||||
|
||||
//-
|
||||
virtual void initialise
|
||||
(
|
||||
const scalar H,
|
||||
const scalar d,
|
||||
const scalar T,
|
||||
scalar& kOut,
|
||||
scalar& LambdaOut,
|
||||
scalar& f1Out,
|
||||
scalar& f2Out
|
||||
) const;
|
||||
|
||||
//-
|
||||
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;
|
||||
|
||||
//-
|
||||
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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,152 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,367 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,174 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#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;
|
||||
|
||||
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;
|
||||
|
||||
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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,429 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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_;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,257 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,103 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user