Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 #include <OpenFOAM/argList.H>
00070 #include <OpenFOAM/timeSelector.H>
00071 #include <OpenFOAM/Time.H>
00072 #include <finiteVolume/fvMesh.H>
00073 #include <finiteVolume/volFields.H>
00074 #include <finiteVolume/surfaceFields.H>
00075 #include <OpenFOAM/transformGeometricField.H>
00076 #include <OpenFOAM/IOobjectList.H>
00077
00078 using namespace Foam;
00079
00080 template<class GeometricField>
00081 void RotateFields
00082 (
00083 const fvMesh& mesh,
00084 const IOobjectList& objects,
00085 const tensor& T
00086 )
00087 {
00088
00089 IOobjectList fields(objects.lookupClass(GeometricField::typeName));
00090
00091 forAllIter(IOobjectList, fields, fieldIter)
00092 {
00093 Info<< " Rotating " << fieldIter()->name() << endl;
00094
00095 GeometricField theta(*fieldIter(), mesh);
00096 transform(theta, dimensionedTensor(T), theta);
00097 theta.write();
00098 }
00099 }
00100
00101
00102
00103
00104 int main(int argc, char *argv[])
00105 {
00106 timeSelector::addOptions();
00107
00108 argList::validArgs.append("n1");
00109 argList::validArgs.append("n2");
00110
00111 # include <OpenFOAM/setRootCase.H>
00112 # include <OpenFOAM/createTime.H>
00113
00114 vector n1(IStringStream(args.additionalArgs()[0])());
00115 n1 /= mag(n1);
00116
00117 vector n2(IStringStream(args.additionalArgs()[1])());
00118 n2 /= mag(n2);
00119
00120 tensor T = rotationTensor(n1, n2);
00121
00122 {
00123 pointIOField points
00124 (
00125 IOobject
00126 (
00127 "points",
00128 runTime.findInstance(polyMesh::meshSubDir, "points"),
00129 polyMesh::meshSubDir,
00130 runTime,
00131 IOobject::MUST_READ,
00132 IOobject::NO_WRITE,
00133 false
00134 )
00135 );
00136
00137 points = transform(T, points);
00138
00139
00140 IOstream::defaultPrecision(10);
00141
00142 Info << "Writing points into directory " << points.path() << nl << endl;
00143 points.write();
00144 }
00145
00146
00147 instantList timeDirs = timeSelector::select0(runTime, args);
00148
00149 # include <OpenFOAM/createMesh.H>
00150
00151
00152 forAll(timeDirs, timeI)
00153 {
00154 runTime.setTime(timeDirs[timeI], timeI);
00155
00156 Info<< "Time = " << runTime.timeName() << endl;
00157
00158
00159 IOobjectList objects(mesh, runTime.timeName());
00160
00161 RotateFields<volVectorField>(mesh, objects, T);
00162 RotateFields<volSphericalTensorField>(mesh, objects, T);
00163 RotateFields<volSymmTensorField>(mesh, objects, T);
00164 RotateFields<volTensorField>(mesh, objects, T);
00165
00166 RotateFields<surfaceVectorField>(mesh, objects, T);
00167 RotateFields<surfaceSphericalTensorField>(mesh, objects, T);
00168 RotateFields<surfaceSymmTensorField>(mesh, objects, T);
00169 RotateFields<surfaceTensorField>(mesh, objects, T);
00170 }
00171
00172 Info<< "\nEnd.\n" << endl;
00173
00174 return 0;
00175 }
00176
00177
00178