FreeFOAM The Cross-Platform CFD Toolkit
gmvOutput.H
Go to the documentation of this file.
1 for (label i=0; i < nTypes; i++)
2 {
3  wordList fieldNames = objects.names(fieldTypes[i]);
4 
5  if (fieldTypes[i] == "volScalarField")
6  {
7  gmvFile << "variable" << nl;
8  }
9  for (label j=0; j < fieldNames.size(); j++)
10  {
11 
12  word fieldName = fieldNames[j];
13 
14  IOobject fieldObject
15  (
16  fieldName,
17  runTime.timeName(),
18  mesh,
19  IOobject::MUST_READ,
20  IOobject::NO_WRITE
21  );
22 
23  if (fieldTypes[i] == "volScalarField")
24  {
25  volScalarField gmvScalarField(fieldObject, mesh);
26  gmvFile << fieldName << " 0" << nl;
27  for(label indx=0;indx<mesh.nCells();indx++)
28  {
29  gmvFile << gmvScalarField[indx] << " ";
30  }
31  gmvFile << nl;
32  }
33 
34  if (fieldTypes[i] == "volVectorField")
35  {
36  if (fieldName == vComp)
37  {
38  volVectorField gmvVectorField(fieldObject, mesh);
39  gmvFile << "velocity 0" << nl;
40  for (label indx=0;indx<mesh.nCells();indx++)
41  {
42  gmvFile << gmvVectorField[indx].x() << " ";
43  }
44  for (label indx=0;indx<mesh.nCells();indx++)
45  {
46  gmvFile << gmvVectorField[indx].y() << " ";
47  }
48  for (label indx=0;indx<mesh.nCells();indx++)
49  {
50  gmvFile << gmvVectorField[indx].z() << " ";
51  }
52  gmvFile << nl;
53  }
54  }
55 
56  if (fieldTypes[i] == "surfaceScalarField")
57  {
58  // ...
59  }
60 
61  }
62 
63  if (fieldTypes[i] == cloud::prefix)
64  {
65  IOobject lagrangianHeader
66  (
67  "positions",
68  runTime.timeName(),
69  cloud::prefix,
70  mesh,
71  IOobject::NO_READ
72  );
73 
74  if (lagrangianHeader.headerOk())
75  {
76  Cloud<passiveParticle> particles(mesh);
77 
78  IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
79 
80  wordList lagrangianScalarNames = objects.names("scalarField");
81  wordList lagrangianVectorNames = objects.names("vectorField");
82 
83  if (particles.size())
84  {
85 # include "gmvOutputLagrangian.H"
86  }
87  }
88  }
89 
90  if (fieldTypes[i] == "volScalarField")
91  {
92  gmvFile << "endvars" << nl;
93  }
94 }
95 
96 // ************************ vim: set sw=4 sts=4 et: ************************ //