gmvOutput.H
Go to the documentation of this file.
1 for (const word& fieldType : fieldTypes)
2 {
3  const wordList fieldNames = objects.sortedNames(fieldType);
4 
5  if (fieldType == "volScalarField")
6  {
7  gmvFile << "variable" << nl;
8  }
9 
10  for (const word& fieldName : fieldNames)
11  {
12  IOobject fieldObject
13  (
14  fieldName,
15  runTime.timeName(),
16  mesh,
17  IOobject::MUST_READ,
18  IOobject::NO_WRITE
19  );
20 
21  if (fieldType == "volScalarField")
22  {
23  volScalarField fld(fieldObject, mesh);
24  gmvFile << fieldName << " 0" << nl;
25  for (label indx=0; indx<mesh.nCells(); ++indx)
26  {
27  gmvFile << fld[indx] << " ";
28  }
29  gmvFile << nl;
30  }
31 
32  if (fieldType == "volVectorField")
33  {
34  if (fieldName == vComp)
35  {
36  volVectorField fld(fieldObject, mesh);
37  gmvFile << "velocity 0" << nl;
38  for (label indx=0;indx<mesh.nCells();indx++)
39  {
40  gmvFile << fld[indx].x() << " ";
41  }
42  for (label indx=0;indx<mesh.nCells();indx++)
43  {
44  gmvFile << fld[indx].y() << " ";
45  }
46  for (label indx=0;indx<mesh.nCells();indx++)
47  {
48  gmvFile << fld[indx].z() << " ";
49  }
50  gmvFile << nl;
51  }
52  }
53 
54  if (fieldType == "surfaceScalarField")
55  {
56  // ...
57  }
58 
59  }
60 
61  if (fieldType == cloud::prefix)
62  {
63  IOobject positionsHeader
64  (
65  "positions",
66  runTime.timeName(),
67  cloud::prefix,
68  mesh,
69  IOobject::NO_READ
70  );
71 
72  IOobject coordinatesHeader
73  (
74  "coordinates",
75  runTime.timeName(),
76  cloud::prefix,
77  mesh,
78  IOobject::NO_READ
79  );
80 
81  if
82  (
83  positionsHeader.typeHeaderOk<IOPosition<Cloud<passiveParticle>>>
84  (
85  false
86  )
87  || coordinatesHeader.typeHeaderOk<IOPosition<Cloud<passiveParticle>>>
88  (
89  false
90  )
91  )
92  {
93  Cloud<passiveParticle> particles(mesh, cloud::defaultName);
94 
95  IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
96 
97  wordList lagrangianScalarNames(objects.sortedNames("scalarField"));
98  wordList lagrangianVectorNames(objects.sortedNames("vectorField"));
99 
100  if (particles.size())
101  {
102  #include "gmvOutputLagrangian.H"
103  }
104  }
105  }
106 
107  if (fieldType == "volScalarField")
108  {
109  gmvFile << "endvars" << nl;
110  }
111 }
runTime
engineTime & runTime
Definition: createEngineTime.H:13
gmvOutputLagrangian.H
vComp
word vComp(conversionProperties.get< word >("vector"))
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:62
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
fieldNames
const wordRes fieldNames(propsDict.getOrDefault< wordRes >("fields", wordRes()))
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:62
Foam::nl
constexpr char nl
Definition: Ostream.H:404