Commit 402f17f7 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: swirlMassFlowRateInletVelocity -> swirlFlowRateInletVelocity

- improve documentation, use GPL version 3
parent 7abd5470
......@@ -156,7 +156,7 @@ $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityK
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
$(derivedFvPatchFields)/swirlMassFlowRateInletVelocity/swirlMassFlowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C
fvsPatchFields = fields/fvsPatchFields
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
......
......@@ -118,9 +118,9 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
}
// a simpler way of doing this would be nice
scalar avgU = -flowRate_/gSum(patch().magSf());
const scalar avgU = -flowRate_/gSum(patch().magSf());
vectorField n = patch().nf();
tmp<vectorField> n = patch().nf();
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
......
......@@ -37,9 +37,9 @@ Description
@verbatim
inlet
{
type flowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
value uniform (0 0 0); // placeholder
type flowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
value uniform (0 0 0); // placeholder
}
@endverbatim
......
......@@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "swirlMassFlowRateInletVelocityFvPatchVectorField.H"
#include "swirlFlowRateInletVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
......@@ -33,8 +33,8 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField::
swirlFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
......@@ -49,10 +49,10 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField::
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf,
const swirlFlowRateInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
......@@ -66,8 +66,8 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField::
swirlFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
......@@ -83,10 +83,10 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField::
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf
const swirlFlowRateInletVelocityFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
......@@ -98,10 +98,10 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField::
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf,
const swirlFlowRateInletVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
......@@ -115,25 +115,28 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
void Foam::swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
scalar totArea = gSum(patch().magSf());
const scalar totArea = gSum(patch().magSf());
// a simpler way of doing this would be nice
scalar avgU = -flowRate_/totArea;
const scalar avgU = -flowRate_/totArea;
vector center = gSum(patch().Cf()*patch().magSf())/totArea;
vector normal = gSum(patch().nf()*patch().magSf())/totArea;
const vector avgCenter = gSum(patch().Cf()*patch().magSf())/totArea;
const vector avgNormal = gSum(patch().Sf())/totArea;
vectorField tangVelo =
// Update angular velocity - convert [rpm] to [rad/s]
vectorField tangentialVelocity =
(
(rpm_*constant::mathematical::pi/30.0)
*(patch().Cf() - center) ^ normal;
* (patch().Cf() - avgCenter) ^ avgNormal
);
vectorField n = patch().nf();
tmp<vectorField> n = patch().nf();
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
......@@ -141,7 +144,7 @@ void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
if (phi.dimensions() == dimVelocity*dimArea)
{
// volumetric flow-rate
operator==(tangVelo + n*avgU);
operator==(tangentialVelocity + n*avgU);
}
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
......@@ -149,13 +152,13 @@ void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// mass flow-rate
operator==(tangVelo + n*avgU/rhop);
operator==(tangentialVelocity + n*avgU/rhop);
}
else
{
FatalErrorIn
(
"swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()"
"swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()"
) << "dimensions of " << phiName_ << " are incorrect" << nl
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
......@@ -167,18 +170,15 @@ void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
}
void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
void Foam::swirlFlowRateInletVelocityFvPatchVectorField::write
(
Ostream& os
) const
{
fvPatchField<vector>::write(os);
os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl;
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
......@@ -191,7 +191,7 @@ namespace Foam
makePatchTypeField
(
fvPatchVectorField,
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
);
}
......
......@@ -22,11 +22,11 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::swirlMassFlowRateInletVelocityFvPatchVectorField
Foam::swirlFlowRateInletVelocityFvPatchVectorField
Description
Describes a volumetric/mass flow normal vector boundary condition by its
magnitude as an integral over its area with a swirl component determined
magnitude as an integral over its area, with a swirl component determined
by the RPM
The basis of the patch (volumetric or mass) is determined by the
......@@ -38,22 +38,30 @@ Description
@verbatim
inlet
{
type swirlMassFlowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
rpm 100;
type swirlFlowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
rpm 100;
value uniform (0 0 0); // placeholder
}
@endverbatim
Note
- The value is positive inwards
- May not work correctly for transonic inlets
- Swirl is defined in RPM about the patch centre-axis according
to a right-hand rule (inwards axis).
- Primarily useful for planar patches.
See Also
Foam::flowRateInletVelocityFvPatchVectorField
SourceFiles
swirlMassFlowRateInletVelocityFvPatchVectorField.C
swirlFlowRateInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef swirlMassFlowRateInletVelocityFvPatchVectorField_H
#define swirlMassFlowRateInletVelocityFvPatchVectorField_H
#ifndef swirlFlowRateInletVelocityFvPatchVectorField_H
#define swirlFlowRateInletVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
......@@ -62,10 +70,10 @@ SourceFiles
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class swirlMassFlowRateInletVelocityFvPatchVectorField Declaration
Class swirlFlowRateInletVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class swirlMassFlowRateInletVelocityFvPatchVectorField
class swirlFlowRateInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
......@@ -80,27 +88,27 @@ class swirlMassFlowRateInletVelocityFvPatchVectorField
//- Name of the density field used to normalize the mass flux
word rhoName_;
//- RPM
//- Swirl rate [rpm]
scalar rpm_;
public:
//- Runtime type information
TypeName("swirlMassFlowRateInletVelocity");
TypeName("swirlFlowRateInletVelocity");
// Constructors
//- Construct from patch and internal field
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
......@@ -110,18 +118,18 @@ public:
//- Construct by mapping given
// flowRateInletVelocityFvPatchVectorField
// onto a new patch
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField&,
const swirlFlowRateInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField&
const swirlFlowRateInletVelocityFvPatchVectorField&
);
//- Construct and return a clone
......@@ -129,14 +137,14 @@ public:
{
return tmp<fvPatchVectorField>
(
new swirlMassFlowRateInletVelocityFvPatchVectorField(*this)
new swirlFlowRateInletVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField&,
const swirlFlowRateInletVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
......@@ -148,7 +156,7 @@ public:
{
return tmp<fvPatchVectorField>
(
new swirlMassFlowRateInletVelocityFvPatchVectorField(*this, iF)
new swirlFlowRateInletVelocityFvPatchVectorField(*this, iF)
);
}
......@@ -169,6 +177,18 @@ public:
return flowRate_;
}
//- Return the swirl rpm
scalar rpm() const
{
return rpm_;
}
//- Return reference to the swirl rpm to allow adjustment
scalar& rpm()
{
return rpm_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
......
Markdown is supported
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