# Simple simulation (tutorial) with temperature gradient in the slab

**URL:** <https://festim.discourse.group/t/simple-simulation-tutorial-with-temperature-gradient-in-the-slab/157>\
**Category:** User Support\
**Created:** [February 5, 2026, 5:24pm UTC](https://festim.discourse.group/t/simple-simulation-tutorial-with-temperature-gradient-in-the-slab/157 "2026-02-05T17:24:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francesca](https://avatars.discourse-cdn.com/v4/letter/f/9fc348/32.png) [@Francesca](https://festim.discourse.group/u/Francesca)\
**Post date:** [February 5, 2026, 5:24pm UTC](https://festim.discourse.group/t/simple-simulation-tutorial-with-temperature-gradient-in-the-slab/157/1 "2026-02-05T17:24:28Z")

</div>

Hi!

I’ve just started using FESTIM. I installed version 1.4.1.post1 on windows via WLS. I tried to run the basic tutorial sample case from the website ( [Simple simulation — FESTIM tutorial](https://festim-workshop.readthedocs.io/en/latest/content/task01.html) ) and it worked. Now I am trying to input a linear temperature gradient instead of a constant value. Everything seems to work until reaching the “initialise”. Then I get the error: SympifyError: SympifyError: “cannot sympify object of type \<class ‘function’\>”.

I was previously working with the latest Python version, now I am on Python 3.10.19 but the problem is still there.

Can somebody help me? Thanks!

This is the part of the code related with temperature distribution:

T1=673.0 #K

T2=663.0 #K

t=0.002 #m thickness slab

m\_T=(T2-T1)/(t)

print(f’m\_T è: {m\_T}')

print(f’type(m\_T) = {type(m\_T)}')

q\_T=673.0

print(f’q\_T è: {q\_T}')

print(f’type(q\_T) = {type(q\_T)}')

def temperature\_func(x):

```
return m_T\*x\[0\]+q_T

```

slab.T = F.Temperature(value=temperature\_func)

print(“Temperatura impostata con successo!”)

---

<div class="post-metadata">

**Author:** ![VVKulagin](https://yyz2.discourse-cdn.com/free1/user_avatar/festim.discourse.group/vvkulagin/32/51_2.png) [@VVKulagin](https://festim.discourse.group/u/VVKulagin)\
**Post date:** [February 6, 2026, 1:10pm UTC](https://festim.discourse.group/t/simple-simulation-tutorial-with-temperature-gradient-in-the-slab/157/2 "2026-02-06T13:10:32Z")

</div>

Hi @Francesca!

As described in the [documentation](https://festim.readthedocs.io/en/latest/userguide/temperature.html), a simple temperature distribution in a 1D geometry can be defined with `x` imported from the `festim` library (which is a `sympy.symbol` as shown [here](https://github.com/festim-dev/FESTIM/blob/c986b6cb8a15cd3b24245a65b23f7e7076512723/festim/ __init__.py#L18)), e.g.:

```auto
from festim import x

my_temp = 300 + 2*x

```

The same approach applies for `t` (time) and for `y` / `z` in 2D or 3D geometries.

Let me know if this helps.

Also, please enclose your code with triple backticks (```) next time.
