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 
32  RealGradient operator() (Real x, Real y)
33  {
34  const Real ux = cos(pi*x)*sin(pi*y);
35  const Real uy = -sin(pi*x)*cos(pi*y);
36 
37  return RealGradient(ux, uy);
38  }
39 
41  {
42  const Real dux_dx = -pi*sin(pi*x)*sin(pi*y);
43  const Real dux_dy = pi*cos(pi*x)*cos(pi*y);
44  const Real duy_dx = -pi*cos(pi*x)*cos(pi*y);
45  const Real duy_dy = pi*sin(pi*x)*sin(pi*y);
46 
47  return RealTensor(dux_dx, dux_dy, Real(0), duy_dx, duy_dy);
48  }
49 
51  {
52  const Real dux_dy = pi*cos(pi*x)*cos(pi*y);
53  const Real duy_dx = -pi*cos(pi*x)*cos(pi*y);
54 
55  return RealGradient(Real(0), Real(0), duy_dx - dux_dy);
56  }
57 
59  {
60  const Real fx = (2*pi*pi + 1)*cos(pi*x)*sin(pi*y);
61  const Real fy = -(2*pi*pi + 1)*sin(pi*x)*cos(pi*y);
62 
63  return RealGradient(fx, fy);
64  }
65 };
66 
67 #endif // CURL_CURL_EXACT_SOLUTION_H
RealVectorValue RealGradient
RealTensorValue RealTensor
The libMesh namespace provides an interface to certain functionality in the library.
RealTensor grad(Real x, Real y)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
RealGradient curl(Real x, Real y)
RealGradient forcing(Real x, Real y)
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
const Real pi
.
Definition: libmesh.h:274