mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: swirlMassFlowRateInletVelocity -> swirlFlowRateInletVelocity
- improve documentation, use GPL version 3
This commit is contained in:
@ -156,7 +156,7 @@ $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityK
|
|||||||
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
|
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
|
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/swirlMassFlowRateInletVelocity/swirlMassFlowRateInletVelocityFvPatchVectorField.C
|
$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C
|
||||||
|
|
||||||
fvsPatchFields = fields/fvsPatchFields
|
fvsPatchFields = fields/fvsPatchFields
|
||||||
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
||||||
|
|||||||
@ -118,9 +118,9 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// a simpler way of doing this would be nice
|
// 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 =
|
const surfaceScalarField& phi =
|
||||||
db().lookupObject<surfaceScalarField>(phiName_);
|
db().lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|||||||
@ -37,9 +37,9 @@ Description
|
|||||||
@verbatim
|
@verbatim
|
||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
|
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
|
||||||
value uniform (0 0 0); // placeholder
|
value uniform (0 0 0); // placeholder
|
||||||
}
|
}
|
||||||
@endverbatim
|
@endverbatim
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "swirlMassFlowRateInletVelocityFvPatchVectorField.H"
|
#include "swirlFlowRateInletVelocityFvPatchVectorField.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "fvPatchFieldMapper.H"
|
#include "fvPatchFieldMapper.H"
|
||||||
@ -33,8 +33,8 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::
|
Foam::
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField::
|
swirlFlowRateInletVelocityFvPatchVectorField::
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField
|
swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<vector, volMesh>& iF
|
const DimensionedField<vector, volMesh>& iF
|
||||||
@ -49,10 +49,10 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
|
|||||||
|
|
||||||
|
|
||||||
Foam::
|
Foam::
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField::
|
swirlFlowRateInletVelocityFvPatchVectorField::
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField
|
swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf,
|
const swirlFlowRateInletVelocityFvPatchVectorField& ptf,
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<vector, volMesh>& iF,
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
@ -66,8 +66,8 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
|
|||||||
|
|
||||||
|
|
||||||
Foam::
|
Foam::
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField::
|
swirlFlowRateInletVelocityFvPatchVectorField::
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField
|
swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<vector, volMesh>& iF,
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
@ -83,10 +83,10 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
|
|||||||
|
|
||||||
|
|
||||||
Foam::
|
Foam::
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField::
|
swirlFlowRateInletVelocityFvPatchVectorField::
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField
|
swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf
|
const swirlFlowRateInletVelocityFvPatchVectorField& ptf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(ptf),
|
fixedValueFvPatchField<vector>(ptf),
|
||||||
@ -98,10 +98,10 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
|
|||||||
|
|
||||||
|
|
||||||
Foam::
|
Foam::
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField::
|
swirlFlowRateInletVelocityFvPatchVectorField::
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField
|
swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf,
|
const swirlFlowRateInletVelocityFvPatchVectorField& ptf,
|
||||||
const DimensionedField<vector, volMesh>& iF
|
const DimensionedField<vector, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -115,25 +115,28 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
void Foam::swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
||||||
{
|
{
|
||||||
if (updated())
|
if (updated())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar totArea = gSum(patch().magSf());
|
const scalar totArea = gSum(patch().magSf());
|
||||||
// a simpler way of doing this would be nice
|
// 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;
|
const vector avgCenter = gSum(patch().Cf()*patch().magSf())/totArea;
|
||||||
vector normal = gSum(patch().nf()*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)
|
(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 =
|
const surfaceScalarField& phi =
|
||||||
db().lookupObject<surfaceScalarField>(phiName_);
|
db().lookupObject<surfaceScalarField>(phiName_);
|
||||||
@ -141,7 +144,7 @@ void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
if (phi.dimensions() == dimVelocity*dimArea)
|
if (phi.dimensions() == dimVelocity*dimArea)
|
||||||
{
|
{
|
||||||
// volumetric flow-rate
|
// volumetric flow-rate
|
||||||
operator==(tangVelo + n*avgU);
|
operator==(tangentialVelocity + n*avgU);
|
||||||
}
|
}
|
||||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||||
{
|
{
|
||||||
@ -149,13 +152,13 @@ void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
|
|
||||||
// mass flow-rate
|
// mass flow-rate
|
||||||
operator==(tangVelo + n*avgU/rhop);
|
operator==(tangentialVelocity + n*avgU/rhop);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()"
|
"swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()"
|
||||||
) << "dimensions of " << phiName_ << " are incorrect" << nl
|
) << "dimensions of " << phiName_ << " are incorrect" << nl
|
||||||
<< " on patch " << this->patch().name()
|
<< " on patch " << this->patch().name()
|
||||||
<< " of field " << this->dimensionedInternalField().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);
|
fvPatchField<vector>::write(os);
|
||||||
os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl;
|
os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl;
|
||||||
if (phiName_ != "phi")
|
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||||
{
|
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||||
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
if (rhoName_ != "rho")
|
|
||||||
{
|
|
||||||
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
|
os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ namespace Foam
|
|||||||
makePatchTypeField
|
makePatchTypeField
|
||||||
(
|
(
|
||||||
fvPatchVectorField,
|
fvPatchVectorField,
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField
|
swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,11 +22,11 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::swirlMassFlowRateInletVelocityFvPatchVectorField
|
Foam::swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Describes a volumetric/mass flow normal vector boundary condition by its
|
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
|
by the RPM
|
||||||
|
|
||||||
The basis of the patch (volumetric or mass) is determined by the
|
The basis of the patch (volumetric or mass) is determined by the
|
||||||
@ -38,22 +38,30 @@ Description
|
|||||||
@verbatim
|
@verbatim
|
||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type swirlMassFlowRateInletVelocity;
|
type swirlFlowRateInletVelocity;
|
||||||
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
|
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
|
||||||
rpm 100;
|
rpm 100;
|
||||||
|
value uniform (0 0 0); // placeholder
|
||||||
}
|
}
|
||||||
@endverbatim
|
@endverbatim
|
||||||
|
|
||||||
Note
|
Note
|
||||||
- The value is positive inwards
|
- 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
|
SourceFiles
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField.C
|
swirlFlowRateInletVelocityFvPatchVectorField.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef swirlMassFlowRateInletVelocityFvPatchVectorField_H
|
#ifndef swirlFlowRateInletVelocityFvPatchVectorField_H
|
||||||
#define swirlMassFlowRateInletVelocityFvPatchVectorField_H
|
#define swirlFlowRateInletVelocityFvPatchVectorField_H
|
||||||
|
|
||||||
#include "fixedValueFvPatchFields.H"
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
@ -62,10 +70,10 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class swirlMassFlowRateInletVelocityFvPatchVectorField Declaration
|
Class swirlFlowRateInletVelocityFvPatchVectorField Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class swirlMassFlowRateInletVelocityFvPatchVectorField
|
class swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
:
|
:
|
||||||
public fixedValueFvPatchVectorField
|
public fixedValueFvPatchVectorField
|
||||||
{
|
{
|
||||||
@ -80,27 +88,27 @@ class swirlMassFlowRateInletVelocityFvPatchVectorField
|
|||||||
//- Name of the density field used to normalize the mass flux
|
//- Name of the density field used to normalize the mass flux
|
||||||
word rhoName_;
|
word rhoName_;
|
||||||
|
|
||||||
//- RPM
|
//- Swirl rate [rpm]
|
||||||
scalar rpm_;
|
scalar rpm_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("swirlMassFlowRateInletVelocity");
|
TypeName("swirlFlowRateInletVelocity");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from patch and internal field
|
//- Construct from patch and internal field
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField
|
swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<vector, volMesh>&
|
const DimensionedField<vector, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from patch, internal field and dictionary
|
//- Construct from patch, internal field and dictionary
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField
|
swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<vector, volMesh>&,
|
const DimensionedField<vector, volMesh>&,
|
||||||
@ -110,18 +118,18 @@ public:
|
|||||||
//- Construct by mapping given
|
//- Construct by mapping given
|
||||||
// flowRateInletVelocityFvPatchVectorField
|
// flowRateInletVelocityFvPatchVectorField
|
||||||
// onto a new patch
|
// onto a new patch
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField
|
swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const swirlMassFlowRateInletVelocityFvPatchVectorField&,
|
const swirlFlowRateInletVelocityFvPatchVectorField&,
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<vector, volMesh>&,
|
const DimensionedField<vector, volMesh>&,
|
||||||
const fvPatchFieldMapper&
|
const fvPatchFieldMapper&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField
|
swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const swirlMassFlowRateInletVelocityFvPatchVectorField&
|
const swirlFlowRateInletVelocityFvPatchVectorField&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
@ -129,14 +137,14 @@ public:
|
|||||||
{
|
{
|
||||||
return tmp<fvPatchVectorField>
|
return tmp<fvPatchVectorField>
|
||||||
(
|
(
|
||||||
new swirlMassFlowRateInletVelocityFvPatchVectorField(*this)
|
new swirlFlowRateInletVelocityFvPatchVectorField(*this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
//- Construct as copy setting internal field reference
|
||||||
swirlMassFlowRateInletVelocityFvPatchVectorField
|
swirlFlowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const swirlMassFlowRateInletVelocityFvPatchVectorField&,
|
const swirlFlowRateInletVelocityFvPatchVectorField&,
|
||||||
const DimensionedField<vector, volMesh>&
|
const DimensionedField<vector, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -148,7 +156,7 @@ public:
|
|||||||
{
|
{
|
||||||
return tmp<fvPatchVectorField>
|
return tmp<fvPatchVectorField>
|
||||||
(
|
(
|
||||||
new swirlMassFlowRateInletVelocityFvPatchVectorField(*this, iF)
|
new swirlFlowRateInletVelocityFvPatchVectorField(*this, iF)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +177,18 @@ public:
|
|||||||
return flowRate_;
|
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
|
//- Update the coefficients associated with the patch field
|
||||||
virtual void updateCoeffs();
|
virtual void updateCoeffs();
|
||||||
Reference in New Issue
Block a user