Go to the documentation of this file.
70 int main(
int argc,
char *argv[])
74 "Reconstruct fields of a parallel case"
79 timeSelector::addOptions(
true,
true);
80 argList::noParallel();
82 argList::addBoolOption
85 "operate on all regions in regionProperties"
91 "specify a list of fields to be reconstructed. Eg, '(U T p)' - "
92 "regular expressions not currently supported"
98 "specify a list of lagrangian fields to be reconstructed. Eg, '(U d)' -"
99 "regular expressions not currently supported, "
100 "positions always included."
102 argList::addBoolOption
105 "skip reconstructing lagrangian positions and fields"
107 argList::addBoolOption
110 "skip reconstructing cellSets, faceSets, pointSets"
112 argList::addBoolOption
115 "only reconstruct new times (i.e. that do not exist already)"
131 Info<<
"Skipping reconstructing lagrangian positions and fields"
138 if (noReconstructSets)
140 Info<<
"Skipping reconstructing cellSets, faceSets and pointSets"
151 <<
"Cannot specify noLagrangian and lagrangianFields "
152 <<
"options together."
174 <<
"No processor* directories found"
188 Time::controlDictName,
199 databases[0].times(),
213 <<
"No times selected"
222 masterTimeDirs = runTime.times();
227 masterTimeDirSet.
insert(masterTimeDirs[i].
name());
234 databases[procI].setTime(runTime);
242 Info<<
"Reconstructing for all regions in regionProperties" <<
nl
250 if (
findIndex(regionNames, regions[i]) == -1)
252 regionNames.
append(regions[i]);
256 regionDirs = regionNames;
264 regionDirs = regionNames;
268 regionNames =
wordList(1, fvMesh::defaultRegion);
269 regionDirs =
wordList(1, word::null);
274 forAll(regionNames, regionI)
277 const word& regionDir = regionDirs[regionI];
285 && regionNames.
size() == 1
286 && regionDirs[0].empty()
291 <<
" since already have all times"
320 if (newTimes && masterTimeDirSet.
found(
timeDirs[timeI].name()))
329 runTime.setTime(
timeDirs[timeI], timeI);
336 databases[procI].setTime(
timeDirs[timeI], timeI);
342 fvMesh::readUpdateState procStat = procMeshes.readUpdate();
344 if (procStat == fvMesh::POINTS_MOVED)
348 procMeshes.reconstructPoints(
mesh);
350 else if (meshStat != procStat)
353 <<
"readUpdate for the reconstructed mesh:"
355 <<
"readUpdate for the processor meshes :"
357 <<
"These should be equal or your addressing"
358 <<
" might be incorrect."
359 <<
" Please check your time directories for any "
360 <<
"mesh directories." <<
endl;
367 procMeshes.meshes()[0],
368 databases[0].timeName()
373 Info<<
"Reconstructing FV fields" <<
nl <<
endl;
379 procMeshes.faceProcAddressing(),
380 procMeshes.cellProcAddressing(),
381 procMeshes.boundaryProcAddressing()
384 fvReconstructor.reconstructFvVolumeInternalFields<scalar>
389 fvReconstructor.reconstructFvVolumeInternalFields<
vector>
394 fvReconstructor.reconstructFvVolumeInternalFields
400 fvReconstructor.reconstructFvVolumeInternalFields<
symmTensor>
405 fvReconstructor.reconstructFvVolumeInternalFields<
tensor>
411 fvReconstructor.reconstructFvVolumeFields<scalar>
416 fvReconstructor.reconstructFvVolumeFields<
vector>
426 fvReconstructor.reconstructFvVolumeFields<
symmTensor>
431 fvReconstructor.reconstructFvVolumeFields<
tensor>
437 fvReconstructor.reconstructFvSurfaceFields<scalar>
442 fvReconstructor.reconstructFvSurfaceFields<
vector>
452 fvReconstructor.reconstructFvSurfaceFields<
symmTensor>
457 fvReconstructor.reconstructFvSurfaceFields<
tensor>
463 if (fvReconstructor.nReconstructed() == 0)
470 Info<<
"Reconstructing point fields" <<
nl <<
endl;
480 new pointMesh(procMeshes.meshes()[procI])
488 procMeshes.pointProcAddressing(),
489 procMeshes.boundaryProcAddressing()
492 pointReconstructor.reconstructFields<scalar>
497 pointReconstructor.reconstructFields<
vector>
507 pointReconstructor.reconstructFields<
symmTensor>
512 pointReconstructor.reconstructFields<
tensor>
518 if (pointReconstructor.nReconstructed() == 0)
542 databases[procI].timePath()
554 cloudObjects.
find(cloudDirs[i]);
556 if (iter == cloudObjects.end())
561 procMeshes.meshes()[procI],
562 databases[procI].timeName(),
563 cloud::prefix/cloudDirs[i]
567 sprayObjs.lookup(
word(
"positions"));
571 cloudObjects.
insert(cloudDirs[i], sprayObjs);
578 if (cloudObjects.
size())
591 Info<<
"Reconstructing lagrangian fields for cloud "
599 procMeshes.faceProcAddressing(),
600 procMeshes.cellProcAddressing()
602 reconstructLagrangianFields<label>
608 selectedLagrangianFields
610 reconstructLagrangianFieldFields<label>
616 selectedLagrangianFields
618 reconstructLagrangianFields<scalar>
624 selectedLagrangianFields
626 reconstructLagrangianFieldFields<scalar>
632 selectedLagrangianFields
634 reconstructLagrangianFields<vector>
640 selectedLagrangianFields
642 reconstructLagrangianFieldFields<vector>
648 selectedLagrangianFields
650 reconstructLagrangianFields<sphericalTensor>
656 selectedLagrangianFields
658 reconstructLagrangianFieldFields<sphericalTensor>
664 selectedLagrangianFields
666 reconstructLagrangianFields<symmTensor>
672 selectedLagrangianFields
674 reconstructLagrangianFieldFields<symmTensor>
680 selectedLagrangianFields
682 reconstructLagrangianFields<tensor>
688 selectedLagrangianFields
690 reconstructLagrangianFieldFields<tensor>
696 selectedLagrangianFields
707 if (!noReconstructSets)
714 forAll(procMeshes.meshes(), procI)
716 const fvMesh& procMesh = procMeshes.meshes()[procI];
726 polyMesh::meshSubDir/
"sets"
729 IOobjectList cSets(objects.lookupClass(cellSet::typeName));
735 IOobjectList fSets(objects.lookupClass(faceSet::typeName));
740 IOobjectList pSets(objects.lookupClass(pointSet::typeName));
752 Info<<
"Reconstructing sets:" <<
endl;
753 if (cSetNames.
size())
757 if (fSetNames.
size())
761 if (pSetNames.
size())
767 forAll(procMeshes.meshes(), procI)
769 const fvMesh& procMesh = procMeshes.meshes()[procI];
775 polyMesh::meshSubDir/
"sets"
780 procMeshes.cellProcAddressing()[procI];
782 IOobjectList cSets(objects.lookupClass(cellSet::typeName));
786 const cellSet procSet(*iter());
797 cSet.
instance() = runTime.timeName();
807 procMeshes.faceProcAddressing()[procI];
809 IOobjectList fSets(objects.lookupClass(faceSet::typeName));
813 const faceSet procSet(*iter());
824 fSet.
instance() = runTime.timeName();
833 procMeshes.pointProcAddressing()[procI];
835 IOobjectList pSets(objects.lookupClass(pointSet::typeName));
841 if (!pointSets.set(setI))
850 pSet.
instance() = runTime.timeName();
870 pointSets[i].write();
879 forAll(procMeshes.meshes(), procI)
881 const fvMesh& procMesh = procMeshes.meshes()[procI];
892 polyMesh::meshSubDir,
894 IOobject::READ_IF_PRESENT,
905 procMeshes.cellProcAddressing();
910 cellMaps.set(i, &cellAddr[i]);
914 procMeshes.pointProcAddressing();
919 pointMaps.set(i, &pointAddr[i]);
925 procRefs.set(i, &procData[i]);
934 polyMesh::meshSubDir,
952 runTime.setTime(
timeDirs[timeI], timeI);
953 databases[0].setTime(
timeDirs[timeI], timeI);
955 fileName uniformDir0 = databases[0].timePath()/
"uniform";
956 if (
isDir(uniformDir0))
958 cp(uniformDir0, runTime.timePath());
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
int main(int argc, char *argv[])
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
A class for handling words, derived from string.
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
A class for handling file names.
const PtrList< fvMesh > & meshes() const
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
label nReconstructed() const
Return number of fields reconstructed.
void reconstructFvSurfaceFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Read, reconstruct and write all/selected surface fields.
An STL-conforming const_iterator.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Container for processor mesh addressing.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< scalar > mag(const dimensioned< Type > &)
const fileName & instance() const
A HashTable with keys but without contents.
void reconstructPoints(fvMesh &)
Reconstruct point position after motion in parallel.
const fileName & rootPath() const
Return root path.
const PtrList< labelIOList > & boundaryProcAddressing() const
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
bool set(const Key &, const T &newElmt, bool protect)
Assign a new hashedEntry to a possibly already existing key.
List< word > wordList
A List of words.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
Point field reconstructor.
label nReconstructed() const
Return number of fields reconstructed.
bool set(const label) const
Is element set.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void append(const T &)
Append an element at the end of the list.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
const volScalarField & cp
Simple class to hold region information for coupled region simulations.
PtrList< labelIOList > & faceProcAddressing()
Various for reading/decomposing/reconstructing/distributing refinement data.
const PtrList< labelIOList > & cellProcAddressing() const
void reconstructFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Reconstruct and write all fields.
fileName path() const
Return the path to the caseName.
IOobject * lookup(const word &name) const
Lookup a given name and return IOobject ptr if found else NULL.
label size() const
Return number of elements in table.
bool found(const Key &) const
Return true if hashedEntry is found in table.
Mesh data needed to do the Finite Volume discretisation.
Mesh representing a set of points created from polyMesh.
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
A collection of cell labels.
IOobjectList lookupClass(const word &className) const
Return the list for all IOobjects of a given class.
bool haveAllTimes(const HashSet< word > &masterTimeDirSet, const instantList &timeDirs)
List< Key > sortedToc() const
Return the table of contents as a sorted list.
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
List of IOobjects with searching and retrieving facilities.
errorManipArg< error, int > exit(error &err, const int errNo=1)
fvMesh::readUpdateState readUpdate()
Update the meshes based on the mesh files saved in time directories.
Finite volume reconstructor for volume and surface fields.
const Key & key() const
Return the Key corresponding to the iterator.
void reconstructFvVolumeInternalFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Read, reconstruct and write all/selected volume internal fields.
static instantList timeDirs
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool set(const label) const
Is element set.
label size() const
Return the number of elements in the PtrList.
bool insert(const Key &key)
Insert a new entry.
const word cloudName(propsDict.lookup("cloudName"))
bool optionFound(const word &opt) const
Return true if the named option is found.
const PtrList< labelIOList > & pointProcAddressing() const
const Time & time() const
Return the top-level database.
const fileName & caseName() const
Return case name (parallel run) or global case (serial run)
void size(const label)
Override size to be inconsistent with allocated storage.
fileNameList readDir(const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true)
Read a directory and return the entries as a string list.
void reconstructFvVolumeFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Read, reconstruct and write all/selected volume fields.
Foam::argList args(argc, argv)
void reconstructLagrangianPositions(const polyMesh &mesh, const word &cloudName, const PtrList< fvMesh > &meshes, const PtrList< labelIOList > &faceProcAddressing, const PtrList< labelIOList > &cellProcAddressing)
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
#define WarningInFunction
Report a warning using Foam::Warning.
word name(const complex &)
Return a string representation of a complex.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.