libMesh
curl_curl_exact_solution.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 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 #ifndef CURL_CURL_EXACT_SOLUTION_H
19 #define CURL_CURL_EXACT_SOLUTION_H
20 
21 #include "libmesh/libmesh_common.h"
22 #include "libmesh/vector_value.h"
23 
24 using namespace libMesh;
25 
27 {
28 public:
29  CurlCurlExactSolution() = default;
30  ~CurlCurlExactSolution() = default;
31 
33  {
34  const Real ux = (1.0 - y*y)*(1.0 - z*z);
35  const Real uy = (1.0 - x*x)*(1.0 - z*z);
36  const Real uz = (1.0 - x*x)*(1.0 - y*y);
37 
38  return RealGradient(ux, uy, uz);
39  }
40 
42  {
43  const Real dux_dx = 0.0;
44  const Real dux_dy = (1.0 - z*z)*(-2.0*y);
45  const Real dux_dz = (1.0 - y*y)*(-2.0*z);
46 
47  const Real duy_dx = (1.0 - z*z)*(-2.0*x);
48  const Real duy_dy = 0.0;
49  const Real duy_dz = (1.0 - x*x)*(-2.0*z);
50 
51  const Real duz_dx = (1.0 - y*y)*(-2.0*x);
52  const Real duz_dy = (1.0 - x*x)*(-2.0*y);
53  const Real duz_dz = 0.0;
54 
55  return RealTensor(dux_dx, dux_dy, dux_dz, duy_dx, duy_dy, duy_dz, duz_dx, duz_dy, duz_dz);
56  }
57 
59  {
60  const Real duz_dy = (1.0 - x*x)*(-2.0*y);
61  const Real duy_dz = (1.0 - x*x)*(-2.0*z);
62 
63  const Real dux_dz = (1.0 - y*y)*(-2.0*z);
64  const Real duz_dx = (1.0 - y*y)*(-2.0*x);
65 
66  const Real dux_dy = (1.0 - z*z)*(-2.0*y);
67  const Real duy_dx = (1.0 - z*z)*(-2.0*x);
68 
69  return RealGradient(duz_dy - duy_dz, dux_dz - duz_dx, duy_dx - dux_dy);
70  }
71 
73  {
74  const Real fx = 2.0*(1.0 - y*y) + 2.0*(1.0 - z*z) + (1.0 - y*y)*(1.0 - z*z);
75  const Real fy = 2.0*(1.0 - x*x) + 2.0*(1.0 - z*z) + (1.0 - x*x)*(1.0 - z*z);
76  const Real fz = 2.0*(1.0 - x*x) + 2.0*(1.0 - y*y) + (1.0 - x*x)*(1.0 - y*y);
77 
78  return RealGradient(fx, fy, fz);
79  }
80 
81 };
82 
83 #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)
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.