libMesh
Loading...
Searching...
No Matches
div_grad_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 DIV_GRAD_EXACT_SOLUTION_H
19#define DIV_GRAD_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 return cos(k*x)*sin(k*y);
35 }
36
38 {
39 return cos(k*x)*sin(k*y)*cos(k*z);
40 }
41
43 {
44 const Real ux = k*sin(k*x)*sin(k*y);
45 const Real uy = -k*cos(k*x)*cos(k*y);
46
47 return RealGradient(ux, uy);
48 }
49
51 {
52 const Real ux = k*sin(k*x)*sin(k*y)*cos(k*z);
53 const Real uy = -k*cos(k*x)*cos(k*y)*cos(k*z);
54 const Real uz = k*cos(k*x)*sin(k*y)*sin(k*z);
55
56 return RealGradient(ux, uy, uz);
57 }
58
60 {
61 const Real dux_dx = k*k*cos(k*x)*sin(k*y);
62 const Real dux_dy = k*k*sin(k*x)*cos(k*y);
63 const Real duy_dx = k*k*sin(k*x)*cos(k*y);
64 const Real duy_dy = k*k*cos(k*x)*sin(k*y);
65
66 return RealTensor(dux_dx, dux_dy, Real(0), duy_dx, duy_dy);
67 }
68
70 {
71 const Real dux_dx = k*k*cos(k*x)*sin(k*y)*cos(k*z);
72 const Real dux_dy = k*k*sin(k*x)*cos(k*y)*cos(k*z);
73 const Real dux_dz = -k*k*sin(k*x)*sin(k*y)*sin(k*z);
74 const Real duy_dx = k*k*sin(k*x)*cos(k*y)*cos(k*z);
75 const Real duy_dy = k*k*cos(k*x)*sin(k*y)*cos(k*z);
76 const Real duy_dz = k*k*cos(k*x)*cos(k*y)*sin(k*z);
77 const Real duz_dx = -k*k*sin(k*x)*sin(k*y)*sin(k*z);
78 const Real duz_dy = k*k*cos(k*x)*cos(k*y)*sin(k*z);
79 const Real duz_dz = k*k*cos(k*x)*sin(k*y)*cos(k*z);
80
81 return RealTensor(dux_dx, dux_dy, dux_dz, duy_dx, duy_dy, duy_dz, duz_dx, duz_dy, duz_dz);
82 }
83
85 {
86 const Real dux_dx = grad(x, y)(0, 0);
87 const Real duy_dy = grad(x, y)(1, 1);
88
89 return dux_dx + duy_dy;
90 }
91
93 {
94 const Real dux_dx = grad(x, y, z)(0, 0);
95 const Real duy_dy = grad(x, y, z)(1, 1);
96 const Real duz_dz = grad(x, y, z)(2, 2);
97
98 return dux_dx + duy_dy + duz_dz;
99 }
100
102 {
103 return div(x, y);
104 }
105
107 {
108 return div(x, y, z);
109 }
110
111private:
112 const Real k = .5*pi;
113};
114
115#endif // DIV_GRAD_EXACT_SOLUTION_H
Real forcing(Real x, Real y, Real z)
DivGradExactSolution()=default
RealTensor grad(Real x, Real y)
Real forcing(Real x, Real y)
RealTensor grad(Real x, Real y, Real z)
Real scalar(Real x, Real y, Real z)
~DivGradExactSolution()=default
RealGradient operator()(Real x, Real y)
Real div(Real x, Real y, Real z)
Real scalar(Real x, Real y)
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
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