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;
114 <<
"Source cannot be used with '" 115 << selectionModeTypeNames_[selectionMode()]
116 <<
"' mode. Please use one of: " <<
nl 117 << selectionModeTypeNames_[smCellSet] <<
nl 118 << selectionModeTypeNames_[smCellZone] <<
nl 119 << selectionModeTypeNames_[smAll]
130 static const scalar tol = 0.8;
132 const label nInternalFaces = mesh_.nInternalFaces();
142 labelList nbrFaceCellAddr(mesh_.nFaces() - nInternalFaces, -1);
152 label nbrFacei = facei - nInternalFaces;
153 label own = mesh_.faceOwner()[facei];
154 nbrFaceCellAddr[nbrFacei] = cellAddr[own];
163 for (
label facei = 0; facei < nInternalFaces; facei++)
165 const label own = cellAddr[mesh_.faceOwner()[facei]];
166 const label nbr = cellAddr[mesh_.faceNeighbour()[facei]];
168 if ((own != -1) && (nbr == -1))
170 vector nf = Sf[facei]/magSf[facei];
172 if ((nf & axis) > tol)
174 area_[own] += magSf[facei];
178 else if ((own == -1) && (nbr != -1))
180 vector nf = Sf[facei]/magSf[facei];
182 if ((-nf & axis) > tol)
184 area_[nbr] += magSf[facei];
203 const label own = cellAddr[mesh_.faceOwner()[facei]];
204 const label nbr = nbrFaceCellAddr[facei - nInternalFaces];
205 const vector nf = Sfp[j]/magSfp[j];
207 if ((own != -1) && (nbr == -1) && ((nf & axis) > tol))
209 area_[own] += magSfp[j];
219 const label own = cellAddr[mesh_.faceOwner()[facei]];
220 const vector nf = Sfp[j]/magSfp[j];
222 if ((own != -1) && ((nf & axis) > tol))
224 area_[own] += magSfp[j];
244 mesh_.time().timeName(),
254 Info<<
type() <<
": " << name_ <<
" writing field " << area.name()
270 geometryModeTypeNames_.read(coeffs_.lookup(
"geometryMode"));
282 const label celli = cells_[i];
284 origin += V[celli]*C[celli];
292 scalar magR = -GREAT;
295 const label celli = cells_[i];
296 vector test = C[celli] - origin;
297 if (
mag(test) > magR)
309 const label celli = cells_[i];
310 vector dx2 = C[celli] - origin;
311 if (
mag(dx2) > 0.5*magR)
314 if (
mag(axis) > SMALL)
325 vector pointAbove(coeffs_.lookup(
"pointAbove"));
326 vector dir = pointAbove - origin;
328 if ((dir & axis) < 0)
334 coeffs_.lookup(
"refDirection") >> refDir;
349 setFaceArea(axis,
true);
355 coeffs_.lookup(
"origin") >> origin;
356 coeffs_.lookup(
"axis") >> axis;
357 coeffs_.lookup(
"refDirection") >> refDir;
370 setFaceArea(axis,
false);
377 <<
"Unknown geometryMode " << geometryModeTypeNames_[gm]
378 <<
". Available geometry modes include " 383 coordSys_ =
cylindricalCS(
"rotorCoordSys", origin, axis, refDir,
false);
385 const scalar sumArea =
gSum(area_);
387 Info<<
" Rotor gometry:" <<
nl 388 <<
" - disk diameter = " << diameter <<
nl 389 <<
" - disk area = " << sumArea <<
nl 390 <<
" - origin = " << coordSys_.origin() <<
nl 391 <<
" - r-axis = " << coordSys_.R().e1() <<
nl 392 <<
" - psi-axis = " << coordSys_.R().e2() <<
nl 393 <<
" - z-axis = " << coordSys_.R().e3() <<
endl;
403 if (area_[i] > ROOTVSMALL)
405 const label celli = cells_[i];
408 x_[i] = coordSys_.localPosition(C[celli]);
411 rMax_ =
max(rMax_, x_[i].
x());
414 scalar
psi = x_[i].y();
418 flap_.beta0 - flap_.beta1c*
cos(psi) - flap_.beta2s*
sin(psi);
422 scalar
c =
cos(beta);
423 scalar
s =
sin(beta);
424 R_[i] =
tensor(c, 0, -s, 0, 1, 0, s, 0, c);
425 invR_[i] = R_[i].T();
439 case ifSurfaceNormal:
470 const word& modelType,
481 inletVelocity_(
Zero),
484 x_(cells_.size(),
Zero),
485 R_(cells_.size(),
I),
486 invR_(cells_.size(),
I),
487 area_(cells_.size(), 0.0),
492 blade_(coeffs_.subDict(
"blade")),
493 profiles_(coeffs_.subDict(
"profiles"))
517 name_ +
":rotorForce",
518 mesh_.time().timeName(),
531 coeffs_.lookup(
"rhoRef") >> rhoRef_;
534 trim_->correct(Uin, force);
540 if (mesh_.time().writeTime())
558 name_ +
":rotorForce",
559 mesh_.time().timeName(),
572 trim_->correct(rho, Uin, force);
573 calculate(rho, Uin, trim_->thetag(), force);
578 if (mesh_.time().writeTime())
589 coeffs_.lookup(
"fields") >> fieldNames_;
590 applied_.setSize(fieldNames_.size(),
false);
593 scalar rpm(
readScalar(coeffs_.lookup(
"rpm")));
596 coeffs_.lookup(
"nBlades") >> nBlades_;
598 inletFlow_ = inletFlowTypeNames_.read(coeffs_.lookup(
"inletFlowType"));
600 coeffs_.lookup(
"tipEffect") >> tipEffect_;
602 const dictionary& flapCoeffs(coeffs_.subDict(
"flapCoeffs"));
603 flapCoeffs.
lookup(
"beta0") >> flap_.beta0;
604 flapCoeffs.lookup(
"beta1c") >> flap_.beta1c;
605 flapCoeffs.lookup(
"beta2s") >> flap_.beta2s;
606 flap_.beta0 =
degToRad(flap_.beta0);
607 flap_.beta1c =
degToRad(flap_.beta1c);
608 flap_.beta2s =
degToRad(flap_.beta2s);
612 createCoordinateSystem();
619 trim_->read(coeffs_);
623 writeField(
"thetag", trim_->thetag()(),
true);
624 writeField(
"faceArea", area_,
true);
static autoPtr< trimModel > New(const fv::rotorDiskSource &rotor, const dictionary &dict)
Return a reference to the selected trim model.
Graphite solid properties.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
static const NamedEnum< inletFlowType, 3 > inletFlowTypeNames_
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const GeometricField< Type, fvPatchField, volMesh > & psi() const
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual ~rotorDiskSource()
Destructor.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Macros for easy insertion into run-time selection tables.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
rotorDiskSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
void constructGeometry()
Construct geometry.
const dimensionSet dimVolume(pow3(dimLength))
Cylindrical coordinate system.
bool read(const char *, int32_t &)
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))
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...
Type gSum(const FieldField< Field, Type > &f)
dimensionedScalar cos(const dimensionedScalar &ds)
static const Identity< scalar > I
A class for handling words, derived from string.
A local coordinate rotation.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
errorManip< error > abort(error &err)
const scalar twoPi(2 *pi)
static const NamedEnum< geometryModeType, 2 > geometryModeTypeNames_
dimensionedScalar sin(const dimensionedScalar &ds)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Source term to momentum equation.
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(psi *p+alphal *rhol0+((alphav *psiv+alphal *psil) - psi) *pSat, rhoMin);# 1 "/home/ubuntu/OpenFOAM-5.0/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H" 1{ alphav=max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0));alphal=1.0 - alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
defineTypeNameAndDebug(combustionModel, 0)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
void checkData()
Check data.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing.
const dimensionedScalar c
Speed of light in a vacuum.
label start() const
Return start label of this patch in the polyMesh face list.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
Cell-set options abtract base class. Provides a base set of controls, e.g.:
const volScalarField & psi
virtual Ostream & write(const token &)=0
Write next token to stream.
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.
A patch is a list of labels that address the faces in the global face list.
virtual bool write(const bool valid=true) const
Write using setting from DB.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void createCoordinateSystem()
Create the co-ordinate system.
Tensor< scalar > tensor
Tensor of scalars.
tmp< vectorField > inflowVelocity(const volVectorField &U) const
Return the inlet flow field.
const dimensionSet dimArea(sqr(dimLength))
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const dimensionSet & dimensions() const