Go to the documentation of this file.
39 namespace functionObjects
49 Foam::functionObjects::setFlow::modeType
51 Foam::functionObjects::setFlow::modeTypeNames
53 { functionObjects::setFlow::modeType::FUNCTION,
"function" },
54 { functionObjects::setFlow::modeType::ROTATION,
"rotation" },
55 { functionObjects::setFlow::modeType::VORTEX2D,
"vortex2D" },
56 { functionObjects::setFlow::modeType::VORTEX3D,
"vortex3D" },
72 if (rhoName_ !=
"none")
85 <<
"Unable to find rho field'" << rhoName_
86 <<
"' in the mesh database. Available fields are:"
108 mode_(modeType::FUNCTION),
112 reverseTime_(VGREAT),
117 velocityPtr_(
nullptr)
131 modeTypeNames.readEntry(
"mode",
dict, mode_);
133 Info<<
" operating mode: " << modeTypeNames[mode_] <<
endl;
135 if (
dict.readIfPresent(
"U", UName_))
137 Info<<
" U field name: " << UName_ <<
endl;
140 if (
dict.readIfPresent(
"rho", rhoName_))
142 Info<<
" rho field name: " << rhoName_ <<
endl;
145 if (
dict.readIfPresent(
"phi", phiName_))
147 Info<<
" phi field name: " << phiName_ <<
endl;
150 if (
dict.readIfPresent(
"reverseTime", reverseTime_))
152 Info<<
" reverse flow direction at time: " << reverseTime_
154 reverseTime_ = mesh_.time().userTimeToTime(reverseTime_);
162 case modeType::FUNCTION:
167 case modeType::ROTATION:
171 dict.readEntry(
"origin", origin_);
175 R_ =
tensor(refDir, axis, refDir^axis);
178 case modeType::VORTEX2D:
179 case modeType::VORTEX3D:
181 dict.readEntry(
"origin", origin_);
185 R_ =
tensor(refDir, axis, refDir^axis);
209 if (!Uptr || !phiptr)
211 Info<<
" Either field " << UName_ <<
" or " << phiName_
212 <<
" not found in the mesh database" <<
nl;
217 const scalar t = mesh_.time().timeOutputValue();
219 Log <<
" setting " << UName_ <<
" and " << phiName_ <<
nl;
226 case modeType::FUNCTION:
228 const vector Uc = velocityPtr_->value(t);
230 U.correctBoundaryConditions();
235 case modeType::ROTATION:
246 const scalar omega = omegaPtr_->value(t);
252 volVectorField::Boundary& Ubf =
U.boundaryFieldRef();
269 U.correctBoundaryConditions();
274 case modeType::VORTEX2D:
294 U.correctBoundaryConditions();
298 const vectorField Cf(mesh_.Cf().primitiveField() - origin_);
308 const vectorField& Sfc = mesh_.Sf().primitiveField();
311 surfaceScalarField::Boundary& phibf =
phi.boundaryFieldRef();
312 const surfaceVectorField::Boundary& Sfbf =
313 mesh_.Sf().boundaryField();
314 const surfaceVectorField::Boundary& Cfbf =
315 mesh_.Cf().boundaryField();
334 case modeType::VORTEX3D:
354 U.correctBoundaryConditions();
358 const vectorField Cf(mesh_.Cf().primitiveField() - origin_);
368 const vectorField& Sfc = mesh_.Sf().primitiveField();
371 surfaceScalarField::Boundary& phibf =
phi.boundaryFieldRef();
372 const surfaceVectorField::Boundary& Sfbf =
373 mesh_.Sf().boundaryField();
374 const surfaceVectorField::Boundary& Cfbf =
375 mesh_.Cf().boundaryField();
396 if (t > reverseTime_)
398 Log <<
" flow direction: reverse" <<
nl;
404 const scalar
s = scalePtr_->value(t);
408 U.correctBoundaryConditions();
411 Log <<
" Continuity error: max(mag(sum(phi))) = "
virtual bool read(const dictionary &dict)
Read the setFlow data.
Type * getObjectPtr(const word &name, const bool recursive=false) const
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
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))
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
static constexpr const zero Zero
Global zero (0)
const dimensionSet dimVelocity
dimensionedScalar sin(const dimensionedScalar &ds)
bool read(const char *buf, int32_t &val)
Same as readInt32.
setFlow(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
autoPtr< surfaceVectorField > Uf
Ostream & endl(Ostream &os)
Add newline and flush stream.
Vector< Cmpt > & normalise()
Normalise the vector by its magnitude.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
#define forAll(list, i)
Loop across all elements in list.
surfaceScalarField phic(mixture.cAlpha() *mag(alphaPhic/mesh.magSf()))
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
virtual bool execute()
Do nothing.
virtual bool write()
Calculate the setFlow and write.
messageStream Info
Information stream (stdout output on master, null elsewhere)
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual bool read(const dictionary &dict)
Read optional controls.
Macros for easy insertion into run-time selection tables.
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
GeometricField< vector, fvPatchField, volMesh > volVectorField
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
constexpr scalar pi(M_PI)
wordList names() const
The names of all objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
void surfaceIntegrate(Field< Type > &ivf, const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Calculate the face-flux of the given field.
const fvMesh & mesh_
Reference to the fvMesh.
const volScalarField & Cp
defineTypeNameAndDebug(ObukhovLength, 0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Graphite solid properties.
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
Type gMax(const FieldField< Field, Type > &f)