writeFluentFields.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 InClass
27  Foam::writeFluentFields
28 
29 \*---------------------------------------------------------------------------*/
30 
31 #ifndef Foam_writeFluentFields_H
32 #define Foam_writeFluentFields_H
33 
34 #include "volFields.H"
35 #include "dictionary.H"
36 #include "IOobjectList.H"
37 #include "Ostream.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
45 (
46  const volScalarField& phi,
47  const label fluentFieldIdentifier,
48  Ostream& os
49 );
50 
52 (
53  const volVectorField& phi,
54  const label fluentFieldIdentifier,
55  Ostream& os
56 );
57 
58 
59 template<class GeoField>
61 (
62  const dictionary& dict,
63  const IOobjectList& objects,
64  const fvMesh& mesh,
65  Ostream& os
66 )
67 {
68  for (const IOobject& io : objects.csorted<GeoField>())
69  {
70  // Lookup field from dictionary and convert field
71  const word& fieldName = io.name();
72  label unitNumber;
73  if
74  (
75  dict.readIfPresent(fieldName, unitNumber)
76  && unitNumber > 0
77  )
78  {
79  // Read field
80  GeoField field(io, mesh);
81 
82  Info<< " Converting field " << fieldName << nl;
83  writeFluentField(field, unitNumber, os);
84  }
85  }
86 }
87 
88 
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 } // End namespace Foam
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 #endif
97 
98 // ************************************************************************* //
dictionary dict
rDeltaTY field()
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
Definition: IOobjectList.H:55
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:195
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
void writeFluentField(const volScalarField &phi, const label fluentFieldIdentifier, Ostream &os)
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:82
void readFieldsAndWriteFluent(const dictionary &dict, const IOobjectList &objects, const fvMesh &mesh, Ostream &os)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:81
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
OBJstream os(runTime.globalPath()/outputName)
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
messageStream Info
Information stream (stdout output on master, null elsewhere)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
UPtrList< const IOobject > csorted() const
The sorted list of IOobjects with headerClassName == Type::typeName.
Namespace for OpenFOAM.