Go to the documentation of this file.
45 template<>
const char* NamedEnum<fv::rotorDiskSource::geometryModeType, 2>::
52 const NamedEnum<fv::rotorDiskSource::geometryModeType, 2>
55 template<>
const char* NamedEnum<fv::rotorDiskSource::inletFlowType, 3>::
63 const NamedEnum<fv::rotorDiskSource::inletFlowType, 3>
73 switch (selectionMode())
80 profiles_.connectBlades(blade_.profileName(), blade_.profileID());
85 coeffs_.lookup(
"inletVelocity") >> inletVelocity_;
92 readScalar(coeffs_.lookup(
"inletNormalVelocity"))
94 inletVelocity_ = -coordSys_.R().e3()*UIn;
115 <<
"Source cannot be used with '"
116 << selectionModeTypeNames_[selectionMode()]
117 <<
"' mode. Please use one of: " <<
nl
118 << selectionModeTypeNames_[smCellSet] <<
nl
119 << selectionModeTypeNames_[smCellZone] <<
nl
120 << selectionModeTypeNames_[smAll]
131 static const scalar tol = 0.8;
133 const label nInternalFaces = mesh_.nInternalFaces();
143 labelList nbrFaceCellAddr(mesh_.nFaces() - nInternalFaces, -1);
153 label nbrFaceI = faceI - nInternalFaces;
154 label own = mesh_.faceOwner()[faceI];
155 nbrFaceCellAddr[nbrFaceI] = cellAddr[own];
164 for (
label faceI = 0; faceI < nInternalFaces; faceI++)
166 const label own = cellAddr[mesh_.faceOwner()[faceI]];
167 const label nbr = cellAddr[mesh_.faceNeighbour()[faceI]];
169 if ((own != -1) && (nbr == -1))
171 vector nf = Sf[faceI]/magSf[faceI];
173 if ((nf & axis) > tol)
175 area_[own] += magSf[faceI];
179 else if ((own == -1) && (nbr != -1))
181 vector nf = Sf[faceI]/magSf[faceI];
183 if ((-nf & axis) > tol)
185 area_[nbr] += magSf[faceI];
196 const vectorField& Sfp = mesh_.Sf().boundaryField()[patchI];
197 const scalarField& magSfp = mesh_.magSf().boundaryField()[patchI];
204 const label own = cellAddr[mesh_.faceOwner()[faceI]];
205 const label nbr = nbrFaceCellAddr[faceI - nInternalFaces];
206 const vector nf = Sfp[j]/magSfp[j];
208 if ((own != -1) && (nbr == -1) && ((nf & axis) > tol))
210 area_[own] += magSfp[j];
220 const label own = cellAddr[mesh_.faceOwner()[faceI]];
221 const vector nf = Sfp[j]/magSfp[j];
223 if ((own != -1) && ((nf & axis) > tol))
225 area_[own] += magSfp[j];
245 mesh_.time().timeName(),
255 Info<<
type() <<
": " << name_ <<
" writing field " << area.name()
271 geometryModeTypeNames_.read(coeffs_.lookup(
"geometryMode"));
283 const label cellI = cells_[i];
285 origin += V[cellI]*
C[cellI];
293 scalar magR = -GREAT;
296 const label cellI = cells_[i];
310 const label cellI = cells_[i];
311 vector dx2 =
C[cellI] - origin;
312 if (
mag(dx2) > 0.5*magR)
315 if (
mag(axis) > SMALL)
326 vector pointAbove(coeffs_.lookup(
"pointAbove"));
327 vector dir = pointAbove - origin;
329 if ((dir & axis) < 0)
335 coeffs_.lookup(
"refDirection") >> refDir;
350 setFaceArea(axis,
true);
356 coeffs_.lookup(
"origin") >> origin;
357 coeffs_.lookup(
"axis") >> axis;
358 coeffs_.lookup(
"refDirection") >> refDir;
371 setFaceArea(axis,
false);
378 <<
"Unknown geometryMode " << geometryModeTypeNames_[gm]
379 <<
". Available geometry modes include "
384 coordSys_ =
cylindricalCS(
"rotorCoordSys", origin, axis, refDir,
false);
386 const scalar sumArea =
gSum(area_);
388 Info<<
" Rotor gometry:" <<
nl
389 <<
" - disk diameter = " << diameter <<
nl
390 <<
" - disk area = " << sumArea <<
nl
391 <<
" - origin = " << coordSys_.origin() <<
nl
392 <<
" - r-axis = " << coordSys_.R().e1() <<
nl
393 <<
" - psi-axis = " << coordSys_.R().e2() <<
nl
394 <<
" - z-axis = " << coordSys_.R().e3() <<
endl;
404 if (area_[i] > ROOTVSMALL)
406 const label cellI = cells_[i];
409 x_[i] = coordSys_.localPosition(
C[cellI]);
412 rMax_ =
max(rMax_, x_[i].
x());
415 scalar
psi = x_[i].y();
419 flap_.beta0 - flap_.beta1c*
cos(
psi) - flap_.beta2s*
sin(
psi);
426 invR_[i] = R_[i].T();
440 case ifSurfaceNormal:
451 return U.internalField();
471 const word& modelType,
486 R_(cells_.size(),
I),
487 invR_(cells_.size(),
I),
488 area_(cells_.size(), 0.0),
493 blade_(coeffs_.subDict(
"blade")),
494 profiles_(coeffs_.subDict(
"profiles"))
518 name_ +
":rotorForce",
519 mesh_.time().timeName(),
532 coeffs_.lookup(
"rhoRef") >> rhoRef_;
535 trim_->correct(Uin, force);
541 if (mesh_.time().outputTime())
559 name_ +
":rotorForce",
560 mesh_.time().timeName(),
573 trim_->correct(
rho, Uin, force);
574 calculate(
rho, Uin, trim_->thetag(), force);
579 if (mesh_.time().outputTime())
590 coeffs_.lookup(
"fieldNames") >> fieldNames_;
591 applied_.setSize(fieldNames_.size(),
false);
594 scalar rpm(
readScalar(coeffs_.lookup(
"rpm")));
597 coeffs_.lookup(
"nBlades") >> nBlades_;
599 inletFlow_ = inletFlowTypeNames_.read(coeffs_.lookup(
"inletFlowType"));
601 coeffs_.lookup(
"tipEffect") >> tipEffect_;
603 const dictionary& flapCoeffs(coeffs_.subDict(
"flapCoeffs"));
604 flapCoeffs.
lookup(
"beta0") >> flap_.beta0;
605 flapCoeffs.
lookup(
"beta1c") >> flap_.beta1c;
606 flapCoeffs.
lookup(
"beta2s") >> flap_.beta2s;
607 flap_.beta0 =
degToRad(flap_.beta0);
608 flap_.beta1c =
degToRad(flap_.beta1c);
609 flap_.beta2s =
degToRad(flap_.beta2s);
613 createCoordinateSystem();
620 trim_->read(coeffs_);
624 writeField(
"thetag", trim_->thetag()(),
true);
625 writeField(
"faceArea", area_,
true);
void checkData()
Check data.
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
virtual bool read(const dictionary &dict)
Read source dictionary.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A class for handling words, derived from string.
Cell-set options abtract base class. Provides a base set of controls, e.g.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldI)
Source term to momentum equation.
void createCoordinateSystem()
Create the co-ordinate system.
#define forAll(list, i)
Loop across all elements in list.
void setFaceArea(vector &axis, const bool correct)
Set the face areas per cell, and optionally correct the rotor axis.
A class for managing temporary objects.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
dimensionedScalar sin(const dimensionedScalar &ds)
bool read(const char *, int32_t &)
const dimensionSet & dimensions() const
Tensor< scalar > tensor
Tensor of scalars.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
A local coordinate rotation. The cell based rotational field can be created in two ways:
Ostream & endl(Ostream &os)
Add newline and flush stream.
Cylindrical coordinate system.
Type gSum(const FieldField< Field, Type > &f)
const scalar twoPi(2 *pi)
dimensioned< scalar > mag(const dimensioned< Type > &)
const GeometricField< Type, fvPatchField, volMesh > & psi() const
virtual ~rotorDiskSource()
Destructor.
Field< vector > vectorField
Specialisation of Field<T> for vector.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
static const NamedEnum< inletFlowType, 3 > inletFlowTypeNames_
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const dimensionSet dimArea(sqr(dimLength))
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
A patch is a list of labels that address the faces in the global face list.
rotorDiskSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
InternalField & internalField()
Return internal field.
void constructGeometry()
Construct geometry.
static const sphericalTensor I(1)
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Macros for easy insertion into run-time selection tables.
Generic dimensioned Type class.
Mesh data needed to do the Finite Volume discretisation.
errorManip< error > abort(error &err)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
label start() const
Return start label of this patch in the polyMesh face list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const volScalarField & psi
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
static const NamedEnum< geometryModeType, 2 > geometryModeTypeNames_
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar sqrt(const dimensionedScalar &ds)
tmp< vectorField > inflowVelocity(const volVectorField &U) const
Return the inlet flow field.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
const dimensionedScalar c
Speed of light in a vacuum.
A List with indirect addressing.
static autoPtr< trimModel > New(const fv::rotorDiskSource &rotor, const dictionary &dict)
Return a reference to the selected trim model.
Graphite solid properties.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
const dimensionSet dimVolume(pow3(dimLength))
Generic GeometricField class.
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
dimensionedScalar cos(const dimensionedScalar &ds)