Shooting method:
Suppose we have a second order ODE:

where a prime denotes a derivative with respect to x, with boundary conditions:

Then we consider an initial value problem:

where s is a paramter given by:

where,
is the solution of initial value problem:

and
is the solution of initial value problem:

Then, the solution of our original boundary value problem is:

Now, our boundary value problem (BVP) is:

so,
We need to find the solutions to the initial value problems (IVP):


using fourth order Runge Kutta (RK4) method.
To use the RK4 method, we need to convert the second order ODE into two first order ODEs:
Let,
, so that we have two first order ODEs:


Similarly, for the second IVP, we will have
and
Now the RK4 scheme for solving a system of coupled ODEs:


is:











where, h is the step size in x
In this way, we solve the two IVPs and get s and then get the solution for our BVP.
The coding is done in python.
############## shooting_method.py #########
import numpy as np
import matplotlib.pyplot as plt
a = 0.0
b = 10.0
alpha = 40.0
beta = 200.0
f = 25.0
h = 0.125
x = np.arange(a,b+h,h)
nitr = len(x)
T1 = np.zeros(nitr)
T2 = np.zeros(nitr)
U1 = np.zeros(nitr)
U2 = np.zeros(nitr)
T1[0] = alpha
T2[0] = 0.0
U1[0] = 0.0
U2[0] = 1.0
for i in range(nitr-1):
# Solving for U1 and T1
k0 = h*(-f)
l0 = h*U1[i]
k1 = h*(-f)
l1 = h*(U1[i]+0.5*l0)
k2 = h*(-f)
l2 = h*(U1[i]+0.5*l1)
k3 = h*(-f)
l3 = h*(U1[i]+l2)
U1[i+1] = U1[i] + (k0 + 2.0*k1 + 2.0*k2 + k3)/6.0
T1[i+1] = T1[i] + (l0 + 2.0*l1 + 2.0*l2 + l3)/6.0
# Solving for U2 and T2
k0 = h*(-f)
l0 = h*U2[i]
k1 = h*(-f)
l1 = h*(U2[i]+0.5*l0)
k2 = h*(-f)
l2 = h*(U2[i]+0.5*l1)
k3 = h*(-f)
l3 = h*(U2[i]+l2)
U2[i+1] = U2[i] + (k0 + 2.0*k1 + 2.0*k2 + k3)/6.0
T2[i+1] = T2[i] + (l0 + 2.0*l1 + 2.0*l2 + l3)/6.0
# for loop ends here
s = (beta - T1[nitr-1])/T2[nitr-1]
T = T1 + s*T2
plt.plot(x,T)
plt.xlabel('x')
plt.ylabel('Temperature in degC')
plt.title('T vs x solved using shooting method')
plt.grid()
plt.savefig('shooting-T_vs_x.png')
plt.show()
idx = np.where(x == 4.0)[0][0]
ans = T[idx] # in degC
ansK = ans + 273.15
mystr = 'Tmperature distribution at x = 4 is '+str(round(ansK,2))+'
K'
print(mystr)
################ end of code ###########
screenshots of the code:

![for i in range(nitr-1): # Solving for ul and ti ko = h*(-f) 10 = h*11[i] kl = h*(-f) 11 h* (U1[i]+0.5*10) k2 : h*(-f) 12 h*(U](http://img.homeworklib.com/questions/726f5d70-e4a9-11ea-b8e2-238407a248df.png?x-oss-process=image/resize,w_560)
![S = (beta - Ti[nitr-1])/T2[nitr-1] T = 11 + 5*T2 plt.plot(x,T) plt.xlabel(x) plt.ylabel(Temperature in degc) plt.title(T](http://img.homeworklib.com/questions/72e17ab0-e4a9-11ea-a54a-51d5426497c0.png?x-oss-process=image/resize,w_560)
plot of the solution:

output on screen:

So, upto the nearest integer, the temperature distributionat x = 4 is 335 K
! Required information An insulated heated rod with a uniform heat source can be modeled with...
Set up and solve a boundary value problem using the shooting
method using Matlab
A heated rod with a uniform heat source may be modeled with Poisson equation. The boundary conditions are T(x = 0) = 40 and T(x = 10) = 200 dTf(x) Use the guess values shown below. zg linspace (-200,100,1000); xin-0:0.01:10 a) Solve using the shooting method with f(x) = 25 . Name your final solution "TA" b) Solve using the shooting method with f(x)-0.12x3-2.4x2 + 12x....
A planar material can be modeled as 1-dimensional with thickness L = 2m. On one boundary (x=0), the surface is held at a fixed temperature Ts = 20°C. the other boundary is perfectly insulated. There is a constant thermal conductivity k = 40 W/mK and the material is being heated internally. The system is at steady state. a) write an expression for each of the two boundary conditions b) If the volumetric heat generation is equal to q.= 10 W/m3....
Ordinary differential equation: shooting method A steady-state heat balance for a 10 meter rod can be presented as: AZ - 0.157 = 0 Use the shooting method with a second order Runge-Kutta algorithm (midpoint) to solve the above ODE. Use a step size of 5 m. T(0) = 240 and T(10) = 150. Hint: assume initial conditions of z(0) = -120 and z(0) = -60. Knowing the analytical solution: T = 3.016944e V0.15x + 236.9831e-V0.15x Comment on the obtained results...
d1=7
d2=8
Question 3 Left end (r-0) ofa copper rod of length 100mm is kept at a constant temperature of Temp = 10+42 degrees and the right end and sides are insulated, so that the temperature in the ou u ax2 rod, 11(X, 1) , obeys the heat partial DE, Ơ Co2 , where D-111 mm 2/s for copper. where D 111 mm*/s for copper. (a) Write the boundary conditions for u(x,t) of the problem above. Note that for the...
The heat that is conducted through a body must frequently be removed by other heat transfer processes. For example, the heat generated in an electronic device must be dissipated to the surroundings through convection by means of fins. Consider the one-dimensional aluminum fin (thickness t 3.0 mm, width 20 cm, length L) shown in Figure 1, that is exposed to a surrounding fluid at a temperature T. The conductivity of the aluminum fin (k) and coefficient of heat convection of...
D1 = 7
D2 = 4
Any assistance would be greatly appreciated
Question 3 Left end (x 0) of a copper rod of length 100mm is kept at a constant temperature of Temp - 10+d2 degrees and the right end and sides are insulated, so that the temperature in the rod, u(x,t). obeys the heat partial DE, CD11 mms copper. where D-1 mm's for copper (a) Write the boundary conditions for u(x, 1) of the problem above. Note that for...
d1=7
d2=8
Any help would be greatly appreciated.
Question 3 Left end (r-0) of a copper rod of length 100mm is kept at a constant temperature of Temp-1 0 a 2 degrees and the right end and sides are insulated, so that the temperature in the ul ul where D = 111 mm2/s for copper. rod, u(x,t), obeys the heat partial DE, Ot Ox (a) Write the boundary conditions for il(x,t) of the problem above. Note that for the left...
2. In lecture, we talked about the heat equation on a thin, laterally insulated rod. There are many other domains on which you might want to determine the temperature. In this question, we explore the temperature on a wire that has been formed into a circle. thin wire, length 2L, laying flat on [-L,L] bend wire into a circular shape result is a circular wire where the ends x=L and x=-L correspond to one point now. While the PDE remains...
A very long solid cylindrical rod contains an internal source of
uniform heat, per unit volume f; and is
connected to a wall that is at the temperature T1, the
rod is exposed to a fluid with a convention coefficient h and
temperature T.
It is requested:
a) Obtain the differential equation, which determines the
temperature distribution in stable state T(x) in the cylindrical
rod.
b) Solve the previous differential equation for the temperature
distribution.
c) Obtain an expression for...
1)
2)
3)
PROJECT #1 (2.5 Marks): The heat that is conducted through a body must frequently be removed by other heat transter processes. For example, the heat generated in an electronic device must be dissipated to the surroundings through convection by means of fins. Consider the one-dimensional aluminum fin (thickness t 3.0 mm, width Z 20 cm, length L) shown in Figure 1, that is exposed to a surrounding fluid at a temperature 1. The conductivity of the aluminum...