1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. 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"
34 #include "objectRegistry.H"
37 #include "volFields.H"
38 #include "surfaceFields.H"
39 #include "transformGeometricField.H"
40 #include "IOobjectList.H"
44 template<class GeometricField>
48 const IOobjectList& objects,
52 // Search list of objects for volScalarFields
53 IOobjectList fields(objects.lookupClass(GeometricField::typeName));
55 forAllIter(IOobjectList, fields, fieldIter)
57 Info<< " Rotating " << fieldIter()->name() << endl;
59 GeometricField theta(*fieldIter(), mesh);
60 transform(theta, dimensionedTensor(T), theta);
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 int main(int argc, char *argv[])
70 timeSelector::addOptions();
72 argList::validArgs.append("n1");
73 argList::validArgs.append("n2");
75 # include "setRootCase.H"
76 # include "createTime.H"
78 vector n1(IStringStream(args.additionalArgs()[0])());
81 vector n2(IStringStream(args.additionalArgs()[1])());
84 tensor T = rotationTensor(n1, n2);
92 runTime.findInstance(polyMesh::meshSubDir, "points"),
101 points = transform(T, points);
103 // Set the precision of the points data to 10
104 IOstream::defaultPrecision(10);
106 Info << "Writing points into directory " << points.path() << nl << endl;
111 instantList timeDirs = timeSelector::select0(runTime, args);
113 # include "createMesh.H"
116 forAll(timeDirs, timeI)
118 runTime.setTime(timeDirs[timeI], timeI);
120 Info<< "Time = " << runTime.timeName() << endl;
122 // Search for list of objects for this time
123 IOobjectList objects(mesh, runTime.timeName());
125 RotateFields<volVectorField>(mesh, objects, T);
126 RotateFields<volSphericalTensorField>(mesh, objects, T);
127 RotateFields<volSymmTensorField>(mesh, objects, T);
128 RotateFields<volTensorField>(mesh, objects, T);
130 RotateFields<surfaceVectorField>(mesh, objects, T);
131 RotateFields<surfaceSphericalTensorField>(mesh, objects, T);
132 RotateFields<surfaceSymmTensorField>(mesh, objects, T);
133 RotateFields<surfaceTensorField>(mesh, objects, T);
136 Info<< "\nEnd.\n" << endl;
142 // ************************************************************************* //