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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "Vector.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class Cmpt>
34 {}
35 
36 
37 template<class Cmpt>
39 :
41 {}
42 
43 
44 template<class Cmpt>
45 template<class Cmpt2>
47 (
48  const VectorSpace<SphericalTensor<Cmpt2>, Cmpt2, 1>& vs
49 )
50 :
52 {}
53 
54 
55 template<class Cmpt>
57 {
58  this->v_[II] = stii;
59 }
60 
61 
62 template<class Cmpt>
64 :
66 {}
67 
68 
69 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
70 
71 template<class Cmpt>
72 inline const Cmpt& Foam::SphericalTensor<Cmpt>::ii() const
73 {
74  return this->v_[II];
75 }
76 
77 
78 template<class Cmpt>
80 {
81  return this->v_[II];
82 }
83 
84 
85 template<class Cmpt>
86 inline const Foam::SphericalTensor<Cmpt>&
88 {
89  return *this;
90 }
91 
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 namespace Foam
96 {
97 
98 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
99 
100 //- Inner-product between two spherical tensors
101 template<class Cmpt>
104 {
105  return SphericalTensor<Cmpt>(st1.ii()*st2.ii());
106 }
107 
108 
109 //- Inner-product between a spherical tensor and a vector
110 template<class Cmpt>
111 inline Vector<Cmpt>
113 {
114  return Vector<Cmpt>
115  (
116  st.ii()*v.x(),
117  st.ii()*v.y(),
118  st.ii()*v.z()
119  );
120 }
121 
122 
123 //- Inner-product between a vector and a spherical tensor
124 template<class Cmpt>
125 inline Vector<Cmpt>
127 {
128  return Vector<Cmpt>
129  (
130  v.x()*st.ii(),
131  v.y()*st.ii(),
132  v.z()*st.ii()
133  );
134 }
135 
136 
137 //- Double-dot-product between a spherical tensor and a spherical tensor
138 template<class Cmpt>
139 inline Cmpt
141 {
142  return 3*st1.ii()*st2.ii();
143 }
144 
145 
146 //- Division of a scalar by a sphericalTensor
147 template<class Cmpt>
148 inline SphericalTensor<Cmpt>
149 operator/(const scalar s, const SphericalTensor<Cmpt>& st)
150 {
151  return SphericalTensor<Cmpt>(s/st.ii());
152 }
153 
154 
155 template<class Cmpt>
156 inline Cmpt magSqr(const SphericalTensor<Cmpt>& st)
157 {
158  return 3*magSqr(st.ii());
159 }
160 
161 
162 template<class Cmpt>
163 inline Cmpt cmptMax(const SphericalTensor<Cmpt>& st)
164 {
165  return st.ii();
166 }
167 
168 
169 template<class Cmpt>
170 inline Cmpt cmptMin(const SphericalTensor<Cmpt>& st)
171 {
172  return st.ii();
173 }
174 
175 
176 template<class Cmpt>
177 inline Cmpt cmptSum(const SphericalTensor<Cmpt>& st)
178 {
179  return 3*st.ii();
180 }
181 
182 
183 template<class Cmpt>
184 inline Cmpt cmptAv(const SphericalTensor<Cmpt>& st)
185 {
186  return st.ii();
187 }
188 
189 
190 //- Return the trace of a spherical tensor
191 template<class Cmpt>
192 inline Cmpt tr(const SphericalTensor<Cmpt>& st)
193 {
194  return 3*st.ii();
195 }
196 
197 
198 //- Return the spherical part of a spherical tensor, i.e. itself
199 template<class Cmpt>
201 {
202  return st;
203 }
204 
205 
206 //- Return the determinant of a spherical tensor
207 template<class Cmpt>
208 inline Cmpt det(const SphericalTensor<Cmpt>& st)
209 {
210  return st.ii()*st.ii()*st.ii();
211 }
212 
213 
214 //- Return the inverse of a spherical tensor
215 template<class Cmpt>
217 {
218  return SphericalTensor<Cmpt>(1.0/st.ii());
219 }
220 
221 
222 template<class Cmpt>
223 class outerProduct<SphericalTensor<Cmpt>, Cmpt>
224 {
225 public:
226 
228 };
229 
230 template<class Cmpt>
231 class outerProduct<Cmpt, SphericalTensor<Cmpt>>
232 {
233 public:
234 
236 };
237 
238 
239 template<class Cmpt>
241 {
242 public:
243 
245 };
246 
247 
248 template<class Cmpt>
250 {
251 public:
252 
254 };
255 
256 template<class Cmpt>
258 {
259 public:
260 
262 };
263 
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 } // End namespace Foam
268 
269 // ************************************************************************* //
Foam::innerProduct< Vector< Cmpt >, SphericalTensor< Cmpt > >::type
Vector< Cmpt > type
Definition: SphericalTensorI.H:261
Foam::Vector::x
const Cmpt & x() const
Access to the vector x component.
Definition: VectorI.H:78
Foam::SphericalTensor::T
const SphericalTensor< Cmpt > & T() const
Transpose.
Definition: SphericalTensorI.H:87
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
Definition: gmvOutputSpray.H:25
Foam::operator&
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
Foam::innerProduct
Definition: products.H:141
Vector.H
Foam::Vector::z
const Cmpt & z() const
Access to the vector z component.
Definition: VectorI.H:90
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::VectorSpace
Templated vector space.
Definition: VectorSpace.H:56
Foam::cmptMin
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:302
Foam::outerProduct< SphericalTensor< Cmpt >, Cmpt >::type
SphericalTensor< Cmpt > type
Definition: SphericalTensorI.H:227
Foam::cmptMax
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:253
Foam::outerProduct< Cmpt, SphericalTensor< Cmpt > >::type
SphericalTensor< Cmpt > type
Definition: SphericalTensorI.H:235
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::inv
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:73
Foam::cmptAv
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:246
Foam::innerProduct< SphericalTensor< Cmpt >, SphericalTensor< Cmpt > >::type
SphericalTensor< Cmpt > type
Definition: SphericalTensorI.H:244
Foam::sph
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a diagonal tensor.
Definition: DiagTensorI.H:290
Foam::innerProduct< SphericalTensor< Cmpt >, Vector< Cmpt > >::type
Vector< Cmpt > type
Definition: SphericalTensorI.H:253
Foam::operator&&
dimensioned< typename scalarProduct< Type1, Type2 >::type > operator&&(const dimensioned< Type1 > &, const dimensioned< Type2 > &)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cmptSum
Cmpt cmptSum(const SphericalTensor< Cmpt > &st)
Definition: SphericalTensorI.H:177
Foam::SphericalTensor::ii
const Cmpt & ii() const
Definition: SphericalTensorI.H:72
Foam::SphericalTensor
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
Definition: SphericalTensor.H:55
Foam::operator/
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
Definition: dimensionedScalar.C:68
Foam::SphericalTensor::SphericalTensor
SphericalTensor()
Construct null.
Definition: SphericalTensorI.H:33
Foam::Vector::y
const Cmpt & y() const
Access to the vector y component.
Definition: VectorI.H:84
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:62
Foam::tr
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:51
Foam::det
dimensionedScalar det(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:62
Foam::outerProduct
Definition: products.H:106
Foam::zero
A class representing the concept of 0 (zero), which can be used to avoid manipulating objects that ar...
Definition: zero.H:61