waves: Improved reverse flow formulation and new test cases

It is now possible to use waveVelocity and waveAlpha boundary conditions
in cases in which the waves generate localised flow reversals along the
boundary. This means waves can be speficied at arbitrary directions and
with zero mean flow. Previously and integral approach, similar to
flowRateOutlet, was used, which was only correct when the direction of
wave propagation was aligned with the boundary normal.

This improvement has been achieved by reformulating the waveVelocity and
waveAlpha boundary conditions in terms of a new fixedValueInletOutlet
boundary condition type. This condition enforces a fixed value in all
cases except that of advection terms in the presence of outflow. In this
configuration a gradient condition is applied that will relax towards
the desired fixed value.

The wavePressure boundary condition has been removed, as it is no longer
necessary or advisable to locally switch between velocity and pressure
formulations along a wave boundary. Wave boundaries should now have the
general fixedFluxPressure or fixedFluxExtrapolatedPressure conditions
applied to the pressure field.

Two new tutorial cases have been created to demonstrate the new
functionality. The multiphase/interFoam/laminar/wave3D case demonstrates
wave generation with zero mean flow and at arbitrary angles to the
boundaries, and incompressible/pimpleFoam/RAS/waveSubSurface
demonstrates usage for sub-surface problems.
This commit is contained in:
Will Bainbridge
2021-09-01 10:55:23 +01:00
parent 984066f81e
commit 1c48685b09
54 changed files with 2213 additions and 711 deletions

View File

@ -217,6 +217,7 @@ $(derivedFvPatchFields)/interfaceCompression/interfaceCompressionFvPatchScalarFi
$(derivedFvPatchFields)/pressure/pressureFvPatchScalarField.C $(derivedFvPatchFields)/pressure/pressureFvPatchScalarField.C
$(derivedFvPatchFields)/PrghPressure/prghPressureFvPatchScalarFields.C $(derivedFvPatchFields)/PrghPressure/prghPressureFvPatchScalarFields.C
$(derivedFvPatchFields)/prghTotalHydrostaticPressure/prghTotalHydrostaticPressureFvPatchScalarField.C $(derivedFvPatchFields)/prghTotalHydrostaticPressure/prghTotalHydrostaticPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedValueInletOutlet/fixedValueInletOutletFvPatchFields.C
fvsPatchFields = fields/fvsPatchFields fvsPatchFields = fields/fvsPatchFields
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C $(fvsPatchFields)/fvsPatchField/fvsPatchFields.C

View File

@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "fixedValueInletOutletFvPatchField.H"
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::fixedValueInletOutletFvPatchField<Type>::fixedValueInletOutletFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(p, iF),
phiName_("phi")
{}
template<class Type>
Foam::fixedValueInletOutletFvPatchField<Type>::fixedValueInletOutletFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict,
const bool valueRequired
)
:
fixedValueFvPatchField<Type>(p, iF, dict, valueRequired),
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{}
template<class Type>
Foam::fixedValueInletOutletFvPatchField<Type>::fixedValueInletOutletFvPatchField
(
const fixedValueInletOutletFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper,
const bool mappingRequired
)
:
fixedValueFvPatchField<Type>(ptf, p, iF, mapper, mappingRequired),
phiName_(ptf.phiName_)
{}
template<class Type>
Foam::fixedValueInletOutletFvPatchField<Type>::fixedValueInletOutletFvPatchField
(
const fixedValueInletOutletFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(ptf, iF),
phiName_(ptf.phiName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::fixedValueInletOutletFvPatchField<Type>::valueInternalCoeffs
(
const tmp<scalarField>&
) const
{
// Behave as a fixed value patch where there is inflow, and fixed gradient
// patch where there is outflow
const scalarField& phi =
this->patch().template
lookupPatchField<surfaceScalarField, scalar>(phiName_);
return (1 - pos0(phi))*Zero + pos0(phi)*pTraits<Type>::one;
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::fixedValueInletOutletFvPatchField<Type>::valueBoundaryCoeffs
(
const tmp<scalarField>&
) const
{
// Behave as a fixed value patch where there is inflow, and fixed gradient
// patch where there is outflow
const scalarField& phi =
this->patch().template
lookupPatchField<surfaceScalarField, scalar>(phiName_);
const Field<Type> pif(this->patchInternalField());
return (1 - pos0(phi))**this + pos0(phi)*(*this - pif);
}
template<class Type>
void Foam::fixedValueInletOutletFvPatchField<Type>::write(Ostream& os) const
{
fixedValueFvPatchField<Type>::write(os);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
}
// ************************************************************************* //

View File

@ -0,0 +1,184 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
\\/ 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::fixedValueInletOutletFvPatchField
Description
This boundary condition sets a fixed value. When the flow direction is
inwards this acts exactly like a fixed value condition. In the presence of
outflow, however, this condition approximates the fixed value constraint in
advective terms by fixing the gradient instead.
This condition is not likely to be used on its own. It is more suitable as
a base class for conditions that need to specify the value of a field even
when the flow reverses.
Usage
\table
Property | Description | Required | Default value
phi | Name of the flux field | no | phi
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type fixedValueInletOutlet;
phi phi;
value 0;
}
\endverbatim
See also
Foam::fixedValueFvPatchField
SourceFiles
fixedValueInletOutletFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef fixedValueInletOutletFvPatchField_H
#define fixedValueInletOutletFvPatchField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedValueInletOutletFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class fixedValueInletOutletFvPatchField
:
public fixedValueFvPatchField<Type>
{
// Private Data
//- Name of the flux field
const word phiName_;
public:
//- Runtime type information
TypeName("fixedValueInletOutlet");
// Constructors
//- Construct from patch and internal field
fixedValueInletOutletFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
fixedValueInletOutletFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&,
const bool valueRequired=true
);
//- Construct by mapping given fixedValueInletOutletFvPatchField
// onto a new patch
fixedValueInletOutletFvPatchField
(
const fixedValueInletOutletFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&,
const bool mappingRequired=true
);
//- Disallow copy without setting internal field reference
fixedValueInletOutletFvPatchField
(
const fixedValueInletOutletFvPatchField<Type>&
) = delete;
//- Copy constructor setting internal field reference
fixedValueInletOutletFvPatchField
(
const fixedValueInletOutletFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type>> clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type>>
(
new fixedValueInletOutletFvPatchField<Type>(*this, iF)
);
}
// Member Functions
// Evaluation functions
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<Field<Type>> valueInternalCoeffs
(
const tmp<scalarField>&
) const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<Field<Type>> valueBoundaryCoeffs
(
const tmp<scalarField>&
) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "fixedValueInletOutletFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "fixedValueInletOutletFvPatchFields.H"
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(fixedValueInletOutlet);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#ifndef fixedValueInletOutletFvPatchFields_H
#define fixedValueInletOutletFvPatchFields_H
#include "fixedValueInletOutletFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(fixedValueInletOutlet);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#ifndef fixedValueInletOutletFvPatchFieldsFwd_H
#define fixedValueInletOutletFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class fixedValueInletOutletFvPatchField;
makePatchTypeFieldTypedefs(fixedValueInletOutlet);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -11,7 +11,6 @@ waveSuperpositions/waveAtmBoundaryLayerSuperposition/waveAtmBoundaryLayerSuperpo
derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.C derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.C
derivedFvPatchFields/waveInletOutlet/waveInletOutletFvPatchFields.C derivedFvPatchFields/waveInletOutlet/waveInletOutletFvPatchFields.C
derivedFvPatchFields/wavePressure/wavePressureFvPatchScalarField.C
derivedFvPatchFields/waveVelocity/waveVelocityFvPatchVectorField.C derivedFvPatchFields/waveVelocity/waveVelocityFvPatchVectorField.C
LIB = $(FOAM_LIBBIN)/libwaves LIB = $(FOAM_LIBBIN)/libwaves

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,11 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "waveAlphaFvPatchScalarField.H" #include "waveAlphaFvPatchScalarField.H"
#include "wavePressureFvPatchScalarField.H"
#include "waveVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "levelSet.H" #include "levelSet.H"
#include "surfaceFields.H"
#include "volFields.H" #include "volFields.H"
#include "fvMeshSubset.H" #include "fvMeshSubset.H"
@ -40,15 +37,9 @@ Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
mixedFvPatchScalarField(p, iF), fixedValueInletOutletFvPatchField<scalar>(p, iF),
UName_("U"), liquid_(true)
liquid_(true), {}
inletOutlet_(true)
{
refValue() = Zero;
refGrad() = Zero;
valueFraction() = 0;
}
Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField
@ -58,23 +49,23 @@ Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
mixedFvPatchScalarField(p, iF), fixedValueInletOutletFvPatchField<scalar>(p, iF, dict, false),
UName_(dict.lookupOrDefault<word>("U", "U")), liquid_(dict.lookupOrDefault<Switch>("liquid", true))
liquid_(dict.lookupOrDefault<Switch>("liquid", true)),
inletOutlet_(dict.lookupOrDefault<Switch>("inletOutlet", true))
{ {
if (dict.found("value")) if (dict.found("value"))
{ {
fvPatchScalarField::operator=(scalarField("value", dict, p.size())); fixedValueInletOutletFvPatchField<scalar>::operator==
(
scalarField("value", dict, p.size())
);
} }
else else
{ {
fvPatchScalarField::operator=(patchInternalField()); fixedValueInletOutletFvPatchField<scalar>::operator==
(
patchInternalField()
);
} }
refValue() = *this;
refGrad() = Zero;
valueFraction() = 0;
} }
@ -86,10 +77,8 @@ Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
mixedFvPatchScalarField(ptf, p, iF, mapper), fixedValueInletOutletFvPatchField<scalar>(ptf, p, iF, mapper),
UName_(ptf.UName_), liquid_(ptf.liquid_)
liquid_(ptf.liquid_),
inletOutlet_(ptf.inletOutlet_)
{} {}
@ -99,18 +88,42 @@ Foam::waveAlphaFvPatchScalarField::waveAlphaFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
mixedFvPatchScalarField(ptf, iF), fixedValueInletOutletFvPatchField<scalar>(ptf, iF),
UName_(ptf.UName_), liquid_(ptf.liquid_)
liquid_(ptf.liquid_),
inletOutlet_(ptf.inletOutlet_)
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::waveAlphaFvPatchScalarField::alpha() const const Foam::fvMeshSubset&
Foam::waveAlphaFvPatchScalarField::faceCellSubset() const
{
const fvMesh& mesh = patch().boundaryMesh().mesh();
const label timeIndex = mesh.time().timeIndex();
if
(
!faceCellSubset_.valid()
|| (mesh.changing() && faceCellSubsetTimeIndex_ != timeIndex)
)
{
faceCellSubset_.reset(new fvMeshSubset(mesh));
faceCellSubset_->setCellSubset(patch().faceCells());
faceCellSubsetTimeIndex_ = timeIndex;
// Ask for the tetBasePtIs to trigger all processors to build them.
// Without this, processors that do not contain this patch will
// generate a comms mismatch.
faceCellSubset_->subMesh().tetBasePtIs();
}
return faceCellSubset_();
}
Foam::tmp<Foam::scalarField>
Foam::waveAlphaFvPatchScalarField::alpha(const scalar t) const
{ {
const scalar t = db().time().timeOutputValue();
const waveSuperposition& waves = waveSuperposition::New(db()); const waveSuperposition& waves = waveSuperposition::New(db());
return return
@ -124,17 +137,12 @@ Foam::tmp<Foam::scalarField> Foam::waveAlphaFvPatchScalarField::alpha() const
} }
Foam::tmp<Foam::scalarField> Foam::waveAlphaFvPatchScalarField::alphan() const Foam::tmp<Foam::scalarField>
Foam::waveAlphaFvPatchScalarField::alphan(const scalar t) const
{ {
const scalar t = db().time().timeOutputValue();
const waveSuperposition& waves = waveSuperposition::New(db()); const waveSuperposition& waves = waveSuperposition::New(db());
const waveVelocityFvPatchVectorField& Up =
refCast<const waveVelocityFvPatchVectorField>
(
patch().lookupPatchField<volVectorField, scalar>(UName_)
);
const fvMeshSubset& subset = Up.faceCellSubset(); const fvMeshSubset& subset = faceCellSubset();
const fvMesh& meshs = subset.subMesh(); const fvMesh& meshs = subset.subMesh();
const label patchis = findIndex(subset.patchMap(), patch().index()); const label patchis = findIndex(subset.patchMap(), patch().index());
@ -175,52 +183,11 @@ void Foam::waveAlphaFvPatchScalarField::updateCoeffs()
return; return;
} }
const fvPatchVectorField& Up = const scalar t = db().time().timeOutputValue();
patch().lookupPatchField<volVectorField, scalar>(UName_);
if (!isA<waveVelocityFvPatchVectorField>(Up)) operator==(alpha(t));
{
FatalErrorInFunction
<< "The corresponding condition for the velocity "
<< "field " << UName_ << " on patch " << patch().name()
<< " is not of type " << waveVelocityFvPatchVectorField::typeName
<< exit(FatalError);
}
const waveVelocityFvPatchVectorField& Uwp = fixedValueInletOutletFvPatchField<scalar>::updateCoeffs();
refCast<const waveVelocityFvPatchVectorField>(Up);
const fvPatchScalarField& pp =
patch().lookupPatchField<volScalarField, scalar>(Uwp.pName());
if (isA<wavePressureFvPatchScalarField>(pp))
{
const scalarField alpha(this->alpha()), alphan(this->alphan());
const scalarField out(pos0(Uwp.U() & patch().Sf()));
valueFraction() = out;
refValue() = alpha;
refGrad() = (alpha - alphan)*patch().deltaCoeffs();
}
else
{
refValue() = alpha();
if (inletOutlet_)
{
const scalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>("phi");
const scalarField out(pos0(phip));
valueFraction() = 1 - out;
}
else
{
valueFraction() = 1;
}
}
mixedFvPatchScalarField::updateCoeffs();
} }
@ -229,9 +196,7 @@ void Foam::waveAlphaFvPatchScalarField::write
Ostream& os Ostream& os
) const ) const
{ {
mixedFvPatchScalarField::write(os); fixedValueInletOutletFvPatchField<scalar>::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<Switch>(os, "inletOutlet", true, inletOutlet_);
writeEntryIfDifferent<Switch>(os, "liquid", true, liquid_); writeEntryIfDifferent<Switch>(os, "liquid", true, liquid_);
} }
@ -240,7 +205,11 @@ void Foam::waveAlphaFvPatchScalarField::write
namespace Foam namespace Foam
{ {
makePatchTypeField(fvPatchScalarField, waveAlphaFvPatchScalarField); makePatchTypeField
(
fvPatchScalarField,
waveAlphaFvPatchScalarField
);
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,27 +30,11 @@ Description
wave modelling parameters are obtained from a centrally registered wave modelling parameters are obtained from a centrally registered
waveSuperposition class. waveSuperposition class.
Flow reversal will occur in the event that the amplitude of the velocity
oscillation is greater than the mean flow. This triggers special handling,
the form of which depends on the inletOutlet flag and whether a wave
pressure condition is being used.
If a wave pressure condition is not being used, the inletOutlet switches
between a fixedValue and an inletOutlet condition, with the value given by
the wave model. If fixedValue, the result may be more accurate, but it
might also be unstable.
If a wave pressure condition is being used, then the normal phase fraction
condition becomes fixedGradient on outlet faces. This gradient is
calculated numerically by evaluating the wave model on both the patch face
and the adjacent cell.
Usage Usage
\table \table
Property | Description | Req'd? | Default Property | Description | Req'd? | Default
U | name of the velocity field | no | U phi | Name of the flux field | no | phi
liquid | is the alpha field that of the liquid | no | true liquid | Is the alpha field that of the liquid? | no | true
inletOutlet | does the condition behave like inletOutlet | no | true
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:
@ -58,9 +42,8 @@ Usage
<patchName> <patchName>
{ {
type waveAlpha; type waveAlpha;
U U; phi phi;
liquid true; liquid true;
inletOutlet true;
} }
\endverbatim \endverbatim
@ -75,31 +58,34 @@ SourceFiles
#ifndef waveAlphaFvPatchScalarField_H #ifndef waveAlphaFvPatchScalarField_H
#define waveAlphaFvPatchScalarField_H #define waveAlphaFvPatchScalarField_H
#include "mixedFvPatchFields.H" #include "fixedValueInletOutletFvPatchFields.H"
#include "waveSuperposition.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
class fvMeshSubset;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class waveAlphaFvPatchScalarField Declaration Class waveAlphaFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class waveAlphaFvPatchScalarField class waveAlphaFvPatchScalarField
: :
public mixedFvPatchScalarField public fixedValueInletOutletFvPatchField<scalar>
{ {
// Private Data // Private Data
//- Name of the velocity field
const word UName_;
//- Is this alpha field that of the liquid under the wave? //- Is this alpha field that of the liquid under the wave?
const Switch liquid_; const Switch liquid_;
//- Act as an inlet/outlet patch? //- Mesh subset corresponding to the patch adjacent cells
const Switch inletOutlet_; mutable autoPtr<fvMeshSubset> faceCellSubset_;
//- Time index for keeping the subset up to date
mutable label faceCellSubsetTimeIndex_;
public: public:
@ -125,7 +111,8 @@ public:
const dictionary& const dictionary&
); );
//- Construct by mapping given mixedTypeFvPatchField onto a new patch //- Construct by mapping given fixedValueTypeFvPatchField onto a new
// patch
waveAlphaFvPatchScalarField waveAlphaFvPatchScalarField
( (
const waveAlphaFvPatchScalarField&, const waveAlphaFvPatchScalarField&,
@ -170,15 +157,19 @@ public:
return liquid_; return liquid_;
} }
//- Access the face-cell subset
const fvMeshSubset& faceCellSubset() const;
// Evaluation functions // Evaluation functions
//- Return the current modelled phase fraction field //- Return the current modelled phase fraction field on the patch
tmp<scalarField> alpha() const; // faces at the given time
tmp<scalarField> alpha(const scalar t) const;
//- Return the current modelled phase fraction field in the //- Return the current modelled phase fraction field in the
// neighbour cell // neighbour cells at the given time
tmp<scalarField> alphan() const; tmp<scalarField> alphan(const scalar t) const;
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();

View File

@ -1,236 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "wavePressureFvPatchScalarField.H"
#include "waveVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "levelSet.H"
#include "volFields.H"
#include "fvMeshSubset.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::wavePressureFvPatchScalarField::wavePressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(p, iF),
UName_("U"),
rhoName_("rho")
{
refValue() = Zero;
refGrad() = Zero;
valueFraction() = Zero;
}
Foam::wavePressureFvPatchScalarField::wavePressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF),
UName_(dict.lookupOrDefault<word>("U", "U")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
if (dict.found("value"))
{
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
}
else
{
fvPatchScalarField::operator=(patchInternalField());
}
refValue() = *this;
refGrad() = Zero;
valueFraction() = Zero;
}
Foam::wavePressureFvPatchScalarField::wavePressureFvPatchScalarField
(
const wavePressureFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
UName_(ptf.UName_),
rhoName_(ptf.rhoName_)
{}
Foam::wavePressureFvPatchScalarField::wavePressureFvPatchScalarField
(
const wavePressureFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(ptf, iF),
UName_(ptf.UName_),
rhoName_(ptf.rhoName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::wavePressureFvPatchScalarField::p() const
{
const scalar t = db().time().timeOutputValue();
const waveSuperposition& waves = waveSuperposition::New(db());
return
levelSetAverage
(
patch(),
waves.height(t, patch().Cf()),
waves.height(t, patch().patch().localPoints()),
waves.pGas(t, patch().Cf())(),
waves.pGas(t, patch().patch().localPoints())(),
waves.pLiquid(t, patch().Cf())(),
waves.pLiquid(t, patch().patch().localPoints())()
);
}
Foam::tmp<Foam::scalarField> Foam::wavePressureFvPatchScalarField::pn() const
{
const scalar t = db().time().timeOutputValue();
const waveSuperposition& waves = waveSuperposition::New(db());
const waveVelocityFvPatchVectorField& Up =
refCast<const waveVelocityFvPatchVectorField>
(
patch().lookupPatchField<volVectorField, scalar>(UName_)
);
const fvMeshSubset& subset = Up.faceCellSubset();
const fvMesh& meshs = subset.subMesh();
const label patchis = findIndex(subset.patchMap(), patch().index());
const scalarField ps
(
levelSetAverage
(
meshs,
waves.height(t, meshs.cellCentres())(),
waves.height(t, meshs.points())(),
waves.pGas(t, meshs.cellCentres())(),
waves.pGas(t, meshs.points())(),
waves.pLiquid(t, meshs.cellCentres())(),
waves.pLiquid(t, meshs.points())()
)
);
tmp<scalarField> tResult(new scalarField(patch().size()));
scalarField& result = tResult.ref();
if (patchis != -1)
{
forAll(meshs.boundary()[patchis], is)
{
const label fs = is + meshs.boundary()[patchis].patch().start();
const label cs = meshs.boundary()[patchis].faceCells()[is];
const label f = subset.faceMap()[fs];
const label i = patch().patch().whichFace(f);
result[i] = ps[cs];
}
}
return tResult;
}
void Foam::wavePressureFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const fvPatchVectorField& Up =
patch().lookupPatchField<volVectorField, scalar>(UName_);
if (!isA<waveVelocityFvPatchVectorField>(Up))
{
FatalErrorInFunction
<< "The corresponding condition for the velocity "
<< "field " << UName_ << " on patch " << patch().name()
<< " is not of type " << waveVelocityFvPatchVectorField::typeName
<< exit(FatalError);
}
const waveVelocityFvPatchVectorField& Uwp =
refCast<const waveVelocityFvPatchVectorField>(Up);
if (Uwp.pName() != internalField().name())
{
FatalErrorInFunction
<< "The corresponding condition for the velocity "
<< "field " << UName_ << " on patch " << patch().name()
<< " does not have the pressure set to " << internalField().name()
<< exit(FatalError);
}
const scalarField p(this->p()), pn(this->pn());
const scalarField out(pos0(Uwp.U() & patch().Sf()));
valueFraction() = out;
refValue() = p;
refGrad() = (p - pn)*patch().deltaCoeffs();
if (internalField().dimensions() == dimPressure)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
refValue() *= rhop;
refGrad() *= rhop;
}
mixedFvPatchScalarField::updateCoeffs();
}
void Foam::wavePressureFvPatchScalarField::write(Ostream& os) const
{
mixedFvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
}
// * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField(fvPatchScalarField, wavePressureFvPatchScalarField);
}
// ************************************************************************* //

View File

@ -1,185 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation
\\/ 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::wavePressureFvPatchScalarField
Description
This boundary condition provides a wavePressure condition. This sets the
pressure to a value specified by a superposition of wave models. All the
wave modelling parameters are obtained from a centrally registered
waveSuperposition class.
This functions like an outletInlet condition. Faces on which the flow is
leaving the domain have a value set by the wave model. Faces on which the
flow is entering the domain have the gradient set. This gradient is
calculated numerically by evaluating the wave model on both the patch face
and the adjacent cell.
Use of this boundary condition triggers a consistent behaviour in the
corresponding velocity and phase-fraction conditions.
Usage
\table
Property | Description | Req'd? | Default
U | name of the velocity field | no | U
rho | name of the density field | no | rho
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type wavePressure;
U U;
rho rho;
}
\endverbatim
See also
Foam::waveSuperposition
SourceFiles
wavePressureFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef wavePressureFvPatchScalarField_H
#define wavePressureFvPatchScalarField_H
#include "mixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class wavePressureFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class wavePressureFvPatchScalarField
:
public mixedFvPatchScalarField
{
// Private Data
//- Name of the velocity field
const word UName_;
//- Name of the density field
const word rhoName_;
public:
//- Runtime type information
TypeName("wavePressure");
// Constructors
//- Construct from patch and internal field
wavePressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
wavePressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given mixedTypeFvPatchField
// onto a new patch
wavePressureFvPatchScalarField
(
const wavePressureFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Disallow copy without setting internal field reference
wavePressureFvPatchScalarField
(
const wavePressureFvPatchScalarField&
) = delete;
//- Copy constructor setting internal field reference
wavePressureFvPatchScalarField
(
const wavePressureFvPatchScalarField&,
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 wavePressureFvPatchScalarField
(
*this,
iF
)
);
}
// Member Functions
// Evaluation functions
//- Return the current modelled pressure field on the patch faces
tmp<scalarField> p() const;
//- Return the current modelled pressure field in the neighbour cell
tmp<scalarField> pn() const;
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "waveVelocityFvPatchVectorField.H" #include "waveVelocityFvPatchVectorField.H"
#include "wavePressureFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "levelSet.H" #include "levelSet.H"
#include "volFields.H" #include "volFields.H"
@ -38,17 +37,8 @@ Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField
const DimensionedField<vector, volMesh>& iF const DimensionedField<vector, volMesh>& iF
) )
: :
directionMixedFvPatchVectorField(p, iF), fixedValueInletOutletFvPatchField<vector>(p, iF)
phiName_("phi"), {}
pName_("p"),
inletOutlet_(true),
faceCellSubset_(nullptr),
faceCellSubsetTimeIndex_(-1)
{
refValue() = Zero;
refGrad() = Zero;
valueFraction() = Zero;
}
Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField
@ -58,25 +48,22 @@ Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField
const dictionary& dict const dictionary& dict
) )
: :
directionMixedFvPatchVectorField(p, iF), fixedValueInletOutletFvPatchField<vector>(p, iF, dict, false)
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
pName_(dict.lookupOrDefault<word>("p", "p")),
inletOutlet_(dict.lookupOrDefault<Switch>("inletOutlet", true)),
faceCellSubset_(nullptr),
faceCellSubsetTimeIndex_(-1)
{ {
if (dict.found("value")) if (dict.found("value"))
{ {
fvPatchVectorField::operator=(vectorField("value", dict, p.size())); fixedValueInletOutletFvPatchField<vector>::operator==
(
vectorField("value", dict, p.size())
);
} }
else else
{ {
fvPatchVectorField::operator=(patchInternalField()); fixedValueInletOutletFvPatchField<vector>::operator==
(
patchInternalField()
);
} }
refValue() = *this;
refGrad() = Zero;
valueFraction() = Zero;
} }
@ -88,12 +75,7 @@ Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
directionMixedFvPatchVectorField(ptf, p, iF, mapper), fixedValueInletOutletFvPatchField<vector>(ptf, p, iF, mapper)
phiName_(ptf.phiName_),
pName_(ptf.pName_),
inletOutlet_(ptf.inletOutlet_),
faceCellSubset_(nullptr),
faceCellSubsetTimeIndex_(-1)
{} {}
@ -103,12 +85,7 @@ Foam::waveVelocityFvPatchVectorField::waveVelocityFvPatchVectorField
const DimensionedField<vector, volMesh>& iF const DimensionedField<vector, volMesh>& iF
) )
: :
directionMixedFvPatchVectorField(ptf, iF), fixedValueInletOutletFvPatchField<vector>(ptf, iF)
phiName_(ptf.phiName_),
pName_(ptf.pName_),
inletOutlet_(ptf.inletOutlet_),
faceCellSubset_(nullptr),
faceCellSubsetTimeIndex_(-1)
{} {}
@ -140,9 +117,9 @@ Foam::waveVelocityFvPatchVectorField::faceCellSubset() const
} }
Foam::tmp<Foam::vectorField> Foam::waveVelocityFvPatchVectorField::U() const Foam::tmp<Foam::vectorField>
Foam::waveVelocityFvPatchVectorField::U(const scalar t) const
{ {
const scalar t = db().time().timeOutputValue();
const waveSuperposition& waves = waveSuperposition::New(db()); const waveSuperposition& waves = waveSuperposition::New(db());
return return
@ -159,9 +136,9 @@ Foam::tmp<Foam::vectorField> Foam::waveVelocityFvPatchVectorField::U() const
} }
Foam::tmp<Foam::vectorField> Foam::waveVelocityFvPatchVectorField::Un() const Foam::tmp<Foam::vectorField>
Foam::waveVelocityFvPatchVectorField::Un(const scalar t) const
{ {
const scalar t = db().time().timeOutputValue();
const waveSuperposition& waves = waveSuperposition::New(db()); const waveSuperposition& waves = waveSuperposition::New(db());
const fvMeshSubset& subset = faceCellSubset(); const fvMeshSubset& subset = faceCellSubset();
@ -208,74 +185,11 @@ void Foam::waveVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const fvPatchScalarField& pp = const scalar t = db().time().timeOutputValue();
patch().lookupPatchField<volScalarField, scalar>(pName_);
if (isA<wavePressureFvPatchScalarField>(pp)) operator==(U(t));
{
const vectorField U(this->U()), Un(this->Un());
const scalarField out(pos0(U & patch().Sf()));
// Where inflow, set all velocity components to values specified by the fixedValueInletOutletFvPatchField<vector>::updateCoeffs();
// wave model. Where outflow, set the tangential values and the normal
// gradient.
valueFraction() = symmTensor::I - out*sqr(patch().nf());
refValue() = U;
refGrad() = (U - Un)*patch().deltaCoeffs();
}
else
{
const vectorField U(this->U());
if (inletOutlet_)
{
const scalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
const scalarField out(pos0(phip));
// Where inflow, fix all velocity components to values specified by
// the wave model.
refValue() = (1 - out)*U;
valueFraction() = (1 - out)*symmTensor::I;
// Where outflow, set the normal component of the velocity to a
// value consistent with phi, but scale it to get the volumetric
// flow rate specified by the wave model. Tangential components are
// extrapolated.
const scalar QPhip = gSum(out*phip);
const scalar QWave = gSum(out*(U & patch().Sf()));
const vectorField nBySf(patch().Sf()/sqr(patch().magSf()));
if (QPhip > vSmall)
{
refValue() += out*(QWave/QPhip)*phip*nBySf;
}
else
{
refValue() += out*QWave*nBySf;
}
valueFraction() += out*sqr(patch().nf());
}
else
{
refValue() = U;
valueFraction() = symmTensor::I;
}
}
directionMixedFvPatchVectorField::updateCoeffs();
directionMixedFvPatchVectorField::evaluate();
}
void Foam::waveVelocityFvPatchVectorField::write
(
Ostream& os
) const
{
directionMixedFvPatchVectorField::write(os);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "p", "p", pName_);
writeEntryIfDifferent<Switch>(os, "inletOutlet", true, inletOutlet_);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,39 +30,10 @@ Description
wave modelling parameters are obtained from a centrally registered wave modelling parameters are obtained from a centrally registered
waveSuperposition class. waveSuperposition class.
Flow reversal will occur in the event that the amplitude of the velocity
oscillation is greater than the mean flow. This triggers special handling,
the form of which depends on the inletOutlet flag and whether a wave
pressure condition is being used.
If a wave pressure condition is not being used, and inletOutlet is false,
then this is a standard fixed value condition, with the value supplied by
the wave model. If flow reversal occurs this state may be unstable. The
corresponding pressure condition should be fixedFluxPressure.
If a wave pressure condition is not being used, and inletOutlet is true or
not specified then the proportion of the patch over which the flow is
reversed functions in a manner similar to the flowRateOutletVelocity
condition; i.e., the velocity is extrapolated and then scaled to match the
required outlet flow rate. Numerically, this is still a fixedValue
constraint on the normal velocity, just one which tends to avoid
instability. Again, the corresponding pressure condition should be
fixedFluxPressure.
If a wave pressure condition is being used, then the normal velocity
condition becomes fixedGradient on outlet faces. This gradient is
calculated numerically by evaluating the wave model on both the patch face
and the adjacent cell. The pressure boundary in this case should be a
wavePressure condition. This will do the opposite; it will fix the pressure
value on outlet faces, and the gradient otherwise.
Usage Usage
\table \table
Property | Description | Req'd? | Default Property | Description | Req'd? | Default
phi | Name of the flux field | no | phi phi | Name of the flux field | no | phi
p | Name of the pressure field | no | p
inletOutlet | does the condition behave like inletOutlet | no | true
ramp | ramping function for the mean flow speed | no | None
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:
@ -71,9 +42,6 @@ Usage
{ {
type waveVelocity; type waveVelocity;
phi phi; phi phi;
p p;
inletOutlet yes;
ramp constant 1;
} }
\endverbatim \endverbatim
@ -88,7 +56,7 @@ SourceFiles
#ifndef waveVelocityFvPatchVectorField_H #ifndef waveVelocityFvPatchVectorField_H
#define waveVelocityFvPatchVectorField_H #define waveVelocityFvPatchVectorField_H
#include "directionMixedFvPatchFields.H" #include "fixedValueInletOutletFvPatchFields.H"
#include "waveSuperposition.H" #include "waveSuperposition.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -104,19 +72,10 @@ class fvMeshSubset;
class waveVelocityFvPatchVectorField class waveVelocityFvPatchVectorField
: :
public directionMixedFvPatchVectorField public fixedValueInletOutletFvPatchField<vector>
{ {
// Private Data // Private Data
//- Name of the flux field
const word phiName_;
//- Name of the pressure field
const word pName_;
//- Act as an inlet/outlet patch?
const Switch inletOutlet_;
//- Mesh subset corresponding to the patch adjacent cells //- Mesh subset corresponding to the patch adjacent cells
mutable autoPtr<fvMeshSubset> faceCellSubset_; mutable autoPtr<fvMeshSubset> faceCellSubset_;
@ -186,12 +145,6 @@ public:
// Access // Access
//- Access the name of the pressure field
const word& pName() const
{
return pName_;
}
//- Access the face-cell subset //- Access the face-cell subset
const fvMeshSubset& faceCellSubset() const; const fvMeshSubset& faceCellSubset() const;
@ -199,17 +152,15 @@ public:
// Evaluation functions // Evaluation functions
//- Return the current modelled velocity field on the patch faces //- Return the current modelled velocity field on the patch faces
tmp<vectorField> U() const; // at the given time
tmp<vectorField> U(const scalar t) const;
//- Return the current modelled velocity field in the neighbour cell //- Return the current modelled velocity field in the neighbour
tmp<vectorField> Un() const; // cells at the given time
tmp<vectorField> Un(const scalar t) const;
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
}; };

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
bottom
{
type noSlip;
}
"(top|inlet)"
{
type waveVelocity;
}
outlet
{
type pressureInletOutletVelocity;
value $internalField;
}
"(front|back)"
{
type symmetryPlane;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volScalarField;
location "0";
object alpha;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 1;
boundaryField
{
bottom
{
type zeroGradient;
}
"(top|inlet|outlet)"
{
type waveAlpha;
}
"(front|back)"
{
type symmetryPlane;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format binary;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 1.4e-6;
boundaryField
{
bottom
{
type epsilonWallFunction;
value $internalField;
}
"(top|inlet|outlet)"
{
type inletOutlet;
value $internalField;
inletValue $internalField;
}
"(front|back)"
{
type symmetryPlane;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format binary;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 1.4e-4;
boundaryField
{
bottom
{
type kqRWallFunction;
value $internalField;
}
"(top|inlet|outlet)"
{
type inletOutlet;
value $internalField;
inletValue $internalField;
}
"(front|back)"
{
type symmetryPlane;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
bottom
{
type nutkWallFunction;
value uniform 0;
}
"(top|inlet|outlet)"
{
type calculated;
value $internalField;
}
"(front|back)"
{
type symmetryPlane;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
bottom
{
type fixedFluxPressure;
}
"(top|inlet)"
{
type fixedFluxExtrapolatedPressure;
}
outlet
{
type entrainmentPressure;
p0 $internalField;
value $internalField;
}
"(front|back)"
{
type symmetryPlane;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,13 @@
#!/bin/sh
cd ${0%/*} || exit 1
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
runApplication setWaves
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar -newTimes

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 0 -9.81);
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object momentumTransport;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kEpsilon;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object physicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu [0 2 -1 0 0 0 0] 1e-05;
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object waveProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
origin (0 0 2.7);
direction (1 0 0);
UMean (0 0 0);
waves
(
Stokes5
{
length 5.64;
amplitude 0.3;
phase 0.8;
angle 0;
depth 2.7;
}
);
scale table ((18 1) (24 0));
// ************************************************************************* //

View File

@ -0,0 +1,96 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 -1.8 0) (0 1.8 0) (0 1.8 2) (0 -1.8 2)
(12 -1.8 0) (12 1.8 0) (12 1.8 2) (12 -1.8 2)
(24 -1.8 0) (24 1.8 0) (24 1.8 2) (24 -1.8 2)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (20 24 72) simpleGrading (1 4 1)
hex (4 5 6 7 8 9 10 11) (20 24 24) simpleGrading (1 4 6)
);
edges
(
);
boundary
(
top
{
type patch;
faces
(
(2 3 7 6)
(6 7 11 10)
);
}
inlet
{
type patch;
faces
(
(0 1 2 3)
);
}
outlet
{
type patch;
faces
(
(8 9 10 11)
);
}
bottom
{
type wall;
faces
(
(0 1 5 4)
(4 5 9 8)
);
}
front
{
type symmetryPlane;
faces
(
(0 4 7 3)
(4 8 11 7)
);
}
back
{
type symmetryPlane;
faces
(
(1 5 6 2)
(5 9 10 6)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,88 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pimpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 100;
deltaT 0.01;
writeControl adjustableRunTime;
writeInterval 1;
purgeWrite 0;
writeFormat ascii;
writePrecision 10;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep no;
maxCo 1;
libs
(
"libwaves.so"
);
functions
{
readG
{
libs ("libutilityFunctionObjects.so");
type coded;
name readG;
enabled yes;
executeControl none;
codeRead
#{
if (!mesh().template foundObject<uniformDimensionedVectorField>("g"))
{
Info<< "\nReading g" << endl;
uniformDimensionedVectorField* g =
new uniformDimensionedVectorField
(
IOobject
(
"g",
mesh().time().constant(),
mesh(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
g->store();
}
#};
}
};
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method hierarchical;
hierarchicalCoeffs
{
n (4 1 1);
delta 0.001;
order xyz;
}
// ************************************************************************* //

View File

@ -0,0 +1,58 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linearUpwind grad(U);
div((nuEff*dev2(T(grad(U))))) Gauss linear;
div(U) Gauss linear;
div(phi,epsilon) Gauss limitedLinear 1;
div(phi,k) Gauss limitedLinear 1;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
patchDist
{
method meshWave;
}
// ************************************************************************* //

View File

@ -0,0 +1,58 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-9;
relTol 0.01;
}
pFinal
{
$p;
relTol 0;
}
"(U|k|epsilon)"
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-6;
relTol 0.1;
}
"(U|k|epsilon)Final"
{
$U;
relTol 0;
}
}
PIMPLE
{
nNonOrthogonalCorrectors 0;
nOuterCorrectors 2;
nCorrectors 1;
pRefCell 0;
pRefValue 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object setWavesDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
alpha alpha;
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(inlet|inletSide)"
{
type waveVelocity;
}
top
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
bottom
{
type noSlip;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volScalarField;
location "0";
object alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(inlet|inletSide)"
{
type waveAlpha;
}
top
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
bottom
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volScalarField;
location "0";
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(inlet|inletSide)"
{
type fixedFluxPressure;
value uniform 0;
}
top
{
type entrainmentPressure;
p0 uniform 0;
}
bottom
{
type fixedFluxPressure;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
#!/bin/sh
cd ${0%/*} || exit 1
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
for i in 1 2
do
runApplication -s XY$i topoSet -dict topoSetDictXY$i
runApplication -s XY$i refineMesh -dict refineMeshDictXY -overwrite
done
for i in 1 2 3 4
do
runApplication -s Z$i topoSet -dict topoSetDictZ$i
runApplication -s Z$i refineMesh -dict refineMeshDictZ -overwrite
done
runApplication setWaves
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar -newTimes

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 0 -9.81);
// ************************************************************************* //

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object momentumTransport;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object phaseProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phases (water air);
sigma 0;
// ************************************************************************* //

View File

@ -0,0 +1,24 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object physicalProperties.air;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
viscosityModel constant;
nu 1.48e-05;
rho 1;
// ************************************************************************* //

View File

@ -0,0 +1,24 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object physicalProperties.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
viscosityModel constant;
nu 1e-06;
rho 1000;
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object waveProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
origin (0 0 0);
direction (1 0 0);
waves
(
Airy
{
length 300;
amplitude 2.5;
phase 0;
angle 0.5235987755982988;
}
);
UMean (0 0 0);
scale table ((1200 1) (1800 0));
crossScale table ((-1800 0) (-1200 1) (1200 1) (1800 0));
// ************************************************************************* //

View File

@ -0,0 +1,112 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
( 0 0 -300) (1200 0 -300) (2700 0 -300)
( 0 1200 -300) (1200 1200 -300) (2700 1200 -300)
( 0 2700 -300) (1200 2700 -300) (2700 2700 -300)
( 0 0 300) (1200 0 300) (2700 0 300)
( 0 1200 300) (1200 1200 300) (2700 1200 300)
( 0 2700 300) (1200 2700 300) (2700 2700 300)
);
blocks
(
hex (0 1 4 3 9 10 13 12) (67 67 40) simpleGrading (1 1 1)
hex (1 2 5 4 10 11 14 13) (27 67 40) simpleGrading (8 1 1)
hex (3 4 7 6 12 13 16 15) (67 27 40) simpleGrading (1 8 1)
hex (4 5 8 7 13 14 17 16) (27 27 40) simpleGrading (8 8 1)
);
edges
(
);
defaultPatch
{
name frontAndBack;
type empty;
}
boundary
(
inlet
{
type patch;
faces
(
(0 3 12 9)
(3 6 15 12)
);
}
inletSide
{
type patch;
faces
(
(0 1 10 9)
(1 2 11 10)
);
}
outletSide
{
type symmetryPlane;
faces
(
(6 7 16 15)
(7 8 17 16)
);
}
outlet
{
type symmetryPlane; //patch;
faces
(
(2 5 14 11)
(5 8 17 14)
);
}
bottom
{
type wall;
faces
(
(0 1 4 3)
(1 2 5 4)
(3 4 7 6)
(4 5 8 7)
);
}
top
{
type patch;
faces
(
(9 10 13 12)
(10 11 14 13)
(12 13 16 15)
(13 14 17 16)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,65 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application interFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 100;
deltaT 0.05;
writeControl adjustableRunTime;
writeInterval 1;
purgeWrite 0;
writeFormat binary;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep no;
maxCo 1;
maxAlphaCo 1;
maxDeltaT 1;
libs
(
"libwaves.so"
);
functions
{
#includeFunc isoSurface(isoField=alpha.water, isoValue=0.5, fields=())
}
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 18;
method hierarchical;
hierarchicalCoeffs
{
n (3 3 2);
order xyz;
}
// ************************************************************************* //

View File

@ -0,0 +1,61 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
/*
default CrankNicolson ocCoeff
{
type scale;
scale linearRamp;
duration 1.0;
value 0.9;
};
*/
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
div(rhoPhi,U) Gauss linearUpwindV grad(U);
div(phi,alpha) Gauss interfaceCompression vanLeer 1;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,90 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"alpha.water.*"
{
nAlphaCorr 2;
nAlphaSubCycles 1;
MULESCorr yes;
nLimiterIter 3;
alphaApplyPrevCorr yes;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-8;
relTol 0;
minIter 1;
}
pcorr
{
solver GAMG;
smoother DIC;
tolerance 1e-4;
relTol 0.01;
}
pcorrFinal
{
$pcorr;
relTol 0;
};
p_rgh
{
solver GAMG;
smoother DIC;
tolerance 1e-7;
relTol 0.001;
}
p_rghFinal
{
$p_rgh;
relTol 0;
}
"U.*"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-7;
relTol 0;
}
}
PIMPLE
{
momentumPredictor yes;
nOuterCorrectors 1;
nCorrectors 3;
nNonOrthogonalCorrectors 0;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object refineMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
set box;
coordinateSystem global;
globalCoeffs
{
e1 (1 0 0);
e2 (0 1 0);
}
directions
(
e1
e2
);
useHexTopology true;
geometricCut false;
writeMesh false;
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object refineMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
set box;
coordinateSystem global;
globalCoeffs
{
e1 (1 0 0);
e2 (0 1 0);
}
directions
(
e3
);
useHexTopology true;
geometricCut false;
writeMesh false;
// ************************************************************************* //

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object setWavesDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
alpha alpha.water;
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
box (-1e6 -1e6 -40) (1300 1300 40);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
box (-1e6 -1e6 -30) (1200 1200 30);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
//box (-1e6 -1e6 -40) (1500 1500 40);
box (-1e6 -1e6 -40) (1e6 1e6 40);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
//box (-1e6 -1e6 -30) (1400 1400 30);
box (-1e6 -1e6 -30) (1e6 1e6 30);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
//box (-1e6 -1e6 -20) (1300 1300 20);
box (-1e6 -1e6 -20) (1e6 1e6 20);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
//box (-1e6 -1e6 -10) (1200 1200 10);
box (-1e6 -1e6 -10) (1e6 1e6 10);
}
);
// ************************************************************************* //