74 void Foam::fv::rotorDisk::readCoeffs(
const dictionary&
dict)
76 UName_ =
dict.lookupOrDefault<word>(
"U",
"U");
80 dict.lookup(
"nBlades") >> nBlades_;
82 inletFlow_ = inletFlowTypeNames_.read(
dict.lookup(
"inletFlowType"));
84 dict.lookup(
"tipEffect") >> tipEffect_;
86 const dictionary& flapCoeffs(
dict.typeDict(
"flap"));
88 flap_.beta1c = flapCoeffs.lookup<scalar>(
"beta1c",
units::degrees);
89 flap_.beta2s = flapCoeffs.lookup<scalar>(
"beta2s",
units::degrees);
92 createCoordinateSystem(
dict);
99 trim_->read(coeffs(
dict));
103 writeField(
"thetag", trim_->thetag()());
104 writeField(
"faceArea", area_);
108 if (
dict.found(
"rhoRef"))
110 dict.lookup(
"rhoRef") >> rhoRef_;
115 void Foam::fv::rotorDisk::checkData(
const dictionary&
dict)
118 profiles_.connectBlades
120 blade_.profileName(),
121 blade_.profileIndex()
127 dict.lookup(
"inletVelocity") >> inletVelocity_;
130 case inletFlowType::surfaceNormal:
134 dict.lookup<scalar>(
"inletNormalVelocity")
136 inletVelocity_ = -coordSys_.R().e3()*UIn;
139 case inletFlowType::local:
152 void Foam::fv::rotorDisk::setFaceArea(
vector& axis,
const bool correct)
156 static const scalar tol = 0.8;
167 UIndirectList<label>(cellAddr, zone_.zone()) =
169 labelList nbrFaceCellAddr(
mesh().nFaces() - nInternalFaces, -1);
172 const polyPatch& pp = pbm[
patchi];
178 label facei = pp.start() + i;
179 label nbrFacei = facei - nInternalFaces;
181 nbrFaceCellAddr[nbrFacei] = cellAddr[own];
190 for (
label facei = 0; facei < nInternalFaces; facei++)
195 if ((own != -1) && (nbr == -1))
197 vector nf = Sf[facei]/magSf[facei];
199 if ((nf & axis) > tol)
201 area_[own] += magSf[facei];
205 else if ((own == -1) && (nbr != -1))
207 vector nf = Sf[facei]/magSf[facei];
209 if ((-nf & axis) > tol)
211 area_[nbr] += magSf[facei];
221 const polyPatch& pp = pbm[
patchi];
229 const label facei = pp.start() + j;
231 const label nbr = nbrFaceCellAddr[facei - nInternalFaces];
232 const vector nf = Sfp[j]/magSfp[j];
234 if ((own != -1) && (nbr == -1) && ((nf & axis) > tol))
236 area_[own] += magSfp[j];
245 const label facei = pp.start() + j;
247 const vector nf = Sfp[j]/magSfp[j];
249 if ((own != -1) && ((nf & axis) > tol))
251 area_[own] += magSfp[j];
279 UIndirectList<scalar>(
area.primitiveField(), zone_.zone()) = area_;
282 <<
type() <<
": " <<
name() <<
" writing field " <<
area.name()
290 void Foam::fv::rotorDisk::createCoordinateSystem(
const dictionary&
dict)
297 geometryModeType gm =
298 geometryModeTypeNames_.read(
dict.lookup(
"geometryMode"));
302 case geometryModeType::automatic:
315 origin += V[celli]*
C[celli];
317 reduce(origin, sumOp<vector>());
318 reduce(sumV, sumOp<scalar>());
323 scalar magR = -great;
327 vector test =
C[celli] - origin;
328 if (
mag(test) > magR)
334 reduce(dx1, maxMagSqrOp<vector>());
341 vector dx2 =
C[celli] - origin;
342 if (
mag(dx2) > 0.5*magR)
345 if (
mag(axis) > small)
351 reduce(axis, maxMagSqrOp<vector>());
357 vector dir = pointAbove - origin;
359 if ((dir & axis) < 0)
365 dict.lookup(
"refDirection") >> refDir;
369 new cylindrical(axis, origin, UIndirectList<vector>(
C,
cells)())
374 setFaceArea(axis,
true);
378 case geometryModeType::specified:
380 dict.lookup(
"origin") >> origin;
381 dict.lookup(
"axis") >> axis;
382 dict.lookup(
"refDirection") >> refDir;
390 UIndirectList<vector>(
mesh().
C(), zone_.zone())()
394 setFaceArea(axis,
false);
401 coordinateSystems::cylindrical(
"rotorCoordSys", origin, axis, refDir);
403 const scalar sumArea =
gSum(area_);
406 <<
indent <<
" - disk diameter = " << diameter <<
nl
407 <<
indent <<
" - disk area = " << sumArea <<
nl
408 <<
indent <<
" - origin = " << coordSys_.origin() <<
nl
409 <<
indent <<
" - r-axis = " << coordSys_.R().e1() <<
nl
410 <<
indent <<
" - psi-axis = " << coordSys_.R().e2() <<
nl
411 <<
indent <<
" - z-axis = " << coordSys_.R().e3() <<
endl;
415 void Foam::fv::rotorDisk::constructGeometry()
423 if (area_[i] > rootVSmall)
428 x_[i] = coordSys_.localPosition(
C[celli]);
431 rMax_ =
max(rMax_, x_[i].
x());
434 scalar
psi = x_[i].y();
438 flap_.beta0 - flap_.beta1c*
cos(
psi) - flap_.beta2s*
sin(
psi);
442 scalar
c =
cos(beta);
443 scalar
s =
sin(beta);
445 invR_[i] = R_[i].T();
459 case inletFlowType::surfaceNormal:
461 return tmp<vectorField>
468 case inletFlowType::local:
470 return U.primitiveField();
490 const word& modelType,
501 inletVelocity_(
Zero),
504 x_(zone_.nCells(),
Zero),
505 R_(zone_.nCells(),
I),
506 invR_(zone_.nCells(),
I),
507 area_(zone_.nCells(),
Zero),
512 blade_(
dict.subDict(
"blade")),
513 profiles_(
dict.subDict(
"profiles")),
544 name() +
":rotorForce",
560 <<
"rhoRef not set, required for incompressible flow"
565 trim_->correct(Uin,
force);
589 name() +
":rotorForce",
625 zone_.topoChange(map);
637 zone_.distribute(map);
645 zone_.read(coeffs(
dict));
646 readCoeffs(coeffs(
dict));
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Initialise the NamedEnum HashTable from the static list of names.
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
A coordinate rotation specified using global axis.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Ostream & write(Ostream &os) const
Write.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
const dimensionSet & dimensions() const
Mesh data needed to do the Finite Volume discretisation.
const volVectorField & C() const
Return cell centres.
const DimensionedField< scalar, fvMesh > & V() const
Return cell volumes.
const surfaceVectorField & Sf() const
Return cell face area vectors.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
const polyMesh & poly() const
Return reference to polyMesh.
Finite volume model abstract base class.
static const dictionary & coeffs(const word &modelType, const dictionary &)
Return the coefficients sub-dictionary for a given model type.
virtual bool read(const dictionary &dict)
Read source dictionary.
Cell based momentum source which approximates the mean effects of rotor forces on a cylindrical regio...
virtual bool movePoints()
Update for mesh motion.
virtual void addSup(const volVectorField &U, fvMatrix< vector > &eqn) const
Source term to momentum equation.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
rotorDisk(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
static const NamedEnum< inletFlowType, 3 > inletFlowTypeNames_
static const NamedEnum< geometryModeType, 2 > geometryModeTypeNames_
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual ~rotorDisk()
Destructor.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
const polyBoundaryMesh & boundary() const
Return boundary mesh.
virtual const labelList & faceOwner() const
Return face owner.
virtual const labelList & faceNeighbour() const
Return face neighbour.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
label nInternalFaces() const
A class for managing temporary objects.
A class for handling words, derived from string.
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#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;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const volScalarField & psi
void correct(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiCorr, const SpType &Sp)
const dimensionedScalar c
Speed of light in a vacuum.
label calculate(const fvMesh &mesh, const labelHashSet &patchIDs, const scalar minFaceFraction, GeometricField< scalar, GeoMesh > &distance)
Calculate distance data from patches.
static const coefficient C("C", dimTemperature, 234.5)
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
VolField< vector > volVectorField
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
Tensor< scalar > tensor
Tensor of scalars.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
dimensionedScalar sin(const dimensionedScalar &ds)
IOstream & fixed(IOstream &io)
const dimensionSet & dimVolume
static const Identity< scalar > I
Type gSum(const UList< Type > &f, const label comm)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
addBackwardCompatibleToRunTimeSelectionTable(fvPatchScalarField, coupledTemperatureFvPatchScalarField, patchMapper, turbulentTemperatureCoupledBaffleMixed, "compressible::turbulentTemperatureCoupledBaffleMixed")
Vector< scalar > vector
A scalar version of the templated Vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
VolField< scalar > volScalarField
Field< vector > vectorField
Specialisation of Field<T> for vector.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
const dimensionSet & dimArea
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
Ostream & indent(Ostream &os)
Indent stream.
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.