1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 Removes all but one cells of the mesh. Used to generate mesh and fields
29 that can be used for boundary-only data.
30 Might easily result in illegal mesh though so only look at boundaries
33 \*---------------------------------------------------------------------------*/
38 #include "volFields.H"
40 #include "ReadFields.H"
41 #include "singleCellFvMesh.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 template<class GeoField>
48 void interpolateFields
50 const singleCellFvMesh& scMesh,
51 const PtrList<GeoField>& flds
56 tmp<GeoField> scFld = scMesh.interpolate(flds[i]);
57 GeoField* scFldPtr = scFld.ptr();
58 scFldPtr->writeOpt() = IOobject::AUTO_WRITE;
66 int main(int argc, char *argv[])
68 # include "addOverwriteOption.H"
69 # include "addTimeOptions.H"
71 # include "setRootCase.H"
72 # include "createTime.H"
74 instantList Times = runTime.times();
75 # include "checkTimeOptions.H"
76 runTime.setTime(Times[startTime], startTime);
77 # include "createMesh.H"
78 const word oldInstance = mesh.pointsInstance();
80 const bool overwrite = args.optionFound("overwrite");
83 // Read objects in time directory
84 IOobjectList objects(mesh, runTime.timeName());
87 PtrList<volScalarField> vsFlds;
88 ReadFields(mesh, objects, vsFlds);
90 PtrList<volVectorField> vvFlds;
91 ReadFields(mesh, objects, vvFlds);
93 PtrList<volSphericalTensorField> vstFlds;
94 ReadFields(mesh, objects, vstFlds);
96 PtrList<volSymmTensorField> vsymtFlds;
97 ReadFields(mesh, objects, vsymtFlds);
99 PtrList<volTensorField> vtFlds;
100 ReadFields(mesh, objects, vtFlds);
109 singleCellFvMesh scMesh
114 mesh.polyMesh::instance(),
123 // Map and store the fields on the scMesh.
124 interpolateFields(scMesh, vsFlds);
125 interpolateFields(scMesh, vvFlds);
126 interpolateFields(scMesh, vstFlds);
127 interpolateFields(scMesh, vsymtFlds);
128 interpolateFields(scMesh, vtFlds);
132 Info<< "Writing mesh to time " << runTime.timeName() << endl;
136 Info<< "End\n" << endl;
142 // ************************************************************************* //