libMesh
Loading...
Searching...
No Matches
Functions
exact_solution.C File Reference

Go to the source code of this file.

Functions

Real exact_solution (const Real x, const Real y, const Real t)
 This is the exact solution that we are trying to obtain.
 

Function Documentation

◆ exact_solution()

Real exact_solution ( const Real  x,
const Real  y,
const Real  t 
)

This is the exact solution that we are trying to obtain.

We will solve

  • (u_xx + u_yy) = f

and take a finite difference approximation using this function to get f. This is the well-known "method of manufactured solutions".

Definition at line 36 of file exact_solution.C.

39{
40 const Real xo = 0.2;
41 const Real yo = 0.2;
42 const Real u = 0.8;
43 const Real v = 0.8;
44
45 const Real num =
46 pow(x - u*t - xo, 2.) +
47 pow(y - v*t - yo, 2.);
48
49 const Real den =
50 0.01*(4.*t + 1.);
51
52 return exp(-num/den)/(4.*t + 1.);
53}
T pow(const T &x)
Definition utility.h:296
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

References libMesh::pi, and libMesh::Real.