% Solution to problem 2 in homework #6 in MEAM 550 in Spring 2004
% The script is below is adapted from Constantin Hatzis's code 
% submitted as a solution.
%
% Solution of the two-point boundary value problem (bvp) concerning
% a Joule-heated circular loop with convection from top considering
% TCR effect and zero temperature at the two ends.
clear all
clc
% Global variables
global t kappa alpha V h rho r
% Data
r = 150E-6;
w = 3e-6;
t = 1e-6;
kappa = 146.4;
alpha = 2000E-6;
rho = 4.2E-4;
V = 100;
h = 30000;
R0 = rho*2*pi*r/w/t;
% Prepare data for the bvp4c function
L = 2*pi*r;
s = 0:L/100:L; % Discretize the circular loop
% Initial guess for the solution of the bvp
solinit = bvpinit(s,[0 0]);
% Call to bvp4c function to get the solution
soln = bvp4c(@deriv, @bcs, solinit);
y1 = deval(soln,s);
% figure(1)
% clf
plot(s*1E6,y1(1,:),'-b','LineWidth',2);
xlabel('s (microns)','FontSize',16);
ylabel('T (K)','FontSize',16);
