Simple simulation (tutorial) with temperature gradient in the slab

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 ) 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!”)

Hi @Francesca!

As described in the documentation, 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), e.g.:

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.

1 Like