movingWallSlipVelocity: Added boundary condition

This boundary condition specifies a slip velocity on moving walls. It
works similarly to movingWallVelocity, except that the tangential
velocity is not constrained. It can be specified as follows:

    <patchName>
    {
        type            movingWallSlipVelocity;
        value           uniform (0 0 0); // Initial value
    }
This commit is contained in:
Will Bainbridge
2021-11-02 10:26:20 +00:00
parent a13826f1d6
commit 80c1a65bc8
3 changed files with 292 additions and 0 deletions

View File

@ -178,6 +178,7 @@ $(derivedFvPatchFields)/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValu
$(derivedFvPatchFields)/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/noSlip/noSlipFvPatchVectorField.C
$(derivedFvPatchFields)/movingWallVelocity/movingWallVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/movingWallSlipVelocity/movingWallSlipVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/outletInlet/outletInletFvPatchFields.C
$(derivedFvPatchFields)/outletMappedUniformInlet/outletMappedUniformInletFvPatchFields.C
$(derivedFvPatchFields)/fixedMeanOutletInlet/fixedMeanOutletInletFvPatchFields.C

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "movingWallSlipVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "fvcMeshPhi.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::movingWallSlipVelocityFvPatchVectorField::
movingWallSlipVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
directionMixedFvPatchVectorField(p, iF)
{
refValue() = Zero;
refGrad() = Zero;
valueFraction() = Zero;
}
Foam::movingWallSlipVelocityFvPatchVectorField::
movingWallSlipVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
directionMixedFvPatchVectorField(p, iF)
{
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
const vectorField n(p.nf());
refValue() = sqr(n) & *this;
refGrad() = Zero;
valueFraction() = sqr(n);
}
Foam::movingWallSlipVelocityFvPatchVectorField::
movingWallSlipVelocityFvPatchVectorField
(
const movingWallSlipVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
directionMixedFvPatchVectorField(ptf, p, iF, mapper)
{}
Foam::movingWallSlipVelocityFvPatchVectorField::
movingWallSlipVelocityFvPatchVectorField
(
const movingWallSlipVelocityFvPatchVectorField& mwvpvf,
const DimensionedField<vector, volMesh>& iF
)
:
directionMixedFvPatchVectorField(mwvpvf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::movingWallSlipVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
const fvMesh& mesh = internalField().mesh();
if (mesh.moving())
{
const fvPatch& p = patch();
const volVectorField& U =
static_cast<const volVectorField&>(internalField());
scalarField phip
(
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U))
);
const vectorField n(p.nf());
const scalarField& magSf = p.magSf();
tmp<scalarField> Un = phip/(magSf + vSmall);
refValue() = n*Un;
refGrad() = Zero;
valueFraction() = sqr(n);
}
directionMixedFvPatchVectorField::updateCoeffs();
directionMixedFvPatchVectorField::evaluate();
}
void Foam::movingWallSlipVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
writeEntry(os, "value", *this);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
movingWallSlipVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,142 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::movingWallSlipVelocityFvPatchVectorField
Description
This boundary condition provides a slip velocity condition for cases with
moving walls.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type movingWallSlipVelocity;
value uniform (0 0 0); // Initial value
}
\endverbatim
SourceFiles
movingWallSlipVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef movingWallSlipVelocityFvPatchVectorField_H
#define movingWallSlipVelocityFvPatchVectorField_H
#include "directionMixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class movingWallSlipVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class movingWallSlipVelocityFvPatchVectorField
:
public directionMixedFvPatchVectorField
{
public:
//- Runtime type information
TypeName("movingWallSlipVelocity");
// Constructors
//- Construct from patch and internal field
movingWallSlipVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
movingWallSlipVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given movingWallSlipVelocityFvPatchVectorField
// onto a new patch
movingWallSlipVelocityFvPatchVectorField
(
const movingWallSlipVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Disallow copy without setting internal field reference
movingWallSlipVelocityFvPatchVectorField
(
const movingWallSlipVelocityFvPatchVectorField&
) = delete;
//- Copy constructor setting internal field reference
movingWallSlipVelocityFvPatchVectorField
(
const movingWallSlipVelocityFvPatchVectorField&,
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 movingWallSlipVelocityFvPatchVectorField(*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
// ************************************************************************* //