reconstructPar.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Application
25  reconstructPar
26 
27 Description
28  Reconstructs fields of a case that is decomposed for parallel
29  execution of OpenFOAM.
30 
31 \*---------------------------------------------------------------------------*/
32 
33 #include "argList.H"
34 #include "timeSelector.H"
35 
36 #include "fvCFD.H"
37 #include "IOobjectList.H"
38 #include "processorMeshes.H"
39 #include "regionProperties.H"
40 #include "fvFieldReconstructor.H"
42 #include "reconstructLagrangian.H"
43 
44 #include "cellSet.H"
45 #include "faceSet.H"
46 #include "pointSet.H"
47 
48 #include "hexRef8Data.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 bool haveAllTimes
53 (
54  const HashSet<word>& masterTimeDirSet,
55  const instantList& timeDirs
56 )
57 {
58  // Loop over all times
59  forAll(timeDirs, timeI)
60  {
61  if (!masterTimeDirSet.found(timeDirs[timeI].name()))
62  {
63  return false;
64  }
65  }
66  return true;
67 }
68 
69 
70 int main(int argc, char *argv[])
71 {
72  argList::addNote
73  (
74  "Reconstruct fields of a parallel case"
75  );
76 
77  // Enable -constant ... if someone really wants it
78  // Enable -withZero to prevent accidentally trashing the initial fields
79  timeSelector::addOptions(true, true);
80  argList::noParallel();
81  #include "addRegionOption.H"
82  argList::addBoolOption
83  (
84  "allRegions",
85  "operate on all regions in regionProperties"
86  );
87  argList::addOption
88  (
89  "fields",
90  "list",
91  "specify a list of fields to be reconstructed. Eg, '(U T p)' - "
92  "regular expressions not currently supported"
93  );
94  argList::addOption
95  (
96  "lagrangianFields",
97  "list",
98  "specify a list of lagrangian fields to be reconstructed. Eg, '(U d)' -"
99  "regular expressions not currently supported, "
100  "positions always included."
101  );
102  argList::addBoolOption
103  (
104  "noLagrangian",
105  "skip reconstructing lagrangian positions and fields"
106  );
107  argList::addBoolOption
108  (
109  "noSets",
110  "skip reconstructing cellSets, faceSets, pointSets"
111  );
112  argList::addBoolOption
113  (
114  "newTimes",
115  "only reconstruct new times (i.e. that do not exist already)"
116  );
117 
118  #include "setRootCase.H"
119  #include "createTime.H"
120 
121  HashSet<word> selectedFields;
122  if (args.optionFound("fields"))
123  {
124  args.optionLookup("fields")() >> selectedFields;
125  }
126 
127  const bool noLagrangian = args.optionFound("noLagrangian");
128 
129  if (noLagrangian)
130  {
131  Info<< "Skipping reconstructing lagrangian positions and fields"
132  << nl << endl;
133  }
134 
135 
136  const bool noReconstructSets = args.optionFound("noSets");
137 
138  if (noReconstructSets)
139  {
140  Info<< "Skipping reconstructing cellSets, faceSets and pointSets"
141  << nl << endl;
142  }
143 
144 
145  HashSet<word> selectedLagrangianFields;
146  if (args.optionFound("lagrangianFields"))
147  {
148  if (noLagrangian)
149  {
151  << "Cannot specify noLagrangian and lagrangianFields "
152  << "options together."
153  << exit(FatalError);
154  }
155 
156  args.optionLookup("lagrangianFields")() >> selectedLagrangianFields;
157  }
158 
159 
160  const bool newTimes = args.optionFound("newTimes");
161  const bool allRegions = args.optionFound("allRegions");
162 
163 
164  // determine the processor count directly
165  label nProcs = 0;
166  while (isDir(args.path()/(word("processor") + name(nProcs))))
167  {
168  ++nProcs;
169  }
170 
171  if (!nProcs)
172  {
174  << "No processor* directories found"
175  << exit(FatalError);
176  }
177 
178  // Create the processor databases
179  PtrList<Time> databases(nProcs);
180 
181  forAll(databases, procI)
182  {
183  databases.set
184  (
185  procI,
186  new Time
187  (
188  Time::controlDictName,
189  args.rootPath(),
190  args.caseName()/fileName(word("processor") + name(procI))
191  )
192  );
193  }
194 
195  // Use the times list from the master processor
196  // and select a subset based on the command-line options
197  instantList timeDirs = timeSelector::select
198  (
199  databases[0].times(),
200  args
201  );
202 
203  // Note that we do not set the runTime time so it is still the
204  // one set through the controlDict. The -time option
205  // only affects the selected set of times from processor0.
206  // - can be illogical
207  // + any point motion handled through mesh.readUpdate
208 
209 
210  if (timeDirs.empty())
211  {
213  << "No times selected"
214  << exit(FatalError);
215  }
216 
217 
218  // Get current times if -newTimes
219  instantList masterTimeDirs;
220  if (newTimes)
221  {
222  masterTimeDirs = runTime.times();
223  }
224  HashSet<word> masterTimeDirSet(2*masterTimeDirs.size());
225  forAll(masterTimeDirs, i)
226  {
227  masterTimeDirSet.insert(masterTimeDirs[i].name());
228  }
229 
230 
231  // Set all times on processor meshes equal to reconstructed mesh
232  forAll(databases, procI)
233  {
234  databases[procI].setTime(runTime);
235  }
236 
237 
238  wordList regionNames;
239  wordList regionDirs;
240  if (allRegions)
241  {
242  Info<< "Reconstructing for all regions in regionProperties" << nl
243  << endl;
244  regionProperties rp(runTime);
246  {
247  const wordList& regions = iter();
248  forAll(regions, i)
249  {
250  if (findIndex(regionNames, regions[i]) == -1)
251  {
252  regionNames.append(regions[i]);
253  }
254  }
255  }
256  regionDirs = regionNames;
257  }
258  else
259  {
261  if (args.optionReadIfPresent("region", regionName))
262  {
263  regionNames = wordList(1, regionName);
264  regionDirs = regionNames;
265  }
266  else
267  {
268  regionNames = wordList(1, fvMesh::defaultRegion);
269  regionDirs = wordList(1, word::null);
270  }
271  }
272 
273 
274  forAll(regionNames, regionI)
275  {
276  const word& regionName = regionNames[regionI];
277  const word& regionDir = regionDirs[regionI];
278 
279  Info<< "\n\nReconstructing fields for mesh " << regionName << nl
280  << endl;
281 
282  if
283  (
284  newTimes
285  && regionNames.size() == 1
286  && regionDirs[0].empty()
287  && haveAllTimes(masterTimeDirSet, timeDirs)
288  )
289  {
290  Info<< "Skipping region " << regionName
291  << " since already have all times"
292  << endl << endl;
293  continue;
294  }
295 
296 
297  fvMesh mesh
298  (
299  IOobject
300  (
301  regionName,
302  runTime.timeName(),
303  runTime,
305  )
306  );
307 
308 
309  // Read all meshes and addressing to reconstructed mesh
310  processorMeshes procMeshes(databases, regionName);
311 
312 
313  // Check face addressing for meshes that have been decomposed
314  // with a very old foam version
315  #include "checkFaceAddressingComp.H"
316 
317  // Loop over all times
318  forAll(timeDirs, timeI)
319  {
320  if (newTimes && masterTimeDirSet.found(timeDirs[timeI].name()))
321  {
322  Info<< "Skipping time " << timeDirs[timeI].name()
323  << endl << endl;
324  continue;
325  }
326 
327 
328  // Set time for global database
329  runTime.setTime(timeDirs[timeI], timeI);
330 
331  Info<< "Time = " << runTime.timeName() << endl << endl;
332 
333  // Set time for all databases
334  forAll(databases, procI)
335  {
336  databases[procI].setTime(timeDirs[timeI], timeI);
337  }
338 
339  // Check if any new meshes need to be read.
340  fvMesh::readUpdateState meshStat = mesh.readUpdate();
341 
342  fvMesh::readUpdateState procStat = procMeshes.readUpdate();
343 
344  if (procStat == fvMesh::POINTS_MOVED)
345  {
346  // Reconstruct the points for moving mesh cases and write
347  // them out
348  procMeshes.reconstructPoints(mesh);
349  }
350  else if (meshStat != procStat)
351  {
353  << "readUpdate for the reconstructed mesh:"
354  << meshStat << nl
355  << "readUpdate for the processor meshes :"
356  << procStat << nl
357  << "These should be equal or your addressing"
358  << " might be incorrect."
359  << " Please check your time directories for any "
360  << "mesh directories." << endl;
361  }
362 
363 
364  // Get list of objects from processor0 database
365  IOobjectList objects
366  (
367  procMeshes.meshes()[0],
368  databases[0].timeName()
369  );
370 
371  {
372  // If there are any FV fields, reconstruct them
373  Info<< "Reconstructing FV fields" << nl << endl;
374 
375  fvFieldReconstructor fvReconstructor
376  (
377  mesh,
378  procMeshes.meshes(),
379  procMeshes.faceProcAddressing(),
380  procMeshes.cellProcAddressing(),
381  procMeshes.boundaryProcAddressing()
382  );
383 
384  fvReconstructor.reconstructFvVolumeInternalFields<scalar>
385  (
386  objects,
387  selectedFields
388  );
389  fvReconstructor.reconstructFvVolumeInternalFields<vector>
390  (
391  objects,
392  selectedFields
393  );
394  fvReconstructor.reconstructFvVolumeInternalFields
396  (
397  objects,
398  selectedFields
399  );
400  fvReconstructor.reconstructFvVolumeInternalFields<symmTensor>
401  (
402  objects,
403  selectedFields
404  );
405  fvReconstructor.reconstructFvVolumeInternalFields<tensor>
406  (
407  objects,
408  selectedFields
409  );
410 
411  fvReconstructor.reconstructFvVolumeFields<scalar>
412  (
413  objects,
414  selectedFields
415  );
416  fvReconstructor.reconstructFvVolumeFields<vector>
417  (
418  objects,
419  selectedFields
420  );
421  fvReconstructor.reconstructFvVolumeFields<sphericalTensor>
422  (
423  objects,
424  selectedFields
425  );
426  fvReconstructor.reconstructFvVolumeFields<symmTensor>
427  (
428  objects,
429  selectedFields
430  );
431  fvReconstructor.reconstructFvVolumeFields<tensor>
432  (
433  objects,
434  selectedFields
435  );
436 
437  fvReconstructor.reconstructFvSurfaceFields<scalar>
438  (
439  objects,
440  selectedFields
441  );
442  fvReconstructor.reconstructFvSurfaceFields<vector>
443  (
444  objects,
445  selectedFields
446  );
447  fvReconstructor.reconstructFvSurfaceFields<sphericalTensor>
448  (
449  objects,
450  selectedFields
451  );
452  fvReconstructor.reconstructFvSurfaceFields<symmTensor>
453  (
454  objects,
455  selectedFields
456  );
457  fvReconstructor.reconstructFvSurfaceFields<tensor>
458  (
459  objects,
460  selectedFields
461  );
462 
463  if (fvReconstructor.nReconstructed() == 0)
464  {
465  Info<< "No FV fields" << nl << endl;
466  }
467  }
468 
469  {
470  Info<< "Reconstructing point fields" << nl << endl;
471 
472  const pointMesh& pMesh = pointMesh::New(mesh);
473  PtrList<pointMesh> pMeshes(procMeshes.meshes().size());
474 
475  forAll(pMeshes, procI)
476  {
477  pMeshes.set
478  (
479  procI,
480  new pointMesh(procMeshes.meshes()[procI])
481  );
482  }
483 
484  pointFieldReconstructor pointReconstructor
485  (
486  pMesh,
487  pMeshes,
488  procMeshes.pointProcAddressing(),
489  procMeshes.boundaryProcAddressing()
490  );
491 
492  pointReconstructor.reconstructFields<scalar>
493  (
494  objects,
495  selectedFields
496  );
497  pointReconstructor.reconstructFields<vector>
498  (
499  objects,
500  selectedFields
501  );
502  pointReconstructor.reconstructFields<sphericalTensor>
503  (
504  objects,
505  selectedFields
506  );
507  pointReconstructor.reconstructFields<symmTensor>
508  (
509  objects,
510  selectedFields
511  );
512  pointReconstructor.reconstructFields<tensor>
513  (
514  objects,
515  selectedFields
516  );
517 
518  if (pointReconstructor.nReconstructed() == 0)
519  {
520  Info<< "No point fields" << nl << endl;
521  }
522  }
523 
524 
525  // If there are any clouds, reconstruct them.
526  // The problem is that a cloud of size zero will not get written so
527  // in pass 1 we determine the cloud names and per cloud name the
528  // fields. Note that the fields are stored as IOobjectList from
529  // the first processor that has them. They are in pass2 only used
530  // for name and type (scalar, vector etc).
531 
532  if (!noLagrangian)
533  {
534  HashTable<IOobjectList> cloudObjects;
535 
536  forAll(databases, procI)
537  {
538  fileNameList cloudDirs
539  (
540  readDir
541  (
542  databases[procI].timePath()
543  / regionDir
544  / cloud::prefix,
545  fileName::DIRECTORY
546  )
547  );
548 
549  forAll(cloudDirs, i)
550  {
551  // Check if we already have cloud objects for this
552  // cloudname
554  cloudObjects.find(cloudDirs[i]);
555 
556  if (iter == cloudObjects.end())
557  {
558  // Do local scan for valid cloud objects
559  IOobjectList sprayObjs
560  (
561  procMeshes.meshes()[procI],
562  databases[procI].timeName(),
563  cloud::prefix/cloudDirs[i]
564  );
565 
566  IOobject* positionsPtr =
567  sprayObjs.lookup(word("positions"));
568 
569  if (positionsPtr)
570  {
571  cloudObjects.insert(cloudDirs[i], sprayObjs);
572  }
573  }
574  }
575  }
576 
577 
578  if (cloudObjects.size())
579  {
580  // Pass2: reconstruct the cloud
581  forAllConstIter(HashTable<IOobjectList>, cloudObjects, iter)
582  {
583  const word cloudName = string::validate<word>
584  (
585  iter.key()
586  );
587 
588  // Objects (on arbitrary processor)
589  const IOobjectList& sprayObjs = iter();
590 
591  Info<< "Reconstructing lagrangian fields for cloud "
592  << cloudName << nl << endl;
593 
595  (
596  mesh,
597  cloudName,
598  procMeshes.meshes(),
599  procMeshes.faceProcAddressing(),
600  procMeshes.cellProcAddressing()
601  );
602  reconstructLagrangianFields<label>
603  (
604  cloudName,
605  mesh,
606  procMeshes.meshes(),
607  sprayObjs,
608  selectedLagrangianFields
609  );
610  reconstructLagrangianFieldFields<label>
611  (
612  cloudName,
613  mesh,
614  procMeshes.meshes(),
615  sprayObjs,
616  selectedLagrangianFields
617  );
618  reconstructLagrangianFields<scalar>
619  (
620  cloudName,
621  mesh,
622  procMeshes.meshes(),
623  sprayObjs,
624  selectedLagrangianFields
625  );
626  reconstructLagrangianFieldFields<scalar>
627  (
628  cloudName,
629  mesh,
630  procMeshes.meshes(),
631  sprayObjs,
632  selectedLagrangianFields
633  );
634  reconstructLagrangianFields<vector>
635  (
636  cloudName,
637  mesh,
638  procMeshes.meshes(),
639  sprayObjs,
640  selectedLagrangianFields
641  );
642  reconstructLagrangianFieldFields<vector>
643  (
644  cloudName,
645  mesh,
646  procMeshes.meshes(),
647  sprayObjs,
648  selectedLagrangianFields
649  );
650  reconstructLagrangianFields<sphericalTensor>
651  (
652  cloudName,
653  mesh,
654  procMeshes.meshes(),
655  sprayObjs,
656  selectedLagrangianFields
657  );
658  reconstructLagrangianFieldFields<sphericalTensor>
659  (
660  cloudName,
661  mesh,
662  procMeshes.meshes(),
663  sprayObjs,
664  selectedLagrangianFields
665  );
666  reconstructLagrangianFields<symmTensor>
667  (
668  cloudName,
669  mesh,
670  procMeshes.meshes(),
671  sprayObjs,
672  selectedLagrangianFields
673  );
674  reconstructLagrangianFieldFields<symmTensor>
675  (
676  cloudName,
677  mesh,
678  procMeshes.meshes(),
679  sprayObjs,
680  selectedLagrangianFields
681  );
682  reconstructLagrangianFields<tensor>
683  (
684  cloudName,
685  mesh,
686  procMeshes.meshes(),
687  sprayObjs,
688  selectedLagrangianFields
689  );
690  reconstructLagrangianFieldFields<tensor>
691  (
692  cloudName,
693  mesh,
694  procMeshes.meshes(),
695  sprayObjs,
696  selectedLagrangianFields
697  );
698  }
699  }
700  else
701  {
702  Info<< "No lagrangian fields" << nl << endl;
703  }
704  }
705 
706 
707  if (!noReconstructSets)
708  {
709  // Scan to find all sets
710  HashTable<label> cSetNames;
711  HashTable<label> fSetNames;
712  HashTable<label> pSetNames;
713 
714  forAll(procMeshes.meshes(), procI)
715  {
716  const fvMesh& procMesh = procMeshes.meshes()[procI];
717 
718  // Note: look at sets in current time only or between
719  // mesh and current time?. For now current time. This will
720  // miss out on sets in intermediate times that have not
721  // been reconstructed.
722  IOobjectList objects
723  (
724  procMesh,
725  databases[0].timeName(), //procMesh.facesInstance()
726  polyMesh::meshSubDir/"sets"
727  );
728 
729  IOobjectList cSets(objects.lookupClass(cellSet::typeName));
730  forAllConstIter(IOobjectList, cSets, iter)
731  {
732  cSetNames.insert(iter.key(), cSetNames.size());
733  }
734 
735  IOobjectList fSets(objects.lookupClass(faceSet::typeName));
736  forAllConstIter(IOobjectList, fSets, iter)
737  {
738  fSetNames.insert(iter.key(), fSetNames.size());
739  }
740  IOobjectList pSets(objects.lookupClass(pointSet::typeName));
741  forAllConstIter(IOobjectList, pSets, iter)
742  {
743  pSetNames.insert(iter.key(), pSetNames.size());
744  }
745  }
746 
747  // Construct all sets
748  PtrList<cellSet> cellSets(cSetNames.size());
749  PtrList<faceSet> faceSets(fSetNames.size());
750  PtrList<pointSet> pointSets(pSetNames.size());
751 
752  Info<< "Reconstructing sets:" << endl;
753  if (cSetNames.size())
754  {
755  Info<< " cellSets " << cSetNames.sortedToc() << endl;
756  }
757  if (fSetNames.size())
758  {
759  Info<< " faceSets " << fSetNames.sortedToc() << endl;
760  }
761  if (pSetNames.size())
762  {
763  Info<< " pointSets " << pSetNames.sortedToc() << endl;
764  }
765 
766  // Load sets
767  forAll(procMeshes.meshes(), procI)
768  {
769  const fvMesh& procMesh = procMeshes.meshes()[procI];
770 
771  IOobjectList objects
772  (
773  procMesh,
774  databases[0].timeName(), //procMesh.facesInstance(),
775  polyMesh::meshSubDir/"sets"
776  );
777 
778  // cellSets
779  const labelList& cellMap =
780  procMeshes.cellProcAddressing()[procI];
781 
782  IOobjectList cSets(objects.lookupClass(cellSet::typeName));
783  forAllConstIter(IOobjectList, cSets, iter)
784  {
785  // Load cellSet
786  const cellSet procSet(*iter());
787  label setI = cSetNames[iter.key()];
788  if (!cellSets.set(setI))
789  {
790  cellSets.set
791  (
792  setI,
793  new cellSet(mesh, iter.key(), procSet.size())
794  );
795  }
796  cellSet& cSet = cellSets[setI];
797  cSet.instance() = runTime.timeName();
798 
799  forAllConstIter(cellSet, procSet, iter)
800  {
801  cSet.insert(cellMap[iter.key()]);
802  }
803  }
804 
805  // faceSets
806  const labelList& faceMap =
807  procMeshes.faceProcAddressing()[procI];
808 
809  IOobjectList fSets(objects.lookupClass(faceSet::typeName));
810  forAllConstIter(IOobjectList, fSets, iter)
811  {
812  // Load faceSet
813  const faceSet procSet(*iter());
814  label setI = fSetNames[iter.key()];
815  if (!faceSets.set(setI))
816  {
817  faceSets.set
818  (
819  setI,
820  new faceSet(mesh, iter.key(), procSet.size())
821  );
822  }
823  faceSet& fSet = faceSets[setI];
824  fSet.instance() = runTime.timeName();
825 
826  forAllConstIter(faceSet, procSet, iter)
827  {
828  fSet.insert(mag(faceMap[iter.key()])-1);
829  }
830  }
831  // pointSets
832  const labelList& pointMap =
833  procMeshes.pointProcAddressing()[procI];
834 
835  IOobjectList pSets(objects.lookupClass(pointSet::typeName));
836  forAllConstIter(IOobjectList, pSets, iter)
837  {
838  // Load pointSet
839  const pointSet propSet(*iter());
840  label setI = pSetNames[iter.key()];
841  if (!pointSets.set(setI))
842  {
843  pointSets.set
844  (
845  setI,
846  new pointSet(mesh, iter.key(), propSet.size())
847  );
848  }
849  pointSet& pSet = pointSets[setI];
850  pSet.instance() = runTime.timeName();
851 
852  forAllConstIter(pointSet, propSet, iter)
853  {
854  pSet.insert(pointMap[iter.key()]);
855  }
856  }
857  }
858 
859  // Write sets
860  forAll(cellSets, i)
861  {
862  cellSets[i].write();
863  }
864  forAll(faceSets, i)
865  {
866  faceSets[i].write();
867  }
868  forAll(pointSets, i)
869  {
870  pointSets[i].write();
871  }
872  }
873 
874 
875  // Reconstruct refinement data
876  {
877  PtrList<hexRef8Data> procData(procMeshes.meshes().size());
878 
879  forAll(procMeshes.meshes(), procI)
880  {
881  const fvMesh& procMesh = procMeshes.meshes()[procI];
882 
883  procData.set
884  (
885  procI,
886  new hexRef8Data
887  (
888  IOobject
889  (
890  "dummy",
891  procMesh.time().timeName(),
892  polyMesh::meshSubDir,
893  procMesh,
894  IOobject::READ_IF_PRESENT,
895  IOobject::NO_WRITE,
896  false
897  )
898  )
899  );
900  }
901 
902  // Combine individual parts
903 
904  const PtrList<labelIOList>& cellAddr =
905  procMeshes.cellProcAddressing();
906 
907  UPtrList<const labelList> cellMaps(cellAddr.size());
908  forAll(cellAddr, i)
909  {
910  cellMaps.set(i, &cellAddr[i]);
911  }
912 
913  const PtrList<labelIOList>& pointAddr =
914  procMeshes.pointProcAddressing();
915 
916  UPtrList<const labelList> pointMaps(pointAddr.size());
917  forAll(pointAddr, i)
918  {
919  pointMaps.set(i, &pointAddr[i]);
920  }
921 
922  UPtrList<const hexRef8Data> procRefs(procData.size());
923  forAll(procData, i)
924  {
925  procRefs.set(i, &procData[i]);
926  }
927 
929  (
930  IOobject
931  (
932  "dummy",
933  mesh.time().timeName(),
934  polyMesh::meshSubDir,
935  mesh,
936  IOobject::NO_READ,
937  IOobject::NO_WRITE,
938  false
939  ),
940  cellMaps,
941  pointMaps,
942  procRefs
943  ).write();
944  }
945  }
946  }
947 
948  // If there are any "uniform" directories copy them from
949  // the master processor
950  forAll(timeDirs, timeI)
951  {
952  runTime.setTime(timeDirs[timeI], timeI);
953  databases[0].setTime(timeDirs[timeI], timeI);
954 
955  fileName uniformDir0 = databases[0].timePath()/"uniform";
956  if (isDir(uniformDir0))
957  {
958  cp(uniformDir0, runTime.timePath());
959  }
960  }
961 
962  Info<< "\nEnd\n" << endl;
963 
964  return 0;
965 }
966 
967 
968 // ************************************************************************* //
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
checkFaceAddressingComp.H
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::SymmTensor< scalar >
main
int main(int argc, char *argv[])
Definition: reconstructPar.C:67
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeFast.C:90
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::compressible::New
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
Definition: turbulentFluidThermoModel.C:36
regionProperties.H
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::processorMeshes::meshes
const PtrList< fvMesh > & meshes() const
Definition: processorMeshes.H:105
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::findIndex
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
fvFieldReconstructor.H
Foam::fvFieldReconstructor::nReconstructed
label nReconstructed() const
Return number of fields reconstructed.
Definition: fvFieldReconstructor.H:146
Foam::fvFieldReconstructor::reconstructFvSurfaceFields
void reconstructFvSurfaceFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Read, reconstruct and write all/selected surface fields.
Definition: fvFieldReconstructorReconstructFields.C:661
Foam::HashTable::const_iterator
An STL-conforming const_iterator.
Definition: HashTable.H:470
Foam::HashTable::insert
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Definition: HashTableI.H:80
Foam::processorMeshes
Container for processor mesh addressing.
Definition: processorMeshes.H:52
Foam::faceSet
A list of face labels.
Definition: faceSet.H:48
Foam::IOobject::MUST_READ
@ MUST_READ
Definition: IOobject.H:108
IOobjectList.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::IOobject::instance
const fileName & instance() const
Definition: IOobject.H:350
Foam::HashSet
A HashTable with keys but without contents.
Definition: HashSet.H:59
processorMeshes.H
Foam::processorMeshes::reconstructPoints
void reconstructPoints(fvMesh &)
Reconstruct point position after motion in parallel.
Definition: processorMeshes.C:205
Foam::argList::rootPath
const fileName & rootPath() const
Return root path.
Definition: argListI.H:36
Foam::processorMeshes::boundaryProcAddressing
const PtrList< labelIOList > & boundaryProcAddressing() const
Definition: processorMeshes.H:130
forAllConstIter
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
Foam::faceSets
Definition: faceSets.H:44
Foam::HashTable::set
bool set(const Key &, const T &newElmt, bool protect)
Assign a new hashedEntry to a possibly already existing key.
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:54
Foam::fvMesh::readUpdate
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
Definition: fvMesh.C:498
Foam::pointFieldReconstructor
Point field reconstructor.
Definition: pointFieldReconstructor.H:51
Foam::pointFieldReconstructor::nReconstructed
label nReconstructed() const
Return number of fields reconstructed.
Definition: pointFieldReconstructor.H:141
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
pointFieldReconstructor.H
Foam::PtrList::set
bool set(const label) const
Is element set.
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::List::append
void append(const T &)
Append an element at the end of the list.
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
argList.H
faceSet.H
addRegionOption.H
Foam::UPtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:53
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
cp
const volScalarField & cp
Definition: setRegionSolidFields.H:8
Foam::regionProperties
Simple class to hold region information for coupled region simulations.
Definition: regionProperties.H:53
Foam::processorMeshes::faceProcAddressing
PtrList< labelIOList > & faceProcAddressing()
Definition: processorMeshes.H:120
Foam::hexRef8Data
Various for reading/decomposing/reconstructing/distributing refinement data.
Definition: hexRef4Data.H:57
Foam::cellSets
Definition: cellSets.H:44
Foam::processorMeshes::cellProcAddressing
const PtrList< labelIOList > & cellProcAddressing() const
Definition: processorMeshes.H:125
Foam::pointFieldReconstructor::reconstructFields
void reconstructFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Reconstruct and write all fields.
Definition: pointFieldReconstructorReconstructFields.C:144
Foam::argList::path
fileName path() const
Return the path to the caseName.
Definition: argListI.H:60
Foam::IOobjectList::lookup
IOobject * lookup(const word &name) const
Lookup a given name and return IOobject ptr if found else NULL.
Definition: IOobjectList.C:128
Foam::FatalError
error FatalError
Foam::HashTable::size
label size() const
Return number of elements in table.
Definition: HashTableI.H:65
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::HashTable< nil, word, string::hash >::found
bool found(const Key &) const
Return true if hashedEntry is found in table.
Definition: HashTable.C:109
hexRef8Data.H
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam::pointMesh
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:48
Foam::isDir
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
Definition: POSIX.C:615
Foam::cellSet
A collection of cell labels.
Definition: cellSet.H:48
Foam::IOobjectList::lookupClass
IOobjectList lookupClass(const word &className) const
Return the list for all IOobjects of a given class.
Definition: IOobjectList.C:199
haveAllTimes
bool haveAllTimes(const HashSet< word > &masterTimeDirSet, const instantList &timeDirs)
Definition: reconstructPar.C:50
Foam::HashTable::sortedToc
List< Key > sortedToc() const
Return the table of contents as a sorted list.
Definition: HashTable.C:216
Foam::SphericalTensor
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
Definition: SphericalTensor.H:51
Foam::HashTable::find
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
Foam::IOobjectList
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:50
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::processorMeshes::readUpdate
fvMesh::readUpdateState readUpdate()
Update the meshes based on the mesh files saved in time directories.
Definition: processorMeshes.C:154
Foam::fvFieldReconstructor
Finite volume reconstructor for volume and surface fields.
Definition: fvFieldReconstructor.H:54
Foam::HashTable< wordList >
Foam::HashTable::iteratorBase::key
const Key & key() const
Return the Key corresponding to the iterator.
Definition: HashTableI.H:260
Foam::fvFieldReconstructor::reconstructFvVolumeInternalFields
void reconstructFvVolumeInternalFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Read, reconstruct and write all/selected volume internal fields.
Definition: fvFieldReconstructorReconstructFields.C:590
setRootCase.H
timeDirs
static instantList timeDirs
Definition: globalFoam.H:44
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::hexRef8Data::write
bool write() const
Write.
Definition: hexRef4Data.C:324
Foam::pointSet
A set of point labels.
Definition: pointSet.H:48
Foam::Vector< scalar >
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::UPtrList::set
bool set(const label) const
Is element set.
Foam::PtrList::size
label size() const
Return the number of elements in the PtrList.
Definition: PtrListI.H:32
Foam::HashSet::insert
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:116
timeName
word timeName
Definition: getTimeIndex.H:3
timeSelector.H
createTime.H
cloudName
const word cloudName(propsDict.lookup("cloudName"))
Foam::argList::optionFound
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:108
Foam::processorMeshes::pointProcAddressing
const PtrList< labelIOList > & pointProcAddressing() const
Definition: processorMeshes.H:115
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
fvCFD.H
Foam::argList::caseName
const fileName & caseName() const
Return case name (parallel run) or global case (serial run)
Definition: argListI.H:42
cellSet.H
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::readDir
fileNameList readDir(const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true)
Read a directory and return the entries as a string list.
Definition: POSIX.C:660
Foam::fvFieldReconstructor::reconstructFvVolumeFields
void reconstructFvVolumeFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Read, reconstruct and write all/selected volume fields.
Definition: fvFieldReconstructorReconstructFields.C:625
args
Foam::argList args(argc, argv)
Foam::reconstructLagrangianPositions
void reconstructLagrangianPositions(const polyMesh &mesh, const word &cloudName, const PtrList< fvMesh > &meshes, const PtrList< labelIOList > &faceProcAddressing, const PtrList< labelIOList > &cellProcAddressing)
Definition: reconstructLagrangianPositions.C:33
Foam::argList::optionReadIfPresent
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
Definition: argListI.H:198
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:259
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
reconstructLagrangian.H
Foam::argList::optionLookup
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
Definition: argListI.H:114
pointSet.H