46 template<>
const char*
56 template<>
const char*
71 void Foam::fv::rotorDiskSource::readCoeffs()
73 UName_ = coeffs().lookupOrDefault<
word>(
"U",
"U");
76 scalar rpm(coeffs().lookup<scalar>(
"rpm"));
79 coeffs().lookup(
"nBlades") >> nBlades_;
81 inletFlow_ = inletFlowTypeNames_.read(coeffs().
lookup(
"inletFlowType"));
83 coeffs().lookup(
"tipEffect") >> tipEffect_;
85 const dictionary& flapCoeffs(coeffs().subDict(
"flapCoeffs"));
86 flapCoeffs.
lookup(
"beta0") >> flap_.beta0;
87 flapCoeffs.
lookup(
"beta1c") >> flap_.beta1c;
88 flapCoeffs.
lookup(
"beta2s") >> flap_.beta2s;
90 flap_.beta1c =
degToRad(flap_.beta1c);
91 flap_.beta2s =
degToRad(flap_.beta2s);
94 createCoordinateSystem();
101 trim_->read(coeffs());
105 writeField(
"thetag", trim_->thetag()(),
true);
106 writeField(
"faceArea", area_,
true);
111 void Foam::fv::rotorDiskSource::checkData()
114 switch (set_.selectionMode())
121 profiles_.connectBlades(blade_.profileName(), blade_.profileID());
126 coeffs().lookup(
"inletVelocity") >> inletVelocity_;
129 case inletFlowType::surfaceNormal:
133 coeffs().lookup<scalar>(
"inletNormalVelocity")
135 inletVelocity_ = -coordSys_.R().e3()*UIn;
138 case inletFlowType::local:
153 <<
"Source cannot be used with '" 155 <<
"' mode. Please use one of: " <<
nl 168 void Foam::fv::rotorDiskSource::setFaceArea(
vector& axis,
const bool correct)
172 static const scalar tol = 0.8;
174 const label nInternalFaces =
mesh().nInternalFaces();
185 labelList nbrFaceCellAddr(
mesh().nFaces() - nInternalFaces, -1);
195 label nbrFacei = facei - nInternalFaces;
197 nbrFaceCellAddr[nbrFacei] = cellAddr[own];
206 for (
label facei = 0; facei < nInternalFaces; facei++)
208 const label own = cellAddr[
mesh().faceOwner()[facei]];
209 const label nbr = cellAddr[
mesh().faceNeighbour()[facei]];
211 if ((own != -1) && (nbr == -1))
213 vector nf = Sf[facei]/magSf[facei];
215 if ((nf & axis) > tol)
217 area_[own] += magSf[facei];
221 else if ((own == -1) && (nbr != -1))
223 vector nf = Sf[facei]/magSf[facei];
225 if ((-nf & axis) > tol)
227 area_[nbr] += magSf[facei];
246 const label own = cellAddr[
mesh().faceOwner()[facei]];
247 const label nbr = nbrFaceCellAddr[facei - nInternalFaces];
248 const vector nf = Sfp[j]/magSfp[j];
250 if ((own != -1) && (nbr == -1) && ((nf & axis) > tol))
252 area_[own] += magSfp[j];
262 const label own = cellAddr[
mesh().faceOwner()[facei]];
263 const vector nf = Sfp[j]/magSfp[j];
265 if ((own != -1) && ((nf & axis) > tol))
267 area_[own] += magSfp[j];
305 void Foam::fv::rotorDiskSource::createCoordinateSystem()
312 geometryModeType gm =
313 geometryModeTypeNames_.read(coeffs().
lookup(
"geometryMode"));
317 case geometryModeType::automatic:
328 const label celli = cells[i];
330 origin += V[celli]*C[celli];
338 scalar magR = -great;
341 const label celli = cells[i];
342 vector test = C[celli] - origin;
343 if (
mag(test) > magR)
355 const label celli = cells[i];
356 vector dx2 = C[celli] - origin;
357 if (
mag(dx2) > 0.5*magR)
360 if (
mag(axis) > small)
372 vector dir = pointAbove - origin;
374 if ((dir & axis) < 0)
380 coeffs().lookup(
"refDirection") >> refDir;
389 setFaceArea(axis,
true);
393 case geometryModeType::specified:
395 coeffs().lookup(
"origin") >> origin;
396 coeffs().lookup(
"axis") >> axis;
397 coeffs().lookup(
"refDirection") >> refDir;
409 setFaceArea(axis,
false);
424 const scalar sumArea =
gSum(area_);
426 Info<<
" Rotor geometry:" <<
nl 427 <<
" - disk diameter = " << diameter <<
nl 428 <<
" - disk area = " << sumArea <<
nl 429 <<
" - origin = " << coordSys_.origin() <<
nl 430 <<
" - r-axis = " << coordSys_.R().e1() <<
nl 431 <<
" - psi-axis = " << coordSys_.R().e2() <<
nl 432 <<
" - z-axis = " << coordSys_.R().e3() <<
endl;
436 void Foam::fv::rotorDiskSource::constructGeometry()
444 if (area_[i] > rootVSmall)
446 const label celli = cells[i];
449 x_[i] = coordSys_.localPosition(C[celli]);
452 rMax_ =
max(rMax_, x_[i].
x());
455 scalar
psi = x_[i].y();
459 flap_.beta0 - flap_.beta1c*
cos(psi) - flap_.beta2s*
sin(psi);
463 scalar
c =
cos(beta);
464 scalar
s =
sin(beta);
465 R_[i] =
tensor(c, 0, -s, 0, 1, 0, s, 0, c);
466 invR_[i] = R_[i].T();
480 case inletFlowType::surfaceNormal:
489 case inletFlowType::local:
511 const word& modelType,
516 fvModel(name, modelType, dict, mesh),
517 set_(coeffs(), mesh),
521 inletFlow_(inletFlowType::local),
522 inletVelocity_(
Zero),
525 x_(set_.cells().size(),
Zero),
526 R_(set_.cells().size(),
I),
527 invR_(set_.cells().size(),
I),
528 area_(set_.cells().size(),
Zero),
533 blade_(coeffs().subDict(
"blade")),
534 profiles_(coeffs().subDict(
"profiles")),
558 const word& fieldName
565 name() +
":rotorForce",
579 coeffs().lookup(
"rhoRef") >> rhoRef_;
582 trim_->correct(Uin, force);
588 if (
mesh().time().writeTime())
599 const word& fieldName
606 name() +
":rotorForce",
620 trim_->correct(rho, Uin, force);
621 calculate(rho, Uin, trim_->thetag(), force);
626 if (
mesh().time().writeTime())
635 set_.updateMesh(mpm);
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.
const dimensionSet dimArea
const word & name() const
Return name.
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.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
const GeometricField< Type, fvPatchField, volMesh > & psi() const
virtual bool read(const dictionary &dict)
Read source dictionary.
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.
Finite volume model abstract base class.
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.
Cylindrical coordinate system.
IOstream & fixed(IOstream &io)
Initialise the NamedEnum HashTable from the static list of names.
const dimensionedScalar c
Speed of light in a vacuum.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
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.
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))
stressControl lookup("compactNormalStress") >> compactNormalStress
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.
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(rho0+psi *p, rhoMin);# 1 "/home/ubuntu/OpenFOAM-9/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()
A local coordinate rotation.
static const word null
An empty word.
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.
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)
defineTypeNameAndDebug(combustionModel, 0)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
List< word > wordList
A List of words.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
virtual void updateMesh(const mapPolyMesh &)
Update for mesh changes.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing.
label start() const
Return start label of this patch in the polyMesh face list.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
const dimensionSet dimVolume
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
const volScalarField & psi
A coordinate rotation specified using global axis.
virtual bool write(const bool write=true) const
Write using setting from DB.
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
static const NamedEnum< selectionModeType, 4 > selectionModeTypeNames_
Word list of selection mode type names.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Tensor< scalar > tensor
Tensor of scalars.
static const Vector< scalar > zero
virtual void addSup(fvMatrix< vector > &eqn, const word &fieldName) const
Source term to momentum equation.
static const SphericalTensor I
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const dimensionSet & dimensions() const