SphericalTensorI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "Vector.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 template<class Cmpt>
37 {}
38 
39 
40 template<class Cmpt>
41 template<class Cmpt2>
43 (
44  const VectorSpace<SphericalTensor<Cmpt2>, Cmpt2, 1>& vs
45 )
46 :
48 {}
49 
50 
51 template<class Cmpt>
53 {
54  this->v_[II] = stii;
55 }
56 
57 
58 template<class Cmpt>
60 :
61  VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>(is)
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 
67 template<class Cmpt>
68 inline const Cmpt& SphericalTensor<Cmpt>::ii() const
69 {
70  return this->v_[II];
71 }
72 
73 
74 template<class Cmpt>
75 inline Cmpt& SphericalTensor<Cmpt>::ii()
76 {
77  return this->v_[II];
78 }
79 
80 
81 template<class Cmpt>
83 {
84  return *this;
85 }
86 
87 
88 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
89 
90 //- Inner-product between two spherical tensors
91 template<class Cmpt>
94 {
95  return SphericalTensor<Cmpt>(st1.ii()*st2.ii());
96 }
97 
98 
99 //- Inner-product between a spherical tensor and a vector
100 template<class Cmpt>
101 inline Vector<Cmpt>
103 {
104  return Vector<Cmpt>
105  (
106  st.ii()*v.x(),
107  st.ii()*v.y(),
108  st.ii()*v.z()
109  );
110 }
111 
112 
113 //- Inner-product between a vector and a spherical tensor
114 template<class Cmpt>
115 inline Vector<Cmpt>
117 {
118  return Vector<Cmpt>
119  (
120  v.x()*st.ii(),
121  v.y()*st.ii(),
122  v.z()*st.ii()
123  );
124 }
125 
126 
127 //- Double-dot-product between a spherical tensor and a spherical tensor
128 template<class Cmpt>
129 inline Cmpt
131 {
132  return 3*st1.ii()*st2.ii();
133 }
134 
135 
136 //- Division of a scalar by a sphericalTensor
137 template<class Cmpt>
138 inline SphericalTensor<Cmpt>
139 operator/(const scalar s, const SphericalTensor<Cmpt>& st)
140 {
141  return SphericalTensor<Cmpt>(s/st.ii());
142 }
143 
144 
145 template<class Cmpt>
146 inline Cmpt magSqr(const SphericalTensor<Cmpt>& st)
147 {
148  return 3*magSqr(st.ii());
149 }
150 
151 
152 //- Return the trace of a spherical tensor
153 template<class Cmpt>
154 inline Cmpt tr(const SphericalTensor<Cmpt>& st)
155 {
156  return 3*st.ii();
157 }
158 
159 
160 //- Return the spherical part of a spherical tensor, i.e. itself
161 template<class Cmpt>
163 {
164  return st;
165 }
166 
167 
168 //- Return the determinant of a spherical tensor
169 template<class Cmpt>
170 inline Cmpt det(const SphericalTensor<Cmpt>& st)
171 {
172  return st.ii()*st.ii()*st.ii();
173 }
174 
175 
176 //- Return the inverse of a spherical tensor
177 template<class Cmpt>
179 {
180  return SphericalTensor<Cmpt>(1.0/st.ii());
181 }
182 
183 
184 template<class Cmpt>
185 class outerProduct<SphericalTensor<Cmpt>, Cmpt>
186 {
187 public:
188 
190 };
191 
192 template<class Cmpt>
193 class outerProduct<Cmpt, SphericalTensor<Cmpt> >
194 {
195 public:
196 
198 };
199 
200 
201 template<class Cmpt>
203 {
204 public:
205 
207 };
208 
209 
210 template<class Cmpt>
211 class innerProduct<SphericalTensor<Cmpt>, Vector<Cmpt> >
212 {
213 public:
214 
216 };
217 
218 template<class Cmpt>
219 class innerProduct<Vector<Cmpt>, SphericalTensor<Cmpt> >
220 {
221 public:
222 
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // ************************************************************************* //
Foam::innerProduct< Vector< Cmpt >, SphericalTensor< Cmpt > >::type
Vector< Cmpt > type
Definition: SphericalTensorI.H:223
Foam::SphericalTensor::ii
const Cmpt & ii() const
Definition: SphericalTensorI.H:68
Foam::operator&
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Foam::SphericalTensor::T
const SphericalTensor< Cmpt > & T() const
Transpose.
Definition: SphericalTensorI.H:82
Foam::innerProduct
Definition: products.H:89
Vector.H
Foam::VectorSpace
Templated vector space.
Definition: VectorSpace.H:52
Foam::outerProduct< SphericalTensor< Cmpt >, Cmpt >::type
SphericalTensor< Cmpt > type
Definition: SphericalTensorI.H:189
Foam::outerProduct< Cmpt, SphericalTensor< Cmpt > >::type
SphericalTensor< Cmpt > type
Definition: SphericalTensorI.H:197
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::inv
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:71
Foam::innerProduct< SphericalTensor< Cmpt >, SphericalTensor< Cmpt > >::type
SphericalTensor< Cmpt > type
Definition: SphericalTensorI.H:206
Foam::sph
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a diagonal tensor.
Definition: DiagTensorI.H:281
Foam::innerProduct< SphericalTensor< Cmpt >, Vector< Cmpt > >::type
Vector< Cmpt > type
Definition: SphericalTensorI.H:215
Foam::operator&&
dimensioned< typename scalarProduct< Type1, Type2 >::type > operator&&(const dimensioned< Type1 > &, const dimensioned< Type2 > &)
Foam::Vector::x
const Cmpt & x() const
Definition: VectorI.H:65
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::Vector::z
const Cmpt & z() const
Definition: VectorI.H:77
s
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::SphericalTensor
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
Definition: SphericalTensor.H:51
Foam::operator/
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
Definition: dimensionedScalar.C:65
Foam::SphericalTensor::SphericalTensor
SphericalTensor()
Construct null.
Definition: SphericalTensorI.H:36
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:57
Foam::Vector::y
const Cmpt & y() const
Definition: VectorI.H:71
Foam::tr
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:49
Foam::det
dimensionedScalar det(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:60
Vector
Definition: Test-Field.H:4
Foam::magSqr
dimensioned< scalar > magSqr(const dimensioned< Type > &)
Foam::outerProduct
Definition: products.H:64