.. _diffusion-laplace_1d:

diffusion/laplace_1d.py
=======================

**Description**


Laplace equation in 1D with a variable coefficient.

Because the mesh is trivial in 1D, it is generated by :func:`mesh_hook()`, and
registered using :class:`UserMeshIO <sfepy.discrete.fem.meshio.UserMeshIO>`.

Find :math:`t` such that:

.. math::
    \int_{\Omega} c(x) \tdiff{s}{x} \tdiff{t}{x}
    = 0
    \;, \quad \forall s \;,

where the coefficient :math:`c(x) = 0.1 + \sin(2 \pi x)^2` is computed in
:func:`get_coef()`.

View the results using::

  sfepy-view laplace_1d.vtk -f t:wt 1:vw


.. image:: /../doc/images/gallery/diffusion-laplace_1d.png


:download:`source code </../sfepy/examples/diffusion/laplace_1d.py>`

.. literalinclude:: /../sfepy/examples/diffusion/laplace_1d.py