45 "p { name P; Label \"Pressure\"; units \"Pa\"; }"
50 "rho { name DENS; Label \"Density\"; units \"kg/m3\"; }"
51 "T { name T; Label \"Temperature\"; units \"K\"; }"
52 "k { name TE; Label \"Turb Kinetic Energy\"; units \"m2/s2\"; }"
53 "epsilon { name ED; Label \"Dissipation Rate\"; units \"m2/s3\"; }"
54 "mu { name LAMV; Label \"Molecular Viscosity\"; units \"Pa s\"; }"
55 "mut { name VIS; Label \"Turbulent Viscosity\"; units \"Pa s\"; }"
57 "U { name ALL; Label \"Velocity\"; units \"m/s\"; }"
59 "_0U { name SU; Label \"Velocity Component U\"; units \"m/s\"; }"
60 "_1U { name SV; Label \"Velocity Component V\"; units \"m/s\"; }"
61 "_2U { name SW; Label \"Velocity Component W\"; units \"m/s\"; }"
63 "phi { name MassFlux; Label \"Mass Flux\"; units \"kg/s\"; }"
70bool Foam::ccm::writer::newFieldNode
72 const ccmID& phaseNode,
73 const word& fieldName,
75 const ccmDimension& dims,
79 const dictionary* subDictPtr = nameMapping.findDict(fieldName);
89 if (!
dict.readIfPresent(
"name", shortName))
94 string ccmLabel(fieldName);
95 dict.readIfPresent(
"Label", ccmLabel);
109 if (dims() == kCCMIOScalar &&
dict.readIfPresent(
"units", units))
138 <<
"cannot write solutions with a polyMesh instead of a fvMesh"
145 if (remappingDictName.empty())
152 mesh_.time().constant(),
163 remapDict =
dictionary(IFstream(remappingDictName)());
174 nameMapping |= *subDictPtr;
178 ccmID stateNode, processorNode, nodeId;
184 &(globalState_->error),
185 (globalState_->root),
191 assertNoError(
"could not create default state");
210 &(globalState_->error),
216 assertNoError(
"could not create processor node");
222 nullptr, stateNode, processorNode,
235 ccmID verticesNode, topoNode;
238 &(globalState_->error),
239 (globalState_->root),
247 &(globalState_->error),
248 (globalState_->root),
254 string topoFileName = defaultMeshName +
".ccmg";
258 &(globalState_->error),
260 topoFileName.c_str(), &verticesNode,
261 topoFileName.c_str(), &topoNode,
266 assertNoError(
"Error after writing geometry processor");
270 &(globalState_->error),
271 (globalState_->root),
277 assertNoError(
"could not create Restart_1 state");
296 &(globalState_->error),
302 assertNoError(
"could not create 'Processor' node");
308 nullptr, stateNode, processorNode,
317 ccmID phaseNode, fieldSetNode;
326 (globalState_->root),
336 &(globalState_->error),
337 (globalState_->root),
342 assertNoError(
"could not create FieldSet node");
347 ccmID restartInfoNode, restartDataNode;
350 &(globalState_->error),
356 assertNoError(
"could not create restartInfoNode node");
359 const Time&
runTime = mesh_.time();
378 if (
io.typeHeaderOk<IOdictionary>(
true))
384 CCMIOWriteRestartInfo
386 &(globalState_->error),
398 &(globalState_->error),
404 assertNoError(
"could not create restartDataNode node");
418 CCMIONewIndexedEntity
420 &(globalState_->error),
434 "Material Specific Heat",
442 "Material Molecular Weight",
447 CCMIONewIndexedEntity
449 &(globalState_->error),
459 const IOobject&
io = *iter.val();
461 const word fieldName =
io.name();
462 const word fieldType =
io.headerClassName();
464 if (!nameMapping.found(fieldName))
478 mesh_.time().timeName(),
509 &(globalState_->error),
518 &(globalState_->error),
524 field.primitiveField().begin()
529 assertNoError(
"writing internalField " + fieldName);
536 &(globalState_->error),
545 &(globalState_->error),
547 maps_->boundary[patchI],
551 field.boundaryField()[patchI].begin()
558 assertNoError(
"writing boundaryField " + fieldName);
569 mesh_.time().timeName(),
589 for (
direction cmpt=0; cmpt < pTraits<vector>::nComponents; ++cmpt)
591 word componentName(
"_" +
Foam::name(cmpt) + fieldName);
594 CCMIOComponent ccmComponent = kCCMIOVectorX;
598 ccmComponent = kCCMIOVectorX;
601 ccmComponent = kCCMIOVectorY;
604 ccmComponent = kCCMIOVectorZ;
625 CCMIOWriteMultiDimensionalFieldData
627 &(globalState_->error),
636 &(globalState_->error),
645 &(globalState_->error),
651 field.primitiveField().begin()
653 kCCMIOStart, kCCMIOEnd
657 "writing internalField " + fieldName +
" " + componentName
666 &(globalState_->error),
675 &(globalState_->error),
677 maps_->boundary[patchI],
681 field.boundaryField()[patchI].begin()
683 kCCMIOStart, kCCMIOEnd
689 "writing boundaryField " + fieldName +
" " + componentName
704 mesh_.time().timeName(),
735 &(globalState_->error),
744 &(globalState_->error),
746 maps_->internalFaces,
750 field.primitiveField().cdata()
755 assertNoError(
"writing internalField " + fieldName);
762 &(globalState_->error),
771 &(globalState_->error),
773 maps_->boundary[patchI],
777 field.boundaryField()[patchI].cdata()
784 assertNoError(
"writing boundaryField " + fieldName);
790 assertNoError(
"Error before writing processor");
794 &(globalState_->error),
799 nullptr, &fieldSetNode
801 assertNoError(
"Error after writing processor");
Input/output from string buffers.
Internal bits for wrapping libccmio - do not use directly.
static const char *const typeName
Typename for Field.
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable,...
@ NO_REGISTER
Do not request registration (bool: false).
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
std::unique_ptr< ccmGlobalState > globalState_
Maintain overall global states (error, root-node).
static bool assertNoError(int err, const char *msg)
Die with msg if there is an error.
FOAM_DLL_EXPORT void writeSolution(const IOobjectList &objects, const fileName &remappingDictName=fileName::null)
Write the solutions.
static FOAM_DLL_EXPORT string defaultMeshName
The name for the topology file reference.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and it is a dictionary) otherwise return nullptr...
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect,...
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
A class for handling file names.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
A class for handling words, derived from Foam::string.
const polyBoundaryMesh & patches
#define WarningInFunction
Report a warning using Foam::Warning.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
GeometricField< vector, fvPatchField, volMesh > volVectorField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Ostream & flush(Ostream &os)
Flush stream.
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.