libMesh
src
numerics
tensor_tools.C
Go to the documentation of this file.
1
// The libMesh Finite Element Library.
2
// Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4
// This library is free software; you can redistribute it and/or
5
// modify it under the terms of the GNU Lesser General Public
6
// License as published by the Free Software Foundation; either
7
// version 2.1 of the License, or (at your option) any later version.
8
9
// This library is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
// Lesser General Public License for more details.
13
14
// You should have received a copy of the GNU Lesser General Public
15
// License along with this library; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
#include "libmesh/tensor_tools.h"
19
#include "libmesh/vector_value.h"
20
#include "libmesh/tensor_value.h"
21
#include "libmesh/type_n_tensor.h"
22
23
namespace
libMesh
24
{
25
namespace
TensorTools
26
{
27
// Needed for ExactSolution to compile
28
Number
curl_from_grad
(
const
VectorValue<Number>
&)
29
{
30
libmesh_error_msg(
"Operation not defined for scalar quantities."
);
31
}
32
33
VectorValue<Number>
curl_from_grad
(
const
TensorValue<Number>
& grad)
34
{
35
const
Number
duz_dy = grad(2,1);
36
const
Number
duy_dz = grad(1,2);
37
const
Number
dux_dz = grad(0,2);
38
const
Number
duz_dx = grad(2,0);
39
const
Number
duy_dx = grad(1,0);
40
const
Number
dux_dy = grad(0,1);
41
42
return
VectorValue<Number>
(duz_dy - duy_dz,
43
dux_dz - duz_dx,
44
duy_dx - dux_dy);
45
}
46
47
// Needed for ExactSolution to compile. Will implement when needed.
48
TensorValue<Number>
curl_from_grad
(
const
TypeNTensor<3,Number>
&
/* grad */
)
49
{
50
libmesh_not_implemented();
51
}
52
53
// Needed for ExactSolution to compile
54
Number
div_from_grad
(
const
VectorValue<Number>
&
/* grad */
)
55
{
56
libmesh_error_msg(
"Operation not defined for scalar quantities."
);
57
}
58
59
Number
div_from_grad
(
const
TensorValue<Number>
& grad )
60
{
61
const
Number
dux_dx = grad(0,0);
62
const
Number
duy_dy = grad(1,1);
63
const
Number
duz_dz = grad(2,2);
64
65
return
dux_dx + duy_dy + duz_dz;
66
}
67
68
// Needed for ExactSolution to compile. Will implement when needed.
69
VectorValue<Number>
div_from_grad
(
const
TypeNTensor<3,Number>
&
/* grad */
)
70
{
71
libmesh_not_implemented();
72
}
73
74
}
75
}
libMesh::Number
Real Number
Definition:
libmesh_common.h:195
libMesh::TensorTools::curl_from_grad
Number curl_from_grad(const VectorValue< Number > &)
Definition:
tensor_tools.C:28
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition:
factoryfunction.C:55
libMesh::TensorTools::div_from_grad
Number div_from_grad(const VectorValue< Number > &grad)
Dummy. Divergence of a scalar not defined, but is needed for ExactSolution to compile.
Definition:
tensor_tools.C:54
libMesh::VectorValue< Number >
libMesh::TensorValue
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
Definition:
exact_solution.h:53
libMesh::TypeNTensor
This class will eventually define a rank-N tensor in LIBMESH_DIM dimensional space of type T.
Definition:
tensor_tools.h:49
Generated on Sat Jan 25 2020 12:07:02 for libMesh by
1.8.16