libMesh
curl_curl_exact_solution.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 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() (Point p)
33  {
34  Point pp = R.transpose()*p;
35  Real x = pp(0), y = pp(1);
36 
37  const Real ux = cos(k*x)*sin(k*y);
38  const Real uy = -sin(k*x)*cos(k*y);
39 
40  return R*RealGradient(ux, uy);
41  }
42 
44  {
45  Point pp = R.transpose()*p;
46  Real x = pp(0), y = pp(1);
47 
48  const Real dux_dx = -k*sin(k*x)*sin(k*y);
49  const Real dux_dy = k*cos(k*x)*cos(k*y);
50  const Real duy_dx = -k*cos(k*x)*cos(k*y);
51  const Real duy_dy = k*sin(k*x)*sin(k*y);
52 
53  return R*RealTensor(dux_dx, dux_dy, Real(0), duy_dx, duy_dy)*R.transpose();
54  }
55 
57  {
58  return (2*k*k + 1)*operator()(p);
59  }
60 
61  static void RM(RealTensor T)
62  {
63  R = T;
64  }
65 
66 private:
67  static RealTensor R;
68  const Real k = pi;
69 };
70 
71 #endif // CURL_CURL_EXACT_SOLUTION_H
RealVectorValue RealGradient
TypeTensor< T > transpose() const
Definition: type_tensor.h:1050
RealTensorValue RealTensor
static void RM(RealTensor T)
The libMesh namespace provides an interface to certain functionality in the library.
RealGradient forcing(Point p)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
const Real pi
.
Definition: libmesh.h:299