Simple transient diffusion case#
This is a simple transient MMS example. We will only consider diffusion of hydrogen in a unit square domain \(\Omega\) at steady state with an homogeneous diffusion coefficient \(D\). Moreover, a Dirichlet boundary condition will be assumed on the boundaries \(\partial \Omega \).
The problem is therefore:
The exact solution for mobile concentration is:
Note
We use a manufactured solution that varies linearly with time (\(t^1\)), as the backward Euler scheme provides an exact solution in this case.
Injecting (6) in (5), we obtain the expressions of \(S\), \(c_0\), and \(c_\mathrm{initial}\):
We can then run a FESTIM model with these values and compare the numerical solution with \(c_\mathrm{exact}\).
FESTIM code#
Comparison with exact solution#
/home/docs/checkouts/readthedocs.org/user_builds/festim-vv-report/conda/festim-2/lib/python3.11/site-packages/pyvista/plotting/utilities/xvfb.py:48: PyVistaDeprecationWarning: This function is deprecated and will be removed in future version of PyVista. Use vtk-osmesa instead.
warnings.warn(
t=1s, Simulation result (left) vs. Exact result (right)
t=7s, Simulation result (left) vs. Exact result (right)
t=13s, Simulation result (left) vs. Exact result (right)
Compute convergence rates#
It is also possible to compute how the numerical error decreases as we increase the number of cells. By iteratively refining the mesh, we find that the error exhibits a second order convergence rate. This is expected for this particular problem as first order finite elements are used.