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 Rotates the mesh and fields from the direcion n1 to the direction n2.
30 \*---------------------------------------------------------------------------*/
33 #include "timeSelector.H"
36 #include "volFields.H"
37 #include "surfaceFields.H"
38 #include "transformGeometricField.H"
39 #include "IOobjectList.H"
43 template<class GeometricField>
47 const IOobjectList& objects,
51 // Search list of objects for volScalarFields
52 IOobjectList fields(objects.lookupClass(GeometricField::typeName));
54 forAllIter(IOobjectList, fields, fieldIter)
56 Info<< " Rotating " << fieldIter()->name() << endl;
58 GeometricField theta(*fieldIter(), mesh);
59 transform(theta, dimensionedTensor(T), theta);
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 int main(int argc, char *argv[])
69 timeSelector::addOptions();
71 argList::validArgs.append("n1");
72 argList::validArgs.append("n2");
74 # include "setRootCase.H"
75 # include "createTime.H"
77 vector n1 = args.argRead<vector>(1);
80 vector n2 = args.argRead<vector>(2);
83 tensor T = rotationTensor(n1, n2);
91 runTime.findInstance(polyMesh::meshSubDir, "points"),
100 points = transform(T, points);
102 // Set the precision of the points data to 10
103 IOstream::defaultPrecision(10);
105 Info<< "Writing points into directory " << points.path() << nl << endl;
110 instantList timeDirs = timeSelector::select0(runTime, args);
112 # include "createMesh.H"
115 forAll(timeDirs, timeI)
117 runTime.setTime(timeDirs[timeI], timeI);
119 Info<< "Time = " << runTime.timeName() << endl;
121 // Search for list of objects for this time
122 IOobjectList objects(mesh, runTime.timeName());
124 RotateFields<volVectorField>(mesh, objects, T);
125 RotateFields<volSphericalTensorField>(mesh, objects, T);
126 RotateFields<volSymmTensorField>(mesh, objects, T);
127 RotateFields<volTensorField>(mesh, objects, T);
129 RotateFields<surfaceVectorField>(mesh, objects, T);
130 RotateFields<surfaceSphericalTensorField>(mesh, objects, T);
131 RotateFields<surfaceSymmTensorField>(mesh, objects, T);
132 RotateFields<surfaceTensorField>(mesh, objects, T);
135 Info<< "\nEnd.\n" << endl;
141 // ************************************************************************* //