General equation in one dimension
=================================

Heat equation governs heat diffusion, as well as other diffusive processes. It describes
the evolution of heat transferred from hotter to colder environments in time and space.

**Notes:**

#. There is no straghtforward solution to this equation, and it depends on initial
   conditions as well.
#. To get a similar equation for the 3-dimensional case, replace the spatial
   derivative with gradient :math:`\nabla`.
#. Thermal conductivity :math:`k` can depend not only on position, but also on local
   temperature, but this is out of the scope of this law.

**Links:**

#. `Wikipedia <https://en.wikipedia.org/wiki/Heat_equation#Non-uniform_isotropic_medium>`__.

.. py:currentmodule:: symplyphysics.laws.thermodynamics.heat_transfer.general_equation_in_one_dimension

.. py:data:: position

    :attr:`~symplyphysics.symbols.classical_mechanics.position`, or spatial variable.

Symbol:
    :code:`x`

Latex:
    :math:`x`

Dimension:
    :code:`length`


.. py:data:: time

    :attr:`~symplyphysics.symbols.basic.time`.

Symbol:
    :code:`t`

Latex:
    :math:`t`

Dimension:
    :code:`time`


.. py:data:: temperature

    :attr:`~symplyphysics.symbols.thermodynamics.temperature` as a function of :attr:`~position` and :attr:`~time`.

Symbol:
    :code:`T(x, t)`

Latex:
    :math:`T{\left(x,t \right)}`

Dimension:
    :code:`temperature`


.. py:data:: medium_density

    :attr:`~symplyphysics.symbols.basic.density` of the medium.

Symbol:
    :code:`rho`

Latex:
    :math:`\rho`

Dimension:
    :code:`mass/volume`


.. py:data:: medium_specific_isobaric_heat_capacity

    :attr:`~symplyphysics.symbols.thermodynamics.heat_capacity` of the medium at constant :attr:`~symplyphysics.symbols.classical_mechanics.pressure` per unit :attr:`~symplyphysics.symbols.basic.mass`.

Symbol:
    :code:`c_p`

Latex:
    :math:`c_{p}`

Dimension:
    :code:`energy/(mass*temperature)`


.. py:data:: thermal_conductivity

    :attr:`~symplyphysics.symbols.thermodynamics.thermal_conductivity` of the medium as a function of :attr:`~position`.

Symbol:
    :code:`k(x)`

Latex:
    :math:`k{\left(x \right)}`

Dimension:
    :code:`power/(length*temperature)`


.. py:data:: heat_source_density

    Density of the rate of heat production by external sources as a function of
    :attr:`~position` and :attr:`~time`. See :attr:`~symplyphysics.symbols.basic.energy_density`.

Symbol:
    :code:`q(x, t)`

Latex:
    :math:`q{\left(x,t \right)}`

Dimension:
    :code:`energy/volume`


.. py:data:: law

    :code:`rho * c_p * Derivative(T(x, t), t) = Derivative(k(x) * Derivative(T(x, t), x), x) + q(x, t)`


    Latex:
        .. math::
            \rho c_{p} \frac{\partial}{\partial t} T{\left(x,t \right)} = \frac{\partial}{\partial x} k{\left(x \right)} \frac{\partial}{\partial x} T{\left(x,t \right)} + q{\left(x,t \right)}