lecture 8 - ulisboa
TRANSCRIPT
CLP
Lecture 8
Homework: no lecture next week
9.1 β Sara
9.2 β CΓ‘tia
9.4 β Diogo
9.6 β Florian
9.7 β Jason
9.9 β Maria
9.16 β Mariana
Heat conduction in the soil
3
πππππ
ππ‘= βπ» β βππ»π + αΆππ
Without internal heat sources, the unidimensional Fourier law is:
πππππ
ππ‘= β
π
ππ§βπ
ππ
ππ§
Representing the evolution of temperature in a profile of soil, with thermal conductivity π, given the initial and spatial boundary conditions αΊ
α»ππ‘ π§ =
0, πΏπ§ .
The solution requires numerical methods.
4
The simplest approach does not workβ¦
Making π = ππππ π‘, π =π
πππ(thermal diffusivity), the explicit solution
πππ+1 β ππ
π
Ξπ‘= π
ππβ1π + ππ+1
π β 2πππ
Ξπ§2
(where πππ+1 is the temperature in position k, instant n+1)
Is numerically unstable: its error grows exponentially in timeβ¦
5
We can rewrite in a way that imposes the mean value theorem
πππ+1 β ππ
π
Ξπ‘=
ππβ1π+ Ξ€1 2
+ ππ+1π+ Ξ€1 2
β 2πππ+ Ξ€1 2
Ξπ§2
= π αΊ1 β πΌα»ππβ1π + ππ+1
π β 2πππ
Ξπ§2+ πΌ
ππβ1π+1 + ππ+1
π+1 β 2πππ+1
Ξπ§2
with πΌ =1
2(if πΌ = 0 we go back to the explicit method. Rewriting:
βπΌπΞπ‘
Ξπ§2ππβ1π+1 + 1 +
πΌπΞπ‘
Ξπ§2πππ+1 β πΌ
πΞπ‘
Ξπ§2ππ+1π+1
= πππ + 1 β πΌ Ξπ‘
ππβ1π + ππ+1
π β 2πππ
Ξπ§2
or
π ππ+1 = π΅π
6
π ππ+1 = π΅π
This is an iterative algorithm to compute the distribution of temperature in successive time steps.
If πΌ = 0, the system is explcit, an unstable.
If πΌ = 1, the system is fully implicit.
If πΌ =1
2, if imposes the mean value theorem, it is semi-implicit, and is
named as the Crank-Nicholson method.
7
Spatial boundary conditions
βπΌπΞπ‘
Ξπ§2ππβ1π+1 + 1 +
2πΌπΞπ‘
Ξπ§2πππ+1 β πΌ
πΞπ‘
Ξπ§2ππ+1π+1
= πππ + 1 β πΌ Ξπ‘
ππβ1π β 2ππ
π + ππ+1π
Ξπ§2
Can only be applied in interior grid points: π β [1, ππ§ β 2]
At the boundaries αΊπ0π+1, πππ§β1
π+1 α» temperature is computed according with the boundary conditions: a la Dirichlet:
π0π+1 = ππ π + 1 π₯π‘
or a la von Neumann:
πππ§β1π+1 = πππ§β2
π+1 +πππππ§
π₯π§
8
Boundary condition at π§ = 0
π = 0: Dirichlet (T specified)
βπΌπΞπ‘
Ξπ§2πππ+1 + 1 +
πΌπΞπ‘
Ξπ§2π0π+1 β πΌ
πΞπ‘
Ξπ§2π1π+1
= π0π + 1 β πΌ πΞπ‘
πππ β 2π0
π + π1π
Ξπ§2
Or
1 +πΌπΞπ‘
Ξπ§2π0π+1 β πΌ
πΞπ‘
Ξπ§2π1π+1
= π0π + 1 β πΌ Ξπ‘π
πππ β 2π0
π + π1π
Ξπ§2
+ πΌπΞπ‘
Ξπ§2ππ
π+1
9
ππ =T(0,t)
k=0
k=Nz-1
Boundary condition at π§ = Lz
π = ππ§ β 1, NO HEAT FLUX: ππ
ππ§= 0 (von Neumann):
βπΌπΞπ‘
Ξπ§2πππ§β2π+1 + 1 +
2πΌπΞπ‘
Ξπ§2πππ§β1π+1
β πΌπΞπ‘
Ξπ§2πππ§β1π+1
= πππ§β1π + 1 β πΌ πΞπ‘
πππ§β2π β 2πππ§β1
π + πππ§β1π
Ξπ§2
Or
βπΌπΞπ‘
Ξπ§2πππ§β2π+1 + 1 +
πΌπΞπ‘
Ξπ§2πππ§β1π+1
= πππ§β1π + 1 β πΌ πΞπ‘
πππ§β2π β πππ§β1
π
Ξπ§2
10
ππ =T(0,t)
k=0
k=Nz-1ππ
ππ§= 0
π Τ¦π₯ = b
1 +2πΌπΞπ‘
Ξπ§2
βπΌπΞπ‘
Ξπ§2
000000000
βπΌπΞπ‘
Ξπ§2
1 +2πΌπΞπ‘
Ξπ§2
0
0
βπΌπΞπ‘
Ξπ§2
0
βπΌπΞπ‘
Ξπ§2
0
1 +2πΌπΞπ‘
Ξπ§2
βπΌπΞπ‘
Ξπ§2
000000000
βπΌπΞπ‘
Ξπ§2
1 +πΌπΞπ‘
Ξπ§2
π0π+1
π1π+1
πππ§β2π+1
πππ§β1π+1
=π
Tridiagonal matrix.
11
π Τ¦π₯ = b
πΤ¦π₯ =
π0π +
1 β πΌ πΞπ‘
Ξπ§2αΊππ
πβ2π0π + π1
πα» +πΌπΞπ‘
Ξπ§2πππ+1
πππ +
1 β πΌ πΞπ‘
Ξπ§2ππβ1π β 2ππ
π + ππ+1π
πππ§β1π +
1 β πΌ πΞπ‘
Ξπ§2πππ§β2π β πππ§β1
π
12
πππ+1 = ππ
The implicit solution is stable for all Ξt, but accuracy will be better for small Ξπ‘.
Crank-Nicholson αΊπΌ = 0.5α» is more accurate.
Note a problem in the implicit method: information propagates throughout the domain instantaneouslyβ¦
13
Python
import numpy as npimport matplotlib.pyplot as pltalpha=0.5 #Crank-NicholsonNz=500;Lz=5.;dz=Lz/Nz; #dz=1cmz=np.arange(dz,Lz,dz)TimeSpan=365*24*3600. #1 anodt=3600.;tempo=np.arange(0.,TimeSpan,dt);nt=len(tempo)ddia=24*3600;dano=365*ddialam=0.25/1600/890 #difusividade tΓ©rmicaTmed=288;AmpD=10;AmpA=10lev=np.array([0,2,4,9,19,29,39,59],int);nlev=len(lev)Tz=np.ones((nt,nlev))*TmedT0=Tmed+AmpD*np.sin(2*np.pi*tempo/ddia+np.pi)\
+AmpA*np.sin(2*np.pi*tempo/dano-np.pi*3./5);plt.subplot(2,1,1);plt.plot(tempo/3600/24,T0)plt.ylabel('T (K)β);plt.xlabel('dia juliano')plt.subplot(2,1,2);plt.plot(tempo[:24]/3600,T0[:24])plt.ylabel('T (K)β);plt.xlabel('hora')plt.suptitle('T@z=0')plt.figure()
14
CΓ‘lculos preliminares: a matriz π Γ© constante!
Tmin=np.min(T0);Tmax=np.max(T0);
zmin=-np.max(z);zmax=0;
T=Tmed*np.ones((Nz)) #perfil inicial de T
beta=alpha*lam*dt/dz**2
zeta=(1-alpha)*lam*dt/dz**2
M=np.zeros((Nz,Nz),float);b=np.zeros((Nz),float)
M[0,0]=1+2*beta;M[0,1]=-beta
for k in range(1,Nz-1):
M[k,k-1]=-beta
M[k,k]=1+2*beta
M[k,k+1]=-beta
M[Nz-1,Nz-2]=-beta
M[Nz-1,Nz-1]=1+beta
Minv=np.linalg.inv(M)
15
Integration
for it in range(1,nt):
b[0]=T[0]+zeta*(T0[it-1]-2*T[0]+T[1])+beta*T0[it]
for iz in range(1,Nz-1):
b[iz]=T[iz]+zeta*(T[iz-1]-2*T[iz]+T[iz+1])
b[Nz-1]=T[Nz-1]+zeta*(T[Nz-2]-T[Nz-1])
T=np.matmul(Minv,b)
for klev in range(nlev):
Tz[it,klev]=T[lev[klev]]
plt.subplot(nlev+2,1,1)
tempoh=tempo/3600/24;plt.plot(tempoh,T0,color='red')
plt.grid();plt.ylabel('T0')
for klev in range(nlev):
ax=plt.subplot(nlev+2,1,klev+2)
plt.plot(tempoh,Tz[:,klev]); plt.grid()
ax2=ax.twinx(); ax2.set_yticks([])
ax2.set_ylabel('z=%3.2f' % (z[lev[klev]]),rotation=0)
plt.suptitle(r'$\partial T /\partial t = \lambda \nabla^2 T,
\lambda=%4.2e$' %(lam))
16
Diurnal cycle
17
At the surface (z=1cm) the soiltemperature is close the theairβs.
In depth the cycle has lessamplitude and lags in phase.
Note that the temperature in depth is still drifting because itstarted with an unbalancedinitial state.
18
5 years
19
day
m
In depth we only see an annual cycle with a phase lag
20
Similarity theory
For a number of boundary layer situations, our knowledge of the governing physics is insufficient to derive laws based on first principles. Nevertheless, boundary layer observations frequently show consistent and repeatable characteristics, suggesting that we could develop empirical relationships for the variables of interest.
Similarity theory provides a way to organize and group the variables to our maximum advantage, and in turn provides guidelines on how to design experiments to gain the most information.
The mathematical basis of similarity theory: dimensional analysis
The equations of Physics must be independent of the system of units.
In other words, they must be invariant under a change in such system.
This imposes some restrictions on the equations, and allows us to get some generic results when we cannot do better.
This invariance reminds us of relativity theory which is also based in a requirement of invariance of the laws under a change of the coordinate frame.
Buckingham PI theorem
Similarity:
Buckingham Pi Dimensional Analysis Methods
The example is that of fluid flow through a pipe, and involves the question: "How does the shear stress, π, vary?"
Buckingham Pi Dimensional Analysis Methods
Homework
7.3 β Mariana
7.5 β Sara
7.6 β CΓ‘tia
7.7 β Diogo
7.12 β Florian
7.15 β Jason
7.18 β Maria