35 #ifndef Foam_transform_H 36 #define Foam_transform_H 40 #include <type_traits> 56 const scalar
s = n1 & n2;
58 const scalar magSqrN3 =
magSqr(n3);
66 + (1 -
s)*
sqr(n3)/magSqrN3
87 const scalar
s =
sin(omega);
88 const scalar
c =
cos(omega);
101 const scalar
s =
sin(omega);
102 const scalar
c =
cos(omega);
113 inline tensor Rz(
const scalar omega)
116 const scalar
c =
cos(omega);
129 const scalar
s =
sin(omega);
130 const scalar
c =
cos(omega);
134 sqr(a.x())*(1 -
c) +
c,
135 a.y()*a.x()*(1 -
c) + a.z()*
s,
136 a.x()*a.z()*(1 -
c) - a.y()*
s,
138 a.x()*a.y()*(1 -
c) - a.z()*
s,
139 sqr(a.y())*(1 -
c) +
c,
140 a.y()*a.z()*(1 -
c) + a.x()*
s,
142 a.x()*a.z()*(1 -
c) + a.y()*
s,
143 a.y()*a.z()*(1 -
c) - a.x()*
s,
144 sqr(a.z())*(1 -
c) +
c 151 constexpr
typename std::enable_if<std::is_arithmetic<T>::value,
T>
::type 159 constexpr
typename std::enable_if<std::is_arithmetic<T>::value,
T>
::type 191 (tt.xx()*t.xx() + tt.xy()*t.yx() + tt.xz()*t.zx())*tt.xx()
192 + (tt.xx()*t.xy() + tt.xy()*t.yy() + tt.xz()*t.zy())*tt.xy()
193 + (tt.xx()*t.xz() + tt.xy()*t.yz() + tt.xz()*t.zz())*tt.xz(),
195 (tt.xx()*t.xx() + tt.xy()*t.yx() + tt.xz()*t.zx())*tt.yx()
196 + (tt.xx()*t.xy() + tt.xy()*t.yy() + tt.xz()*t.zy())*tt.yy()
197 + (tt.xx()*t.xz() + tt.xy()*t.yz() + tt.xz()*t.zz())*tt.yz(),
199 (tt.xx()*t.xx() + tt.xy()*t.yx() + tt.xz()*t.zx())*tt.zx()
200 + (tt.xx()*t.xy() + tt.xy()*t.yy() + tt.xz()*t.zy())*tt.zy()
201 + (tt.xx()*t.xz() + tt.xy()*t.yz() + tt.xz()*t.zz())*tt.zz(),
203 (tt.yx()*t.xx() + tt.yy()*t.yx() + tt.yz()*t.zx())*tt.xx()
204 + (tt.yx()*t.xy() + tt.yy()*t.yy() + tt.yz()*t.zy())*tt.xy()
205 + (tt.yx()*t.xz() + tt.yy()*t.yz() + tt.yz()*t.zz())*tt.xz(),
207 (tt.yx()*t.xx() + tt.yy()*t.yx() + tt.yz()*t.zx())*tt.yx()
208 + (tt.yx()*t.xy() + tt.yy()*t.yy() + tt.yz()*t.zy())*tt.yy()
209 + (tt.yx()*t.xz() + tt.yy()*t.yz() + tt.yz()*t.zz())*tt.yz(),
211 (tt.yx()*t.xx() + tt.yy()*t.yx() + tt.yz()*t.zx())*tt.zx()
212 + (tt.yx()*t.xy() + tt.yy()*t.yy() + tt.yz()*t.zy())*tt.zy()
213 + (tt.yx()*t.xz() + tt.yy()*t.yz() + tt.yz()*t.zz())*tt.zz(),
215 (tt.zx()*t.xx() + tt.zy()*t.yx() + tt.zz()*t.zx())*tt.xx()
216 + (tt.zx()*t.xy() + tt.zy()*t.yy() + tt.zz()*t.zy())*tt.xy()
217 + (tt.zx()*t.xz() + tt.zy()*t.yz() + tt.zz()*t.zz())*tt.xz(),
219 (tt.zx()*t.xx() + tt.zy()*t.yx() + tt.zz()*t.zx())*tt.yx()
220 + (tt.zx()*t.xy() + tt.zy()*t.yy() + tt.zz()*t.zy())*tt.yy()
221 + (tt.zx()*t.xz() + tt.zy()*t.yz() + tt.zz()*t.zz())*tt.yz(),
223 (tt.zx()*t.xx() + tt.zy()*t.yx() + tt.zz()*t.zx())*tt.zx()
224 + (tt.zx()*t.xy() + tt.zy()*t.yy() + tt.zz()*t.zy())*tt.zy()
225 + (tt.zx()*t.xz() + tt.zy()*t.yz() + tt.zz()*t.zz())*tt.zz()
237 (tt.xx()*t.xx() + tt.yx()*t.yx() + tt.zx()*t.zx())*tt.xx()
238 + (tt.xx()*t.xy() + tt.yx()*t.yy() + tt.zx()*t.zy())*tt.yx()
239 + (tt.xx()*t.xz() + tt.yx()*t.yz() + tt.zx()*t.zz())*tt.zx(),
241 (tt.xx()*t.xx() + tt.yx()*t.yx() + tt.zx()*t.zx())*tt.xy()
242 + (tt.xx()*t.xy() + tt.yx()*t.yy() + tt.zx()*t.zy())*tt.yy()
243 + (tt.xx()*t.xz() + tt.yx()*t.yz() + tt.zx()*t.zz())*tt.zy(),
245 (tt.xx()*t.xx() + tt.yx()*t.yx() + tt.zx()*t.zx())*tt.xz()
246 + (tt.xx()*t.xy() + tt.yx()*t.yy() + tt.zx()*t.zy())*tt.yz()
247 + (tt.xx()*t.xz() + tt.yx()*t.yz() + tt.zx()*t.zz())*tt.zz(),
249 (tt.xy()*t.xx() + tt.yy()*t.yx() + tt.zy()*t.zx())*tt.xx()
250 + (tt.xy()*t.xy() + tt.yy()*t.yy() + tt.zy()*t.zy())*tt.yx()
251 + (tt.xy()*t.xz() + tt.yy()*t.yz() + tt.zy()*t.zz())*tt.zx(),
253 (tt.xy()*t.xx() + tt.yy()*t.yx() + tt.zy()*t.zx())*tt.xy()
254 + (tt.xy()*t.xy() + tt.yy()*t.yy() + tt.zy()*t.zy())*tt.yy()
255 + (tt.xy()*t.xz() + tt.yy()*t.yz() + tt.zy()*t.zz())*tt.zy(),
257 (tt.xy()*t.xx() + tt.yy()*t.yx() + tt.zy()*t.zx())*tt.xz()
258 + (tt.xy()*t.xy() + tt.yy()*t.yy() + tt.zy()*t.zy())*tt.yz()
259 + (tt.xy()*t.xz() + tt.yy()*t.yz() + tt.zy()*t.zz())*tt.zz(),
261 (tt.xz()*t.xx() + tt.yz()*t.yx() + tt.zz()*t.zx())*tt.xx()
262 + (tt.xz()*t.xy() + tt.yz()*t.yy() + tt.zz()*t.zy())*tt.yx()
263 + (tt.xz()*t.xz() + tt.yz()*t.yz() + tt.zz()*t.zz())*tt.zx(),
265 (tt.xz()*t.xx() + tt.yz()*t.yx() + tt.zz()*t.zx())*tt.xy()
266 + (tt.xz()*t.xy() + tt.yz()*t.yy() + tt.zz()*t.zy())*tt.yy()
267 + (tt.xz()*t.xz() + tt.yz()*t.yz() + tt.zz()*t.zz())*tt.zy(),
269 (tt.xz()*t.xx() + tt.yz()*t.yx() + tt.zz()*t.zx())*tt.xz()
270 + (tt.xz()*t.xy() + tt.yz()*t.yy() + tt.zz()*t.zy())*tt.yz()
271 + (tt.xz()*t.xz() + tt.yz()*t.yz() + tt.zz()*t.zz())*tt.zz()
281 const SphericalTensor<Cmpt>& st
293 const SphericalTensor<Cmpt>& st
307 (tt.xx()*st.
xx() + tt.xy()*st.
xy() + tt.xz()*st.
xz())*tt.xx()
308 + (tt.xx()*st.
xy() + tt.xy()*st.
yy() + tt.xz()*st.
yz())*tt.xy()
309 + (tt.xx()*st.
xz() + tt.xy()*st.
yz() + tt.xz()*st.
zz())*tt.xz(),
311 (tt.xx()*st.
xx() + tt.xy()*st.
xy() + tt.xz()*st.
xz())*tt.yx()
312 + (tt.xx()*st.
xy() + tt.xy()*st.
yy() + tt.xz()*st.
yz())*tt.yy()
313 + (tt.xx()*st.
xz() + tt.xy()*st.
yz() + tt.xz()*st.
zz())*tt.yz(),
315 (tt.xx()*st.
xx() + tt.xy()*st.
xy() + tt.xz()*st.
xz())*tt.zx()
316 + (tt.xx()*st.
xy() + tt.xy()*st.
yy() + tt.xz()*st.
yz())*tt.zy()
317 + (tt.xx()*st.
xz() + tt.xy()*st.
yz() + tt.xz()*st.
zz())*tt.zz(),
319 (tt.yx()*st.
xx() + tt.yy()*st.
xy() + tt.yz()*st.
xz())*tt.yx()
320 + (tt.yx()*st.
xy() + tt.yy()*st.
yy() + tt.yz()*st.
yz())*tt.yy()
321 + (tt.yx()*st.
xz() + tt.yy()*st.
yz() + tt.yz()*st.
zz())*tt.yz(),
323 (tt.yx()*st.
xx() + tt.yy()*st.
xy() + tt.yz()*st.
xz())*tt.zx()
324 + (tt.yx()*st.
xy() + tt.yy()*st.
yy() + tt.yz()*st.
yz())*tt.zy()
325 + (tt.yx()*st.
xz() + tt.yy()*st.
yz() + tt.yz()*st.
zz())*tt.zz(),
327 (tt.zx()*st.
xx() + tt.zy()*st.
xy() + tt.zz()*st.
xz())*tt.zx()
328 + (tt.zx()*st.
xy() + tt.zy()*st.
yy() + tt.zz()*st.
yz())*tt.zy()
329 + (tt.zx()*st.
xz() + tt.zy()*st.
yz() + tt.zz()*st.
zz())*tt.zz()
337 inline SymmTensor<Cmpt>
340 return SymmTensor<Cmpt>
342 (tt.xx()*st.xx() + tt.yx()*st.xy() + tt.zx()*st.xz())*tt.xx()
343 + (tt.xx()*st.xy() + tt.yx()*st.yy() + tt.zx()*st.yz())*tt.yx()
344 + (tt.xx()*st.xz() + tt.yx()*st.yz() + tt.zx()*st.zz())*tt.zx(),
346 (tt.xx()*st.xx() + tt.yx()*st.xy() + tt.zx()*st.xz())*tt.xy()
347 + (tt.xx()*st.xy() + tt.yx()*st.yy() + tt.zx()*st.yz())*tt.yy()
348 + (tt.xx()*st.xz() + tt.yx()*st.yz() + tt.zx()*st.zz())*tt.zy(),
350 (tt.xx()*st.xx() + tt.yx()*st.xy() + tt.zx()*st.xz())*tt.xz()
351 + (tt.xx()*st.xy() + tt.yx()*st.yy() + tt.zx()*st.yz())*tt.yz()
352 + (tt.xx()*st.xz() + tt.yx()*st.yz() + tt.zx()*st.zz())*tt.zz(),
354 (tt.xy()*st.xx() + tt.yy()*st.xy() + tt.zy()*st.xz())*tt.xy()
355 + (tt.xy()*st.xy() + tt.yy()*st.yy() + tt.zy()*st.yz())*tt.yy()
356 + (tt.xy()*st.xz() + tt.yy()*st.yz() + tt.zy()*st.zz())*tt.zy(),
358 (tt.xy()*st.xx() + tt.yy()*st.xy() + tt.zy()*st.xz())*tt.xz()
359 + (tt.xy()*st.xy() + tt.yy()*st.yy() + tt.zy()*st.yz())*tt.yz()
360 + (tt.xy()*st.xz() + tt.yy()*st.yz() + tt.zy()*st.zz())*tt.zz(),
362 (tt.xz()*st.xx() + tt.yz()*st.xy() + tt.zz()*st.xz())*tt.xz()
363 + (tt.xz()*st.xy() + tt.yz()*st.yy() + tt.zz()*st.yz())*tt.yz()
364 + (tt.xz()*st.xz() + tt.yz()*st.yz() + tt.zz()*st.zz())*tt.zz()
369 template<
class Type1,
class Type2>
407 const scalar cos_angle = vec & e0;
408 const scalar sin_angle = vec & e1;
410 if (sin_angle < -SMALL)
const Cmpt & xz() const noexcept
A templated (3 x 3) symmetric tensor of objects of <T>, effectively containing 6 elements, derived from VectorSpace.
dimensionSet invTransform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
scalar pseudoAngle(const vector &e0, const vector &e1, const vector &vec)
Estimate angle of vec in coordinate system (e0, e1, e0^e1).
dimensionedSymmTensor sqr(const dimensionedVector &dv)
sphericalTensor transformMask< sphericalTensor >(const symmTensor &st)
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a DiagTensor as a SphericalTensor.
const Cmpt & zz() const noexcept
tensor Rz(const scalar omega)
Rotational transformation tensor about the z-axis by omega radians.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
dimensionedScalar cos(const dimensionedScalar &ds)
symmTensor transformMask< symmTensor >(const symmTensor &st)
static const Identity< scalar > I
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
const Cmpt & xx() const noexcept
constexpr scalar piByTwo(0.5 *M_PI)
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross-product operators.
dimensionedScalar sin(const dimensionedScalar &ds)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
tensor Ry(const scalar omega)
Rotational transformation tensor about the y-axis by omega radians.
Type1 transformMask(const Type2 &t)
const Cmpt & yy() const noexcept
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
const dimensionedScalar c
Speed of light in a vacuum.
tensor Ra(const vector &a, const scalar omega)
Rotational transformation tensor about axis a by omega radians.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
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))
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Tensor of scalars, i.e. Tensor<scalar>.
tensor Rx(const scalar omega)
Rotational transformation tensor about the x-axis by omega radians.
const Cmpt & xy() const noexcept
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
const Cmpt & yz() const noexcept