SphericalTensor2DI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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 "Vector2D.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Cmpt>
32 {}
33 
34 
35 template<class Cmpt>
37 :
39 {}
40 
41 
42 template<class Cmpt>
44 (
45  const VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>& vs
46 )
47 :
49 {}
50 
51 
52 template<class Cmpt>
54 {
55  this->v_[II] = stii;
56 }
57 
58 
59 template<class Cmpt>
61 :
63 {}
64 
65 
66 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67 
68 template<class Cmpt>
69 inline const Cmpt& Foam::SphericalTensor2D<Cmpt>::ii() const
70 {
71  return this->v_[II];
72 }
73 
74 
75 template<class Cmpt>
77 {
78  return this->v_[II];
79 }
80 
81 
82 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83 
84 namespace Foam
85 {
86 
87 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
88 
89 //- Inner-product between two spherical tensors
90 template<class Cmpt>
92 operator&
93 (
94  const SphericalTensor2D<Cmpt>& st1,
95  const SphericalTensor2D<Cmpt>& st2
96 )
97 {
98  return SphericalTensor2D<Cmpt>(st1.ii()*st2.ii());
99 }
100 
101 
102 //- Inner-product between a spherical tensor and a vector
103 template<class Cmpt>
104 inline Vector2D<Cmpt>
106 {
107  return Vector2D<Cmpt>
108  (
109  st.ii()*v.x(),
110  st.ii()*v.y()
111  );
112 }
113 
114 
115 //- Inner-product between a vector and a spherical tensor
116 template<class Cmpt>
117 inline Vector2D<Cmpt>
119 {
120  return Vector2D<Cmpt>
121  (
122  v.x()*st.ii(),
123  v.y()*st.ii()
124  );
125 }
126 
127 
128 //- Division of a scalar by a sphericalTensor2D
129 template<class Cmpt>
131 operator/(const scalar s, const SphericalTensor2D<Cmpt>& st)
132 {
133  return SphericalTensor2D<Cmpt>(s/st.ii());
134 }
135 
136 
137 //- Return the trace of a spherical tensor
138 template<class Cmpt>
139 inline Cmpt tr(const SphericalTensor2D<Cmpt>& st)
140 {
141  return 2*st.ii();
142 }
143 
144 
145 //- Return the spherical part of a spherical tensor, i.e. itself
146 template<class Cmpt>
148 {
149  return st;
150 }
151 
152 
153 //- Return the determinant of a spherical tensor
154 template<class Cmpt>
155 inline Cmpt det(const SphericalTensor2D<Cmpt>& st)
156 {
157  return st.ii()*st.ii();
158 }
159 
160 
161 //- Return the inverse of a symmetric tensor
162 template<class Cmpt>
164 {
165  return SphericalTensor2D<Cmpt>(1.0/st.ii());
166 }
167 
168 
169 template<class Cmpt>
170 class outerProduct<SphericalTensor2D<Cmpt>, Cmpt>
171 {
172 public:
173 
175 };
176 
177 template<class Cmpt>
178 class outerProduct<Cmpt, SphericalTensor2D<Cmpt>>
179 {
180 public:
181 
183 };
184 
185 
186 template<class Cmpt>
188 {
189 public:
190 
192 };
193 
194 
195 template<class Cmpt>
197 {
198 public:
199 
201 };
202 
203 template<class Cmpt>
205 {
206 public:
207 
209 };
210 
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 } // End namespace Foam
215 
216 // ************************************************************************* //
SphericalTensor2D()
Construct null.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Templated vector space.
Definition: VectorSpace.H:53
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
dimensionedScalar det(const dimensionedSphericalTensor &dt)
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a diagonal tensor.
Definition: DiagTensorI.H:288
const Cmpt & x() const
Definition: Vector2DI.H:68
tmp< GeometricField< Type, fvPatchField, volMesh > > operator &(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
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))
const Cmpt & y() const
Definition: Vector2DI.H:74
static const zero Zero
Definition: zero.H:97
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
const Cmpt & ii() const
Templated 2D sphericalTensor derived from VectorSpace adding construction from 1 component, element access using ii() member function and the inner-product (dot-product) and outer-product operators.
VectorSpace< SphericalTensor2D< Cmpt >, Cmpt, Ncmpts > vsType
VectorSpace type.
Definition: VectorSpace.H:87
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:49
Templated 2D Vector derived from VectorSpace adding construction from 2 components, element access using x() and y() member functions and the inner-product (dot-product).
Definition: Vector2D.H:51
Cmpt v_[Ncmpts]
The components of this vector space.
Definition: VectorSpace.H:84
Namespace for OpenFOAM.