Aded swirlInletVelocity boundary condition
This commit is contained in:
parent
d5b9215b1e
commit
65fcc20630
3 changed files with 363 additions and 0 deletions
|
@ -158,6 +158,7 @@ $(derivedFvPatchFields)/partialSlip/partialSlipFvPatchFields.C
|
|||
$(derivedFvPatchFields)/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/swirlInletVelocity/swirlInletVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/timeVaryingMappedPressureDirectedInletVelocity/timeVaryingMappedPressureDirectedInletVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.C
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.1
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "swirlInletVelocityFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::swirlInletVelocityFvPatchVectorField::
|
||||
swirlInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
origin_(vector::zero),
|
||||
axis_(vector::zero),
|
||||
axialVelocity_(),
|
||||
radialVelocity_(),
|
||||
tangentialVelocity_()
|
||||
{}
|
||||
|
||||
|
||||
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,
|
||||
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 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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,192 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.1
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::swirlInletVelocityFvPatchVectorField
|
||||
|
||||
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
|
||||
|
||||
// ************************************************************************* //
|
Reference in a new issue