libMesh
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. More...
 

Function Documentation

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.

References libMesh::pi, std::pow(), and libMesh::Real.

Referenced by assemble_cd(), assemble_poisson(), exact_solution_wrapper(), and exact_value().

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 }
PetscErrorCode Vec x
double pow(double a, int b)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real