39namespace functionObjects
49 Foam::functionObjects::setFlow::modeType
51Foam::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);
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();
313 mesh_.Sf().boundaryField();
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();
373 mesh_.Sf().boundaryField();
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))) = "
surfaceScalarField phic(mixture.cAlpha() *mag(alphaPhic/mesh.magSf()))
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Graphite solid properties.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
void size(const label n)
Older name for setAddressableSize.
Vector< Cmpt > & normalise(const scalar tol=ROOTVSMALL)
Inplace normalise the vector by its magnitude.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
Computes the magnitude of an input field.
Provides options to set the velocity and flux fields as a function of time.
virtual bool read(const dictionary &dict)
Read the setFlow data.
virtual bool execute()
Do nothing.
virtual bool write()
Calculate the setFlow and write.
refPtr< surfaceScalarField > setPhi()
Return cell face motion fluxes (or null)
wordList names() const
The unsorted names of all objects.
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
Type * getObjectPtr(const word &name, const bool recursive=false) const
virtual bool write(const bool valid=true) const
Write using setting from DB.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const volScalarField & Cp
autoPtr< surfaceVectorField > Uf
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Calculate the face-flux of the given field.
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField.
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)
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
void surfaceIntegrate(Field< Type > &ivf, const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
dimensionedScalar sin(const dimensionedScalar &ds)
const dimensionSet dimVelocity
messageStream Info
Information stream (stdout output on master, null elsewhere)
static const Identity< scalar > I
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Type gMax(const FieldField< Field, Type > &f)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.