Skip to content
Snippets Groups Projects
Commit 9976caa1 authored by Henry Weller's avatar Henry Weller Committed by Andrew Heather
Browse files

swirlInletVelocity: New general swirl inlet BC

which support the specification of the individual velocity components (axial,
radial and tangential) as Function1s.
parent 1ae664e3
Branches
Tags
No related merge requests found
......@@ -158,6 +158,7 @@ $(derivedFvPatchFields)/mappedFixedPushedInternalValue/mappedFixedPushedInternal
$(derivedFvPatchFields)/mappedFixedValue/mappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/mappedFlowRate/mappedFlowRateFvPatchVectorField.C
$(derivedFvPatchFields)/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C
$(derivedFvPatchFields)/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/noSlip/noSlipFvPatchVectorField.C
$(derivedFvPatchFields)/movingWallVelocity/movingWallVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/outletInlet/outletInletFvPatchFields.C
......@@ -180,6 +181,7 @@ $(derivedFvPatchFields)/slip/slipFvPatchFields.C
$(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C
$(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C
$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/swirlInletVelocity/swirlInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/syringePressure/syringePressureFvPatchScalarField.C
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/totalPressure/totalPressureFvPatchScalarField.C
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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 "swirlInletVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::swirlInletVelocityFvPatchVectorField::
swirlInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(p, iF),
origin_(Zero),
axis_(Zero),
axialVelocity_(),
radialVelocity_(),
tangentialVelocity_()
{}
Foam::swirlInletVelocityFvPatchVectorField::
swirlInletVelocityFvPatchVectorField
(
const swirlInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
origin_(ptf.origin_),
axis_(ptf.axis_),
axialVelocity_(ptf.axialVelocity_, false),
radialVelocity_(ptf.radialVelocity_, false),
tangentialVelocity_(ptf.tangentialVelocity_, false)
{}
Foam::swirlInletVelocityFvPatchVectorField::
swirlInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict),
origin_(dict.lookup("origin")),
axis_(dict.lookup("axis")),
axialVelocity_(Function1<scalar>::New("axialVelocity", dict)),
radialVelocity_(Function1<scalar>::New("radialVelocity", dict)),
tangentialVelocity_(Function1<scalar>::New("tangentialVelocity", dict))
{}
Foam::swirlInletVelocityFvPatchVectorField::
swirlInletVelocityFvPatchVectorField
(
const swirlInletVelocityFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
origin_(ptf.origin_),
axis_(ptf.axis_),
axialVelocity_(ptf.axialVelocity_, false),
radialVelocity_(ptf.radialVelocity_, false),
tangentialVelocity_(ptf.tangentialVelocity_, false)
{}
Foam::swirlInletVelocityFvPatchVectorField::
swirlInletVelocityFvPatchVectorField
(
const swirlInletVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(ptf, iF),
origin_(ptf.origin_),
axis_(ptf.axis_),
axialVelocity_(ptf.axialVelocity_, false),
radialVelocity_(ptf.radialVelocity_, false),
tangentialVelocity_(ptf.tangentialVelocity_, false)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::swirlInletVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
const vector axisHat = axis_/mag(axis_);
// Radius vector in plane of rotation
vectorField r(patch().Cf() - origin_);
r -= (axisHat & r)*axisHat;
const scalarField magr(mag(r));
const vectorField rHat(r/magr);
const scalarField axialVelocity(axialVelocity_->value(magr));
const scalarField radialVelocity(radialVelocity_->value(magr));
const scalarField tangentialVelocity(tangentialVelocity_->value(magr));
operator==
(
axialVelocity*axisHat
+ radialVelocity*rHat
+ tangentialVelocity*(axisHat ^ rHat)
);
fixedValueFvPatchField<vector>::updateCoeffs();
}
void Foam::swirlInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchField<vector>::write(os);
os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
axialVelocity_->writeData(os);
radialVelocity_->writeData(os);
tangentialVelocity_->writeData(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
swirlInletVelocityFvPatchVectorField
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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::swirlInletVelocityFvPatchVectorField
Group
grpInletBoundaryConditions
Description
This boundary condition describes an inlet vector boundary condition in
swirl co-ordinates given a central axis, central point, axial, radial and
tangential velocity profiles.
Usage
\table
Property | Description | Required | Default value
axis | Axis of rotation | yes |
origin |Origin of rotation | yes |
axialVelocity | Axial velocity profile [m/s] | yes |
radialVelocity | Radial velocity profile [m/s] | yes |
tangentialVelocity | tangential velocity profile [m/s] | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type swirlInletVelocity;
axis (0 0 1);
origin (0 0 0);
axialVelocity constant 30;
radialVelocity constant 10;
tangentialVelocity constant 100;
}
\endverbatim
Note
The \c axialVelocity, \c radialVelocity and \c tangentialVelocity entries
are Function1 types, able to describe time varying functions. The example
above gives the usage for supplying constant values.
See also
Foam::fixedValueFvPatchField
Foam::Function1Types
SourceFiles
swirlInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef swirlInletVelocityFvPatchVectorField_H
#define swirlInletVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class swirlInletVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class swirlInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Origin of the rotation
const vector origin_;
//- Axis of the rotation
const vector axis_;
//- Axial velocity
autoPtr<Function1<scalar>> axialVelocity_;
//- Radial velocity
autoPtr<Function1<scalar>> radialVelocity_;
//- Tangential velocity
autoPtr<Function1<scalar>> tangentialVelocity_;
public:
//- Runtime type information
TypeName("swirlInletVelocity");
// Constructors
//- Construct from patch and internal field
swirlInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
swirlInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// flowRateInletVelocityFvPatchVectorField
// onto a new patch
swirlInletVelocityFvPatchVectorField
(
const swirlInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
swirlInletVelocityFvPatchVectorField
(
const swirlInletVelocityFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new swirlInletVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
swirlInletVelocityFvPatchVectorField
(
const swirlInletVelocityFvPatchVectorField&,
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 swirlInletVelocityFvPatchVectorField(*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
// ************************************************************************* //
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment