Code Reference

class manufacturedsol_heateqn_fenics.ProbFenicsNumpiHeat2d(symbsol, V, kappa=1)

This class takes a sympy expression as the manufactured solution \(u(t;x,y)\) to the nonstationary heat equation

\[u_t - \nabla \cdot (\kappa \nabla u) = f\]

completed with Dirichlet boundary conditions and an initial condition

and a FEM function space where the equation is approximated on.

Parameters:
  • symbsol – a symbolic expression with parameters t,x,y with internal names x[0], x[1], t
  • V – FeNiCs functionspace on a 2D mesh
  • kappa – diffusion coefficient: may be a constant value or a FEniCS expression in x[0] and x[1]. Defaults to 1
A = None

csr matrix representing the weak discrete \(-\nabla \cdot (\kappa \nabla )\) operator

M = None

csr matrix for the mass

comp_cur_error(uvec, tcur)

get the current error

Parameters:
  • uvec – vector of solution approximation
  • tcur – current time
Returns:

the approximation error

currhs(tcur)

Compute the current source term

containing the actual source of the system plus the contribution from the Dirichlet boundary data

Parameters:tcur – current time
Returns:Vector of the current rhs
cursolprjtd(tcur)

Get the current solution projected onto the FEM space

Parameters:tcur – current time
Returns:vector of the current projected solution
expand_vec_to_fun(uvec)

expand uvec to the dolfin function representation

Parameters:uvec – vector of a current solution approximation
Returns:FEniCS function containing the values of uvec and the Dirichlet data
manufacturedsol_heateqn_fenics.test_impeul_int()

Example for the test of convergence of Implicit Euler

manufacturedsol_heateqn_fenics.tran_heat_eq2d(omega=1)

An example time varying 2D manufactured solution

Parameters:omega – Parameter for the frequency. Defaults to 1
Returns:A symbolic expression of a scalar function depending on the space variables x (internal name is x[0]) and y (internal name is x[1]) and the time variable t

Previous topic

Manufactured solutions to the 2D time-dependent heat equation

This Page