57 { geometryModeType::gmAuto,
"auto" },
58 { geometryModeType::gmSpecified,
"specified" },
68 { inletFlowType::ifFixed,
"fixed" },
70 { inletFlowType::ifLocal,
"local" },
96 scalar UIn(
coeffs_.get<scalar>(
"inletNormalVelocity"));
116 <<
"Source cannot be used with '"
118 <<
"' mode. Please use one of: " <<
nl
132 static const scalar tol = 0.8;
134 const label nInternalFaces = mesh_.nInternalFaces();
144 labelList nbrFaceCellAddr(mesh_.nBoundaryFaces(), -1);
153 label facei =
pp.start() + i;
154 label nbrFacei = facei - nInternalFaces;
155 label own = mesh_.faceOwner()[facei];
156 nbrFaceCellAddr[nbrFacei] = cellAddr[own];
165 for (label facei = 0; facei < nInternalFaces; facei++)
167 const label own = cellAddr[mesh_.faceOwner()[facei]];
168 const label nbr = cellAddr[mesh_.faceNeighbour()[facei]];
170 if ((own != -1) && (nbr == -1))
172 vector nf = Sf[facei]/magSf[facei];
174 if ((nf & axis) > tol)
176 area_[own] += magSf[facei];
180 else if ((own == -1) && (nbr != -1))
182 vector nf = Sf[facei]/magSf[facei];
184 if ((-nf & axis) > tol)
186 area_[nbr] += magSf[facei];
196 const polyPatch&
pp =
pbm[patchi];
197 const vectorField& Sfp = mesh_.Sf().boundaryField()[patchi];
198 const scalarField& magSfp = mesh_.magSf().boundaryField()[patchi];
204 const label facei =
pp.start() + j;
205 const label own = cellAddr[mesh_.faceOwner()[facei]];
206 const label nbr = nbrFaceCellAddr[facei - nInternalFaces];
207 const vector nf = Sfp[j]/magSfp[j];
209 if ((own != -1) && (nbr == -1) && ((nf & axis) > tol))
211 area_[own] += magSfp[j];
220 const label facei =
pp.start() + j;
221 const label own = cellAddr[mesh_.faceOwner()[facei]];
222 const vector nf = Sfp[j]/magSfp[j];
224 if ((own != -1) && ((nf & axis) > tol))
226 area_[own] += magSfp[j];
248 auto&
area = tarea.ref();
250 UIndirectList<scalar>(
area.primitiveFieldRef(), cells_) = area_;
253 <<
" writing field " << area.name() <<
endl;
267 geometryModeType gm =
268 geometryModeTypeNames_.get(
"geometryMode", coeffs_);
280 const label celli = cells_[i];
282 origin += V[celli]*
C[celli];
290 scalar magR = -GREAT;
293 const label celli = cells_[i];
294 vector test =
C[celli] - origin;
295 if (
mag(test) > magR)
307 const label celli = cells_[i];
308 vector dx2 =
C[celli] - origin;
309 if (
mag(dx2) > 0.5*magR)
312 if (
mag(axis) > SMALL)
324 vector dir = pointAbove - origin;
326 if ((dir & axis) < 0)
332 coeffs_.readEntry(
"refDirection", refDir);
336 setFaceArea(axis,
true);
342 coeffs_.readEntry(
"origin", origin);
343 coeffs_.readEntry(
"axis", axis);
344 coeffs_.readEntry(
"refDirection", refDir);
346 setFaceArea(axis,
false);
353 <<
"Unknown geometryMode " << geometryModeTypeNames_[gm]
354 <<
". Available geometry modes include "
355 << geometryModeTypeNames_
360 coordSys_ = coordSystem::cylindrical(origin, axis, refDir);
362 const scalar sumArea =
gSum(area_);
364 Info<<
" Rotor gometry:" <<
nl
365 <<
" - disk diameter = " << diameter <<
nl
366 <<
" - disk area = " << sumArea <<
nl
383 if (area_[i] > ROOTVSMALL)
386 x_[i] = coordSys_.localPosition(cc[i]);
389 rMax_ =
max(rMax_, x_[i].
x());
392 scalar
psi = x_[i].y();
396 flap_.beta0 - flap_.beta1c*
cos(
psi) - flap_.beta2s*
sin(
psi);
416 case ifSurfaceNormal:
424 return U.primitiveField();
444 const word& modelType,
455 inletVelocity_(
Zero),
458 x_(cells_.size(),
Zero),
459 Rcone_(cells_.size(),
I),
460 area_(cells_.size(),
Zero),
464 blade_(coeffs_.subDict(
"blade")),
465 profiles_(coeffs_.subDict(
"profiles"))
486 auto& force = tforce.ref();
489 coeffs_.readEntry(
"rhoRef", rhoRef_);
492 trim_->correct(Uin, force);
519 auto& force = tforce.ref();
522 trim_->correct(
rho, Uin, force);
523 calculate(
rho, Uin, trim_->thetag(), force);
539 coeffs_.readEntry(
"fields", fieldNames_);
543 omega_ =
rpmToRads(coeffs_.get<scalar>(
"rpm"));
545 coeffs_.readEntry(
"nBlades", nBlades_);
547 inletFlowTypeNames_.readEntry(
"inletFlowType", coeffs_, inletFlow_);
549 coeffs_.readEntry(
"tipEffect", tipEffect_);
551 const dictionary& flapCoeffs(coeffs_.subDict(
"flapCoeffs"));
552 flap_.beta0 =
degToRad(flapCoeffs.get<scalar>(
"beta0"));
553 flap_.beta1c =
degToRad(flapCoeffs.get<scalar>(
"beta1c"));
554 flap_.beta2s =
degToRad(flapCoeffs.get<scalar>(
"beta2s"));
558 createCoordinateSystem();
565 trim_->read(coeffs_);
569 writeField(
"thetag", trim_->thetag()(),
true);
570 writeField(
"faceArea", area_,
true);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
Graphite solid properties.
C() noexcept
Default construct.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
@ NO_REGISTER
Do not request registration (bool: false).
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
A List with indirect addressing. Like IndirectList but does not store addressing.
Vector< Cmpt > & normalise(const scalar tol=ROOTVSMALL)
Inplace normalise the vector by its magnitude.
const List< label > & profileID() const
Return const access to the profile ID list.
const List< word > & profileName() const
Return const access to the profile name list.
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,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect,...
A special matrix type and solver, designed for finite volume solutions of scalar equations....
const dimensionSet & dimensions() const noexcept
const GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0) const
Return psi.
Mesh data needed to do the Finite Volume discretisation.
Intermediate abstract class for handling cell-set options for the derived fvOptions.
scalar V() const noexcept
Return const access to the total cell volume.
labelList cells_
Set of cells to apply source to.
virtual bool read(const dictionary &dict)
Read source dictionary.
cellSetOption(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
static const Enum< selectionModeType > selectionModeTypeNames_
List of selection mode type names.
selectionModeType selectionMode() const noexcept
Return the cell selection mode.
Base abstract class for handling finite volume options (i.e. fvOption).
const word & name() const noexcept
Return const access to the source name.
const fvMesh & mesh_
Reference to the mesh database.
static autoPtr< option > New(const word &name, const dictionary &dict, const fvMesh &mesh)
Return a reference to the selected fvOption model.
wordList fieldNames_
Field names to apply source to - populated by derived models.
dictionary coeffs_
Dictionary containing source coefficients.
void resetApplied()
Resize/reset applied flag list for all fieldNames_ entries.
virtual void correct(volScalarField &field)
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
const word name_
Source name.
Applies cell-based momentum sources on velocity (i.e. U) within a specified cylindrical region to app...
scalar omega_
Rotational speed [rad/s].
rotorDiskSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
static const Enum< geometryModeType > geometryModeTypeNames_
Names for geometryModeType.
void calculate(const RhoFieldType &rho, const vectorField &U, const scalarField &thetag, vectorField &force, const bool divideVolume=true, const bool output=true) const
Calculate forces.
scalar rhoRef_
Reference density for incompressible case.
void setFaceArea(vector &axis, const bool correct)
Set the face areas per cell, and optionally correct the rotor axis.
void checkData()
Check data.
List< scalar > area_
Area [m2].
scalar tipEffect_
Tip effect [0-1].
inletFlowType inletFlow_
Inlet flow type.
void constructGeometry()
Construct geometry.
void writeField(const word &name, const List< Type > &values, const bool writeNow=false) const
Helper function to write rotor values.
coordSystem::cylindrical coordSys_
Rotor local cylindrical coordinate system (r-theta-z).
scalar rMax_
Maximum radius.
virtual bool read(const dictionary &dict)
Read source dictionary.
List< point > x_
Cell centre positions in local rotor frame.
bladeModel blade_
Blade data.
tmp< vectorField > inflowVelocity(const volVectorField &U) const
Return the inlet flow field.
void createCoordinateSystem()
Create the coordinate system.
flapData flap_
Blade flap coefficients [rad/s].
vector inletVelocity_
Inlet velocity for specified inflow.
inletFlowType
Options for the inlet flow type specification.
List< tensor > Rcone_
Rotation tensor for flap angle.
label nBlades_
Number of blades.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add explicit contribution to momentum equation.
autoPtr< trimModel > trim_
Trim model.
profileModelList profiles_
Profile data.
static const Enum< inletFlowType > inletFlowTypeNames_
Names for inletFlowType.
geometryModeType
Options for the geometry type specification.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
A patch is a list of labels that address the faces in the global face list.
void connectBlades(const List< word > &names, List< label > &addr) const
Set blade->profile addressing.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Base class for trim models for handling blade characteristics and thrust-torque relations.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const volScalarField & psi
#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;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))
constexpr scalar pi(M_PI)
Different types of constants.
Namespace for handling debugging switches.
const wordList area
Standard area field types (scalar, vector, tensor, etc).
Namespace for finite-volume.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Type gSum(const FieldField< Field, Type > &f)
GeometricField< vector, fvPatchField, volMesh > volVectorField
bool read(const char *buf, int32_t &val)
Same as readInt32.
List< label > labelList
A List of labels.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
UIndirectList< label > labelUIndList
UIndirectList of labels.
const dimensionSet dimArea(sqr(dimLength))
dimensionedScalar sin(const dimensionedScalar &ds)
messageStream Info
Information stream (stdout output on master, null elsewhere).
static const Identity< scalar > I
UIndirectList< point > pointUIndList
UIndirectList of point.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
label checkData(const objectRegistry &obr, const instantList &timeDirs, wordList &objectNames, const fileName &local=fileName::null)
Check if fields are good to use (available at all times).
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr scalar rpmToRads() noexcept
Multiplication factor for revolutions/minute to radians/sec.
constexpr scalar degToRad() noexcept
Multiplication factor for degrees to radians conversion.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const dimensionSet dimVolume(pow3(dimLength))
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
constexpr char nl
The newline '\n' character (0x0a).
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
#define forAll(list, i)
Loop across all elements in list.
Unit conversion functions.