diff --git a/applications/solvers/multiphase/interFoam/Make/options b/applications/solvers/multiphase/interFoam/Make/options index cfe4a920729ed8bd1497f89de334caf51b85a312..21e9667b837644e37c0270d13883c42a6b1ebc78 100644 --- a/applications/solvers/multiphase/interFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/Make/options @@ -17,4 +17,5 @@ EXE_LIBS = \ -lfiniteVolume \ -lfvOptions \ -lmeshTools \ - -lsampling + -lsampling \ + -lwaveModels diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options b/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options index bceea20c8147c9bf4b7ff720f6d00f6ba21b65bd..9792cb9b8584eaf4f866d82593d7eef94739d9f8 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options @@ -24,4 +24,5 @@ EXE_LIBS = \ -ltopoChangerFvMesh \ -lmeshTools \ -lfvOptions \ - -lsampling + -lsampling \ + -lwaveModels diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options index ce7222ff1bcf43af0ef9ab7a62e7d43b469072b3..3d2ce063a5dcdc8c840a3a1dc3eccafe313d215c 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options @@ -23,4 +23,5 @@ EXE_LIBS = \ -lfiniteVolume \ -lmeshTools \ -lfvOptions \ - -lsampling + -lsampling \ + -lwaveModels diff --git a/src/Allwmake b/src/Allwmake index 96b82df71a96cc16414f27ef33110ac760bf5d4f..949c32b5dab6e6214d8612b20bb54798e93501a8 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -70,6 +70,7 @@ lagrangian/Allwmake $targetType $* mesh/Allwmake $targetType $* renumber/Allwmake $targetType $* fvAgglomerationMethods/Allwmake $targetType $* +wmake $targetType waveModels wmake $targetType engine wmake $targetType fvOptions diff --git a/src/waveModels/Make/files b/src/waveModels/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..67333fa8212da6bf46a5c56b6b6d02f53b6855db --- /dev/null +++ b/src/waveModels/Make/files @@ -0,0 +1,20 @@ +waveModel/waveModel.C +waveModel/waveModelNew.C + +waveGenerationModels/base/waveGenerationModel/waveGenerationModel.C +waveGenerationModels/base/regularWaveModel/regularWaveModel.C +waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.C +waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.C +waveGenerationModels/derived/cnoidal/cnoidalWaveModel.C +waveGenerationModels/derived/StokesII/StokesIIWaveModel.C +waveGenerationModels/derived/StokesI/StokesIWaveModel.C +waveGenerationModels/derived/StokesV/StokesVWaveModel.C + + +waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.C +waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.C + +derivedFvPatchFields/waveVelocity/waveVelocityFvPatchVectorField.C +derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.C + +LIB = $(FOAM_LIBBIN)/libwaveModels diff --git a/src/waveModels/Make/options b/src/waveModels/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..71b7873964d544eddf96d22aa40f4c3372c23c9c --- /dev/null +++ b/src/waveModels/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -lfiniteVolume diff --git a/src/waveModels/derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.C b/src/waveModels/derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..6117513bc992aa6ce37ccb7994291e9eb97c3d42 --- /dev/null +++ b/src/waveModels/derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.C @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "waveAlphaFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "waveModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(p, iF), + waveDictName_(waveModel::dictName) +{} + + +Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField +( + const waveAlphaFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + waveDictName_(ptf.waveDictName_) +{} + + +Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchField<scalar>(p, iF, dict), + waveDictName_(dict.lookupOrDefault<word>("waveDict", waveModel::dictName)) +{} + + +Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField +( + const waveAlphaFvPatchScalarField& ptf +) +: + fixedValueFvPatchField<scalar>(ptf), + waveDictName_(ptf.waveDictName_) +{} + + +Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField +( + const waveAlphaFvPatchScalarField& ptf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(ptf, iF), + waveDictName_(ptf.waveDictName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::waveAlphaFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + tmp<waveModel> tmodel + ( + waveModel::lookupOrCreate + ( + patch().patch(), + internalField().mesh(), + waveDictName_ + ) + ); + + waveModel& model = const_cast<waveModel&>(tmodel()); + + model.correct(db().time().value()); + + operator == (model.alpha()); + + fixedValueFvPatchField<scalar>::updateCoeffs(); +} + + +void Foam::waveAlphaFvPatchScalarField::write(Ostream& os) const +{ + fvPatchField<scalar>::write(os); + + os.writeKeyword("waveDictName") << waveDictName_ + << token::END_STATEMENT << nl; + + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + waveAlphaFvPatchScalarField + ); +} + + +// ************************************************************************* // diff --git a/src/waveModels/derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.H b/src/waveModels/derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..4286d15a7abaea9bad5b0d5812f29cfe9ff08ab4 --- /dev/null +++ b/src/waveModels/derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.H @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveAlphaFvPatchScalarField + +Description + + Example of the boundary condition specification: + \verbatim + inlet + { + type waveAlpha; + value uniform (0 0 0); + } + \endverbatim + +Usage + \table + Property | Description | Required | Default value + type | type: waveAlpha | yes | + waveDict | Dictionary specifying wave variables | no | waveProperties + \endtable + +Note + - The value is positive inwards + - May not work correctly for transonic inlets + - Strange behaviour with potentialFoam since the U equation is not solved + +SourceFiles + waveAlphaFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef waveAlphaFvPatchScalarField_H +#define waveAlphaFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + class waveAlphaFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class waveAlphaFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + //- Dictionary name + word waveDictName_; + + +public: + + //- Runtime type information + TypeName("waveAlpha"); + + + // Constructors + + //- Construct from patch and internal field + waveAlphaFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + waveAlphaFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // waveAlphaFvPatchScalarField + // onto a new patch + waveAlphaFvPatchScalarField + ( + const waveAlphaFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + waveAlphaFvPatchScalarField + ( + const waveAlphaFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new waveAlphaFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + waveAlphaFvPatchScalarField + ( + const waveAlphaFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new waveAlphaFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/derivedFvPatchFields/waveVelocity/waveVelocityFvPatchVectorField.C b/src/waveModels/derivedFvPatchFields/waveVelocity/waveVelocityFvPatchVectorField.C new file mode 100644 index 0000000000000000000000000000000000000000..a237aabbc1705ebd897bc189ba4766f216af8353 --- /dev/null +++ b/src/waveModels/derivedFvPatchFields/waveVelocity/waveVelocityFvPatchVectorField.C @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "waveVelocityFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "waveModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF +) +: + fixedValueFvPatchField<vector>(p, iF), + waveDictName_(waveModel::dictName) +{} + + +Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField +( + const waveVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField<vector>(ptf, p, iF, mapper), + waveDictName_(ptf.waveDictName_) +{} + + +Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchField<vector>(p, iF, dict), + waveDictName_(dict.lookupOrDefault<word>("waveDict", waveModel::dictName)) +{} + + +Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField +( + const waveVelocityFvPatchVectorField& ptf +) +: + fixedValueFvPatchField<vector>(ptf), + waveDictName_(ptf.waveDictName_) +{} + + +Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField +( + const waveVelocityFvPatchVectorField& ptf, + const DimensionedField<vector, volMesh>& iF +) +: + fixedValueFvPatchField<vector>(ptf, iF), + waveDictName_(ptf.waveDictName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::waveVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + tmp<waveModel> tmodel + ( + waveModel::lookupOrCreate + ( + patch().patch(), + internalField().mesh(), + waveDictName_ + ) + ); + + waveModel& model = const_cast<waveModel&>(tmodel()); + + model.correct(db().time().value()); + + operator == (model.U()); + + fixedValueFvPatchField<vector>::updateCoeffs(); +} + + +void Foam::waveVelocityFvPatchVectorField::write(Ostream& os) const +{ + fvPatchField<vector>::write(os); + + os.writeKeyword("waveDictName") << waveDictName_ + << token::END_STATEMENT << nl; + + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + waveVelocityFvPatchVectorField + ); +} + + +// ************************************************************************* // diff --git a/src/waveModels/derivedFvPatchFields/waveVelocity/waveVelocityFvPatchVectorField.H b/src/waveModels/derivedFvPatchFields/waveVelocity/waveVelocityFvPatchVectorField.H new file mode 100644 index 0000000000000000000000000000000000000000..5098102dd1a8c19b8d2aed41e48b5ad545c7575b --- /dev/null +++ b/src/waveModels/derivedFvPatchFields/waveVelocity/waveVelocityFvPatchVectorField.H @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveVelocityFvPatchVectorField + +Description + Example of the boundary condition specification: + \verbatim + inlet + { + type waveVelocity; + value uniform (0 0 0); + } + \endverbatim + +Usage + \table + Property | Description | Required | Default value + type | type: waveVelocity | yes | + waveDict | Dictionary specifying wave variables | no | waveProperties + \endtable + +Note + - The value is positive inwards + - May not work correctly for transonic inlets + - Strange behaviour with potentialFoam since the U equation is not solved + +SourceFiles + waveVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef waveVelocityFvPatchVectorField_H +#define waveVelocityFvPatchVectorField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class waveVelocityFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class waveVelocityFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Dictionary name + word waveDictName_; + + +public: + + //- Runtime type information + TypeName("waveVelocity"); + + + // Constructors + + //- Construct from patch and internal field + waveVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + waveVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // waveVelocityFvPatchVectorField + // onto a new patch + waveVelocityFvPatchVectorField + ( + const waveVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + waveVelocityFvPatchVectorField + ( + const waveVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchVectorField> clone() const + { + return tmp<fvPatchVectorField> + ( + new waveVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + waveVelocityFvPatchVectorField + ( + const waveVelocityFvPatchVectorField&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchVectorField> clone + ( + const DimensionedField<vector, volMesh>& iF + ) const + { + return tmp<fvPatchVectorField> + ( + new waveVelocityFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.C b/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.C new file mode 100644 index 0000000000000000000000000000000000000000..a0f47ef919478f9a2333b0ce25ed5116ce367ede --- /dev/null +++ b/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.C @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "waveAbsorptionModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + defineTypeNameAndDebug(waveAbsorptionModel, 0); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::scalar Foam::waveModels::waveAbsorptionModel::timeCoeff +( + const scalar t +) const +{ + // No time ramping applied applied for absorption + return 1; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::waveAbsorptionModel::waveAbsorptionModel +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + waveModel(dict, mesh, patch, false) +{ + if (readFields) + { + read(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::waveAbsorptionModel::~waveAbsorptionModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::waveAbsorptionModel::read(const dictionary& overrideDict) +{ + if (waveModel::read(overrideDict)) + { + // Note: always set to true + activeAbsorption_ = true; + + return true; + } + + return false; +} + + +// ************************************************************************* // diff --git a/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.H b/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.H new file mode 100644 index 0000000000000000000000000000000000000000..0201aaaab7c94f3dd2671971c51908744fbe0c40 --- /dev/null +++ b/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.H @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveAbsorptionModel + +Description + +\*---------------------------------------------------------------------------*/ + +#ifndef waveModels_waveAbsorptionModel_H +#define waveModels_waveAbsorptionModel_H + +#include "waveModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + +/*---------------------------------------------------------------------------*\ + Class waveAbsorptionModel Declaration +\*---------------------------------------------------------------------------*/ + +class waveAbsorptionModel +: + public waveModel +{ +protected: + + // Protected Member Functions + + //- Return the time scaling coefficient + virtual scalar timeCoeff(const scalar t) const; + + +public: + + //- Runtime type information + TypeName("waveAbsorptionModel"); + + //- Constructor + waveAbsorptionModel + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields = true + ); + + //- Destructor + virtual ~waveAbsorptionModel(); + + + // Public Member Functions + + //- Read from dictionary + virtual bool read(const dictionary& overrideDict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace waveModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.C b/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.C new file mode 100644 index 0000000000000000000000000000000000000000..471ac164bcf5fa8d2466ca21f685a4c739664f46 --- /dev/null +++ b/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.C @@ -0,0 +1,117 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "shallowWaterAbsorption.H" +#include "volFields.H" +#include "fvPatchFields.H" +#include "addToRunTimeSelectionTable.H" + + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + defineTypeNameAndDebug(shallowWaterAbsorption, 0); + addToRunTimeSelectionTable(waveModel, shallowWaterAbsorption, patch); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::waveModels::shallowWaterAbsorption::setLevel +( + const scalar t, + const scalar tCoeff, + scalarField& level +) const +{ + level = waterDepthRef_; +} + + +void Foam::waveModels::shallowWaterAbsorption::setVelocity +( + const scalar t, + const scalar tCoeff, + const scalarField& level +) +{ + U_ = vector::zero; +} + + +void Foam::waveModels::shallowWaterAbsorption::setAlpha +( + const scalarField& level +) +{ + // Set alpha as zero-gradient + const volScalarField& alpha = + mesh_.lookupObject<volScalarField>(alphaName_); + + alpha_ = alpha.boundaryField()[patch_.index()].patchInternalField(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::shallowWaterAbsorption::shallowWaterAbsorption +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + waveAbsorptionModel(dict, mesh, patch, false) +{ + if (readFields) + { + read(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::shallowWaterAbsorption::~shallowWaterAbsorption() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::shallowWaterAbsorption::read +( + const dictionary& overrideDict +) +{ + return waveAbsorptionModel::read(overrideDict); +} + + +// ************************************************************************* // diff --git a/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.H b/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.H new file mode 100644 index 0000000000000000000000000000000000000000..bbc31f78783f87ca856e13755c9f12b6f4d5297f --- /dev/null +++ b/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::shallowWaterAbsorption + +Description + +\*---------------------------------------------------------------------------*/ + +#ifndef waveModels_shallowWaterAbsorption_H +#define waveModels_shallowWaterAbsorption_H + +#include "waveAbsorptionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + +/*---------------------------------------------------------------------------*\ + Class shallowWaterAbsorption Declaration +\*---------------------------------------------------------------------------*/ + +class shallowWaterAbsorption +: + public waveAbsorptionModel +{ +protected: + + // Protected Member Functions + + + //- Set the water level + virtual void setLevel + ( + const scalar t, + const scalar tCoeff, + scalarField& level + ) const; + + //- Calculate the wave model velocity + virtual void setVelocity + ( + const scalar t, + const scalar tCoeff, + const scalarField& level + ); + + //- Set the alpha field based on the water level + virtual void setAlpha(const scalarField& level); + + +public: + + //- Runtime type information + TypeName("shallowWaterAbsorption"); + + //- Constructor + shallowWaterAbsorption + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields = true + ); + + //- Destructor + virtual ~shallowWaterAbsorption(); + + + // Public Member Functions + + //- Read from dictionary + virtual bool read(const dictionary& overrideDict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace waveModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.C b/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.C new file mode 100644 index 0000000000000000000000000000000000000000..efaa83b5524b4a861a4d61795d656e9eb586dd6c --- /dev/null +++ b/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.C @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regularWaveModel.H" +#include "mathematicalConstants.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + defineTypeNameAndDebug(regularWaveModel, 0); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::scalar Foam::waveModels::regularWaveModel::timeCoeff +( + const scalar t +) const +{ + return max(0, min(t/rampTime_, 1)); +} + + +Foam::word Foam::waveModels::regularWaveModel::waveType() const +{ + scalar waveK = 2.0*mathematical::pi/waveLength_; + + word generation = "Intermediate"; + if (waveK*waterDepthRef_ > mathematical::pi) + { + generation = "Deep"; + } + else if (waveK*waterDepthRef_ < 0.1*mathematical::pi) + { + generation = "Shallow"; + } + + return generation; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::regularWaveModel::regularWaveModel +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + waveGenerationModel(dict, mesh, patch, false), + rampTime_(VSMALL), + wavePeriod_(0), + waveLength_(0), + wavePhase_(1.5*mathematical::pi) +{ + if (readFields) + { + read(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::regularWaveModel::~regularWaveModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::regularWaveModel::read(const dictionary& overrideDict) +{ + if (waveGenerationModel::read(overrideDict)) + { + lookup("rampTime") >> rampTime_; + + lookup("wavePeriod") >> wavePeriod_; + if (wavePeriod_ < 0) + { + FatalIOErrorInFunction(*this) + << "Wave period must be greater than zero. Supplied" + << " value wavePeriod = " << wavePeriod_ + << exit(FatalIOError); + } + + readIfPresent("wavePhase", wavePhase_); + + // Note: waveLength to be set in derived classes + + return true; + } + + return false; +} + + +void Foam::waveModels::regularWaveModel::info(Ostream& os) const +{ + waveGenerationModel::info(os); + + os << " Ramp time : " << rampTime_ << nl + << " Wave period : " << wavePeriod_ << nl + << " Wave length : " << waveLength_ << nl + << " Wave phase : " << wavePhase_ << nl; +} + + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.H b/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.H new file mode 100644 index 0000000000000000000000000000000000000000..13b6bfda73ef3bd58bae18b6e96c6c6311c83184 --- /dev/null +++ b/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.H @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveModels::regularWaveModel + +Description + +\*---------------------------------------------------------------------------*/ + +#ifndef waveModels_reguarWaveModel_H +#define waveModels_reguarWaveModel_H + +#include "waveGenerationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + +/*---------------------------------------------------------------------------*\ + Class regularWaveModel Declaration +\*---------------------------------------------------------------------------*/ + +class regularWaveModel +: + public waveGenerationModel +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + regularWaveModel(const regularWaveModel&); + + //- Disallow default bitwise assignment + void operator=(const regularWaveModel&); + + +protected: + + // Protected data + + //- Ramp time + scalar rampTime_; + + //- Wave period + scalar wavePeriod_; + + //- Wavelength + scalar waveLength_; + + //- Wave phase + scalar wavePhase_; + + + // Protected Member Functions + + //- Return the time scaling coefficient + virtual scalar timeCoeff(const scalar t) const; + + //- Return word description of wave type + virtual word waveType() const; + + +public: + + //- Runtime type information + TypeName("regularWaveModel"); + + + //- Constructor + regularWaveModel + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields = true + ); + + //- Destructor + virtual ~regularWaveModel(); + + + // Public Member Functions + + //- Read from dictionary + virtual bool read(const dictionary& overrideDict); + + //- Info + virtual void info(Ostream& os) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace waveModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.C b/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.C new file mode 100644 index 0000000000000000000000000000000000000000..332d7e0304d011802dd8dd322724ca75b05d515f --- /dev/null +++ b/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.C @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "solitaryWaveModel.H" +#include "polyPatch.H" +#include "SubField.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + defineTypeNameAndDebug(solitaryWaveModel, 0); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::scalar Foam::waveModels::solitaryWaveModel::timeCoeff +( + const scalar t +) const +{ + // Ramping not applicable to solitary waves + return 1; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::solitaryWaveModel::solitaryWaveModel +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + waveGenerationModel(dict, mesh, patch, false), + x_ + ( + patch.faceCentres().component(0)*cos(waveAngle_) + + patch.faceCentres().component(1)*sin(waveAngle_) + ), + x0_(gMin(x_)) +{ + if (readFields) + { + read(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::solitaryWaveModel::~solitaryWaveModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::solitaryWaveModel::read(const dictionary& overrideDict) +{ + if (waveGenerationModel::read(overrideDict)) + { + return true; + } + + return false; +} + + +void Foam::waveModels::solitaryWaveModel::info(Ostream& os) const +{ + waveGenerationModel::info(os); + + os << " x0: " << x0_ << nl; +} + + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.H b/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.H new file mode 100644 index 0000000000000000000000000000000000000000..f01dff404c3d44de7b12377d07619b79a2a8946d --- /dev/null +++ b/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.H @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveModels::solitaryWaveModel + +Description + +\*---------------------------------------------------------------------------*/ + +#ifndef waveModels_solitaryWaveModel_H +#define waveModels_solitaryWaveModel_H + +#include "waveGenerationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + +/*---------------------------------------------------------------------------*\ + Class solitaryWaveModel Declaration +\*---------------------------------------------------------------------------*/ + +class solitaryWaveModel +: + public waveGenerationModel +{ + +protected: + + // Protected data + + //- + const scalarField& x_; + + const scalar x0_; + + + // Protected Member Functions + + //- Return the time scaling coefficient + virtual scalar timeCoeff(const scalar t) const; + + +public: + + //- Runtime type information + TypeName("solitaryWaveModel"); + + + //- Constructor + solitaryWaveModel + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields = true + ); + + //- Destructor + virtual ~solitaryWaveModel(); + + + // Public Member Functions + + //- Read from dictionary + virtual bool read(const dictionary& overrideDict); + + //- Info + virtual void info(Ostream& os) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace waveModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.C b/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.C new file mode 100644 index 0000000000000000000000000000000000000000..44cf01006b305e6123d849dd3f43d17dc8d34268 --- /dev/null +++ b/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.C @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "waveGenerationModel.H" +#include "mathematicalConstants.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + defineTypeNameAndDebug(waveGenerationModel, 0); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::waveGenerationModel::waveGenerationModel +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + waveModel(dict, mesh, patch, false), + waveHeight_(0), + waveAngle_(0) +{ + if (readFields) + { + read(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::waveGenerationModel::~waveGenerationModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::waveGenerationModel::read(const dictionary& overrideDict) +{ + if (waveModel::read(overrideDict)) + { + lookup("activeAbsorption") >> activeAbsorption_; + + lookup("waveHeight") >> waveHeight_; + if (waveHeight_ < 0) + { + FatalIOErrorInFunction(*this) + << "Wave height must be greater than zero. Supplied" + << " value waveHeight = " << waveHeight_ + << exit(FatalIOError); + } + + lookup("waveAngle") >> waveAngle_; + waveAngle_ *= mathematical::pi/180; + + return true; + } + + return false; +} + + +void Foam::waveModels::waveGenerationModel::info(Ostream& os) const +{ + waveModel::info(os); + + os << " Wave height : " << waveHeight_ << nl + << " Wave angle : " << 180/mathematical::pi*waveAngle_ << nl; +} + + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.H b/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.H new file mode 100644 index 0000000000000000000000000000000000000000..c0ed643e7b9467975acfc5c24f90ec696bf9b485 --- /dev/null +++ b/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveGenerationModel + +Description + +\*---------------------------------------------------------------------------*/ + +#ifndef waveModels_waveGenerationModel_H +#define waveModels_waveGenerationModel_H + +#include "waveModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + +/*---------------------------------------------------------------------------*\ + Class waveGenerationModel Declaration +\*---------------------------------------------------------------------------*/ + +class waveGenerationModel +: + public waveModel +{ +protected: + + // Protected data + + //- Wave height / [m] + scalar waveHeight_; + + //- Wave angle / [rad] (read in degrees) + scalar waveAngle_; + + +public: + + //- Runtime type information + TypeName("waveGenerationModel"); + + //- Constructor + waveGenerationModel + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields = true + ); + + //- Destructor + virtual ~waveGenerationModel(); + + + // Public Member Functions + + //- Read from dictionary + virtual bool read(const dictionary& overrideDict); + + //- Info + virtual void info(Ostream& os) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace waveModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.C b/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.C new file mode 100644 index 0000000000000000000000000000000000000000..d7e4dca2fc592d56f394e0730593b00a5c33bab6 --- /dev/null +++ b/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.C @@ -0,0 +1,251 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "BoussinesqWaveModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + defineTypeNameAndDebug(Boussinesq, 0); + addToRunTimeSelectionTable + ( + waveModel, + Boussinesq, + patch + ); +} +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::scalar Foam::waveModels::Boussinesq::eta +( + const scalar H, + const scalar h, + const scalar x, + const scalar y, + const scalar theta, + const scalar t, + const scalar X0 +) const +{ + scalar C = sqrt(mag(g_)*(H + h)); + scalar ts = 3.5*h/sqrt(H/h); + scalar aux = sqrt(3.0*H/(4.0*h))/h; + scalar Xa = -C*t + ts - X0 + x*cos(theta) + y*sin(theta); + + return H*1.0/sqr(cosh(aux*Xa)); +} + + +Foam::vector Foam::waveModels::Boussinesq::Deta +( + const scalar H, + const scalar h, + const scalar x, + const scalar y, + const scalar theta, + const scalar t, + const scalar X0 +) const +{ + vector deta(vector::zero); + + scalar C = sqrt(mag(g_)*(H + h)); + scalar ts = 3.5*h/sqrt(H/h); + scalar a = sqrt(3*H/(4*h))/h; + scalar Xa = -C*t + ts - X0 + x*cos(theta) + y*sin(theta); + scalar expTerm = exp(2*a*Xa); + scalar b = 8*a*h*expTerm; + + deta[0] = + b*(1 - expTerm) + /pow3(1 + expTerm); + + deta[1] = + 2*a*b*(exp(4*a*Xa) - 4*expTerm + 1) + /pow4(1 + expTerm); + + deta[2] = + -4*sqr(a)*b*(exp(6*a*Xa) - 11*exp(4*a*Xa) + 11*expTerm - 1) + /pow5(1 + expTerm); + + return deta; +} + + +Foam::vector Foam::waveModels::Boussinesq::U +( + const scalar H, + const scalar h, + const scalar x, + const scalar y, + const scalar theta, + const scalar t, + const scalar X0, + const scalar z +) const +{ + scalar C = sqrt(mag(g_)*(H + h)); + scalar eta = this->eta(H, h, x, y, theta, t, X0); + vector Deta = this->Deta(H, h, x, y, theta, t, X0); + + scalar u = + C*eta/h + *( + 1.0 + - eta/(4.0*h) + + sqr(h)/(3.0*eta)*(1.0 - 3.0/2.0*sqr(z/h))*Deta[1] + ); + + scalar w = + -C*z/h + *( + (1.0 - eta/(2.0*h))*Deta[0] + + sqr(h)/3.0*(1.0 - 1.0/2.0*sqr(z/h))*Deta[2] + ); + + scalar v = u*sin(waveAngle_); + u *= cos(waveAngle_); + + return vector(u, v, w); +} + + +void Foam::waveModels::Boussinesq::setLevel +( + const scalar t, + const scalar tCoeff, + scalarField& level +) const +{ + forAll(level, paddlei) + { + const scalar eta = + this->eta + ( + waveHeight_, + waterDepthRef_, + xPaddle_[paddlei], + yPaddle_[paddlei], + waveAngle_, + t, + x0_ + ); + + level[paddlei] = waterDepthRef_ + tCoeff*eta; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::Boussinesq::Boussinesq +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + solitaryWaveModel(dict, mesh, patch, false) +{ + if (readFields) + { + read(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::Boussinesq::~Boussinesq() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::Boussinesq::read(const dictionary& overrideDict) +{ + if (solitaryWaveModel::read(overrideDict)) + { + return true; + } + + return false; +} + + +void Foam::waveModels::Boussinesq::setVelocity +( + const scalar t, + const scalar tCoeff, + const scalarField& level +) +{ + forAll(U_, facei) + { + // Fraction of geometry represented by paddle - to be set + scalar fraction = 1; + + // Height - to be set + scalar z = 0; + + setPaddlePropeties(level, facei, fraction, z); + + if (fraction > 0) + { + const label paddlei = faceToPaddle_[facei]; + + const vector Uf = U + ( + waveHeight_, + waterDepthRef_, + xPaddle_[paddlei], + yPaddle_[paddlei], + waveAngle_, + t, + x0_, + z + ); + + U_[facei] = fraction*Uf*tCoeff; + } + } +} + + +void Foam::waveModels::Boussinesq::info(Ostream& os) const +{ + solitaryWaveModel::info(os); +} + + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.H b/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.H new file mode 100644 index 0000000000000000000000000000000000000000..ff76841a818fcc57b06cedea59b49cb9823d8ac6 --- /dev/null +++ b/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.H @@ -0,0 +1,146 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveModels::Boussinesq + +Description + Boussinesq wave model + +\*---------------------------------------------------------------------------*/ + +#ifndef waveModels_Boussinesq_H +#define waveModels_Boussinesq_H + +#include "solitaryWaveModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + +/*---------------------------------------------------------------------------*\ + Class Boussinesq Declaration +\*---------------------------------------------------------------------------*/ + +class Boussinesq +: + public solitaryWaveModel +{ +protected: + + // Protected Member Functions + + //- Wave height + virtual scalar eta + ( + const scalar H, + const scalar h, + const scalar x, + const scalar y, + const scalar theta, + const scalar t, + const scalar X0 + ) const; + + //- Wave + virtual vector Deta + ( + const scalar H, + const scalar h, + const scalar x, + const scalar y, + const scalar theta, + const scalar t, + const scalar X0 + ) const; + + //- Wave velocity + virtual vector U + ( + const scalar H, + const scalar h, + const scalar x, + const scalar y, + const scalar theta, + const scalar t, + const scalar X0, + const scalar z + ) const; + + //- Set the water level + virtual void setLevel + ( + const scalar t, + const scalar tCoeff, + scalarField& level + ) const; + + //- Calculate the wave model velocity + virtual void setVelocity + ( + const scalar t, + const scalar tCoeff, + const scalarField& level + ); + + +public: + + //- Runtime type information + TypeName("Boussinesq"); + + //- Constructor + Boussinesq + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields = true + ); + + //- Destructor + virtual ~Boussinesq(); + + + // Public Member Functions + + //- Read from dictionary + virtual bool read(const dictionary& overrideDict); + + //- Info + virtual void info(Ostream& os) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace waveModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.C b/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.C new file mode 100644 index 0000000000000000000000000000000000000000..8a67ea2a2db4ae3349cf47440d211dd4b82f7852 --- /dev/null +++ b/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.C @@ -0,0 +1,238 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "StokesIWaveModel.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + defineTypeNameAndDebug(StokesI, 0); + addToRunTimeSelectionTable + ( + waveModel, + StokesI, + patch + ); +} +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::scalar Foam::waveModels::StokesI::waveLength +( + const scalar h, + const scalar T +) const +{ + scalar L0 = mag(g_)*T*T/(2.0*mathematical::pi); + scalar L = L0; + + for (int i=1; i<=100; i++) + { + L = L0*tanh(2.0*mathematical::pi*h/L); + } + + return L; +} + + +Foam::scalar Foam::waveModels::StokesI::eta +( + const scalar H, + const scalar Kx, + const scalar x, + const scalar Ky, + const scalar y, + const scalar omega, + const scalar t, + const scalar phase +) const +{ + scalar phaseTot = Kx*x + Ky*y - omega*t + phase; + + return H*0.5*cos(phaseTot); +} + +Foam::vector Foam::waveModels::StokesI::U +( + const scalar H, + const scalar h, + const scalar Kx, + const scalar x, + const scalar Ky, + const scalar y, + const scalar omega, + const scalar t, + const scalar phase, + const scalar z +) const +{ + scalar k = sqrt(Kx*Kx + Ky*Ky); + scalar phaseTot = Kx*x + Ky*y - omega*t + phase; + + scalar u = H*0.5*omega*cos(phaseTot)*cosh(k*z)/sinh(k*h); + scalar w = H*0.5*omega*sin(phaseTot)*sinh(k*z)/sinh(k*h); + scalar v = u*sin(waveAngle_); + u *= cos(waveAngle_); + + return vector(u, v, w); +} + + +void Foam::waveModels::StokesI::setLevel +( + const scalar t, + const scalar tCoeff, + scalarField& level +) const +{ + const scalar waveOmega = mathematical::twoPi/wavePeriod_; + const scalar waveK = mathematical::twoPi/waveLength_; + const scalar waveKx = waveK*cos(waveAngle_); + const scalar waveKy = waveK*sin(waveAngle_); + + forAll(level, paddlei) + { + const scalar eta = + this->eta + ( + waveHeight_, + waveKx, + xPaddle_[paddlei], + waveKy, + yPaddle_[paddlei], + waveOmega, + t, + wavePhase_ + ); + + level[paddlei] = waterDepthRef_ + tCoeff*eta; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::StokesI::StokesI +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + regularWaveModel(dict, mesh, patch, false) +{ + if (readFields) + { + read(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::StokesI::~StokesI() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::StokesI::read(const dictionary& overrideDict) +{ + if (regularWaveModel::read(overrideDict)) + { + waveLength_ = waveLength(waterDepthRef_, wavePeriod_); + + return true; + } + + return false; +} + + +void Foam::waveModels::StokesI::setVelocity +( + const scalar t, + const scalar tCoeff, + const scalarField& level +) +{ + const scalar waveOmega = mathematical::twoPi/wavePeriod_; + const scalar waveK = mathematical::twoPi/waveLength_; + const scalar waveKx = waveK*cos(waveAngle_); + const scalar waveKy = waveK*sin(waveAngle_); + + forAll(U_, facei) + { + // Fraction of geometry represented by paddle - to be set + scalar fraction = 1; + + // Height - to be set + scalar z = 0; + + setPaddlePropeties(level, facei, fraction, z); + + if (fraction > 0) + { + const label paddlei = faceToPaddle_[facei]; + + const vector Uf = U + ( + waveHeight_, + waterDepthRef_, + waveKx, + xPaddle_[paddlei], + waveKy, + yPaddle_[paddlei], + waveOmega, + t, + wavePhase_, + z + ); + + U_[facei] = fraction*Uf*tCoeff; + } + } +} + + +void Foam::waveModels::StokesI::info(Ostream& os) const +{ + regularWaveModel::info(os); + + os << " Wave type: " << waveType() << nl; +} + + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.H b/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.H new file mode 100644 index 0000000000000000000000000000000000000000..82213261bf8add3c84dec42e4a969471c4fe3983 --- /dev/null +++ b/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.H @@ -0,0 +1,141 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveModels::StokesI + +Description + Stokes I wave model + +\*---------------------------------------------------------------------------*/ + +#ifndef waveModels_StokesI_H +#define waveModels_StokesI_H + +#include "regularWaveModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + +/*---------------------------------------------------------------------------*\ + Class StokesI Declaration +\*---------------------------------------------------------------------------*/ + +class StokesI +: + public regularWaveModel +{ +protected: + + // Protected Member Functions + + //- Return the wavelength + virtual scalar waveLength(const scalar h, const scalar T) const; + + //- Wave height + virtual scalar eta + ( + const scalar H, + const scalar Kx, + const scalar x, + const scalar Ky, + const scalar y, + const scalar omega, + const scalar t, + const scalar phase + ) const; + + //- Wave velocity + virtual vector U + ( + const scalar H, + const scalar h, + const scalar Kx, + const scalar x, + const scalar Ky, + const scalar y, + const scalar omega, + const scalar t, + const scalar phase, + const scalar z + ) const; + + + //- Set the water level + virtual void setLevel + ( + const scalar t, + const scalar tCoeff, + scalarField& level + ) const; + + //- Calculate the wave model velocity + virtual void setVelocity + ( + const scalar t, + const scalar tCoeff, + const scalarField& level + ); + + +public: + + //- Runtime type information + TypeName("StokesI"); + + //- Constructor + StokesI + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields = true + ); + + //- Destructor + virtual ~StokesI(); + + + // Public Member Functions + + //- Read from dictionary + virtual bool read(const dictionary& overrideDict); + + //- Info + virtual void info(Ostream& os) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace waveModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.C b/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.C new file mode 100644 index 0000000000000000000000000000000000000000..b867959f8c91f4bf9dfe82d4a97fa4f37b62f9ca --- /dev/null +++ b/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.C @@ -0,0 +1,181 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "StokesIIWaveModel.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + defineTypeNameAndDebug(StokesII, 0); + addToRunTimeSelectionTable + ( + waveModel, + StokesII, + patch + ); +} +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::scalar Foam::waveModels::StokesII::eta +( + const scalar H, + const scalar h, + const scalar Kx, + const scalar x, + const scalar Ky, + const scalar y, + const scalar omega, + const scalar t, + const scalar phase +) const +{ + const scalar k = sqrt(Kx*Kx + Ky*Ky); + const scalar sigma = tanh(k*h); + const scalar phaseTot = Kx*x + Ky*y - omega*t + phase; + + return + H*0.5*cos(phaseTot) + + k*H*H/4.0*(3.0 - sigma*sigma)/(4.0*pow3(sigma))*cos(2.0*phaseTot); +} + + +Foam::vector Foam::waveModels::StokesII::U +( + const scalar H, + const scalar h, + const scalar Kx, + const scalar x, + const scalar Ky, + const scalar y, + const scalar omega, + const scalar t, + const scalar phase, + const scalar z +) const +{ + const scalar k = sqrt(Kx*Kx + Ky*Ky); + const scalar phaseTot = Kx*x + Ky*y - omega*t + phase; + + scalar u = + H*0.5*omega*cos(phaseTot)*cosh(k*z)/sinh(k*h) + + 3.0/4.0*H*H/4.0*omega*k*cosh(2.0*k*z)/pow4(sinh(k*h))*cos(2.0*phaseTot); + scalar w = + H*0.5*omega*sin(phaseTot)*sinh(k*z)/sinh(k*h) + + 3.0/4.0*H*H/4.0*omega*k*sinh(2.0*k*z)/pow4(sinh(k*h))*sin(2.0*phaseTot); + scalar v = u*sin(waveAngle_); + u *= cos(waveAngle_); + + return vector(u, v, w); +} + + +void Foam::waveModels::StokesII::setLevel +( + const scalar t, + const scalar tCoeff, + scalarField& level +) const +{ + const scalar waveOmega = mathematical::twoPi/wavePeriod_; + const scalar waveK = mathematical::twoPi/waveLength_; + const scalar waveKx = waveK*cos(waveAngle_); + const scalar waveKy = waveK*sin(waveAngle_); + + forAll(level, paddlei) + { + const scalar eta = + this->eta + ( + waveHeight_, + waterDepthRef_, + waveKx, + xPaddle_[paddlei], + waveKy, + yPaddle_[paddlei], + waveOmega, + t, + wavePhase_ + ); + + level[paddlei] = waterDepthRef_ + tCoeff*eta; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::StokesII::StokesII +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + StokesI(dict, mesh, patch, false) +{ + if (readFields) + { + read(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::StokesII::~StokesII() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::StokesII::read(const dictionary& overrideDict) +{ + if (StokesI::read(overrideDict)) + { + return true; + } + + return false; +} + + +void Foam::waveModels::StokesII::info(Ostream& os) const +{ + StokesI::info(os); +} + + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.H b/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.H new file mode 100644 index 0000000000000000000000000000000000000000..044eba4bc57cb9130e8215ca648212d56869874f --- /dev/null +++ b/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.H @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveModels::StokesII + +Description + Stokes II wave model + +\*---------------------------------------------------------------------------*/ + +#ifndef waveModels_StokesII_H +#define waveModels_StokesII_H + +#include "StokesIWaveModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + +/*---------------------------------------------------------------------------*\ + Class StokesII Declaration +\*---------------------------------------------------------------------------*/ + +class StokesII +: + public StokesI +{ +protected: + + // Protected Member Functions + + //- Wave height + virtual scalar eta + ( + const scalar H, + const scalar h, + const scalar Kx, + const scalar x, + const scalar Ky, + const scalar y, + const scalar omega, + const scalar t, + const scalar phase + ) const; + + //- Wave velocity + virtual vector U + ( + const scalar H, + const scalar h, + const scalar Kx, + const scalar x, + const scalar Ky, + const scalar y, + const scalar omega, + const scalar t, + const scalar phase, + const scalar z + ) const; + + //- Set the water level + virtual void setLevel + ( + const scalar t, + const scalar tCoeff, + scalarField& level + ) const; + + +public: + + //- Runtime type information + TypeName("StokesII"); + + //- Constructor + StokesII + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields = true + ); + + //- Destructor + virtual ~StokesII(); + + + // Public Member Functions + + //- Read from dictionary + virtual bool read(const dictionary& overrideDict); + + //- Info + virtual void info(Ostream& os) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace waveModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.C b/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.C new file mode 100644 index 0000000000000000000000000000000000000000..643acedeb24b848de3334929c6e63df9bfbbf003 --- /dev/null +++ b/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.C @@ -0,0 +1,895 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "StokesVWaveModel.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + defineTypeNameAndDebug(StokesV, 0); + addToRunTimeSelectionTable + ( + waveModel, + StokesV, + patch + ); +} +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::scalar Foam::waveModels::StokesV::A11 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + return 1.0/s; +} + + +Foam::scalar Foam::waveModels::StokesV::A13 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + return -sqr(c)*(5*sqr(c) + 1)/(8*pow5(s)); +} + + +Foam::scalar Foam::waveModels::StokesV::A15 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return + -( + 1184*pow(c, 10) + - 1440*pow(c, 8) + - 1992*pow6(c) + + 2641*pow4(c) + - 249*sqr(c) + 18 + ) + /(1536*pow(s, 11)); +} + + +Foam::scalar Foam::waveModels::StokesV::A22 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + return 3/(8*pow4(s)); +} + + +Foam::scalar Foam::waveModels::StokesV::A24 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return + (192*pow(c, 8) - 424*pow(c, 6) - 312*pow4(c) + 480*sqr(c) - 17) + /(768*pow(s, 10)); +} + + +Foam::scalar Foam::waveModels::StokesV::A33 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return (13 - 4*sqr(c))/(64*pow(s, 7)); +} + + +Foam::scalar Foam::waveModels::StokesV::A35 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return + ( + 512*pow(c, 12) + + 4224*pow(c, 10) + - 6800*pow(c, 8) + - 12808*pow(c, 6) + + 16704.0*pow4(c) + - 3154*sqr(c) + + 107 + ) + /(4096*pow(s, 13)*(6*sqr(c) - 1)); +} + + +Foam::scalar Foam::waveModels::StokesV::A44 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return + (80*pow(c, 6) - 816*pow4(c) + 1338*sqr(c) - 197) + /(1536*pow(s, 10)*(6*sqr(c) - 1)); +} + + +Foam::scalar Foam::waveModels::StokesV::A55 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return + -( + 2880*pow(c, 10) + - 72480*pow(c, 8) + + 324000*pow(c, 6) + - 432000*pow4(c) + + 163470*sqr(c) + - 16245 + ) + /(61440*pow(s, 11)*(6*sqr(c) - 1)*(8*pow4(c) - 11*sqr(c) + 3)); +} + + +Foam::scalar Foam::waveModels::StokesV::B22 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return (2*sqr(c) + 1)*c/(4*pow3(s)); +} + + +Foam::scalar Foam::waveModels::StokesV::B24 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return + (272*pow(c, 8) - 504*pow(c, 6) - 192*pow4(c) + 322*sqr(c) + 21)*c + /(384*pow(s, 9)); +} + + +Foam::scalar Foam::waveModels::StokesV::B33 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return (8*pow6(c) + 1)*3/(64*pow6(s)); +} + + +Foam::scalar Foam::waveModels::StokesV::B33k +( + const scalar h, + const scalar k +) const // d B33 / d k +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + const scalar sk = h*s; + const scalar ck = h*c; + + return 9.*pow5(c)*ck/(4*pow6(s)) - (9*(8*pow6(c) + 1))/(32*pow(s, 7))*sk; +} + + +Foam::scalar Foam::waveModels::StokesV::B35 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return + ( + 88128*pow(c, 14) + - 208224*pow(c, 12) + + 70848*pow(c, 10) + + 54000*pow(c, 8) + - 21816*pow6(c) + + 6264*pow4(c) + - 54*sqr(c) + - 81 + ) + /(12288*pow(s, 12)*(6*sqr(c) - 1)); +} + + +Foam::scalar Foam::waveModels::StokesV::B35k +( + const scalar h, + const scalar k +) const // d B35 / d k +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + const scalar sk = h*s; + const scalar ck = h*c; + + return + ( + 14*88128*pow(c, 13)*ck + - 12*208224*pow(c, 11)*ck + + 10*70848*pow(c, 9)*ck + + 8*54000.0*pow(c, 7)*ck + - 6*21816*pow5(c)*ck + + 4*6264*pow3(c)*ck + - 2*54*c*ck + ) + /(12288*pow(s, 12)*(6*sqr(c) - 1)) + - ( + 88128*pow(c, 14) + - 208224*pow(c, 12) + + 70848*pow(c, 10) + + 54000*pow(c, 8) + - 21816*pow6(c) + + 6264*pow4(c) + - 54*sqr(c) + - 81 + )*12 + /(12288*pow(s, 13)*(6*sqr(c) - 1))*sk + - ( + 88128*pow(c,14) + - 208224*pow(c, 12) + + 70848*pow(c, 10) + + 54000*pow(c, 8) + - 21816*pow6(c) + + 6264*pow4(c) + - 54*sqr(c) + - 81 + )*12*c*ck + /(12288*pow(s, 12)*sqr(6*sqr(c) - 1)); +} + + +Foam::scalar Foam::waveModels::StokesV::B44 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return + ( + 768*pow(c, 10) + - 448*pow(c, 8) + - 48*pow6(c) + + 48*pow4(c) + + 106*sqr(c) + - 21 + )*c + /(384*pow(s, 9)*(6*sqr(c) - 1)); +} + + +Foam::scalar Foam::waveModels::StokesV::B55 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return + ( + 192000*pow(c, 16) + - 262720*pow(c, 14) + + 83680*pow(c, 12) + + 20160*pow(c, 10) + - 7280*pow(c, 8) + + 7160*pow(c, 6) + - 1800*pow(c, 4) + - 1050*sqr(c) + + 225 + ) + /(12288*pow(s, 10)*(6*sqr(c) - 1)*(8*pow4(c) - 11*sqr(c) + 3)); +} + + +Foam::scalar Foam::waveModels::StokesV::B55k +( + const scalar h, + const scalar k +) const // d B55 / d k +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + const scalar sk = h*s; + const scalar ck = h*c; + + return + ( + 16*192000*pow(c, 15)*ck + - 14*262720*pow(c, 13)*ck + + 12*83680*pow(c, 11)*ck + + 10*20160*pow(c, 9)*ck + - 8*7280*pow(c, 7)*ck + + 6*7160*pow(c, 5)*ck + - 4*1800*pow(c, 3)*ck + - 2*1050*pow(c, 1)*ck + ) + /(12288*pow(s, 10)*(6*sqr(c) - 1)*(8*pow(c, 4) - 11*sqr(c) + 3)) + - ( + 192000*pow(c, 16) + - 262720*pow(c, 14) + + 83680*pow(c, 12) + + 20160*pow(c, 10) + - 7280*pow(c, 8) + + 7160*pow(c, 6) + - 1800*pow(c, 4) + - 1050*pow(c, 2) + + 225 + )*10.0 + /(12288*pow(s, 11)*(6*sqr(c) - 1)*(8*pow4(c) - 11*sqr(c) + 3))*sk + - ( + 192000*pow(c, 16) + - 262720*pow(c, 14) + + 83680*pow(c, 12) + + 20160*pow(c,10) + - 7280*pow(c, 8) + + 7160*pow(c, 6) + - 1800*pow(c,4) + - 1050*pow(c, 2) + + 225 + )*12*c*ck + /(12288*pow(s, 10)*sqr(6*sqr(c) - 1)*(8*pow4(c) - 11*sqr(c) + 3)) + - ( + 192000*pow(c, 16) + - 262720*pow(c, 14) + + 83680*pow(c, 12) + + 20160*pow(c, 10) + - 7280*pow(c, 8) + + 7160*pow(c, 6) + - 1800*pow(c, 4) + - 1050*pow(c, 2) + + 225 + )*(32*pow3(c) - 22*c)*ck + /(12288*pow(s, 10)*(6*sqr(c) - 1)*sqr(8*pow4(c) - 11*sqr(c) + 3)); +} + + +Foam::scalar Foam::waveModels::StokesV::C1 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return (8*pow4(c) - 8*sqr(c) + 9)/(8*pow4(s)); +} + + +Foam::scalar Foam::waveModels::StokesV::C1k +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + const scalar sk = h*s; + const scalar ck = h*c; + + return + (4*8*pow3(c)*ck - 2*8*c*ck)/(8*pow4(s)) + - (8*pow4(c) - 8*sqr(c) + 9)*4*sk/(8*pow5(s)); +} + + +Foam::scalar Foam::waveModels::StokesV::C2 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return + ( + 3840*pow(c, 12) + - 4096*pow(c, 10) + + 2592*pow(c, 8) + - 1008*pow(c, 6) + + 5944*pow(c, 4) + - 1830*pow(c, 2) + + 147 + ) // - 2592 + /(512*pow(s, 10)*(6*sqr(c) - 1)); +} + + +Foam::scalar Foam::waveModels::StokesV::C2k +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + const scalar sk = h*s; + const scalar ck = h*c; + + return + ( + 12*3840*pow(c, 11)*ck + - 10*4096*pow(c,9)*ck + + 8*2592*pow(c, 7)*ck + - 6*1008*pow(c, 5)*ck + + 4*5944*pow(c, 3)*ck + - 2*1830*c*ck + ) + /(512*pow(s, 10)*(6*sqr(c) - 1)) + - ( + 3840*pow(c, 12) + - 4096*pow(c, 10) + + 2592*pow(c, 8) + - 1008*pow(c, 6) + + 5944*pow(c, 4) + - 1830*pow(c, 2) + + 147 + )*10*sk + /(512*pow(s, 11)*(6*sqr(c) - 1)) + - ( + 3840*pow(c, 12) + - 4096*pow(c, 10) + + 2592*pow(c, 8) + - 1008*pow(c, 6) + + 5944*pow(c, 4) + - 1830*pow(c, 2) + + 147 + )*12*c*ck + /(512*pow(s, 10)*sqr(6*sqr(c) - 1)); +} + + +Foam::scalar Foam::waveModels::StokesV::C3 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return -1/(4*s*c); +} + + +Foam::scalar Foam::waveModels::StokesV::C4 +( + const scalar h, + const scalar k +) const +{ + const scalar s = sinh(k*h); + const scalar c = cosh(k*h); + + return + (12*pow(c, 8) + 36*pow(c, 6) - 162*pow(c, 4) + 141*sqr(c) - 27) + /(192*c*pow(s, 9)); +} + + +void Foam::waveModels::StokesV::initialise +( + const scalar H, + const scalar d, + const scalar T, + scalar& kOut, + scalar& LambdaOut, + scalar& f1Out, + scalar& f2Out +) const +{ + scalar f1 = 1; + scalar f2 = 1; + + const scalar pi = mathematical::pi; + scalar k = 2.0*pi/(sqrt(mag(g_)*d)*T); + scalar lambda = H/2.0*k; + + label n = 0; + + static const scalar tolerance = 1e-12; + static const label iterMax = 10000; + + while ((mag(f1) > tolerance || mag(f2) > tolerance) && (n < iterMax)) + { + const scalar b33 = B33(d, k); + const scalar b35 = B35(d, k); + const scalar b55 = B55(d, k); + const scalar c1 = C1(d, k); + const scalar c2 = C2(d, k); + + const scalar b33k = B33k(d, k); + const scalar b35k = B35k(d, k); + const scalar b55k = B55k(d, k); + const scalar c1k = C1k(d, k); + const scalar c2k = C2k(d, k); + + const scalar l2 = sqr(lambda); + const scalar l3 = l2*lambda; + const scalar l4 = l3*lambda; + const scalar l5 = l4*lambda; + + const scalar Bmat11 = + 2*pi/(sqr(k)*d)*(lambda + l3*b33 + l5*(b35 + b55)) + - 2*pi/(k*d)*(l3*b33k + l5*(b35k + b55k)); + + const scalar Bmat12 = + - 2*pi/(k*d)*(1 + 3*l2*b33 + 5*l4*(b35 + b55)); + + const scalar Bmat21 = + - d/(2*pi)*tanh(k*d)*(1 + l2*c1 + l4*c2) + - k*d/(2*pi)*(1 - sqr(tanh(k*d)))*d*(1 + l2*c1 + l4*c2) + - k*d/(2*pi)*tanh(k*d)*(l2*c1k + l4*c2k); + + const scalar Bmat22 = - k*d/(2.0*pi)*tanh(k*d)*(2*lambda*c1 + 4*l3*c2); + + f1 = pi*H/d - 2*pi/(k*d)*(lambda + l3*b33 + l5*(b35 + b55)); + + f2 = (2*pi*d)/(mag(g_)*sqr(T)) - k*d/(2*pi)*tanh(k*d)*(1 + l2*c1 + l4*c2); + + const scalar lambdaPr = + (f1*Bmat21 - f2*Bmat11)/(Bmat11*Bmat22 - Bmat12*Bmat21); + const scalar kPr = + (f2*Bmat12 - f1*Bmat22)/(Bmat11*Bmat22 - Bmat12*Bmat21); + + lambda += lambdaPr; + k += kPr; + + n++; + } + + kOut = k; + LambdaOut = lambda; + + f1Out = mag(f1); + f2Out = mag(f2); +} + + +Foam::scalar Foam::waveModels::StokesV::eta +( + const scalar h, + const scalar kx, + const scalar ky, + const scalar lambda, + const scalar T, + const scalar x, + const scalar y, + const scalar t, + const scalar phase +) const +{ + const scalar k = sqrt(kx*kx + ky*ky); + + const scalar b22 = B22(h, k); + const scalar b24 = B24(h, k); + const scalar b33 = B33(h, k); + const scalar b35 = B35(h, k); + const scalar b44 = B44(h, k); + const scalar b55 = B55(h, k); + + const scalar l2 = sqr(lambda); + const scalar l3 = l2*lambda; + const scalar l4 = l3*lambda; + const scalar l5 = l4*lambda; + + const scalar amp1 = lambda/k; + const scalar amp2 = (b22*l2 + b24*l4)/k; + const scalar amp3 = (b33*l3 + b35*l5)/k; + const scalar amp4 = b44*l4/k; + const scalar amp5 = b55*l5/k; + + const scalar theta = kx*x + ky*y - 2.0*mathematical::pi/T*t + phase; + + return + amp1*cos(theta) + + amp2*cos(2*theta) + + amp3*cos(3*theta) + + amp4*cos(4*theta) + + amp5*cos(5*theta); +} + + +Foam::vector Foam::waveModels::StokesV::U +( + const scalar d, + const scalar kx, + const scalar ky, + const scalar lambda, + const scalar T, + const scalar x, + const scalar y, + const scalar t, + const scalar phase, + const scalar z +) const +{ + const scalar k = sqrt(kx*kx + ky*ky); + + const scalar a11 = A11(d, k); + const scalar a13 = A13(d, k); + const scalar a15 = A15(d, k); + const scalar a22 = A22(d, k); + const scalar a24 = A24(d, k); + const scalar a33 = A33(d, k); + const scalar a35 = A35(d, k); + const scalar a44 = A44(d, k); + const scalar a55 = A55(d, k); + + const scalar pi = mathematical::pi; + const scalar l2 = sqr(lambda); + const scalar l3 = l2*lambda; + const scalar l4 = l3*lambda; + const scalar l5 = l4*lambda; + + const scalar a1u = 2*pi/T/k*(lambda*a11 + l3*a13 + l5*a15); + const scalar a2u = 2*2*pi/T/k*(l2*a22 + l4*a24); + const scalar a3u = 3*2*pi/T/k*(l3*a33 + l5*a35); + const scalar a4u = 4*2*pi/T/k*(l4*a44); + const scalar a5u = 5*2*pi/T/k*(l5*a55); + + const scalar theta = kx*x + ky*y - 2*pi/T*t + phase; + + scalar u = + a1u*cosh(k*z)*cos(theta) + + a2u*cosh(2.0*k*z)*cos(2.0*(theta)) + + a3u*cosh(3.0*k*z)*cos(3.0*(theta)) + + a4u*cosh(4.0*k*z)*cos(4.0*(theta)) + + a5u*cosh(5.0*k*z)*cos(5.0*(theta)); + + scalar w = + a1u*sinh(k*z)*sin(theta) + + a2u*sinh(2.0*k*z)*sin(2.0*(theta)) + + a3u*sinh(3.0*k*z)*sin(3.0*(theta)) + + a4u*sinh(4.0*k*z)*sin(4.0*(theta)) + + a5u*sinh(5.0*k*z)*sin(5.0*(theta)); + + scalar v = u*sin(waveAngle_); + u *= cos(waveAngle_); + + return vector(u, v, w); +} + + +void Foam::waveModels::StokesV::setLevel +( + const scalar t, + const scalar tCoeff, + scalarField& level +) const +{ + const scalar waveK = mathematical::twoPi/waveLength_; + const scalar waveKx = waveK*cos(waveAngle_); + const scalar waveKy = waveK*sin(waveAngle_); + + forAll(level, paddlei) + { + const scalar eta = + this->eta + ( + waterDepthRef_, + waveKx, + waveKy, + lambda_, + wavePeriod_, + xPaddle_[paddlei], + yPaddle_[paddlei], + t, + wavePhase_ + ); + + level[paddlei] = waterDepthRef_ + tCoeff*eta; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::StokesV::StokesV +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + regularWaveModel(dict, mesh, patch, false), + lambda_(0) +{ + if (readFields) + { + read(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::StokesV::~StokesV() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::StokesV::read(const dictionary& overrideDict) +{ + if (regularWaveModel::read(overrideDict)) + { + scalar f1; + scalar f2; + scalar waveK; + + initialise + ( + waveHeight_, + waterDepthRef_, + wavePeriod_, + waveK, + lambda_, + f1, + f2 + ); + + if (f1 > 0.001 || f2 > 0.001) + { + FatalErrorInFunction + << "No convergence for Stokes V wave theory" << nl + << " f1: " << f1 << nl + << " f2: " << f2 << nl + << exit(FatalError); + } + + waveLength_ = 2.0*mathematical::pi/waveK; + + return true; + } + + return false; +} + + +void Foam::waveModels::StokesV::setVelocity +( + const scalar t, + const scalar tCoeff, + const scalarField& level +) +{ + const scalar waveK = mathematical::twoPi/waveLength_; + const scalar waveKx = waveK*cos(waveAngle_); + const scalar waveKy = waveK*sin(waveAngle_); + + forAll(U_, facei) + { + // Fraction of geometry represented by paddle - to be set + scalar fraction = 1; + + // Height - to be set + scalar z = 0; + + setPaddlePropeties(level, facei, fraction, z); + + if (fraction > 0) + { + const label paddlei = faceToPaddle_[facei]; + + const vector Uf = U + ( + waterDepthRef_, + waveKx, + waveKy, + lambda_, + wavePeriod_, + xPaddle_[paddlei], + yPaddle_[paddlei], + t, + wavePhase_, + z + ); + + U_[facei] = fraction*Uf*tCoeff; + } + } +} + + +void Foam::waveModels::StokesV::info(Ostream& os) const +{ + regularWaveModel::info(os); + + os << " Lambda : " << lambda_ << nl + << " Wave type : " << waveType() << nl; +} + + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.H b/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.H new file mode 100644 index 0000000000000000000000000000000000000000..225bb9bf1ff3a7f458e9d9434e0eca2226b1d105 --- /dev/null +++ b/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.H @@ -0,0 +1,214 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveModels::StokesV + +Description + Stokes V wave model + + Reference + \verbatim + Skjelbreia, L., Hendrickson, J. (1960). + Fifth order gravity wave theory. + Proc. Coastal Engineering Conf., pp. 184-196. + \endverbatim + +\*---------------------------------------------------------------------------*/ + +#ifndef waveModels_StokesV_H +#define waveModels_StokesV_H + +#include "regularWaveModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + +/*---------------------------------------------------------------------------*\ + Class StokesV Declaration +\*---------------------------------------------------------------------------*/ + +class StokesV +: + public regularWaveModel +{ +protected: + + // Proteced Data + + //- + scalar lambda_; + + + // Protected Member Functions + + // Model coefficients + + virtual scalar A11(const scalar h, const scalar k) const; + + virtual scalar A13(const scalar h, const scalar k) const; + + virtual scalar A15(const scalar h, const scalar k) const; + + virtual scalar A22(const scalar h, const scalar k) const; + + virtual scalar A24(const scalar h, const scalar k) const; + + virtual scalar A33(const scalar h, const scalar k) const; + + virtual scalar A35(const scalar h, const scalar k) const; + + virtual scalar A44(const scalar h, const scalar k) const; + + virtual scalar A55(const scalar h, const scalar k) const; + + virtual scalar B22(const scalar h, const scalar k) const; + + virtual scalar B24(const scalar h, const scalar k) const; + + virtual scalar B33(const scalar h, const scalar k) const; + + virtual scalar B33k(const scalar h, const scalar k) const; + + virtual scalar B35(const scalar h, const scalar k) const; + + virtual scalar B35k(const scalar h, const scalar k) const; + + virtual scalar B44(const scalar h, const scalar k) const; + + virtual scalar B55(const scalar h, const scalar k) const; + + virtual scalar B55k(const scalar h, const scalar k) const; + + virtual scalar C1(const scalar h, const scalar k) const; + + virtual scalar C1k(const scalar h, const scalar k) const; + + virtual scalar C2(const scalar h, const scalar k) const; + + virtual scalar C2k(const scalar h, const scalar k) const; + + virtual scalar C3(const scalar h, const scalar k) const; + + virtual scalar C4(const scalar h, const scalar k) const; + + + //- Model intialisation + virtual void initialise + ( + const scalar H, + const scalar d, + const scalar T, + scalar& kOut, + scalar& LambdaOut, + scalar& f1Out, + scalar& f2Out + ) const; + + //- Wave height + virtual scalar eta + ( + const scalar h, + const scalar kx, + const scalar ky, + const scalar lambda, + const scalar T, + const scalar x, + const scalar y, + const scalar t, + const scalar phase + ) const; + + //- Wave velocity + virtual vector U + ( + const scalar d, + const scalar kx, + const scalar ky, + const scalar lambda, + const scalar T, + const scalar x, + const scalar y, + const scalar t, + const scalar phase, + const scalar z + ) const; + + //- Set the water level + virtual void setLevel + ( + const scalar t, + const scalar tCoeff, + scalarField& level + ) const; + + //- Calculate the wave model velocity + virtual void setVelocity + ( + const scalar t, + const scalar tCoeff, + const scalarField& level + ); + + +public: + + //- Runtime type information + TypeName("StokesV"); + + //- Constructor + StokesV + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields = true + ); + + //- Destructor + virtual ~StokesV(); + + + // Public Member Functions + + //- Read from dictionary + virtual bool read(const dictionary& overrideDict); + + //- Info + virtual void info(Ostream& os) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace waveModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/cnoidal/Elliptic.H b/src/waveModels/waveGenerationModels/derived/cnoidal/Elliptic.H new file mode 100644 index 0000000000000000000000000000000000000000..83effacac998c917963ede87354cdc79cf546063 --- /dev/null +++ b/src/waveModels/waveGenerationModels/derived/cnoidal/Elliptic.H @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Namespace + Foam::Elliptic + +Description + +\*---------------------------------------------------------------------------*/ + +#include "mathematicalConstants.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace Elliptic +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +void ellipticIntegralsKE(const scalar m, scalar& K, scalar& E) +{ + if (m == 0) + { + K = 0.5*mathematical::pi; + E = 0.5*mathematical::pi; + return; + } + + scalar a = 1; + scalar g = Foam::sqrt(1 - m); + scalar ga = g*a; + scalar aux = 1; + scalar sum = 2 - m; + + while (true) + { + scalar aOld = a; + scalar gOld = g; + ga = gOld*aOld; + a = 0.5*(gOld + aOld); + aux += aux; + sum -= aux*(a*a - ga); + + if (mag(aOld - gOld) < SMALL) + { + break; + } + + g = sqrt(ga); + } + + K = 0.5*mathematical::pi/a; + E = 0.25*mathematical::pi/a*sum; +} + + +Foam::scalar JacobiAmp(const scalar u, const scalar mIn) +{ + static const label ITER = 25; + FixedList<scalar, ITER + 1> a, g, c; + scalar aux, amp; + label n; + + const scalar m = mag(mIn); + + if (m == 0) + { + return u; + } + + if (m == 1) + { + return 2*atan(exp(u)) - mathematical::pi/2; + } + + a[0] = 1.0; + g[0] = Foam::sqrt(1.0 - m); + c[0] = Foam::sqrt(m); + + aux = 1.0; + + for (n = 0; n < ITER; n++) + { + if (mag(a[n] - g[n]) < SMALL) + { + break; + } + + aux += aux; + a[n+1] = 0.5*(a[n] + g[n]); + g[n+1] = Foam::sqrt(a[n]*g[n]); + c[n+1] = 0.5*(a[n] - g[n]); + } + + amp = aux*a[n]*u; + + for (; n > 0; n--) + { + amp = 0.5*(amp + asin(c[n]*sin(amp)/a[n])); + } + + return scalar(amp); +} + + +void JacobiSnCnDn +( + const scalar u, + const scalar m, + scalar& Sn, + scalar& Cn, + scalar& Dn +) +{ + const scalar amp = Elliptic::JacobiAmp(u, m); + + Sn = sin(amp); + Cn = cos(amp); + Dn = sqrt(1.0 - m*sin(amp)*sin(amp)); + return; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Elliptic +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.C b/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.C new file mode 100644 index 0000000000000000000000000000000000000000..98c3873451723248f8712a832ec926761c354d52 --- /dev/null +++ b/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.C @@ -0,0 +1,367 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "cnoidalWaveModel.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" +#include "Elliptic.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + defineTypeNameAndDebug(cnoidal, 0); + addToRunTimeSelectionTable + ( + waveModel, + cnoidal, + patch + ); +} +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +void Foam::waveModels::cnoidal::initialise +( + const scalar H, + const scalar d, + const scalar T, + scalar& mOut, + scalar& LOut +) const +{ + const scalar mTolerance = 0.0001; + scalar mElliptic = 0.5; + scalar LElliptic = 0; + scalar phaseSpeed = 0; + + scalar mError = 0.0; + scalar mMinError = GREAT; + + while (mElliptic < 1.0) + { + scalar KElliptic, EElliptic; + Elliptic::ellipticIntegralsKE(mElliptic, KElliptic, EElliptic); + + LElliptic = KElliptic*sqrt(16.0*pow3(d)*mElliptic/(3.0*H)); + + phaseSpeed = + sqrt(mag(g_)*d) + *(1.0 - H/d/2.0 + H/d/mElliptic*(1.0 - 3.0/2.0*EElliptic/KElliptic)); + + mError = mag(T - LElliptic/phaseSpeed); + + if (mError <= mMinError) + { + mOut = mElliptic; + LOut = LElliptic; + mMinError = mError; + } + + mElliptic += mTolerance; + } +} + + +Foam::scalar Foam::waveModels::cnoidal::eta +( + const scalar H, + const scalar m, + const scalar kx, + const scalar ky, + const scalar T, + const scalar x, + const scalar y, + const scalar t +) const +{ + scalar K, E; + Elliptic::ellipticIntegralsKE(m, K, E); + + const scalar uCnoidal = + K/mathematical::pi*(kx*x + ky*y - 2.0*mathematical::pi*t/T); + + scalar sn, cn, dn; + Elliptic::JacobiSnCnDn(uCnoidal, m, sn, cn, dn); + + return H*((1.0 - E/K)/m - 1.0 + sqr(cn)); +} + + +Foam::scalar Foam::waveModels::cnoidal::eta1D +( + const scalar H, + const scalar m, + const scalar t, + const scalar T +) const +{ + scalar K, E; + Elliptic::ellipticIntegralsKE(m, K, E); + + const scalar uCnoidal = -2.0*K*(t/T); + + scalar sn, cn, dn; + Elliptic::JacobiSnCnDn(uCnoidal, m, sn, cn, dn); + + return H*((1.0 - E/K)/m - 1.0 + sqr(cn)); +} + + +Foam::scalar Foam::waveModels::cnoidal::etaMeanSq +( + const scalar H, + const scalar m, + const scalar T +) const +{ + scalar eta = 0; + scalar etaSumSq = 0; + + for (int i=0; i<1000; i++) + { + eta = eta1D(H, m, i*T/(1000.0), T); + etaSumSq += eta*eta; + } + + etaSumSq /= 1000.0; + return etaSumSq; +} + + +Foam::vector Foam::waveModels::cnoidal::dEtaDx +( + const scalar H, + const scalar m, + const scalar uCnoidal, + const scalar L, + const scalar K, + const scalar E +) const +{ + const scalar dudx = 2.0*K/L; + const scalar dudxx = 2.0*K/L*dudx; + const scalar dudxxx = 2.0*K/L*dudxx; + + scalar sn, cn, dn; + Elliptic::JacobiSnCnDn(uCnoidal, m, sn, cn, dn); + + scalar d1 = -2.0*H*cn*dn*sn*dudx; + scalar d2 = 2.0*H*(dn*dn*sn*sn - cn*cn*dn*dn + m*cn*cn*sn*sn)*dudxx; + scalar d3 = + 8.0*H + *( + cn*sn*dn*dn*dn*(-4.0 - 2.0*m) + + 4.0*m*cn*sn*sn*sn*dn + - 2.0*m*cn*cn*cn*sn*dn + ) + *dudxxx; + + return vector(d1, d2, d3); +} + + +Foam::vector Foam::waveModels::cnoidal::U +( + const scalar H, + const scalar h, + const scalar m, + const scalar kx, + const scalar ky, + const scalar T, + const scalar x, + const scalar y, + const scalar t, + const scalar z +) const +{ + scalar K, E; + Elliptic::ellipticIntegralsKE(m, K, E); + + const scalar uCnoidal = + K/mathematical::pi*(kx*x + ky*y - 2.0*mathematical::pi*t/T); + const scalar k = sqrt(kx*kx + ky*ky); + const scalar L = 2.0*mathematical::pi/k; + const scalar c = L/T; + + const scalar etaCN = eta(H, m, kx, ky, T, x, y, t); + const vector etaX = this->dEtaDx(H, m, uCnoidal, L, K, E); + const scalar etaMS = etaMeanSq(H, m, T); + + scalar u = + c*etaCN/h + - c*(etaCN*etaCN/h/h + etaMS*etaMS/h/h) + + 1.0/2.0*c*h*(1.0/3.0 - z*z/h/h)*etaX[1]; + + scalar w = + -c*z*(etaX[0]/h*(1.0 - 2.0*etaCN/h) + 1.0/6.0*h*(1.0 - z*z/h/h)*etaX[2]); + + scalar v = u*sin(waveAngle_); + u *= cos(waveAngle_); + + return vector(u, v, w); +} + + +void Foam::waveModels::cnoidal::setLevel +( + const scalar t, + const scalar tCoeff, + scalarField& level +) const +{ + const scalar waveK = mathematical::twoPi/waveLength_; + const scalar waveKx = waveK*cos(waveAngle_); + const scalar waveKy = waveK*sin(waveAngle_); + + forAll(level, paddlei) + { + const scalar eta = + this->eta + ( + waveHeight_, + m_, + waveKx, + waveKy, + wavePeriod_, + xPaddle_[paddlei], + yPaddle_[paddlei], + t + ); + + level[paddlei] = waterDepthRef_ + tCoeff*eta; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::cnoidal::cnoidal +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + regularWaveModel(dict, mesh, patch, false), + m_(0) +{ + if (readFields) + { + read(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::cnoidal::~cnoidal() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::cnoidal::read(const dictionary& overrideDict) +{ + if (regularWaveModel::read(overrideDict)) + { + // Initialise m parameter and wavelength + initialise + ( + waveHeight_, + waterDepthRef_, + wavePeriod_, + m_, + waveLength_ + ); + + return true; + } + + return false; +} + + +void Foam::waveModels::cnoidal::setVelocity +( + const scalar t, + const scalar tCoeff, + const scalarField& level +) +{ + const scalar waveK = mathematical::twoPi/waveLength_; + const scalar waveKx = waveK*cos(waveAngle_); + const scalar waveKy = waveK*sin(waveAngle_); + + forAll(U_, facei) + { + // Fraction of geometry represented by paddle - to be set + scalar fraction = 1; + + // Height - to be set + scalar z = 0; + + setPaddlePropeties(level, facei, fraction, z); + + if (fraction > 0) + { + const label paddlei = faceToPaddle_[facei]; + + const vector Uf = U + ( + waveHeight_, + waterDepthRef_, + m_, + waveKx, + waveKy, + wavePeriod_, + xPaddle_[paddlei], + yPaddle_[paddlei], + t, + z + ); + + U_[facei] = fraction*Uf*tCoeff; + } + } +} + + +void Foam::waveModels::cnoidal::info(Ostream& os) const +{ + regularWaveModel::info(os); + + os << " Cnoidal m parameter : " << m_ << nl; +} + + +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.H b/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.H new file mode 100644 index 0000000000000000000000000000000000000000..3c786581543566cfd87a58a842cf78f53926dba1 --- /dev/null +++ b/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.H @@ -0,0 +1,177 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveModels::cnoidal + +Description + Cnoidal wave model + +\*---------------------------------------------------------------------------*/ + +#ifndef waveModels_cnoidal_H +#define waveModels_cnoidal_H + +#include "regularWaveModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace waveModels +{ + +/*---------------------------------------------------------------------------*\ + Class cnoidal Declaration +\*---------------------------------------------------------------------------*/ + +class cnoidal +: + public regularWaveModel +{ +protected: + + // Protected data + + //- `m' coefficient + scalar m_; + + + // Protected Member Functions + + void initialise + ( + const scalar H, + const scalar d, + const scalar T, + scalar& mOut, + scalar& LOut + ) const; + + //- Wave height + virtual scalar eta + ( + const scalar H, + const scalar Kx, + const scalar x, + const scalar Ky, + const scalar y, + const scalar omega, + const scalar t, + const scalar phase + ) const; + + scalar eta1D + ( + const scalar H, + const scalar m, + const scalar t, + const scalar T + ) const; + + scalar etaMeanSq + ( + const scalar H, + const scalar m, + const scalar T + ) const; + + vector dEtaDx + ( + const scalar H, + const scalar m, + const scalar uCnoidal, + const scalar L, + const scalar K, + const scalar E + ) const; + + //- Wave velocity + virtual vector U + ( + const scalar H, + const scalar h, + const scalar Kx, + const scalar x, + const scalar Ky, + const scalar y, + const scalar omega, + const scalar t, + const scalar phase, + const scalar z + ) const; + + //- Set the water level + virtual void setLevel + ( + const scalar t, + const scalar tCoeff, + scalarField& level + ) const; + + //- Calculate the wave model velocity + virtual void setVelocity + ( + const scalar t, + const scalar tCoeff, + const scalarField& level + ); + + +public: + + //- Runtime type information + TypeName("cnoidal"); + + //- Constructor + cnoidal + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields = true + ); + + //- Destructor + virtual ~cnoidal(); + + + // Public Member Functions + + //- Read from dictionary + virtual bool read(const dictionary& overrideDict); + + //- Info + virtual void info(Ostream& os) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace waveModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveModel/waveModel.C b/src/waveModels/waveModel/waveModel.C new file mode 100644 index 0000000000000000000000000000000000000000..01f5749b9b5ff7868ca5e2a9d2085f607a19886b --- /dev/null +++ b/src/waveModels/waveModel/waveModel.C @@ -0,0 +1,433 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "waveModel.H" +#include "fvMesh.H" +#include "polyPatch.H" +#include "uniformDimensionedFields.H" +#include "volFields.H" +#include "fvPatchFields.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(waveModel, 0); + defineRunTimeSelectionTable(waveModel, patch); +} + +const Foam::word Foam::waveModel::dictName("waveProperties"); + + +Foam::word Foam::waveModel::modelName(const word& patchName) +{ + return dictName + '.' + patchName; +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::waveModel::initialiseGeometry() +{ + // Determine local patch co-ordinate system given by: + // - X: streamwise: patch normal + // - Y: spanwise: Z^X + // - Z: up: (negative) gravity direction + vector x(-gAverage(patch_.faceAreas())); + x /= mag(x) + ROOTVSMALL; + vector z = -g_/mag(g_); + vector y = z^x; + + // Rotation from global<->local about global origin + Rlg_ = tensor(x, y, z); + Rgl_ = Rlg_.T(); + + // Global patch extents + const vectorField& Cp = patch_.localPoints(); + const vectorField CpLocal(Rgl_ & Cp); + boundBox bb(CpLocal, true); + const scalar xMin = bb.min().x(); + const scalar xMax = bb.max().x(); + const scalar yMin = bb.min().y(); + const scalar yMax = bb.max().y(); + zSpan_ = bb.max().z() - bb.min().z(); + + // Global x, y positions of the paddle centres + xPaddle_.setSize(nPaddle_, 0); + yPaddle_.setSize(nPaddle_, 0); + const scalar xMid = xMin + 0.5*(xMax - xMin); + const scalar paddleDy = (yMax - yMin)/scalar(nPaddle_); + for (label paddlei = 0; paddlei < nPaddle_; ++paddlei) + { + xPaddle_[paddlei] = xMid; + yPaddle_[paddlei] = paddlei*paddleDy + yMin + 0.5*paddleDy;; + } + + // Local face centres + const vectorField& Cf = patch_.faceCentres(); + const vectorField CfLocal(Rgl_ & Cf); + z_ = CfLocal.component(2); + + // Local face extents in z-direction + zMin_.setSize(patch_.size()); + zMax_.setSize(patch_.size()); + const faceList& faces = patch_.localFaces(); + forAll(faces, facei) + { + const face& f = faces[facei]; + const label nPoint = f.size(); + zMin_[facei] = CpLocal[f[0]].z(); + zMax_[facei] = CpLocal[f[0]].z(); + + for (label fpi = 1; fpi < nPoint; ++fpi) + { + const label pointi = f[fpi]; + zMin_[facei] = min(zMin_[facei], CpLocal[pointi].z()); + zMax_[facei] = max(zMax_[facei], CpLocal[pointi].z()); + } + } + + // Local paddle-to-face addressing + faceToPaddle_.setSize(patch_.size(), -1); + forAll(faceToPaddle_, facei) + { + faceToPaddle_[facei] = floor((CfLocal[facei].y() - yMin)/paddleDy); + } +} + + +Foam::tmp<Foam::scalarField> Foam::waveModel::waterLevel() const +{ + // Note: initialising as initial depth + tmp<scalarField> tlevel(new scalarField(nPaddle_, initialDepth_)); + scalarField& level = tlevel.ref(); + + const volScalarField& alpha = + mesh_.lookupObject<volScalarField>(alphaName_); + const fvPatchScalarField& alphap = alpha.boundaryField()[patch_.index()]; + const scalarField alphac(alphap.patchInternalField()); + + const scalarField& magSf = alphap.patch().magSf(); + scalarList paddleMagSf(nPaddle_, 0.0); + scalarList paddleWettedMagSf(nPaddle_, 0.0); + + forAll(alphac, facei) + { + label paddlei = faceToPaddle_[facei]; + paddleMagSf[paddlei] += magSf[facei]; + paddleWettedMagSf[paddlei] += magSf[facei]*alphac[facei]; + } + + forAll(paddleMagSf, paddlei) + { + reduce(paddleMagSf[paddlei], sumOp<scalar>()); + reduce(paddleWettedMagSf[paddlei], sumOp<scalar>()); + level[paddlei] += + paddleWettedMagSf[paddlei] + /(paddleMagSf[paddlei]*zSpan_ + ROOTVSMALL); + } + + return tlevel; +} + + +void Foam::waveModel::setAlpha(const scalarField& level) +{ + forAll(alpha_, facei) + { + const label paddlei = faceToPaddle_[facei]; + const scalar paddleCalc = level[paddlei]; + + if (zMax_[facei] < paddleCalc) + { + alpha_[facei] = 1.0; + } + else if (zMin_[facei] > paddleCalc) + { + alpha_[facei] = 0.0; + } + else + { + scalar dz = paddleCalc - zMin_[facei]; + alpha_[facei] = dz/zSpan_; + } + } +} + + +void Foam::waveModel::setPaddlePropeties +( + const scalarField& level, + const label facei, + scalar& fraction, + scalar& z +) const +{ + const label paddlei = faceToPaddle_[facei]; + const scalar paddleCalc = level[paddlei]; + const scalar paddleHeight = min(paddleCalc, waterDepthRef_); + const scalar zMin = zMin_[facei]; + const scalar zMax = zMax_[facei]; + + fraction = 1; + z = 0; + + if (zMax < paddleHeight) + { + z = z_[facei]; + } + else if (zMin > paddleCalc) + { + fraction = -1; + } + else + { + if (paddleCalc < waterDepthRef_) + { + if ((zMax > paddleCalc) && (zMin < paddleCalc)) + { + scalar dz = paddleCalc - zMin; + fraction = dz/zSpan_; + z = z_[facei]; + } + } + else + { + if (zMax < paddleCalc) + { + z = waterDepthRef_; + } + else if ((zMax > paddleCalc) && (zMin < paddleCalc)) + { + scalar dz = paddleCalc - zMin; + fraction = dz/zSpan_; + z = waterDepthRef_; + } + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModel::waveModel +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + IOdictionary + ( + IOobject + ( + modelName(patch.name()), + Time::timeName(mesh.time().startTime().value()), + "uniform", + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ) + ), + mesh_(mesh), + patch_(patch), + g_(mesh.lookupObject<uniformDimensionedVectorField>("g").value()), + UName_("U"), + alphaName_("alpha"), + Rgl_(tensor::I), + Rlg_(tensor::I), + nPaddle_(1), + xPaddle_(), + yPaddle_(), + z_(), + zSpan_(0), + zMin_(), + zMax_(), + waterDepthRef_(0), + initialDepth_(0), + currTimeIndex_(-1), + activeAbsorption_(false), + U_(patch.size(), vector::zero), + alpha_(patch.size(), 0) +{ + if (readFields) + { + read(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModel::~waveModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModel::read(const dictionary& overrideDict) +{ + readOpt() = IOobject::READ_IF_PRESENT; + if (headerOk()) + { + IOdictionary::regIOobject::read(); + } + + merge(overrideDict); + + readIfPresent("U", UName_); + readIfPresent("alpha", alphaName_); + + lookup("nPaddle") >> nPaddle_; + if (nPaddle_ < 1) + { + FatalIOErrorInFunction(*this) + << "Number of paddles must be greater than zero. Supplied" + << " value nPaddles = " << nPaddle_ + << exit(FatalIOError); + } + + readIfPresent("initialDepth", initialDepth_); + + // Need to intialise the geometry before calling waterLevel() + initialiseGeometry(); + + // Set the reference water depth + if (!readIfPresent("waterDepthRef", waterDepthRef_)) + { + scalar waterDepth = 0; + if (readIfPresent("waterDepth", waterDepth)) + { + waterDepthRef_ = waterDepth; + } + else + { + const scalarField level(waterLevel()); + if (level.size()) + { + waterDepthRef_ = level.first(); + } + } + + // Avoid potential zero... + waterDepthRef_ += SMALL; + + // Insert the reference water depth into [this] to enable restart + add("waterDepthRef", waterDepthRef_); + } + + return true; +} + + +void Foam::waveModel::correct(const scalar t) +{ + if (mesh_.time().timeIndex() != currTimeIndex_) + { + Info<< "Updating " << type() << " wave model for patch " + << patch_.name() << endl; + + // Time ramp weight + const scalar tCoeff = timeCoeff(t); + + // Reset the velocity and phase fraction fields + U_ = vector::zero; + alpha_ = 0; + + // Update the calculated water level field + scalarField calculatedLevel(nPaddle_, 0); + + if (patch_.size()) + { + // Set wave level + setLevel(t, tCoeff, calculatedLevel); + + // Update the velocity field + setVelocity(t, tCoeff, calculatedLevel); + + // Update the phase fraction field + setAlpha(calculatedLevel); + } + + if (activeAbsorption_) + { + const scalarField activeLevel(this->waterLevel()); + + forAll(U_, facei) + { + const label paddlei = faceToPaddle_[facei]; + + if (zMin_[facei] < activeLevel[paddlei]) + { + scalar UCorr = + (calculatedLevel[paddlei] - activeLevel[paddlei]) + *sqrt(mag(g_)/activeLevel[paddlei]); + + U_[facei].x() += UCorr; + } + else + { + U_[facei].x() = 0; + } + } + } + + // Transform velocity into global co-ordinate system + U_ = Rlg_ & U_; + + currTimeIndex_ = mesh_.time().timeIndex(); + } +} + + +const Foam::vectorField& Foam::waveModel::U() const +{ + return U_; +} + + +const Foam::scalarField& Foam::waveModel::alpha() const +{ + return alpha_; +} + + +void Foam::waveModel::info(Ostream& os) const +{ + os << "Wave model: patch " << patch_.name() << nl + << " Type : " << type() << nl + << " Velocity field name : " << UName_ << nl + << " Phase fraction field name : " << alphaName_ << nl + << " Transformation from local to global system : " << Rlg_ << nl + << " Number of paddles: " << nPaddle_ << nl + << " Reference water depth : " << waterDepthRef_ << nl + << " Active absorption: " << activeAbsorption_ << nl; +} + + +// ************************************************************************* // diff --git a/src/waveModels/waveModel/waveModel.H b/src/waveModels/waveModel/waveModel.H new file mode 100644 index 0000000000000000000000000000000000000000..7a0efd457053419ae0d724902c72f05f9556ae41 --- /dev/null +++ b/src/waveModels/waveModel/waveModel.H @@ -0,0 +1,258 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::waveModel + +Description + Base class for waveModels + +\*---------------------------------------------------------------------------*/ + +#ifndef waveModel_H +#define waveModel_H + +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +#include "IOdictionary.H" +#include "dictionary.H" +#include "scalarField.H" +#include "vectorField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class fvMesh; +class polyPatch; + +/*---------------------------------------------------------------------------*\ + Class waveModel Declaration +\*---------------------------------------------------------------------------*/ + +class waveModel +: + public refCount, + public IOdictionary +{ +protected: + + // Protected data + + //- Reference to the mesh database + const fvMesh& mesh_; + + //- Reference to the polyPatch + const polyPatch& patch_; + + //- Gravity + const vector& g_; + + //- Name of velocity field, default = "U" + word UName_; + + //- Name of phase fraction field, default = "alpha" + word alphaName_; + + //- Rotation tensor from global to local system + tensor Rgl_; + + //- Rotation tensor from local to global system + tensor Rlg_; + + //- Number of paddles + label nPaddle_; + + //- Paddle x co-ordinates / [m] + scalarField xPaddle_; + + //- Paddle y co-ordinates / [m] + scalarField yPaddle_; + + //- Addressing from patch face index to paddle index + labelList faceToPaddle_; + + //- Patch face centre z co-ordinates / [m] + scalarField z_; + + //- Overall (point) span in z-direction / [m] + scalar zSpan_; + + //- Minimum z (point) height per patch face / [m] + scalarField zMin_; + + //- Maximum z (point) height per patch face / [m] + scalarField zMax_; + + //- Reference water depth / [m] + scalar waterDepthRef_; + + //- Initial depth / [m] + scalar initialDepth_; + + //- Time index used for updating + label currTimeIndex_; + + //- Active wave absorption switch + bool activeAbsorption_; + + + // Current values + + //- Velocity field + vectorField U_; + + //- Wave indicator field + scalarField alpha_; + + + // Protected Member Functions + + //- Initialise + virtual void initialiseGeometry(); + + //- Water level + virtual tmp<scalarField> waterLevel() const; + + //- Return the time scaling coefficient + virtual scalar timeCoeff(const scalar t) const = 0; + + //- Set the water level + virtual void setLevel + ( + const scalar t, + const scalar tCoeff, + scalarField& level + ) const = 0; + + //- Calculate the wave model velocity + virtual void setVelocity + ( + const scalar t, + const scalar tCoeff, + const scalarField& level + ) = 0; + + //- Set the alpha field based on the water level + virtual void setAlpha(const scalarField& level); + + //- Set the paddle coverage fraction and reference height + virtual void setPaddlePropeties + ( + const scalarField& level, + const label facei, + scalar& fraction, + scalar& z + ) const; + + +public: + + //- Runtime type information + TypeName("waveModel"); + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + waveModel, + patch, + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch + ), + (dict, mesh, patch) + ); + + + //- Constructor + waveModel + ( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields = true + ); + + + // Selectors + + //- Return a reference to the selected wave model + static autoPtr<waveModel> New + ( + const word& dictName, + const fvMesh& mesh, + const polyPatch& patch + ); + + //- Lookup waveModel from database, or create new + static tmp<waveModel> lookupOrCreate + ( + const polyPatch& patch, + const fvMesh& mesh, + const word& waveDictName + ); + + + //- Destructor + virtual ~waveModel(); + + //- Dictionary name + static const word dictName; + + + // Public Member Functions + + //- Utility function to construct the model name + static word modelName(const word& patchName); + + //- Read from dictionary + virtual bool read(const dictionary& overrideDict); + + //- Return the latest wave velocity prediction + virtual const vectorField& U() const; + + //- Return the latest wave indicator field prediction + virtual const scalarField& alpha() const; + + //- Correct the model for time, t[s] + virtual void correct(const scalar t); + + //- Info + virtual void info(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/waveModels/waveModel/waveModelNew.C b/src/waveModels/waveModel/waveModelNew.C new file mode 100644 index 0000000000000000000000000000000000000000..60446418e577dcc2c7eafe42ec6e71fa8335b094 --- /dev/null +++ b/src/waveModels/waveModel/waveModelNew.C @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015 IH-Cantabria +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "waveModel.H" +#include "fvMesh.H" + +Foam::autoPtr<Foam::waveModel> Foam::waveModel::New +( + const word& dictName, + const fvMesh& mesh, + const polyPatch& patch +) +{ + IOdictionary waveDict + ( + IOobject + ( + dictName, + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false // Not registering + ) + ); + + word modelType = "none"; + dictionary patchDict; + if (waveDict.found(patch.name())) + { + patchDict = waveDict.subDict(patch.name()); + patchDict.lookup("waveModel") >> modelType; + } + else + { + FatalIOErrorInFunction(waveDict) + << "Dictionary entry for patch " << patch.name() << " not found" + << exit(FatalIOError); + } + + Info<< "Selecting waveModel " << modelType << endl; + + patchConstructorTable::iterator cstrIter = + patchConstructorTablePtr_->find(modelType); + + if (cstrIter == patchConstructorTablePtr_->end()) + { + FatalIOErrorInFunction(waveDict) + << "Unknown waveModel type " + << modelType << nl << nl + << "Valid waveModel types are:" << nl + << patchConstructorTablePtr_->sortedToc() + << exit(FatalIOError); + } + + return autoPtr<waveModel>(cstrIter()(patchDict, mesh, patch)); +} + + +Foam::tmp<Foam::waveModel> Foam::waveModel::lookupOrCreate +( + const polyPatch& patch, + const fvMesh& mesh, + const word& waveDictName +) +{ + const word modelName = waveModel::modelName(patch.name()); + + if (!mesh.foundObject<waveModel>(modelName)) + { + autoPtr<waveModel> model(waveModel::New(waveDictName, mesh, patch)); + waveModel* waveModelPtr = model.ptr(); + waveModelPtr->store(); + waveModelPtr->info(Info); + } + + return mesh.lookupObject<waveModel>(modelName); +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/0.orig/U b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/0.orig/U new file mode 100644 index 0000000000000000000000000000000000000000..097dae5bea707a8e8adad78039ed29ccc6f57d4d --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/0.orig/U @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type waveVelocity; + value uniform (0 0 0); + } + + outlet + { + type waveVelocity; + value uniform (0 0 0); + } + + sides + { + type empty; + } + + ground + { + type fixedValue; + value uniform (0 0 0); + } + + top + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/0.orig/alpha.water b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/0.orig/alpha.water new file mode 100644 index 0000000000000000000000000000000000000000..424d47590253066912d94924a60135b00aca8dd3 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/0.orig/alpha.water @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alpha.water; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type waveAlpha; + value uniform 0; + } + + outlet + { + type zeroGradient; + } + + ground + { + type zeroGradient; + } + + sides + { + type empty; + } + + top + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/0.orig/p_rgh b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/0.orig/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..7ad5729cbfb902af1952dc5d9c949d8ed9967080 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/0.orig/p_rgh @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type fixedFluxPressure; + value uniform 0; + } + + outlet + { + type fixedFluxPressure; + value uniform 0; + } + + ground + { + type fixedFluxPressure; + value uniform 0; + } + + sides + { + type empty; + } + + top + { + type totalPressure; + U U; + phi phi; + rho rho; + psi none; + gamma 1; + p0 uniform 0; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/Allclean b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..705f91474c4a86592eb4f9f16b842144f410492f --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +rm -rf 0 + +cleanCase + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/Allrun b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..9f0c668029a93fea007d22217c227f723d480abe --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/Allrun @@ -0,0 +1,15 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +restore0Dir + +runApplication blockMesh + +runApplication decomposePar + +runParallel setFields + +runParallel $(getApplication) diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/g b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..3ec2141e5c9b5a8a78035c1d7906278b36600862 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/transportProperties b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..019225dd4f128332aeb280c0f517ff2f87dfa827 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/transportProperties @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +water +{ + transportModel Newtonian; + nu [0 2 -1 0 0 0 0] 1e-06; + rho [1 -3 0 0 0 0 0] 1000; +} + +air +{ + transportModel Newtonian; + nu [0 2 -1 0 0 0 0] 1.48e-05; + rho [1 -3 0 0 0 0 0] 1; +} + +sigma [1 0 -2 0 0 0 0] 0.07; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/turbulenceProperties b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..115a9830c11098c87040784f3183691b1877caea --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/waveProperties b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/waveProperties new file mode 100644 index 0000000000000000000000000000000000000000..34a5dbc9da2cc0856f2f0548864f964dc2e4c835 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/constant/waveProperties @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object wavesProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inlet +{ + alpha alpha.water; + + waveModel cnoidal; + + nPaddle 1; + + waveHeight 0.1; + + waveAngle 0.0; + + rampTime 6.0; + + activeAbsorption yes; + + wavePeriod 4.0; +} + +outlet +{ + alpha alpha.water; + + waveModel shallowWaterAbsorption; + + nPaddle 1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/blockMeshDict b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..3b84f93af71a9a0b0bf06f2861e9ada3fe5308c1 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/blockMeshDict @@ -0,0 +1,90 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + ( 0.0 0.0 0.0) + ( 30.0 0.0 0.0) + ( 30.0 0.04 0.0) + ( 0.0 0.04 0.0) + ( 0.0 0.0 0.7) + ( 30.0 0.0 0.7) + ( 30.0 0.04 0.7) + ( 0.0 0.04 0.7) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (750 1 70) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + outlet + { + type patch; + faces + ( + (1 5 6 2) + ); + } + ground + { + type wall; + faces + ( + (0 1 2 3) + ); + } + top + { + type patch; + faces + ( + (4 5 6 7) + ); + } + sides + { + type empty; + faces + ( + (0 1 5 4) + (3 2 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/controlDict b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..92a1a646e9e951a5107396320f90da56ee549d26 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/controlDict @@ -0,0 +1,146 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 50.0; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 0.033; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.65; +maxAlphaCo 0.65; + +maxDeltaT 0.05; + + +functions +{ + line + { + type sets; + libs ("libsampling.so"); + enabled true; + writeControl writeTime; + writeInterval 1; + + interpolationScheme cellPoint; + setFormat raw; + sets + ( + line1 + { + type uniform; + axis distance; + start ( 1.0 0.005 0.0 ); + end ( 1.0 0.005 0.8 ); + nPoints 1001; + } + line2 + { + type uniform; + axis distance; + start ( 2.0 0.005 0.0 ); + end ( 2.0 0.005 0.8 ); + nPoints 1001; + } + line3 + { + type uniform; + axis distance; + start ( 3.0 0.005 0.0 ); + end ( 3.0 0.005 0.8 ); + nPoints 1001; + } + line4 + { + type uniform; + axis distance; + start ( 5.0 0.005 0.0 ); + end ( 5.0 0.005 0.8 ); + nPoints 1001; + } + line5 + { + type uniform; + axis distance; + start ( 7.5 0.005 0.0 ); + end ( 7.5 0.005 0.8 ); + nPoints 1001; + } + + line6 + { + type uniform; + axis distance; + start ( 10.0 0.005 0.0 ); + end ( 10.0 0.005 0.8 ); + nPoints 1001; + } + line7 + { + type uniform; + axis distance; + start ( 12.0 0.005 0.0 ); + end ( 12.0 0.005 0.8 ); + nPoints 1001; + } + line8 + { + type uniform; + axis distance; + start ( 14.0 0.005 0.0 ); + end ( 14.0 0.005 0.8 ); + nPoints 1001; + } + ); + + fixedLocations false; + fields + ( + U alpha.water + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/decomposeParDict b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..301d97027b8aa1815be46c6525b8a54c5f6b6de1 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/decomposeParDict @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/fvSchemes b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..eeff89271fbc31a2b0adeb80ad6afdef35eba94e --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/fvSchemes @@ -0,0 +1,54 @@ + +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rhoPhi,U) Gauss linearUpwind grad(U); + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear orthogonal; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default orthogonal; +} + + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/fvSolution b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..a6d6b311547cc1a5887d044ac34d0f8bfb366a1a --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/fvSolution @@ -0,0 +1,93 @@ + +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "alpha.water.*" + { + nAlphaCorr 1; + nAlphaSubCycles 3; + alphaOuterCorrectors yes; + cAlpha 1; + + MULESCorr no; + nLimiterIter 3; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; + } + + pcorr + { + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0; + } + + p_rgh + { + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0.1; + } + + p_rghFinal + { + solver GAMG; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + cacheAgglomeration on; + agglomerator faceAreaPair; + nCellsInCoarsestLevel 10; + mergeLevels 1; + tolerance 1e-7; + relTol 0; + } + + U + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0.1; + } + + UFinal + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + nCorrectors 2; + nNonOrthogonalCorrectors 0; +} + + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/setFieldsDict b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..9d2a8bcb80d5e2922b40f7c42d915bede3b1130f --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleCnoidal/system/setFieldsDict @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 +); + +regions +( + boxToCell + { + box (0 0 0) (30.0 1.0 0.4); + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/0.orig/U b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/0.orig/U new file mode 100644 index 0000000000000000000000000000000000000000..95453554e5529d177dda4c13adb6acf9108a6c76 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/0.orig/U @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type waveVelocity; + value uniform (0 0 0); + } + + outlet + { + type waveVelocity; + value uniform (0 0 0); + } + + sides + { + type empty; + } + + ground + { + type fixedValue; + value uniform (0 0 0); + } + + top + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/0.orig/alpha.water b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/0.orig/alpha.water new file mode 100644 index 0000000000000000000000000000000000000000..424d47590253066912d94924a60135b00aca8dd3 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/0.orig/alpha.water @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alpha.water; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type waveAlpha; + value uniform 0; + } + + outlet + { + type zeroGradient; + } + + ground + { + type zeroGradient; + } + + sides + { + type empty; + } + + top + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/0.orig/p_rgh b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/0.orig/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..7ad5729cbfb902af1952dc5d9c949d8ed9967080 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/0.orig/p_rgh @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type fixedFluxPressure; + value uniform 0; + } + + outlet + { + type fixedFluxPressure; + value uniform 0; + } + + ground + { + type fixedFluxPressure; + value uniform 0; + } + + sides + { + type empty; + } + + top + { + type totalPressure; + U U; + phi phi; + rho rho; + psi none; + gamma 1; + p0 uniform 0; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/Allclean b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..705f91474c4a86592eb4f9f16b842144f410492f --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +rm -rf 0 + +cleanCase + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/Allrun b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..9f0c668029a93fea007d22217c227f723d480abe --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/Allrun @@ -0,0 +1,15 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +restore0Dir + +runApplication blockMesh + +runApplication decomposePar + +runParallel setFields + +runParallel $(getApplication) diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/g b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..3ec2141e5c9b5a8a78035c1d7906278b36600862 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/transportProperties b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..019225dd4f128332aeb280c0f517ff2f87dfa827 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/transportProperties @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +water +{ + transportModel Newtonian; + nu [0 2 -1 0 0 0 0] 1e-06; + rho [1 -3 0 0 0 0 0] 1000; +} + +air +{ + transportModel Newtonian; + nu [0 2 -1 0 0 0 0] 1.48e-05; + rho [1 -3 0 0 0 0 0] 1; +} + +sigma [1 0 -2 0 0 0 0] 0.07; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/turbulenceProperties b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..115a9830c11098c87040784f3183691b1877caea --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/waveProperties b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/waveProperties new file mode 100644 index 0000000000000000000000000000000000000000..b2568d8bda9376e8d121bdf42c2a2533f2a98ea9 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/constant/waveProperties @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object wavesProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inlet +{ + alpha alpha.water; + + waveModel Boussinesq; + + nPaddle 1; + + waveHeight 0.3; + + waveAngle 0.0; + + activeAbsorption yes; + + wavePeriod 0.0; +} + +outlet +{ + alpha alpha.water; + + waveModel shallowWaterAbsorption; + + nPaddle 1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/blockMeshDict b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..175bb83f20a1b44b6f6fcb49a72125b47f2ebef3 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/blockMeshDict @@ -0,0 +1,90 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + ( 0.0 0.0 0.0) + ( 10.0 0.0 0.0) + ( 10.0 0.02 0.0) + ( 0.0 0.02 0.0) + ( 0.0 0.0 1.5) + ( 10.0 0.0 1.5) + ( 10.0 0.02 1.5) + ( 0.0 0.02 1.5) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (500 1 150) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + outlet + { + type patch; + faces + ( + (1 5 6 2) + ); + } + ground + { + type wall; + faces + ( + (0 1 2 3) + ); + } + top + { + type patch; + faces + ( + (4 5 6 7) + ); + } + sides + { + type empty; + faces + ( + (0 1 5 4) + (3 2 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/controlDict b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..87022a24cebf4c34bedec5879f5f03c4bbfcfecb --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/controlDict @@ -0,0 +1,130 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 7.0; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 0.033; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.65; +maxAlphaCo 0.65; + +maxDeltaT 0.05; + + +functions +{ + line + { + type sets; + libs ("libsampling.so"); + enabled true; + writeControl writeTime; + writeInterval 1; + + interpolationScheme cellPoint; + setFormat raw; + sets + ( + line1 + { + type uniform; + axis distance; + start ( 1.0 0.01 0.0 ); + end ( 1.0 0.01 1.5 ); + nPoints 1001; + } + line2 + { + type uniform; + axis distance; + start ( 2.0 0.01 0.0 ); + end ( 2.0 0.01 1.5 ); + nPoints 1001; + } + line3 + { + type uniform; + axis distance; + start ( 3.0 0.01 0.0 ); + end ( 3.0 0.01 1.5 ); + nPoints 1001; + } + line4 + { + type uniform; + axis distance; + start ( 5.0 0.01 0.0 ); + end ( 5.0 0.01 1.5 ); + nPoints 1001; + } + line5 + { + type uniform; + axis distance; + start ( 7.5 0.01 0.0 ); + end ( 7.5 0.01 1.5 ); + nPoints 1001; + } + + line6 + { + type uniform; + axis distance; + start ( 9.0 0.01 0.0 ); + end ( 9.0 0.01 1.5 ); + nPoints 1001; + } + ); + + fixedLocations false; + fields + ( + U alpha.water + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/decomposeParDict b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..301d97027b8aa1815be46c6525b8a54c5f6b6de1 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/decomposeParDict @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/fvSchemes b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..eeff89271fbc31a2b0adeb80ad6afdef35eba94e --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/fvSchemes @@ -0,0 +1,54 @@ + +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rhoPhi,U) Gauss linearUpwind grad(U); + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear orthogonal; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default orthogonal; +} + + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/fvSolution b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..a6d6b311547cc1a5887d044ac34d0f8bfb366a1a --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/fvSolution @@ -0,0 +1,93 @@ + +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "alpha.water.*" + { + nAlphaCorr 1; + nAlphaSubCycles 3; + alphaOuterCorrectors yes; + cAlpha 1; + + MULESCorr no; + nLimiterIter 3; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; + } + + pcorr + { + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0; + } + + p_rgh + { + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0.1; + } + + p_rghFinal + { + solver GAMG; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + cacheAgglomeration on; + agglomerator faceAreaPair; + nCellsInCoarsestLevel 10; + mergeLevels 1; + tolerance 1e-7; + relTol 0; + } + + U + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0.1; + } + + UFinal + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + nCorrectors 2; + nNonOrthogonalCorrectors 0; +} + + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/setFieldsDict b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..755936dbe4cf9ce49fbe4737b0d3f5f9efcbaaeb --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleSolitary/system/setFieldsDict @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 +); + +regions +( + boxToCell + { + box (0 0 0) (30.0 1.0 0.7); + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/0.orig/U b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/0.orig/U new file mode 100644 index 0000000000000000000000000000000000000000..95453554e5529d177dda4c13adb6acf9108a6c76 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/0.orig/U @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type waveVelocity; + value uniform (0 0 0); + } + + outlet + { + type waveVelocity; + value uniform (0 0 0); + } + + sides + { + type empty; + } + + ground + { + type fixedValue; + value uniform (0 0 0); + } + + top + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/0.orig/alpha.water b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/0.orig/alpha.water new file mode 100644 index 0000000000000000000000000000000000000000..424d47590253066912d94924a60135b00aca8dd3 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/0.orig/alpha.water @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alpha.water; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type waveAlpha; + value uniform 0; + } + + outlet + { + type zeroGradient; + } + + ground + { + type zeroGradient; + } + + sides + { + type empty; + } + + top + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/0.orig/p_rgh b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/0.orig/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..7ad5729cbfb902af1952dc5d9c949d8ed9967080 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/0.orig/p_rgh @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type fixedFluxPressure; + value uniform 0; + } + + outlet + { + type fixedFluxPressure; + value uniform 0; + } + + ground + { + type fixedFluxPressure; + value uniform 0; + } + + sides + { + type empty; + } + + top + { + type totalPressure; + U U; + phi phi; + rho rho; + psi none; + gamma 1; + p0 uniform 0; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/Allclean b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..705f91474c4a86592eb4f9f16b842144f410492f --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +rm -rf 0 + +cleanCase + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/Allrun b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..9f0c668029a93fea007d22217c227f723d480abe --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/Allrun @@ -0,0 +1,15 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +restore0Dir + +runApplication blockMesh + +runApplication decomposePar + +runParallel setFields + +runParallel $(getApplication) diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/g b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..3ec2141e5c9b5a8a78035c1d7906278b36600862 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/transportProperties b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..019225dd4f128332aeb280c0f517ff2f87dfa827 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/transportProperties @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +water +{ + transportModel Newtonian; + nu [0 2 -1 0 0 0 0] 1e-06; + rho [1 -3 0 0 0 0 0] 1000; +} + +air +{ + transportModel Newtonian; + nu [0 2 -1 0 0 0 0] 1.48e-05; + rho [1 -3 0 0 0 0 0] 1; +} + +sigma [1 0 -2 0 0 0 0] 0.07; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/turbulenceProperties b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..115a9830c11098c87040784f3183691b1877caea --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/waveProperties b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/waveProperties new file mode 100644 index 0000000000000000000000000000000000000000..7597533efdb1be3fbf1712730420abb37e8cdd4f --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/constant/waveProperties @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object wavesProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inlet +{ + alpha alpha.water; + + waveModel StokesI; + + nPaddle 1; + + waveHeight 0.05; + + waveAngle 0.0; + + rampTime 3.0; + + activeAbsorption yes; + + wavePeriod 3.0; +} + +outlet +{ + alpha alpha.water; + + waveModel shallowWaterAbsorption; + + nPaddle 1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/blockMeshDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..2a16096fd603b5f81066aed5db4ad71b018d30bd --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/blockMeshDict @@ -0,0 +1,90 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + ( 0.0 0.0 0.0) + ( 20.0 0.0 0.0) + ( 20.0 0.04 0.0) + ( 0.0 0.04 0.0) + ( 0.0 0.0 0.75) + ( 20.0 0.0 0.75) + ( 20.0 0.04 0.75) + ( 0.0 0.04 0.75) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (500 1 75) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + outlet + { + type patch; + faces + ( + (1 5 6 2) + ); + } + ground + { + type wall; + faces + ( + (0 1 2 3) + ); + } + top + { + type patch; + faces + ( + (4 5 6 7) + ); + } + sides + { + type empty; + faces + ( + (0 1 5 4) + (3 2 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/controlDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..91f0a8a1440ffec8363f12775becdcf362dafc01 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/controlDict @@ -0,0 +1,146 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 20.0; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 0.033; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.65; +maxAlphaCo 0.65; + +maxDeltaT 0.05; + + +functions +{ + line + { + type sets; + libs ("libsampling.so"); + enabled true; + writeControl writeTime; + writeInterval 1; + + interpolationScheme cellPoint; + setFormat raw; + sets + ( + line1 + { + type uniform; + axis distance; + start ( 1.0 0.02 0.0 ); + end ( 1.0 0.02 0.75 ); + nPoints 1001; + } + line2 + { + type uniform; + axis distance; + start ( 2.0 0.02 0.0 ); + end ( 2.0 0.02 0.75 ); + nPoints 1001; + } + line3 + { + type uniform; + axis distance; + start ( 3.0 0.02 0.0 ); + end ( 3.0 0.02 0.75 ); + nPoints 1001; + } + line4 + { + type uniform; + axis distance; + start ( 5.0 0.02 0.0 ); + end ( 5.0 0.02 0.75 ); + nPoints 1001; + } + line5 + { + type uniform; + axis distance; + start ( 7.5 0.02 0.0 ); + end ( 7.5 0.02 0.75 ); + nPoints 1001; + } + + line6 + { + type uniform; + axis distance; + start ( 10.0 0.02 0.0 ); + end ( 10.0 0.02 0.75 ); + nPoints 1001; + } + line7 + { + type uniform; + axis distance; + start ( 12.0 0.005 0.0 ); + end ( 12.0 0.005 0.75 ); + nPoints 1001; + } + line8 + { + type uniform; + axis distance; + start ( 14.0 0.005 0.0 ); + end ( 14.0 0.005 0.75 ); + nPoints 1001; + } + ); + + fixedLocations false; + fields + ( + U alpha.water + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/decomposeParDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..301d97027b8aa1815be46c6525b8a54c5f6b6de1 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/decomposeParDict @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/fvSchemes b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..eeff89271fbc31a2b0adeb80ad6afdef35eba94e --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/fvSchemes @@ -0,0 +1,54 @@ + +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rhoPhi,U) Gauss linearUpwind grad(U); + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear orthogonal; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default orthogonal; +} + + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/fvSolution b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..a6d6b311547cc1a5887d044ac34d0f8bfb366a1a --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/fvSolution @@ -0,0 +1,93 @@ + +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "alpha.water.*" + { + nAlphaCorr 1; + nAlphaSubCycles 3; + alphaOuterCorrectors yes; + cAlpha 1; + + MULESCorr no; + nLimiterIter 3; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; + } + + pcorr + { + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0; + } + + p_rgh + { + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0.1; + } + + p_rghFinal + { + solver GAMG; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + cacheAgglomeration on; + agglomerator faceAreaPair; + nCellsInCoarsestLevel 10; + mergeLevels 1; + tolerance 1e-7; + relTol 0; + } + + U + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0.1; + } + + UFinal + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + nCorrectors 2; + nNonOrthogonalCorrectors 0; +} + + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/setFieldsDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..7ef9bb06a1968c2c18ab4bbc45b311c777ea28e1 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/setFieldsDict @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 +); + +regions +( + boxToCell + { + box (0 0 0) (20.0 1.0 0.6); + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/0.orig/U b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/0.orig/U new file mode 100644 index 0000000000000000000000000000000000000000..95453554e5529d177dda4c13adb6acf9108a6c76 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/0.orig/U @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type waveVelocity; + value uniform (0 0 0); + } + + outlet + { + type waveVelocity; + value uniform (0 0 0); + } + + sides + { + type empty; + } + + ground + { + type fixedValue; + value uniform (0 0 0); + } + + top + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/0.orig/alpha.water b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/0.orig/alpha.water new file mode 100644 index 0000000000000000000000000000000000000000..424d47590253066912d94924a60135b00aca8dd3 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/0.orig/alpha.water @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alpha.water; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type waveAlpha; + value uniform 0; + } + + outlet + { + type zeroGradient; + } + + ground + { + type zeroGradient; + } + + sides + { + type empty; + } + + top + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/0.orig/p_rgh b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/0.orig/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..7ad5729cbfb902af1952dc5d9c949d8ed9967080 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/0.orig/p_rgh @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type fixedFluxPressure; + value uniform 0; + } + + outlet + { + type fixedFluxPressure; + value uniform 0; + } + + ground + { + type fixedFluxPressure; + value uniform 0; + } + + sides + { + type empty; + } + + top + { + type totalPressure; + U U; + phi phi; + rho rho; + psi none; + gamma 1; + p0 uniform 0; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/Allclean b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..705f91474c4a86592eb4f9f16b842144f410492f --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +rm -rf 0 + +cleanCase + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/Allrun b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..9f0c668029a93fea007d22217c227f723d480abe --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/Allrun @@ -0,0 +1,15 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +restore0Dir + +runApplication blockMesh + +runApplication decomposePar + +runParallel setFields + +runParallel $(getApplication) diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/g b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..3ec2141e5c9b5a8a78035c1d7906278b36600862 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/transportProperties b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..019225dd4f128332aeb280c0f517ff2f87dfa827 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/transportProperties @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +water +{ + transportModel Newtonian; + nu [0 2 -1 0 0 0 0] 1e-06; + rho [1 -3 0 0 0 0 0] 1000; +} + +air +{ + transportModel Newtonian; + nu [0 2 -1 0 0 0 0] 1.48e-05; + rho [1 -3 0 0 0 0 0] 1; +} + +sigma [1 0 -2 0 0 0 0] 0.07; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/turbulenceProperties b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..115a9830c11098c87040784f3183691b1877caea --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/waveProperties b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/waveProperties new file mode 100644 index 0000000000000000000000000000000000000000..2099df6ed53067e8b362594551517982c4011305 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/constant/waveProperties @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object wavesProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inlet +{ + alpha alpha.water; + + waveModel StokesII; + + nPaddle 1; + + waveHeight 0.05; + + waveAngle 0.0; + + rampTime 3.0; + + activeAbsorption yes; + + wavePeriod 3.0; +} + +outlet +{ + alpha alpha.water; + + waveModel shallowWaterAbsorption; + + nPaddle 1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/blockMeshDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..afdb56d1bb6308bd4fc55baa9ac95d315a2b02b3 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/blockMeshDict @@ -0,0 +1,90 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + ( 0.0 0.0 0.0) + ( 20.0 0.0 0.0) + ( 20.0 0.04 0.0) + ( 0.0 0.04 0.0) + ( 0.0 0.0 0.55) + ( 20.0 0.0 0.55) + ( 20.0 0.04 0.55) + ( 0.0 0.04 0.55) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (500 1 55) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + outlet + { + type patch; + faces + ( + (1 5 6 2) + ); + } + ground + { + type wall; + faces + ( + (0 1 2 3) + ); + } + top + { + type patch; + faces + ( + (4 5 6 7) + ); + } + sides + { + type empty; + faces + ( + (0 1 5 4) + (3 2 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/controlDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..8c005190cc18fe61ad6fca2be1db516d691c3e00 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/controlDict @@ -0,0 +1,146 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 20.0; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 0.033; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.65; +maxAlphaCo 0.65; + +maxDeltaT 0.05; + + +functions +{ + line + { + type sets; + libs ("libsampling.so"); + enabled true; + writeControl writeTime; + writeInterval 1; + + interpolationScheme cellPoint; + setFormat raw; + sets + ( + line1 + { + type uniform; + axis distance; + start ( 1.0 0.02 0.0 ); + end ( 1.0 0.02 0.55 ); + nPoints 1001; + } + line2 + { + type uniform; + axis distance; + start ( 2.0 0.02 0.0 ); + end ( 2.0 0.02 0.55 ); + nPoints 1001; + } + line3 + { + type uniform; + axis distance; + start ( 3.0 0.02 0.0 ); + end ( 3.0 0.02 0.55 ); + nPoints 1001; + } + line4 + { + type uniform; + axis distance; + start ( 5.0 0.02 0.0 ); + end ( 5.0 0.02 0.55 ); + nPoints 1001; + } + line5 + { + type uniform; + axis distance; + start ( 7.5 0.02 0.0 ); + end ( 7.5 0.02 0.55 ); + nPoints 1001; + } + + line6 + { + type uniform; + axis distance; + start ( 10.0 0.02 0.0 ); + end ( 10.0 0.02 0.55 ); + nPoints 1001; + } + line7 + { + type uniform; + axis distance; + start ( 12.0 0.005 0.0 ); + end ( 12.0 0.005 0.55 ); + nPoints 1001; + } + line8 + { + type uniform; + axis distance; + start ( 14.0 0.005 0.0 ); + end ( 14.0 0.005 0.55 ); + nPoints 1001; + } + ); + + fixedLocations false; + fields + ( + U alpha.water + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/decomposeParDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..301d97027b8aa1815be46c6525b8a54c5f6b6de1 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/decomposeParDict @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/fvSchemes b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..eeff89271fbc31a2b0adeb80ad6afdef35eba94e --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/fvSchemes @@ -0,0 +1,54 @@ + +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rhoPhi,U) Gauss linearUpwind grad(U); + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear orthogonal; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default orthogonal; +} + + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/fvSolution b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..a6d6b311547cc1a5887d044ac34d0f8bfb366a1a --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/fvSolution @@ -0,0 +1,93 @@ + +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "alpha.water.*" + { + nAlphaCorr 1; + nAlphaSubCycles 3; + alphaOuterCorrectors yes; + cAlpha 1; + + MULESCorr no; + nLimiterIter 3; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; + } + + pcorr + { + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0; + } + + p_rgh + { + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0.1; + } + + p_rghFinal + { + solver GAMG; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + cacheAgglomeration on; + agglomerator faceAreaPair; + nCellsInCoarsestLevel 10; + mergeLevels 1; + tolerance 1e-7; + relTol 0; + } + + U + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0.1; + } + + UFinal + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + nCorrectors 2; + nNonOrthogonalCorrectors 0; +} + + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/setFieldsDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..9d2a8bcb80d5e2922b40f7c42d915bede3b1130f --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/setFieldsDict @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 +); + +regions +( + boxToCell + { + box (0 0 0) (30.0 1.0 0.4); + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/0.orig/U b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/0.orig/U new file mode 100644 index 0000000000000000000000000000000000000000..02f000b04a96deca8ef6653fdd99a8d9854c8bf9 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/0.orig/U @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type waveVelocity; + value uniform (0 0 0); + } + + outlet + { + type waveVelocity; + value uniform (0 0 0); + } + + sides + { + type empty; + } + + ground + { + type fixedValue; + value uniform (0 0 0); + } + + top + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/0.orig/alpha.water b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/0.orig/alpha.water new file mode 100644 index 0000000000000000000000000000000000000000..9069a26b66bfac5a51c2af8e3001ac0b63c831d0 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/0.orig/alpha.water @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alpha.water; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type waveAlpha; + value uniform 0; + } + + outlet + { + type zeroGradient; + } + + ground + { + type zeroGradient; + } + + sides + { + type empty; + } + + top + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/0.orig/p_rgh b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/0.orig/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..7ad5729cbfb902af1952dc5d9c949d8ed9967080 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/0.orig/p_rgh @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type fixedFluxPressure; + value uniform 0; + } + + outlet + { + type fixedFluxPressure; + value uniform 0; + } + + ground + { + type fixedFluxPressure; + value uniform 0; + } + + sides + { + type empty; + } + + top + { + type totalPressure; + U U; + phi phi; + rho rho; + psi none; + gamma 1; + p0 uniform 0; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/Allclean b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..705f91474c4a86592eb4f9f16b842144f410492f --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +rm -rf 0 + +cleanCase + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/Allrun b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..9f0c668029a93fea007d22217c227f723d480abe --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/Allrun @@ -0,0 +1,15 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +restore0Dir + +runApplication blockMesh + +runApplication decomposePar + +runParallel setFields + +runParallel $(getApplication) diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/g b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..195dbea3f3cac083e26f182b8ae44f0074c8486c --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/transportProperties b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..019225dd4f128332aeb280c0f517ff2f87dfa827 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/transportProperties @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +water +{ + transportModel Newtonian; + nu [0 2 -1 0 0 0 0] 1e-06; + rho [1 -3 0 0 0 0 0] 1000; +} + +air +{ + transportModel Newtonian; + nu [0 2 -1 0 0 0 0] 1.48e-05; + rho [1 -3 0 0 0 0 0] 1; +} + +sigma [1 0 -2 0 0 0 0] 0.07; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/turbulenceProperties b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..e4ad75d18c58796a41b783918420c965ae86fd6a --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/waveProperties b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/waveProperties new file mode 100644 index 0000000000000000000000000000000000000000..9192fe116177fd6eccf05dcc12d0a313455ac1aa --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/constant/waveProperties @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: http://www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object wavesProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inlet +{ + alpha alpha.water; + + waveModel StokesV; + + nPaddle 1; + + waveHeight 0.1; + + waveAngle 0.0; + + rampTime 4.0; + + activeAbsorption yes; + + wavePeriod 2.0; +} + +outlet +{ + alpha alpha.water; + + waveModel shallowWaterAbsorption; + + nPaddle 1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/blockMeshDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..6f5bedb3be5c14dffae1c7abd62f8f250f040973 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/blockMeshDict @@ -0,0 +1,90 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + ( 0.0 0.0 0.0) + ( 30.0 0.0 0.0) + ( 30.0 0.04 0.0) + ( 0.0 0.04 0.0) + ( 0.0 0.0 0.7) + ( 30.0 0.0 0.7) + ( 30.0 0.04 0.7) + ( 0.0 0.04 0.7) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (750 1 70) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + outlet + { + type patch; + faces + ( + (1 5 6 2) + ); + } + ground + { + type wall; + faces + ( + (0 1 2 3) + ); + } + top + { + type patch; + faces + ( + (4 5 6 7) + ); + } + sides + { + type empty; + faces + ( + (0 1 5 4) + (3 2 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/controlDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..76911c1e87a88678cdb67c8e518aa0a9a8f997a5 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/controlDict @@ -0,0 +1,144 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 30.0; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 0.033; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep on; + +maxCo 0.65; +maxAlphaCo 0.65; + +maxDeltaT 0.05; + +functions +{ + line + { + type sets; + libs ("libsampling.so"); + enabled true; + writeControl writeTime; + writeInterval 1; + + interpolationScheme cellPoint; + setFormat raw; + sets + ( + line1 + { + type uniform; + axis distance; + start ( 1.0 0.005 0.0 ); + end ( 1.0 0.005 0.8 ); + nPoints 1001; + } + line2 + { + type uniform; + axis distance; + start ( 2.0 0.005 0.0 ); + end ( 2.0 0.005 0.8 ); + nPoints 1001; + } + line3 + { + type uniform; + axis distance; + start ( 3.0 0.005 0.0 ); + end ( 3.0 0.005 0.8 ); + nPoints 1001; + } + line4 + { + type uniform; + axis distance; + start ( 4.0 0.005 0.0 ); + end ( 4.0 0.005 0.8 ); + nPoints 1001; + } + line5 + { + type uniform; + axis distance; + start ( 5 0.005 0.0 ); + end ( 5 0.005 0.8 ); + nPoints 1001; + } + + line6 + { + type uniform; + axis distance; + start ( 7.0 0.005 0.0 ); + end ( 7.0 0.005 0.8 ); + nPoints 1001; + } + line7 + { + type uniform; + axis distance; + start ( 8.0 0.005 0.0 ); + end ( 8.0 0.005 0.8 ); + nPoints 1001; + } + line8 + { + type uniform; + axis distance; + start ( 9.0 0.005 0.0 ); + end ( 9.0 0.005 0.8 ); + nPoints 1001; + } + ); + fixedLocations false; + fields + ( + U alpha.water + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/decomposeParDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..57c7bea5e33d5df6b8b44bd1f87c1a5d95fcbf79 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/decomposeParDict @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/fvSchemes b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..eeff89271fbc31a2b0adeb80ad6afdef35eba94e --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/fvSchemes @@ -0,0 +1,54 @@ + +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rhoPhi,U) Gauss linearUpwind grad(U); + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear orthogonal; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default orthogonal; +} + + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/fvSolution b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..a6d6b311547cc1a5887d044ac34d0f8bfb366a1a --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/fvSolution @@ -0,0 +1,93 @@ + +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "alpha.water.*" + { + nAlphaCorr 1; + nAlphaSubCycles 3; + alphaOuterCorrectors yes; + cAlpha 1; + + MULESCorr no; + nLimiterIter 3; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; + } + + pcorr + { + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0; + } + + p_rgh + { + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0.1; + } + + p_rghFinal + { + solver GAMG; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + cacheAgglomeration on; + agglomerator faceAreaPair; + nCellsInCoarsestLevel 10; + mergeLevels 1; + tolerance 1e-7; + relTol 0; + } + + U + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0.1; + } + + UFinal + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + nCorrectors 2; + nNonOrthogonalCorrectors 0; +} + + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/setFieldsDict b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..ea8c0c2ee3d3cf7ae93d722c29636471c906a776 --- /dev/null +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/setFieldsDict @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 +); + +regions +( + boxToCell + { + box (0 0 0) (30.0 1.0 0.4); + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } +); + + +// ************************************************************************* //