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 
33  RealGradient operator() (Real x, Real y)
34  {
35  const Real ux = cos(pi*x)*sin(pi*y);
36  const Real uy = -sin(pi*x)*cos(pi*y);
37 
38  return RealGradient(ux, uy);
39  }
40 
42  {
43  const Real dux_dx = -pi*sin(pi*x)*sin(pi*y);
44  const Real dux_dy = pi*cos(pi*x)*cos(pi*y);
45  const Real duy_dx = -pi*cos(pi*x)*cos(pi*y);
46  const Real duy_dy = pi*sin(pi*x)*sin(pi*y);
47 
48  return RealTensor(dux_dx, dux_dy, Real(0), duy_dx, duy_dy);
49  }
50 
52  {
53  const Real dux_dy = pi*cos(pi*x)*cos(pi*y);
54  const Real duy_dx = -pi*cos(pi*x)*cos(pi*y);
55 
56  return RealGradient(Real(0), Real(0), duy_dx - dux_dy);
57  }
58 
60  {
61  const Real fx = (2*pi*pi + 1)*cos(pi*x)*sin(pi*y);
62  const Real fy = -(2*pi*pi + 1)*sin(pi*x)*cos(pi*y);
63 
64  return RealGradient(fx, fy);
65  }
66 };
67 
68 #endif // CURL_CURL_EXACT_SOLUTION_H
RealVectorValue RealGradient
RealTensorValue RealTensor
The libMesh namespace provides an interface to certain functionality in the library.
PetscErrorCode Vec x
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:172