Go to the documentation of this file.
57 { geometryModeType::gmAuto,
"auto" },
58 { geometryModeType::gmSpecified,
"specified" },
68 { inletFlowType::ifFixed,
"fixed" },
69 { inletFlowType::ifSurfaceNormal,
"surfaceNormal" },
70 { inletFlowType::ifLocal,
"local" },
79 switch (selectionMode())
86 profiles_.connectBlades(blade_.profileName(), blade_.profileID());
91 coeffs_.readEntry(
"inletVelocity", inletVelocity_);
96 scalar UIn(coeffs_.get<scalar>(
"inletNormalVelocity"));
97 inletVelocity_ = -coordSys_.e3()*UIn;
117 <<
"Source cannot be used with '"
118 << selectionModeTypeNames_[selectionMode()]
119 <<
"' mode. Please use one of: " <<
nl
120 << selectionModeTypeNames_[smCellSet] <<
nl
121 << selectionModeTypeNames_[smCellZone] <<
nl
122 << selectionModeTypeNames_[smAll]
133 static const scalar tol = 0.8;
135 const label nInternalFaces = mesh_.nInternalFaces();
145 labelList nbrFaceCellAddr(mesh_.nFaces() - nInternalFaces, -1);
154 label facei = pp.
start() + i;
155 label nbrFacei = facei - nInternalFaces;
156 label own = mesh_.faceOwner()[facei];
157 nbrFaceCellAddr[nbrFacei] = cellAddr[own];
166 for (label facei = 0; facei < nInternalFaces; facei++)
168 const label own = cellAddr[mesh_.faceOwner()[facei]];
169 const label nbr = cellAddr[mesh_.faceNeighbour()[facei]];
171 if ((own != -1) && (nbr == -1))
173 vector nf = Sf[facei]/magSf[facei];
175 if ((nf & axis) > tol)
177 area_[own] += magSf[facei];
181 else if ((own == -1) && (nbr != -1))
183 vector nf = Sf[facei]/magSf[facei];
185 if ((-nf & axis) > tol)
187 area_[nbr] += magSf[facei];
198 const vectorField& Sfp = mesh_.Sf().boundaryField()[patchi];
199 const scalarField& magSfp = mesh_.magSf().boundaryField()[patchi];
205 const label facei = pp.
start() + j;
206 const label own = cellAddr[mesh_.faceOwner()[facei]];
207 const label nbr = nbrFaceCellAddr[facei - nInternalFaces];
208 const vector nf = Sfp[j]/magSfp[j];
210 if ((own != -1) && (nbr == -1) && ((nf & axis) > tol))
212 area_[own] += magSfp[j];
221 const label facei = pp.
start() + j;
222 const label own = cellAddr[mesh_.faceOwner()[facei]];
223 const vector nf = Sfp[j]/magSfp[j];
225 if ((own != -1) && ((nf & axis) > tol))
227 area_[own] += magSfp[j];
247 mesh_.time().timeName(),
257 Info<<
type() <<
": " << name_ <<
" writing field " <<
area.name()
273 geometryModeTypeNames_.get(
"geometryMode", coeffs_);
285 const label celli = cells_[i];
287 origin += V[celli]*
C[celli];
295 scalar magR = -GREAT;
298 const label celli = cells_[i];
299 vector test =
C[celli] - origin;
300 if (
mag(test) > magR)
312 const label celli = cells_[i];
313 vector dx2 =
C[celli] - origin;
314 if (
mag(dx2) > 0.5*magR)
317 if (
mag(axis) > SMALL)
329 vector dir = pointAbove - origin;
331 if ((dir & axis) < 0)
337 coeffs_.readEntry(
"refDirection", refDir);
341 setFaceArea(axis,
true);
347 coeffs_.readEntry(
"origin", origin);
348 coeffs_.readEntry(
"axis", axis);
349 coeffs_.readEntry(
"refDirection", refDir);
351 setFaceArea(axis,
false);
358 <<
"Unknown geometryMode " << geometryModeTypeNames_[gm]
359 <<
". Available geometry modes include "
360 << geometryModeTypeNames_
367 const scalar sumArea =
gSum(area_);
369 Info<<
" Rotor gometry:" <<
nl
370 <<
" - disk diameter = " << diameter <<
nl
371 <<
" - disk area = " << sumArea <<
nl
372 <<
" - origin = " << coordSys_.origin() <<
nl
373 <<
" - r-axis = " << coordSys_.e1() <<
nl
374 <<
" - psi-axis = " << coordSys_.e2() <<
nl
375 <<
" - z-axis = " << coordSys_.e3() <<
endl;
388 if (area_[i] > ROOTVSMALL)
391 x_[i] = coordSys_.localPosition(cc[i]);
394 rMax_ =
max(rMax_, x_[i].
x());
397 scalar
psi = x_[i].y();
401 flap_.beta0 - flap_.beta1c*
cos(
psi) - flap_.beta2s*
sin(
psi);
407 Rcone_[i] =
tensor(
c, 0, -
s, 0, 1, 0,
s, 0,
c);
421 case ifSurfaceNormal:
429 return U.primitiveField();
449 const word& modelType,
460 inletVelocity_(
Zero),
463 x_(cells_.size(),
Zero),
464 Rcone_(cells_.size(),
I),
465 area_(cells_.size(),
Zero),
469 blade_(coeffs_.subDict(
"blade")),
470 profiles_(coeffs_.subDict(
"profiles"))
488 name_ +
":rotorForce",
489 mesh_.time().timeName(),
497 coeffs_.readEntry(
"rhoRef", rhoRef_);
500 trim_->correct(Uin, force);
506 if (mesh_.time().writeTime())
524 name_ +
":rotorForce",
525 mesh_.time().timeName(),
533 trim_->correct(
rho, Uin, force);
534 calculate(
rho, Uin, trim_->thetag(), force);
539 if (mesh_.time().writeTime())
550 coeffs_.readEntry(
"fields", fieldNames_);
551 applied_.setSize(fieldNames_.size(),
false);
554 omega_ =
rpmToRads(coeffs_.get<scalar>(
"rpm"));
556 coeffs_.readEntry(
"nBlades", nBlades_);
558 inletFlowTypeNames_.readEntry(
"inletFlowType", coeffs_, inletFlow_);
560 coeffs_.readEntry(
"tipEffect", tipEffect_);
562 const dictionary& flapCoeffs(coeffs_.subDict(
"flapCoeffs"));
563 flap_.beta0 =
degToRad(flapCoeffs.get<scalar>(
"beta0"));
564 flap_.beta1c =
degToRad(flapCoeffs.get<scalar>(
"beta1c"));
565 flap_.beta2s =
degToRad(flapCoeffs.get<scalar>(
"beta2s"));
569 createCoordinateSystem();
576 trim_->read(coeffs_);
580 writeField(
"thetag", trim_->thetag()(),
true);
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
void checkData()
Check data.
virtual bool read(const dictionary &dict)
Read source dictionary.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A class for handling words, derived from Foam::string.
Intermediate abstract class for handling cell-set options for the derived fvOptions.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
void createCoordinateSystem()
Create the coordinate system.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
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.
static constexpr const zero Zero
Global zero (0)
Different types of constants.
label checkData(const fvMesh &mesh, const instantList &timeDirs, wordList &objectNames)
Check if fields are good to use (available at all times)
dimensionedScalar sin(const dimensionedScalar &ds)
const dimensionSet & dimensions() const
bool read(const char *buf, int32_t &val)
Same as readInt32.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
Unit conversion functions.
geometryModeType
Options for the geometry type specification.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Type gSum(const FieldField< Field, Type > &f)
Vector< Cmpt > & normalise()
Normalise the vector by its magnitude.
const GeometricField< Type, fvPatchField, volMesh > & psi() const
#define forAll(list, i)
Loop across all elements in list.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add explicit contribution to momentum equation.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const dimensionSet dimArea(sqr(dimLength))
messageStream Info
Information stream (uses stdout - output is on the master only)
A patch is a list of labels that address the faces in the global face list.
word name(const complex &c)
Return string representation of complex.
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
rotorDiskSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void constructGeometry()
Construct geometry.
A cylindrical coordinate system (r-theta-z). The coordinate system angle theta is always in radians.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
Mesh data needed to do the Finite Volume discretisation.
errorManip< error > abort(error &err)
label start() const
Return start label of this patch in the polyMesh face list.
static const Enum< geometryModeType > geometryModeTypeNames_
Names for geometryModeType.
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
static const Enum< inletFlowType > inletFlowTypeNames_
Names for inletFlowType.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr scalar rpmToRads(const scalar rpm) noexcept
Conversion from revolutions/minute to radians/sec.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool writeField(ensightFile &os, const Field< Type > &fld, const ensightCells &part, bool parallel)
constexpr scalar pi(M_PI)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
inletFlowType
Options for the inlet flow type specification.
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
tmp< vectorField > inflowVelocity(const volVectorField &U) const
Return the inlet flow field.
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
const wordList area
Standard area field types (scalar, vector, tensor, etc)
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.
const dimensionSet dimVolume(pow3(dimLength))
const volScalarField & psi
defineTypeNameAndDebug(combustionModel, 0)
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
static const Identity< scalar > I
dimensionedScalar cos(const dimensionedScalar &ds)
UIndirectList< label > labelUIndList
UIndirectList of labels.