00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "argList.H"
00035 #include "timeSelector.H"
00036
00037 #include "fvCFD.H"
00038 #include "IOobjectList.H"
00039 #include "processorMeshes.H"
00040 #include "fvFieldReconstructor.H"
00041 #include "pointFieldReconstructor.H"
00042 #include "reconstructLagrangian.H"
00043
00044
00045
00046 int main(int argc, char *argv[])
00047 {
00048
00049
00050 timeSelector::addOptions(true, true);
00051 argList::noParallel();
00052 # include "addRegionOption.H"
00053 argList::validOptions.insert("fields", "\"(list of fields)\"");
00054 argList::validOptions.insert("noLagrangian", "");
00055
00056 # include "setRootCase.H"
00057 # include "createTime.H"
00058
00059 HashSet<word> selectedFields;
00060 if (args.optionFound("fields"))
00061 {
00062 args.optionLookup("fields")() >> selectedFields;
00063 }
00064
00065 bool noLagrangian = args.optionFound("noLagrangian");
00066
00067
00068 label nProcs = 0;
00069 while (isDir(args.path()/(word("processor") + name(nProcs))))
00070 {
00071 ++nProcs;
00072 }
00073
00074 if (!nProcs)
00075 {
00076 FatalErrorIn(args.executable())
00077 << "No processor* directories found"
00078 << exit(FatalError);
00079 }
00080
00081
00082 PtrList<Time> databases(nProcs);
00083
00084 forAll (databases, procI)
00085 {
00086 databases.set
00087 (
00088 procI,
00089 new Time
00090 (
00091 Time::controlDictName,
00092 args.rootPath(),
00093 args.caseName()/fileName(word("processor") + name(procI))
00094 )
00095 );
00096 }
00097
00098
00099
00100 instantList timeDirs = timeSelector::select
00101 (
00102 databases[0].times(),
00103 args
00104 );
00105
00106 if (timeDirs.empty())
00107 {
00108 FatalErrorIn(args.executable())
00109 << "No times selected"
00110 << exit(FatalError);
00111 }
00112
00113 # include "createNamedMesh.H"
00114 fileName regionPrefix = "";
00115 if (regionName != fvMesh::defaultRegion)
00116 {
00117 regionPrefix = regionName;
00118 }
00119
00120
00121 forAll (databases, procI)
00122 {
00123 databases[procI].setTime(runTime.timeName(), runTime.timeIndex());
00124 }
00125
00126
00127 processorMeshes procMeshes(databases, regionName);
00128
00129
00130
00131
00132 # include "checkFaceAddressingComp.H"
00133
00134
00135 forAll (timeDirs, timeI)
00136 {
00137
00138 runTime.setTime(timeDirs[timeI], timeI);
00139
00140 Info << "Time = " << runTime.timeName() << endl << endl;
00141
00142
00143 forAll (databases, procI)
00144 {
00145 databases[procI].setTime(timeDirs[timeI], timeI);
00146 }
00147
00148
00149 fvMesh::readUpdateState meshStat = mesh.readUpdate();
00150
00151 fvMesh::readUpdateState procStat = procMeshes.readUpdate();
00152
00153 if (procStat == fvMesh::POINTS_MOVED)
00154 {
00155
00156 procMeshes.reconstructPoints(mesh);
00157 }
00158 else if (meshStat != procStat)
00159 {
00160 WarningIn(args.executable())
00161 << "readUpdate for the reconstructed mesh:" << meshStat << nl
00162 << "readUpdate for the processor meshes :" << procStat << nl
00163 << "These should be equal or your addressing"
00164 << " might be incorrect."
00165 << " Please check your time directories for any "
00166 << "mesh directories." << endl;
00167 }
00168
00169
00170
00171 IOobjectList objects(procMeshes.meshes()[0], databases[0].timeName());
00172
00173
00174
00175
00176 if
00177 (
00178 objects.lookupClass(volScalarField::typeName).size()
00179 || objects.lookupClass(volVectorField::typeName).size()
00180 || objects.lookupClass(volSphericalTensorField::typeName).size()
00181 || objects.lookupClass(volSymmTensorField::typeName).size()
00182 || objects.lookupClass(volTensorField::typeName).size()
00183 || objects.lookupClass(surfaceScalarField::typeName).size()
00184 )
00185 {
00186 Info << "Reconstructing FV fields" << nl << endl;
00187
00188 fvFieldReconstructor fvReconstructor
00189 (
00190 mesh,
00191 procMeshes.meshes(),
00192 procMeshes.faceProcAddressing(),
00193 procMeshes.cellProcAddressing(),
00194 procMeshes.boundaryProcAddressing()
00195 );
00196
00197 fvReconstructor.reconstructFvVolumeFields<scalar>
00198 (
00199 objects,
00200 selectedFields
00201 );
00202 fvReconstructor.reconstructFvVolumeFields<vector>
00203 (
00204 objects,
00205 selectedFields
00206 );
00207 fvReconstructor.reconstructFvVolumeFields<sphericalTensor>
00208 (
00209 objects,
00210 selectedFields
00211 );
00212 fvReconstructor.reconstructFvVolumeFields<symmTensor>
00213 (
00214 objects,
00215 selectedFields
00216 );
00217 fvReconstructor.reconstructFvVolumeFields<tensor>
00218 (
00219 objects,
00220 selectedFields
00221 );
00222
00223 fvReconstructor.reconstructFvSurfaceFields<scalar>
00224 (
00225 objects,
00226 selectedFields
00227 );
00228 }
00229 else
00230 {
00231 Info << "No FV fields" << nl << endl;
00232 }
00233
00234
00235
00236 if
00237 (
00238 objects.lookupClass(pointScalarField::typeName).size()
00239 || objects.lookupClass(pointVectorField::typeName).size()
00240 || objects.lookupClass(pointSphericalTensorField::typeName).size()
00241 || objects.lookupClass(pointSymmTensorField::typeName).size()
00242 || objects.lookupClass(pointTensorField::typeName).size()
00243 )
00244 {
00245 Info << "Reconstructing point fields" << nl << endl;
00246
00247 pointMesh pMesh(mesh);
00248 PtrList<pointMesh> pMeshes(procMeshes.meshes().size());
00249
00250 forAll (pMeshes, procI)
00251 {
00252 pMeshes.set(procI, new pointMesh(procMeshes.meshes()[procI]));
00253 }
00254
00255 pointFieldReconstructor pointReconstructor
00256 (
00257 pMesh,
00258 pMeshes,
00259 procMeshes.pointProcAddressing(),
00260 procMeshes.boundaryProcAddressing()
00261 );
00262
00263 pointReconstructor.reconstructFields<scalar>(objects);
00264 pointReconstructor.reconstructFields<vector>(objects);
00265 pointReconstructor.reconstructFields<sphericalTensor>(objects);
00266 pointReconstructor.reconstructFields<symmTensor>(objects);
00267 pointReconstructor.reconstructFields<tensor>(objects);
00268 }
00269 else
00270 {
00271 Info << "No point fields" << nl << endl;
00272 }
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282 if (!noLagrangian)
00283 {
00284 HashTable<IOobjectList> cloudObjects;
00285
00286 forAll (databases, procI)
00287 {
00288 fileNameList cloudDirs
00289 (
00290 readDir
00291 (
00292 databases[procI].timePath()/regionPrefix/cloud::prefix,
00293 fileName::DIRECTORY
00294 )
00295 );
00296
00297 forAll (cloudDirs, i)
00298 {
00299
00300 HashTable<IOobjectList>::const_iterator iter =
00301 cloudObjects.find(cloudDirs[i]);
00302
00303 if (iter == cloudObjects.end())
00304 {
00305
00306 IOobjectList sprayObjs
00307 (
00308 procMeshes.meshes()[procI],
00309 databases[procI].timeName(),
00310 cloud::prefix/cloudDirs[i]
00311 );
00312
00313 IOobject* positionsPtr = sprayObjs.lookup("positions");
00314
00315 if (positionsPtr)
00316 {
00317 cloudObjects.insert(cloudDirs[i], sprayObjs);
00318 }
00319 }
00320 }
00321 }
00322
00323
00324 if (cloudObjects.size())
00325 {
00326
00327 forAllConstIter(HashTable<IOobjectList>, cloudObjects, iter)
00328 {
00329 const word cloudName = string::validate<word>(iter.key());
00330
00331
00332 const IOobjectList& sprayObjs = iter();
00333
00334 Info<< "Reconstructing lagrangian fields for cloud "
00335 << cloudName << nl << endl;
00336
00337 reconstructLagrangianPositions
00338 (
00339 mesh,
00340 cloudName,
00341 procMeshes.meshes(),
00342 procMeshes.faceProcAddressing(),
00343 procMeshes.cellProcAddressing()
00344 );
00345 reconstructLagrangianFields<label>
00346 (
00347 cloudName,
00348 mesh,
00349 procMeshes.meshes(),
00350 sprayObjs
00351 );
00352 reconstructLagrangianFields<scalar>
00353 (
00354 cloudName,
00355 mesh,
00356 procMeshes.meshes(),
00357 sprayObjs
00358 );
00359 reconstructLagrangianFields<vector>
00360 (
00361 cloudName,
00362 mesh,
00363 procMeshes.meshes(),
00364 sprayObjs
00365 );
00366 reconstructLagrangianFields<sphericalTensor>
00367 (
00368 cloudName,
00369 mesh,
00370 procMeshes.meshes(),
00371 sprayObjs
00372 );
00373 reconstructLagrangianFields<symmTensor>
00374 (
00375 cloudName,
00376 mesh,
00377 procMeshes.meshes(),
00378 sprayObjs
00379 );
00380 reconstructLagrangianFields<tensor>
00381 (
00382 cloudName,
00383 mesh,
00384 procMeshes.meshes(),
00385 sprayObjs
00386 );
00387 }
00388 }
00389 else
00390 {
00391 Info << "No lagrangian fields" << nl << endl;
00392 }
00393 }
00394
00395
00396
00397
00398 fileName uniformDir0 = databases[0].timePath()/"uniform";
00399 if (isDir(uniformDir0))
00400 {
00401 cp(uniformDir0, runTime.timePath());
00402 }
00403 }
00404
00405 Info<< "End.\n" << endl;
00406
00407 return 0;
00408 }
00409
00410
00411