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" },
62void Foam::functionObjects::setFlow::setPhi(
const volVectorField&
U)
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_);
158 scalePtr_ = Function1<scalar>::New(
"scale",
dict, &mesh_);
162 case modeType::FUNCTION:
164 velocityPtr_ = Function1<vector>::New(
"velocity",
dict, &mesh_);
167 case modeType::ROTATION:
169 omegaPtr_ = Function1<scalar>::New(
"omega",
dict, &mesh_);
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:
248 const scalar omega = omegaPtr_->value(t);
273 U.correctBoundaryConditions();
278 case modeType::VORTEX2D:
302 U.correctBoundaryConditions();
306 const vectorField Cf(mesh_.Cf().primitiveField() - origin_);
316 const vectorField& Sfc = mesh_.Sf().primitiveField();
321 mesh_.Sf().boundaryField();
323 mesh_.Cf().boundaryField();
342 case modeType::VORTEX3D:
367 U.correctBoundaryConditions();
371 const vectorField Cf(mesh_.Cf().primitiveField() - origin_);
381 const vectorField& Sfc = mesh_.Sf().primitiveField();
386 mesh_.Sf().boundaryField();
388 mesh_.Cf().boundaryField();
409 if (t > reverseTime_)
411 Log <<
" flow direction: reverse" <<
nl;
417 const scalar
s = scalePtr_->value(t);
421 U.correctBoundaryConditions();
424 Log <<
" Continuity error: max(mag(sum(phi))) = "
static const Foam::dimensionedScalar C("", Foam::dimTemperature, 234.5)
constexpr scalar pi(M_PI)
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...
static int localBoundaryConsistency() noexcept
Get flag for local boundary consistency checks.
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.
GeometricBoundaryField< vector, fvPatchField, volMesh > Boundary
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
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.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
const fvMesh & mesh_
Reference to the fvMesh.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Provides options to set the velocity and flux fields as a function of time.
setFlow(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
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)
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
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)
GeometricField< vector, fvPatchField, volMesh > volVectorField
bool read(const char *buf, int32_t &val)
Same as readInt32.
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
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Type gMax(const FieldField< Field, Type > &f)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.