libMesh
curl_curl_exact_solution.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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/libmesh_common.h"
19 #include "libmesh/vector_value.h"
20 
21 using namespace libMesh;
22 
23 #ifndef CURL_CURL_EXACT_SOLUTION_H
24 #define CURL_CURL_EXACT_SOLUTION_H
25 
27 {
28 public:
30 
32 
34  {
35  const Real ux = (1.0 - y*y)*(1.0 - z*z);
36  const Real uy = (1.0 - x*x)*(1.0 - z*z);
37  const Real uz = (1.0 - x*x)*(1.0 - y*y);
38 
39  return RealGradient(ux, uy, uz);
40  }
41 
43  {
44  const Real dux_dx = 0.0;
45  const Real dux_dy = (1.0 - z*z)*(-2.0*y);
46  const Real dux_dz = (1.0 - y*y)*(-2.0*z);
47 
48  const Real duy_dx = (1.0 - z*z)*(-2.0*x);
49  const Real duy_dy = 0.0;
50  const Real duy_dz = (1.0 - x*x)*(-2.0*z);
51 
52  const Real duz_dx = (1.0 - y*y)*(-2.0*x);
53  const Real duz_dy = (1.0 - x*x)*(-2.0*y);
54  const Real duz_dz = 0.0;
55 
56  return RealTensor(dux_dx, dux_dy, dux_dz, duy_dx, duy_dy, duy_dz, duz_dx, duz_dy, duz_dz);
57  }
58 
60  {
61  const Real duz_dy = (1.0 - x*x)*(-2.0*y);
62  const Real duy_dz = (1.0 - x*x)*(-2.0*z);
63 
64  const Real dux_dz = (1.0 - y*y)*(-2.0*z);
65  const Real duz_dx = (1.0 - y*y)*(-2.0*x);
66 
67  const Real dux_dy = (1.0 - z*z)*(-2.0*y);
68  const Real duy_dx = (1.0 - z*z)*(-2.0*x);
69 
70  return RealGradient(duz_dy - duy_dz, dux_dz - duz_dx, duy_dx - dux_dy);
71  }
72 
74  {
75  const Real fx = 2.0*(1.0 - y*y) + 2.0*(1.0 - z*z) + (1.0 - y*y)*(1.0 - z*z);
76  const Real fy = 2.0*(1.0 - x*x) + 2.0*(1.0 - z*z) + (1.0 - x*x)*(1.0 - z*z);
77  const Real fz = 2.0*(1.0 - x*x) + 2.0*(1.0 - y*y) + (1.0 - x*x)*(1.0 - y*y);
78 
79  return RealGradient(fx, fy, fz);
80  }
81 
82 };
83 
84 #endif // CURL_CURL_EXACT_SOLUTION_H
RealVectorValue RealGradient
RealGradient forcing(Real x, Real y, Real z)
RealTensorValue RealTensor
RealGradient curl(Real x, Real y, Real z)
The libMesh namespace provides an interface to certain functionality in the library.
RealTensor grad(Real x, Real y, Real z)
PetscErrorCode Vec x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
RealGradient operator()(Real x, Real y, Real z)
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.