40template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
45 const word& solverName
48 typedef GeometricField<Type, PatchField, GeoMesh> fieldType;
51 localIOdictionary
dict
69 for (entry& dEntry : bField)
73 dEntry.dict().add<word>(
"solverName",
solverName,
true);
83template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
84bool variablesSet::readFieldOK
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);
164template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
189template<
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())
345template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
352 if (
field.nOldTimes())
const Mesh & mesh() const noexcept
Return const reference to mesh.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Generic GeometricField class.
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef().
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
@ NO_REGISTER
Do not request registration (bool: false).
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (respects is_globalIOobject trait) and check its info. A void type suppresses trait and t...
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
T * ptr() noexcept
Same as release().
Mesh data needed to do the Finite Volume discretisation.
virtual void rename(const word &newName)
Rename.
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.
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,...
static void setField(autoPtr< GeometricField< Type, fvPatchField, volMesh > > &fieldPtr, const fvMesh &mesh, const word &baseName, const word &solverName, const bool useSolverNameForFields)
Read vol fields.
const word & solverName() const
Return solver name.
bool useSolverNameForFields() const
Append solver name to fields?
virtual autoPtr< variablesSet > clone() const
Clone the variablesSet.
tmp< GeometricField< Type, fvPatchField, volMesh > > allocateField(const fvMesh &mesh, const word &baseName, const word &solverName, const bool useSolverNameForFields)
static void nullifyField(GeometricField< Type, PatchField, GeoMesh > &fieldPtr)
Nullify field and old times, if present.
A class for handling words, derived from Foam::string.
Info<< "Creating field kinetic energy K\n"<< 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()
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInfo
Report an information message using Foam::Info.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
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...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.