Good morning,
I would be very greatful if someone take the time to help me.
I have a scientific research study to deal with, my topic is : The the evolution of the transfers in a mug with temperature.
I have now to simulate this with the Heat equation in a 1D problem (to simplify) as a wall.
I have already modelised it, (with termal sources so as to simulate the exchange of the mug with the water on the one hand (i=0, water temperature not fixed) and the air (i=N+1, air temperature fixed at Text)).
So I have 3 expressions for the temperature at the moment k+1 that requires the température at the moment k.
I would like to calculate these températures time after time ( incrementation 1 by 1 for k ) and to finally only return the temperature at the interface with the water (i=0).
Nevertheless, my code is not working:
File "F:\TIPE\Modélisation Python\Programme.py", line 71
Temp.append(L[k][N]+dt/(dr*rho*capa(L[k][N],0,0))*(h*(Text-L[k][N])+lambd(L[k][N],0,0)/dr*(L[k][N-1]-L[k][N])))
^
SyntaxError: invalid syntax
I have tried to change a lot of things with my basic ability, but I can't go over this "SyntaxError" and I don't know where could be the error. I'll be greatful for you help.
L a list of list, it contains the list of the temperature at the points i=0 to i=N+1, at each instant k from 0 to M.
capa and lambd are functions that provide the evolution of physic parameters with the temperature.
Interface_eau is the list of temperature at the point i=0 at each moment k from 0 to M.
I would be very greatful if someone take the time to help me.
I have a scientific research study to deal with, my topic is : The the evolution of the transfers in a mug with temperature.
I have now to simulate this with the Heat equation in a 1D problem (to simplify) as a wall.
I have already modelised it, (with termal sources so as to simulate the exchange of the mug with the water on the one hand (i=0, water temperature not fixed) and the air (i=N+1, air temperature fixed at Text)).
So I have 3 expressions for the temperature at the moment k+1 that requires the température at the moment k.
I would like to calculate these températures time after time ( incrementation 1 by 1 for k ) and to finally only return the temperature at the interface with the water (i=0).
Nevertheless, my code is not working:
File "F:\TIPE\Modélisation Python\Programme.py", line 71
Temp.append(L[k][N]+dt/(dr*rho*capa(L[k][N],0,0))*(h*(Text-L[k][N])+lambd(L[k][N],0,0)/dr*(L[k][N-1]-L[k][N])))
^
SyntaxError: invalid syntax
I have tried to change a lot of things with my basic ability, but I can't go over this "SyntaxError" and I don't know where could be the error. I'll be greatful for you help.
L a list of list, it contains the list of the temperature at the points i=0 to i=N+1, at each instant k from 0 to M.
capa and lambd are functions that provide the evolution of physic parameters with the temperature.
Interface_eau is the list of temperature at the point i=0 at each moment k from 0 to M.
## Importation des modules import numpy as np import matplotlib.pyplot as plt ## Definition des fonctions # Données fixes: rho=2500 le=1.4e-3 ce=4186 rhoe=1000 h=10 e=5e-3 #Coefficients dépendances thermiques lambda0=-11.91 lambda1=87.6e-3 lambda2=-145e-6 c0=-243e3 c1=2e3 c2=-2 #Fonctions dépendances thermiques def lambd(T,coeff1,coeff2): '''O si prends les valeurs exp, 1 si prends les valeurs entrées pour coeff1 et coeff2''' if coeff1==0 and coeff2==0: coeff1=lambda1 coeff2=lambda2 return (lambda0+coeff1*T+coeff2*T*T) def capa(T,coeff1,coeff2): '''O si prends les valeurs exp, 1 si prends les valeurs entrées pour coeff1 et coeff2''' if coeff1==0 and coeff2==0: coeff1=c1 coeff2=c2 return (c0+coeff1*T+coeff2*T*T) #Paramètres de pas N=10 dt=10 dr=e/N+1 #Paramètres initiaux Tdeb=90 Text=20 #Fonction méthode explicite def résolution(M): '''S'arrete à tmax=M*dt, renvoie la liste des T en r=0 aux différents temps''' Interface_eau=[Tdeb] Temps=[elt for elt in range(M+1)] L=[[Tdeb]+(N)*[Text]] for k in range(0,M): Temp=[] #Calcul interface eau i=0 Temp.append(L[k][0]+lambd(L[k][0],0,0)*dr*dt/(dr*rho*capa(L[k][0],0,0)-le*rhoe*ce)/dr/dr*(L[k][1]-L[k][0])) #Calcul intérieur tasse i entre 1 et N for i in range(1,N): Temp.append((L[k][i]+lambd(L[k][i],0,0)*dr*dt/(dr*rho*capa(L[k][i],0,0))/dr/dr*(L[k][i+1]+L[k][i-1]-2*L[k][i])) #Calcul interface air i=N+1 Temp.append(L[k][N]+dt/(dr*rho*capa(L[k][N],0,0))*(h*(Text-L[k][N])+lambd(L[k][N],0,0)/dr*(L[k][N-1]-L[k][N]))) L.append(Temp) Interface_eau.append(Temp[0]) plt.plot(Temps, Interface_eau) #Lançage résolution(10)