1 //======================================================================
3 //======================================================================
4 int USERD_set_filenames
13 Info << "Entering: USERD_set_filenames" << endl << flush;
18 label lRoot = strlen(the_path);
19 label lCase = strlen(filename_1);
25 lRoot = strlen(the_path);
26 lCase = strlen(filename_1);
28 // remove the last '/' from rootDir
29 if (the_path[lRoot-1] == '/')
31 the_path[lRoot-1] = (char)NULL;
41 // the path is pre-pended to filename_1
42 // 1 is the 'Geometry' : 2 the 'Result' which is null here
43 // since two_field is FALSE
44 for (label i=0; i<lCase-lRoot;i++)
46 tmp[i] = filename_1[i+1+lRoot];
50 if (!isDir(rootDir/caseDir))
52 Info<< rootDir/caseDir << " is not a valid directory."
58 // construct the global pointers to the database and mesh
65 Time::controlDictName,
70 Time& runTime = *runTimePtr;
76 fvMesh::defaultRegion,
82 // set the available number of time-steps
83 TimeList = (const instantList&)Foam::Time::findTimes(rootDir/caseDir);
85 Num_time_steps = TimeList.size() - 1;
87 nPatches = meshPtr->boundaryMesh().size();
89 // set the number of fields and store their names
90 // a valid field must exist for all time-steps
91 runTime.setTime(TimeList[TimeList.size()-1], TimeList.size()-1);
92 IOobjectList objects(*meshPtr, runTime.timeName());
94 fieldNames = (const wordList&)objects.names();
96 // because of the spray being a 'field' ...
97 // get the availabe number of variables and
98 // check for type (scalar/vector/tensor)
101 wordList scalars = objects.names(scalarName);
103 for (label n=0; n<fieldNames.size(); n++)
105 bool isitScalar = false;
108 if (fieldNames[n] == scalars[i])
111 var2field[nVar++] = n;
114 isScalar[n] = isitScalar;
117 wordList vectors = objects.names(vectorName);
119 for (label n=0; n<fieldNames.size(); n++)
121 bool isitVector = false;
124 if (fieldNames[n] == vectors[i])
127 var2field[nVar++] = n;
130 isVector[n] = isitVector;
133 wordList tensors = objects.names(tensorName);
135 for (label n=0; n<fieldNames.size(); n++)
137 bool isitTensor = false;
140 if (fieldNames[n] == tensors[i])
143 var2field[nVar++] = n;
146 isTensor[n] = isitTensor;
149 bool lagrangianNamesFound = false;
151 while ((!lagrangianNamesFound) && (n<Num_time_steps))
153 runTime.setTime(TimeList[n+1], n+1);
155 Cloud<passiveParticle> lagrangian(*meshPtr);
158 if (lagrangian.size()>0)
160 lagrangianNamesFound = true;
176 if (sprayHeader.headerOk())
178 Info << "[Found lagrangian]" << endl;
182 sprayPtr = new Cloud<passiveParticle>(*meshPtr);
184 IOobjectList objects(*meshPtr, runTime.timeName(), "lagrangian");
186 lagrangianScalarNames =
187 (const wordList&)objects.names(sprayScalarFieldName);
188 lagrangianVectorNames =
189 (const wordList&)objects.names(sprayVectorFieldName);
191 isSpray[fieldNames.size()] = true;
193 nSprayVariables += lagrangianScalarNames.size();
194 nSprayVariables += lagrangianVectorNames.size();
196 Num_unstructured_parts++;
199 Current_time_step = Num_time_steps;
200 runTime.setTime(TimeList[Current_time_step], Current_time_step);
202 Num_variables = nVar + nSprayVariables;
205 // Check if second mesh (region) exist.
206 IOobject ensightReaderDictHeader
218 word secondRegionName("solid");
220 if(ensightReaderDictHeader.headerOk())
222 IOdictionary ensightReaderDict
234 if (ensightReaderDict.found("secondRegionName"))
236 secondRegionName = word
238 ensightReaderDict.lookup("secondRegionName")
242 if (ensightReaderDict.found("scalingFactor"))
244 scalingFactor = readScalar
246 ensightReaderDict.lookup("scalingFactor")
251 objectRegistry secondMeshObjReg
262 IOobject pointsHeader
266 polyMesh::meshSubDir,
270 if(pointsHeader.headerOk())
272 secondMeshPtr = new fvMesh
286 Num_unstructured_parts += 1;
288 nSecondMeshPatches = secondMeshPtr->boundaryMesh().size();
290 IOobjectList secondMeshObjects(*secondMeshPtr, runTime.timeName());
292 secondMeshFieldNames = (const wordList&)secondMeshObjects.names();
295 wordList scalars = secondMeshObjects.names(scalarName);
297 for (label n=0; n<secondMeshFieldNames.size(); n++)
299 bool isitScalar = false;
302 if (secondMeshFieldNames[n] == scalars[i])
305 secondMeshVar2field[nVar++] = n;
308 secondMeshIsScalar[n] = isitScalar;
311 wordList vectors = secondMeshObjects.names(vectorName);
313 for (label n=0; n<secondMeshFieldNames.size(); n++)
315 bool isitVector = false;
318 if (secondMeshFieldNames[n] == vectors[i])
321 secondMeshVar2field[nVar++] = n;
324 secondMeshIsVector[n] = isitVector;
327 wordList tensors = secondMeshObjects.names(tensorName);
329 for (label n=0; n<secondMeshFieldNames.size(); n++)
331 bool isitTensor = false;
334 if (secondMeshFieldNames[n] == tensors[i])
337 secondMeshVar2field[nVar++] = n;
340 secondMeshIsTensor[n] = isitTensor;
343 Num_variables += nVar;
344 nSecondMeshVariables = nVar;
347 secondMeshPartNum = nPatches+2;
351 secondMeshPartNum += 1;
355 // Check if finite area mesh exists
356 IOobject faMeshBoundaryIOobj
359 meshPtr->time().findInstance
361 meshPtr->dbDir()/fvMesh::meshSubDir, "boundary"
370 if(faMeshBoundaryIOobj.headerOk())
372 Info << "\nFound finite area mesh" << endl;
373 faMeshPtr = new faMesh(*meshPtr);
379 Num_unstructured_parts += 1;
381 IOobjectList faMeshObjects(faMeshPtr->time(), runTime.timeName());
383 faMeshFieldNames = (const wordList&)faMeshObjects.names();
385 Info << faMeshFieldNames << endl;
388 wordList scalars = faMeshObjects.names(faScalarName);
390 for (label n=0; n<faMeshFieldNames.size(); n++)
392 bool isitScalar = false;
395 if (faMeshFieldNames[n] == scalars[i])
398 faMeshVar2field[nVar++] = n;
401 faMeshIsScalar[n] = isitScalar;
404 wordList vectors = faMeshObjects.names(faVectorName);
406 for (label n=0; n<faMeshFieldNames.size(); n++)
408 bool isitVector = false;
411 if (faMeshFieldNames[n] == vectors[i])
414 faMeshVar2field[nVar++] = n;
417 faMeshIsVector[n] = isitVector;
420 wordList tensors = faMeshObjects.names(faTensorName);
422 for (label n=0; n<faMeshFieldNames.size(); n++)
424 bool isitTensor = false;
427 if (faMeshFieldNames[n] == tensors[i])
430 faMeshVar2field[nVar++] = n;
433 faMeshIsTensor[n] = isitTensor;
436 Num_variables += nVar;
437 nFaMeshVariables = nVar;
441 Numparts_available = Num_unstructured_parts + Num_structured_parts
442 + nPatches + nSecondMeshPatches;
446 Info << "Leaving: USERD_set_filenames" << endl << flush;