40 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
41 GeometricField<Type, PatchField, GeoMesh>* variablesSet::allocateNamedField
45 const word& solverName
48 typedef GeometricField<Type, PatchField, GeoMesh> fieldType;
51 localIOdictionary
dict 65 dictionary& bField(
dict.subDict(
"boundaryField"));
69 for (entry& dEntry : bField)
73 dEntry.dict().add<word>(
"solverName",
solverName,
true);
83 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
84 bool variablesSet::readFieldOK
86 autoPtr<GeometricField<Type, PatchField, GeoMesh>>& fieldPtr,
89 const word& solverName,
90 const bool useSolverNameForFields
93 typedef GeometricField<Type, PatchField, GeoMesh> fieldType;
96 IOobject headerCustomName
99 mesh.time().timeName(),
105 IOobject headerBaseName
108 mesh.time().timeName(),
114 bool fieldFound(
false);
119 headerCustomName.typeHeaderOk<fieldType>(
false)
125 allocateNamedField<Type, PatchField, GeoMesh>
135 else if (headerBaseName.typeHeaderOk<fieldType>(
false))
139 allocateNamedField<Type, PatchField, GeoMesh>
150 Info<<
"Field " << customName <<
" not found" <<
endl;
151 Info<<
"Reading base field " << baseName <<
" and renaming ... " 153 fieldPtr.ref().rename(customName);
164 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
189 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
192 autoPtr<GeometricField<Type, PatchField, GeoMesh>>& p1,
193 autoPtr<GeometricField<Type, PatchField, GeoMesh>>& p2
212 GeometricField<Type, PatchField, GeoMesh> temp(
"temp", p1());
225 const word& baseName,
226 const word& solverName,
227 const bool useSolverNameForFields
247 <<
"Could not read field with custom (" 249 <<
"or base (" << baseName <<
") name" 259 const word& baseName,
260 const word& solverName,
261 const bool useSolverNameForFields
264 typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
266 autoPtr<VolFieldType> fieldPtr(
nullptr);
277 const word& solverName
282 typedef typename VolFieldType::Boundary Boundary;
285 const word baseName = baseField.
name();
290 baseField.
rename(customName);
312 mesh.time().timeName(),
319 if (headerCustomName.typeHeaderOk<VolFieldType>(
true))
321 Info<<
"Reading custom turbulence field " << customName
322 <<
" and replacing " << baseName <<
nl <<
endl;
323 VolFieldType customField(headerCustomName,
mesh);
332 Boundary& customBoundary = customField.boundaryFieldRef();
333 forAll(baseBoundary, patchI)
338 customBoundary[patchI].
clone(baseField.
ref())
345 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
348 GeometricField<Type, PatchField, GeoMesh>&
field 351 typedef GeometricField<Type, PatchField, GeoMesh> fieldType;
353 if (
field.nOldTimes())
Info<< "Creating field kinetic energy K\"<< endl;volScalarField K("K", 0.5 *magSqr(U));if(U.nOldTimes()){ volVectorField *Uold=&U.oldTime();volScalarField *Kold=&K.oldTime();*Kold==0.5 *magSqr(*Uold);while(Uold->nOldTimes()) { Uold=&Uold-> oldTime()
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word & name() const noexcept
Return the object name.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void nullifyField(GeometricField< Type, PatchField, GeoMesh > &fieldPtr)
Nullify field and old times, if present.
Generic GeometricField class.
Ignore writing from objectRegistry::writeObject()
#define forAll(list, i)
Loop across all elements in list.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
autoPtr< GeometricField< Type, PatchField, GeoMesh > > allocateRenamedField(const autoPtr< GeometricField< Type, PatchField, GeoMesh >> &bf)
void renameTurbulenceField(GeometricField< Type, fvPatchField, volMesh > &baseField, const word &solverName)
Turbulence model always reads fields with the prescribed name If a custom name is supplied...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
bool useSolverNameForFields() const
Append solver name to fields?
A class for handling words, derived from Foam::string.
const word & solverName() const
Return solver name.
#define DebugInfo
Report an information message using Foam::Info.
const Mesh & mesh() const noexcept
Return mesh.
virtual void rename(const word &newName)
Rename.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
Mesh data needed to do the Finite Volume discretisation.
Automatically write from objectRegistry::writeObject()
virtual autoPtr< variablesSet > clone() const
Clone the variablesSet.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
tmp< GeometricField< Type, fvPatchField, volMesh > > allocateField(const fvMesh &mesh, const word &baseName, const word &solverName, const bool useSolverNameForFields)
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
A class for managing temporary objects.
void swapAndRename(autoPtr< GeometricField< Type, PatchField, GeoMesh >> &p1, autoPtr< GeometricField< Type, PatchField, GeoMesh >> &p2)
Swap autoPtrs and rename managed fields.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Do not request registration (bool: false)
static void setField(autoPtr< GeometricField< Type, fvPatchField, volMesh >> &fieldPtr, const fvMesh &mesh, const word &baseName, const word &solverName, const bool useSolverNameForFields)
Read vol fields.
static constexpr const zero Zero
Global zero (0)