B7 - boundary conditions

types of boundary conditions

von neumann BC: 2nd derivative

f(x0+Δx)≈f(x0)+f′(x0)Δx+12f″(x0)(Δx)2+O[(Δx)3] f(x1)=f(x0+Δx)≈f(x0)+12f″(x0)(Δx)2 f″(x0)=2(Δx)2[f(x1)−f(x0)] f″(x0)=f(x1)+f(x−1)−2f(x0)(Δx)2 f′(x0)=12Δx[f(x1)−f(x−1)]=0⟹f(x1)=f(x−1) f″(x0)=2(Δx)2[f(x1)−f(x0)]

boundary value problem

dTdt=d2Tdx2+S(x) 1(Δx)2[Tk−1+Tk+1−2Tk]+Sk=0 A(Δx)2[T0⋮TK−1]=−[S0⋮SK−1] 1(Δx)2[Tk−1+Tk+1−2Tk]=−Sk

C6 - boundary conditions.png|500
image: B Hnat, lecture notes

C6 - boundary conditions-1.png|500
image: B Hnat, lecture notes

aij=b[ku+i−j]j

C6 - boundary conditions-2.png|500
image: B Hnat, lecture notes

C6 - boundary conditions-3.png|500
image: B Hnat, lecture notes

x2 - code for transforming indices

periodic boundaries

d2Tdx2=−S(x) T(x0−Δx)=T(x0−Δx+L)=T[x0+(L−Δx)]or, T−1=TK−1 1(Δx)2[T−1+T1−2T0]=−S0⟹1(Δx)2[T−K−1+T1−2T0]=−S0 T″|k=0=1(Δx)2[TK−1+T1−2T0]=S0 T″|k=K−1=1(Δx)2[TK−2+T0−2TK−1]=SK−1 (1Δx)2[−210⋯11−21⋯001−2⋯0⋮⋮⋮⋱⋮100⋯−2][T0T1T2⋮TK−1]=−[S0S1S2⋮SK−1]

matrix folding

C6 - boundary conditions-4.png|500
image: B Hnat, lecture notes

C6 - boundary conditions-5.png|500
image: B Hnat, lecture notes

j(i)=2ifor i<K/2j(i)=2(K−i)−1otherwise