Solve for the temperature distribution of a long, thin circular solid tube with a length of 10 cm (shown in Figure2), using the Finite Difference Method: Parabolic Equation (Explicit Method). The following values of the circular solid tube is as provided: k’= 0.49 cal/ (s · cm · oC), Δt = 0.1 s and Δx = 2 cm. When t = 0, the temperature of the circular solid tube is zero and the boundary conditions are fixed for all times at temperature T, at x = 0 cm is 100oC where as the temperature T, at x =10 is 50oC. From this information it is given that the circular solid rod is made of material with heat capacity, C = 0.2174 cal/(g· oC) and density (ρ) = 2.7 g/cm3. Use Explicit Method to solve this problem. Task: A Visual Basic of the FDM solution for (a) has been initially developed based on the required calculation of task Q2(a). The source code is as provided below (may need some minor tweak): Option Explicit Sub Explicit() Dim i As Integer, j As Integer, np As Integer, ns As Integer Dim Te(20) As Single, dTe(20) As Single, tpr(20) As Single, Tepr(20, 20) As Single Dim k As Single, dx As Single, L As Single, tc As Single, tf As Single Dim tp As Single, t As Single, tend As Single, h As Single L = 10 ns = 5 dx = 2 k = 0.835 Te(0) = 100 Te(5) = 50 tc = 0.1 tf = 1 tp = 0.3 np = 0 tpr(np) = t For i = 0 To ns Tepr(i, np) = Te(i) Next i Do tend = t + tp If tend > tf Then tend = tf h = tc Do If t + h > tend Then h = tend - t Call Derivs(Te, dTe, ns, dx, k) For j = 1 To ns - 1 Te(j) = Te(j) + dTe(j) * h Next j t = t + h If t >= tend Then Exit Do Loop np = np + 1 tpr(np) = t For j = 0 To ns Tepr(j, np) = Te(j) Next j If t >= tf Then Exit Do Loop Sheets("sheet1").Select Range("a4").Select For i = 0 To np ActiveCell.Value = tpr(i) For j = 0 To ns ActiveCell.Offset(0, 1).Select ActiveCell.Value = Tepr(j, i) Next j ActiveCell.Offset(1, -ns - 1).Select Next i End Sub Sub Derivs(Te, dTe, ns, dx, k) Dim j As Integer For j = 1 To ns - 1 dTe(j) = k * (Te(j - 1) - 2 * Te(j) + Te(j + 1)) / dx ^ 2 Next j End Sub i.Modify and run the VBA script to obtain the solution for t =0.1 to 10 minutes at 0.1 intervals. Provide the revised script and results as answer. ii. Modify and run the VBA script to obtain the solution for t =0.1 to 10 minutes using a new material (Heat Capacity, C = 0.09195 cal/(g· oC)) and density (ρ) = 8.9 g/cm3. Provide the revised script and results as answer.
Solve for the temperature distribution of a long, thin circular solid tube with a length of 10 cm (shown in Figure2), using the Finite Difference Method: Parabolic Equation (Explicit Method). The following values of the circular solid tube is as provided: k’= 0.49 cal/ (s · cm · oC), Δt = 0.1 s and Δx = 2 cm. When t = 0, the temperature of the circular solid tube is zero and the boundary conditions are fixed for all times at temperature T, at x = 0 cm is 100oC where as the temperature T, at x =10 is 50oC. From this information it is given that the circular solid rod is made of material with heat capacity, C = 0.2174 cal/(g· oC) and density (ρ) = 2.7 g/cm3. Use Explicit Method to solve this problem.
Task:
- A Visual Basic of the FDM solution for (a) has been initially developed based on the required calculation of task Q2(a). The source code is as provided below (may need some minor tweak):
Option Explicit
Sub Explicit()
Dim i As Integer, j As Integer, np As Integer, ns As Integer
Dim Te(20) As Single, dTe(20) As Single, tpr(20) As Single, Tepr(20, 20)
As Single
Dim k As Single, dx As Single, L As Single, tc As Single, tf As Single
Dim tp As Single, t As Single, tend As Single, h As Single
L = 10
ns = 5
dx = 2
k = 0.835
Te(0) = 100
Te(5) = 50
tc = 0.1
tf = 1
tp = 0.3
np = 0
tpr(np) = t
For i = 0 To ns
Tepr(i, np) = Te(i)
Next i
Do
tend = t + tp
If tend > tf Then tend = tf
h = tc
Do
If t + h > tend Then h = tend - t
Call Derivs(Te, dTe, ns, dx, k)
For j = 1 To ns - 1
Te(j) = Te(j) + dTe(j) * h
Next j
t = t + h
If t >= tend Then Exit Do
Loop
np = np + 1
tpr(np) = t
For j = 0 To ns
Tepr(j, np) = Te(j)
Next j
If t >= tf Then Exit Do
Loop
Sheets("sheet1").Select
Range("a4").Select
For i = 0 To np
ActiveCell.Value = tpr(i)
For j = 0 To ns
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Tepr(j, i)
Next j
ActiveCell.Offset(1, -ns - 1).Select
Next i
End Sub
Sub Derivs(Te, dTe, ns, dx, k)
Dim j As Integer
For j = 1 To ns - 1
dTe(j) = k * (Te(j - 1) - 2 * Te(j) + Te(j + 1)) / dx ^ 2
Next j
End Sub
i.Modify and run the VBA script to obtain the solution for t =0.1 to 10 minutes at 0.1 intervals. Provide the revised script and results as answer.
ii. Modify and run the VBA script to obtain the solution for t =0.1 to 10 minutes using a new material (Heat Capacity, C = 0.09195 cal/(g· oC)) and density (ρ) = 8.9 g/cm3. Provide the revised script and results as answer.
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 3 images