74 void Foam::fv::rotorDisk::readCoeffs(
const dictionary&
dict)
76 UName_ =
dict.lookupOrDefault<word>(
"U",
"U");
80 dict.lookup(
"nBlades") >> nBlades_;
82 inletFlow_ = inletFlowTypeNames_.read(
dict.lookup(
"inletFlowType"));
84 dict.lookup(
"tipEffect") >> tipEffect_;
86 const dictionary& flapCoeffs(
dict.subDict(
"flapCoeffs"));
87 flap_.beta0 = flapCoeffs.lookup<scalar>(
"beta0",
unitDegrees);
88 flap_.beta1c = flapCoeffs.lookup<scalar>(
"beta1c",
unitDegrees);
89 flap_.beta2s = flapCoeffs.lookup<scalar>(
"beta2s",
unitDegrees);
92 createCoordinateSystem(
dict);
99 trim_->read(coeffs(
dict));
103 writeField(
"thetag", trim_->thetag()());
104 writeField(
"faceArea", area_);
108 if (
dict.found(
"rhoRef"))
110 dict.lookup(
"rhoRef") >> rhoRef_;
115 void Foam::fv::rotorDisk::checkData(
const dictionary&
dict)
118 profiles_.connectBlades
120 blade_.profileName(),
121 blade_.profileIndex()
127 dict.lookup(
"inletVelocity") >> inletVelocity_;
130 case inletFlowType::surfaceNormal:
134 dict.lookup<scalar>(
"inletNormalVelocity")
136 inletVelocity_ = -coordSys_.R().e3()*UIn;
139 case inletFlowType::local:
152 void Foam::fv::rotorDisk::setFaceArea(
vector& axis,
const bool correct)
156 static const scalar tol = 0.8;
167 UIndirectList<label>(cellAddr, zone_.zone()) =
169 labelList nbrFaceCellAddr(
mesh().nFaces() - nInternalFaces, -1);
172 const polyPatch& pp = pbm[
patchi];
178 label facei = pp.start() + i;
179 label nbrFacei = facei - nInternalFaces;
181 nbrFaceCellAddr[nbrFacei] = cellAddr[own];
190 for (
label facei = 0; facei < nInternalFaces; facei++)
195 if ((own != -1) && (nbr == -1))
197 vector nf = Sf[facei]/magSf[facei];
199 if ((nf & axis) > tol)
201 area_[own] += magSf[facei];
205 else if ((own == -1) && (nbr != -1))
207 vector nf = Sf[facei]/magSf[facei];
209 if ((-nf & axis) > tol)
211 area_[nbr] += magSf[facei];
221 const polyPatch& pp = pbm[
patchi];
229 const label facei = pp.start() + j;
231 const label nbr = nbrFaceCellAddr[facei - nInternalFaces];
232 const vector nf = Sfp[j]/magSfp[j];
234 if ((own != -1) && (nbr == -1) && ((nf & axis) > tol))
236 area_[own] += magSfp[j];
245 const label facei = pp.start() + j;
247 const vector nf = Sfp[j]/magSfp[j];
249 if ((own != -1) && ((nf & axis) > tol))
251 area_[own] += magSfp[j];
279 UIndirectList<scalar>(area.primitiveField(), zone_.zone()) = area_;
281 Info<<
type() <<
": " <<
name() <<
" writing field " << area.name()
289 void Foam::fv::rotorDisk::createCoordinateSystem(
const dictionary&
dict)
296 geometryModeType gm =
297 geometryModeTypeNames_.read(
dict.lookup(
"geometryMode"));
301 case geometryModeType::automatic:
314 origin += V[celli]*
C[celli];
316 reduce(origin, sumOp<vector>());
317 reduce(sumV, sumOp<scalar>());
322 scalar magR = -great;
326 vector test =
C[celli] - origin;
327 if (
mag(test) > magR)
333 reduce(dx1, maxMagSqrOp<vector>());
340 vector dx2 =
C[celli] - origin;
341 if (
mag(dx2) > 0.5*magR)
344 if (
mag(axis) > small)
350 reduce(axis, maxMagSqrOp<vector>());
356 vector dir = pointAbove - origin;
358 if ((dir & axis) < 0)
364 dict.lookup(
"refDirection") >> refDir;
368 new cylindrical(axis, origin, UIndirectList<vector>(
C,
cells)())
373 setFaceArea(axis,
true);
377 case geometryModeType::specified:
379 dict.lookup(
"origin") >> origin;
380 dict.lookup(
"axis") >> axis;
381 dict.lookup(
"refDirection") >> refDir;
389 UIndirectList<vector>(
mesh().
C(), zone_.zone())()
393 setFaceArea(axis,
false);
400 coordinateSystems::cylindrical(
"rotorCoordSys", origin, axis, refDir);
402 const scalar sumArea =
gSum(area_);
404 Info<<
" Rotor geometry:" <<
nl
405 <<
" - disk diameter = " << diameter <<
nl
406 <<
" - disk area = " << sumArea <<
nl
407 <<
" - origin = " << coordSys_.origin() <<
nl
408 <<
" - r-axis = " << coordSys_.R().e1() <<
nl
409 <<
" - psi-axis = " << coordSys_.R().e2() <<
nl
410 <<
" - z-axis = " << coordSys_.R().e3() <<
endl;
414 void Foam::fv::rotorDisk::constructGeometry()
422 if (area_[i] > rootVSmall)
427 x_[i] = coordSys_.localPosition(
C[celli]);
430 rMax_ =
max(rMax_, x_[i].
x());
433 scalar
psi = x_[i].y();
437 flap_.beta0 - flap_.beta1c*
cos(
psi) - flap_.beta2s*
sin(
psi);
441 scalar
c =
cos(beta);
442 scalar
s =
sin(beta);
444 invR_[i] = R_[i].T();
458 case inletFlowType::surfaceNormal:
460 return tmp<vectorField>
467 case inletFlowType::local:
469 return U.primitiveField();
489 const word& modelType,
500 inletVelocity_(
Zero),
503 x_(zone_.nCells(),
Zero),
504 R_(zone_.nCells(),
I),
505 invR_(zone_.nCells(),
I),
506 area_(zone_.nCells(),
Zero),
511 blade_(
dict.subDict(
"blade")),
512 profiles_(
dict.subDict(
"profiles")),
543 name() +
":rotorForce",
559 <<
"rhoRef not set, required for incompressible flow"
564 trim_->correct(Uin, force);
570 if (
mesh().time().writeTime())
588 name() +
":rotorForce",
602 trim_->correct(
rho, Uin, force);
608 if (
mesh().time().writeTime())
624 zone_.topoChange(map);
636 zone_.distribute(map);
644 zone_.read(coeffs(
dict));
645 readCoeffs(coeffs(
dict));
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Initialise the NamedEnum HashTable from the static list of names.
virtual Ostream & write(const char)=0
Write character.
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
A coordinate rotation specified using global axis.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
const dimensionSet & dimensions() const
Mesh data needed to do the Finite Volume discretisation.
const volVectorField & C() const
Return cell centres.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
const surfaceVectorField & Sf() const
Return cell face area vectors.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
Finite volume model abstract base class.
static const dictionary & coeffs(const word &modelType, const dictionary &)
Return the coefficients sub-dictionary for a given model type.
virtual bool read(const dictionary &dict)
Read source dictionary.
Cell based momentum source which approximates the mean effects of rotor forces on a cylindrical regio...
virtual bool movePoints()
Update for mesh motion.
virtual void addSup(const volVectorField &U, fvMatrix< vector > &eqn) const
Source term to momentum equation.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
rotorDisk(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
static const NamedEnum< inletFlowType, 3 > inletFlowTypeNames_
static const NamedEnum< geometryModeType, 2 > geometryModeTypeNames_
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual ~rotorDisk()
Destructor.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
virtual const labelList & faceOwner() const
Return face owner.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
label nInternalFaces() const
virtual bool write(const bool write=true) const
Write using setting from DB.
A class for managing temporary objects.
A class for handling words, derived from string.
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const volScalarField & psi
void correct(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiCorr, const SpType &Sp)
const dimensionedScalar c
Speed of light in a vacuum.
label calculate(const fvMesh &mesh, const labelHashSet &patchIDs, const scalar minFaceFraction, GeometricField< scalar, GeoMesh > &distance)
Calculate distance data from patches.
static const coefficient C("C", dimTemperature, 234.5)
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
Type gSum(const FieldField< Field, Type > &f)
VolField< vector > volVectorField
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
Tensor< scalar > tensor
Tensor of scalars.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
dimensionedScalar sin(const dimensionedScalar &ds)
IOstream & fixed(IOstream &io)
static const Identity< scalar > I
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
addBackwardCompatibleToRunTimeSelectionTable(fvPatchScalarField, coupledTemperatureFvPatchScalarField, patchMapper, turbulentTemperatureCoupledBaffleMixed, "compressible::turbulentTemperatureCoupledBaffleMixed")
Vector< scalar > vector
A scalar version of the templated Vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const dimensionSet dimVolume
VolField< scalar > volScalarField
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Field< vector > vectorField
Specialisation of Field<T> for vector.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
const dimensionSet dimArea
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensionedScalar cos(const dimensionedScalar &ds)
const unitConversion unitDegrees
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.