libMesh
Loading...
Searching...
No Matches
grad_div_exact_solution.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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 GRAD_DIV_EXACT_SOLUTION_H
19#define GRAD_DIV_EXACT_SOLUTION_H
20
21#include "libmesh/libmesh_common.h"
22#include "libmesh/vector_value.h"
23
24using namespace libMesh;
25
27{
28public:
31
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)/R.det();
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 = dux_dy;
51 const Real duy_dy = dux_dx;
52
53 return R*RealTensor(dux_dx, dux_dy, Real(0), duy_dx, duy_dy)*R.transpose()/R.det();
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
66private:
67 static RealTensor R;
68 const Real k = pi;
69};
70
71#endif // GRAD_DIV_EXACT_SOLUTION_H
RealGradient operator()(Point p)
RealGradient forcing(Point p)
GradDivExactSolution()=default
~GradDivExactSolution()=default
static void RM(RealTensor T)
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:40
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
TypeTensor< T > transpose() const
The libMesh namespace provides an interface to certain functionality in the library.
const Real pi
.
Definition libmesh.h:292
RealTensorValue RealTensor
RealVectorValue RealGradient
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real