fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / OpenFOAM / coordinateSystems / coordinateRotation / STARCDCoordinateRotation.C
blob524eb18c5b5c8ef380f77ca67cda5ee6d3063408
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "STARCDCoordinateRotation.H"
29 #include "Switch.H"
30 #include "mathematicalConstants.H"
31 #include "dictionary.H"
32 #include "addToRunTimeSelectionTable.H"
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 namespace Foam
38     defineTypeNameAndDebug(STARCDCoordinateRotation, 0);
39     addToRunTimeSelectionTable
40     (
41         coordinateRotation,
42         STARCDCoordinateRotation,
43         dictionary
44     );
48 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
50 void Foam::STARCDCoordinateRotation::calcTransform
52     const scalar rotZ,
53     const scalar rotX,
54     const scalar rotY,
55     const bool inDegrees
58     scalar x = rotX;
59     scalar y = rotY;
60     scalar z = rotZ;
62     if (inDegrees)
63     {
64         x *= mathematicalConstant::pi/180.0;
65         y *= mathematicalConstant::pi/180.0;
66         z *= mathematicalConstant::pi/180.0;
67     }
69     tensor::operator=
70     (
71         tensor
72         (
73             cos(y)*cos(z) - sin(x)*sin(y)*sin(z),
74             -cos(x)*sin(z),
75             sin(x)*cos(y)*sin(z) + sin(y)*cos(z),
77             cos(y)*sin(z) + sin(x)*sin(y)*cos(z),
78             cos(x)*cos(z),
79             sin(y)*sin(z) - sin(x)*cos(y)*cos(z),
81             -cos(x)*sin(y),
82             sin(x),
83             cos(x)*cos(y)
84         )
85     );
89 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
91 Foam::STARCDCoordinateRotation::STARCDCoordinateRotation()
93     coordinateRotation()
97 Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
99     const vector& rotZrotXrotY,
100     const bool inDegrees
103     coordinateRotation()
105     calcTransform
106     (
107         rotZrotXrotY.component(vector::X),
108         rotZrotXrotY.component(vector::Y),
109         rotZrotXrotY.component(vector::Z),
110         inDegrees
111     );
115 Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
117     const scalar rotZ,
118     const scalar rotX,
119     const scalar rotY,
120     const bool inDegrees
123     coordinateRotation()
125     calcTransform(rotZ, rotX, rotY, inDegrees);
129 Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
131     const dictionary& dict
134     coordinateRotation()
136     vector rotation(dict.lookup("rotation"));
138     calcTransform
139     (
140         rotation.component(vector::X),
141         rotation.component(vector::Y),
142         rotation.component(vector::Z),
143         dict.lookupOrDefault<Switch>("degrees", true)
144     );
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //