rotatingTotalPressureFvPatchScalarField, rotatingTotalPressureFvPatchScalarField: standardised input specification
Now the input specification for rotation in all rotating BCs is 'origin', 'axis' and a scalar Function1 for rotational speed omega.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,15 +34,15 @@ void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
||||
calcTangentialVelocity()
|
||||
{
|
||||
const scalar t = this->db().time().userTimeValue();
|
||||
vector om = omega_->value(t);
|
||||
const scalar omega = omega_->value(t);
|
||||
|
||||
vector axisHat = om/mag(om);
|
||||
const vectorField tangentialVelocity
|
||||
(
|
||||
(-om) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()))
|
||||
(-omega)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
|
||||
);
|
||||
|
||||
const vectorField n(patch().nf());
|
||||
|
||||
refValue() = tangentialVelocity - n*(n & tangentialVelocity);
|
||||
}
|
||||
|
||||
@ -57,6 +57,8 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
pressureInletOutletVelocityFvPatchVectorField(p, iF),
|
||||
origin_(),
|
||||
axis_(Zero),
|
||||
omega_()
|
||||
{}
|
||||
|
||||
@ -70,7 +72,9 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
pressureInletOutletVelocityFvPatchVectorField(p, iF, dict),
|
||||
omega_(Function1<vector>::New("omega", dict))
|
||||
origin_(dict.lookup("origin")),
|
||||
axis_(dict.lookup("axis")),
|
||||
omega_(Function1<scalar>::New("omega", dict))
|
||||
{
|
||||
calcTangentialVelocity();
|
||||
}
|
||||
@ -79,14 +83,16 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
||||
rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const rotatingPressureInletOutletVelocityFvPatchVectorField& ptf,
|
||||
const rotatingPressureInletOutletVelocityFvPatchVectorField& pvf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper),
|
||||
omega_(ptf.omega_, false)
|
||||
pressureInletOutletVelocityFvPatchVectorField(pvf, p, iF, mapper),
|
||||
origin_(pvf.origin_),
|
||||
axis_(pvf.axis_),
|
||||
omega_(pvf.omega_, false)
|
||||
{
|
||||
calcTangentialVelocity();
|
||||
}
|
||||
@ -95,12 +101,14 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
||||
rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const rotatingPressureInletOutletVelocityFvPatchVectorField& rppvf,
|
||||
const rotatingPressureInletOutletVelocityFvPatchVectorField& pvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
pressureInletOutletVelocityFvPatchVectorField(rppvf, iF),
|
||||
omega_(rppvf.omega_, false)
|
||||
pressureInletOutletVelocityFvPatchVectorField(pvf, iF),
|
||||
origin_(pvf.origin_),
|
||||
axis_(pvf.axis_),
|
||||
omega_(pvf.omega_, false)
|
||||
{
|
||||
calcTangentialVelocity();
|
||||
}
|
||||
@ -115,6 +123,8 @@ void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::write
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
writeEntry(os, "phi", phiName());
|
||||
writeEntry(os, "origin", origin_);
|
||||
writeEntry(os, "axis", axis_);
|
||||
writeEntry(os, omega_());
|
||||
writeEntry(os, "value", *this);
|
||||
}
|
||||
|
||||
@ -35,6 +35,8 @@ Usage
|
||||
Property | Description | Required | Default value
|
||||
phi | flux field name | no | phi
|
||||
tangentialVelocity | tangential velocity field | no |
|
||||
origin | origin of rotation in Cartesian co-ordinates | yes|
|
||||
axis | axis of rotation | yes |
|
||||
omega | angular velocity of the frame [rad/s] | yes |
|
||||
\endtable
|
||||
|
||||
@ -45,6 +47,8 @@ Usage
|
||||
type rotatingPressureInletOutletVelocity;
|
||||
phi phi;
|
||||
tangentialVelocity uniform (0 0 0);
|
||||
origin (0 0 0);
|
||||
axis (0 0 1);
|
||||
omega 100;
|
||||
}
|
||||
\endverbatim
|
||||
@ -89,8 +93,14 @@ class rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Origin of the rotation
|
||||
vector origin_;
|
||||
|
||||
//- Axis of the rotation
|
||||
vector axis_;
|
||||
|
||||
//- Angular velocity of the frame
|
||||
autoPtr<Function1<vector>> omega_;
|
||||
autoPtr<Function1<scalar>> omega_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -39,6 +39,8 @@ rotatingTotalPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
totalPressureFvPatchScalarField(p, iF),
|
||||
origin_(),
|
||||
axis_(Zero),
|
||||
omega_()
|
||||
{}
|
||||
|
||||
@ -52,33 +54,39 @@ rotatingTotalPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
totalPressureFvPatchScalarField(p, iF, dict),
|
||||
omega_(Function1<vector>::New("omega", dict))
|
||||
origin_(dict.lookup("origin")),
|
||||
axis_(dict.lookup("axis")),
|
||||
omega_(Function1<scalar>::New("omega", dict))
|
||||
{}
|
||||
|
||||
|
||||
Foam::rotatingTotalPressureFvPatchScalarField::
|
||||
rotatingTotalPressureFvPatchScalarField
|
||||
(
|
||||
const rotatingTotalPressureFvPatchScalarField& rtppsf,
|
||||
const rotatingTotalPressureFvPatchScalarField& psf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
totalPressureFvPatchScalarField(rtppsf, p, iF, mapper),
|
||||
omega_(rtppsf.omega_, false)
|
||||
totalPressureFvPatchScalarField(psf, p, iF, mapper),
|
||||
origin_(psf.origin_),
|
||||
axis_(psf.axis_),
|
||||
omega_(psf.omega_, false)
|
||||
{}
|
||||
|
||||
|
||||
Foam::rotatingTotalPressureFvPatchScalarField::
|
||||
rotatingTotalPressureFvPatchScalarField
|
||||
(
|
||||
const rotatingTotalPressureFvPatchScalarField& rtppsf,
|
||||
const rotatingTotalPressureFvPatchScalarField& psf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
totalPressureFvPatchScalarField(rtppsf, iF),
|
||||
omega_(rtppsf.omega_, false)
|
||||
totalPressureFvPatchScalarField(psf, iF),
|
||||
origin_(psf.origin_),
|
||||
axis_(psf.axis_),
|
||||
omega_(psf.omega_, false)
|
||||
{}
|
||||
|
||||
|
||||
@ -92,8 +100,7 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs()
|
||||
}
|
||||
|
||||
const scalar t = this->db().time().userTimeValue();
|
||||
const vector omega = omega_->value(t);
|
||||
const vector axis = omega/mag(omega);
|
||||
const scalar omega = omega_->value(t);
|
||||
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
|
||||
@ -101,7 +108,7 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs()
|
||||
const vectorField Up
|
||||
(
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_)
|
||||
+ (omega ^ (patch().Cf() - axis*(axis & patch().Cf())))
|
||||
+ omega*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
|
||||
);
|
||||
|
||||
dynamicPressureFvPatchScalarField::updateCoeffs
|
||||
@ -115,6 +122,8 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs()
|
||||
void Foam::rotatingTotalPressureFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
totalPressureFvPatchScalarField::write(os);
|
||||
writeEntry(os, "origin", origin_);
|
||||
writeEntry(os, "axis", axis_);
|
||||
writeEntry(os, omega_());
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,6 +37,8 @@ Usage
|
||||
psi | compressibility field name | no | none
|
||||
gamma | ratio of specific heats (Cp/Cv) | yes |
|
||||
p0 | static pressure reference | yes |
|
||||
origin | origin of rotation in Cartesian co-ordinates | yes|
|
||||
axis | axis of rotation | yes |
|
||||
omega | angular velocity of the frame [rad/s] | yes |
|
||||
\endtable
|
||||
|
||||
@ -51,6 +53,8 @@ Usage
|
||||
psi psi;
|
||||
gamma 1.4;
|
||||
p0 uniform 1e5;
|
||||
origin (0 0 0);
|
||||
axis (0 0 1);
|
||||
omega 100;
|
||||
}
|
||||
\endverbatim
|
||||
@ -88,8 +92,14 @@ class rotatingTotalPressureFvPatchScalarField
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Origin of the rotation
|
||||
vector origin_;
|
||||
|
||||
//- Axis of the rotation
|
||||
vector axis_;
|
||||
|
||||
//- Angular velocity of the frame
|
||||
const autoPtr<Function1<vector>> omega_;
|
||||
const autoPtr<Function1<scalar>> omega_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -75,30 +75,30 @@ rotatingWallVelocityFvPatchVectorField
|
||||
Foam::rotatingWallVelocityFvPatchVectorField::
|
||||
rotatingWallVelocityFvPatchVectorField
|
||||
(
|
||||
const rotatingWallVelocityFvPatchVectorField& ptf,
|
||||
const rotatingWallVelocityFvPatchVectorField& pvf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||
origin_(ptf.origin_),
|
||||
axis_(ptf.axis_),
|
||||
omega_(ptf.omega_, false)
|
||||
fixedValueFvPatchField<vector>(pvf, p, iF, mapper),
|
||||
origin_(pvf.origin_),
|
||||
axis_(pvf.axis_),
|
||||
omega_(pvf.omega_, false)
|
||||
{}
|
||||
|
||||
|
||||
Foam::rotatingWallVelocityFvPatchVectorField::
|
||||
rotatingWallVelocityFvPatchVectorField
|
||||
(
|
||||
const rotatingWallVelocityFvPatchVectorField& rwvpvf,
|
||||
const rotatingWallVelocityFvPatchVectorField& pvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(rwvpvf, iF),
|
||||
origin_(rwvpvf.origin_),
|
||||
axis_(rwvpvf.axis_),
|
||||
omega_(rwvpvf.omega_, false)
|
||||
fixedValueFvPatchField<vector>(pvf, iF),
|
||||
origin_(pvf.origin_),
|
||||
axis_(pvf.axis_),
|
||||
omega_(pvf.omega_, false)
|
||||
{}
|
||||
|
||||
|
||||
@ -112,12 +112,12 @@ void Foam::rotatingWallVelocityFvPatchVectorField::updateCoeffs()
|
||||
}
|
||||
|
||||
const scalar t = this->db().time().userTimeValue();
|
||||
scalar om = omega_->value(t);
|
||||
const scalar omega = omega_->value(t);
|
||||
|
||||
// Calculate the rotating wall velocity from the specification of the motion
|
||||
const vectorField Up
|
||||
(
|
||||
(-om)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
|
||||
(-omega)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
|
||||
);
|
||||
|
||||
// Remove the component of Up normal to the wall
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -153,33 +153,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access functions
|
||||
|
||||
//- Return the origin of the rotation
|
||||
const vector& origin() const
|
||||
{
|
||||
return origin_;
|
||||
}
|
||||
|
||||
//- Return the axis of the rotation
|
||||
const vector& axis() const
|
||||
{
|
||||
return axis_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the origin of the rotation
|
||||
vector& origin()
|
||||
{
|
||||
return origin_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the axis of the rotation
|
||||
vector& axis()
|
||||
{
|
||||
return axis_;
|
||||
}
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user