Using the Asymptotic method solve the Non-homogenous heat Equation Mathematically
Using the Asymptotic method solve the Non-homogenous heat Equation Mathematically
By using the Asymptotic methodsolve the Non-homogenousheat equation mathematically and then write a MATLAB code.
For :
For your information
Is called Heat equation and this to be solved we need the I C and B C
Consider a laterally insulated metal bar of length 1 and such that = 1 in the heat equation. Suppose that the ends of the bar are kept at temperature and the temperature in the bar at some instant - call it t = 0 - is Applying the Crank Nicolson method with , find the temperature in the bar for 0 = t = 0.2.
Specifically, it will look at systems of the form:
where y represents an array of dependent variables, t represents the independent variable, and C represents an array of constants. Note that although the equation above is a first-order differential equation, many higher-order equations can be re-written to satisfy the form above.
In addition, the examples on this page will assume that the initial values of the variables in y are known - this is what makes these kinds of problems initial value problems (as opposed toboundary value problems).
Matlab Code
Script to solve the heat equation in soil with
%%% seasonal temperature forcing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Initialize variables
dz = .25; %each depth step is 1/4 meter
Nz = 400; % Choose the number of depth steps (should go to at least 100 m)
Nt = 5000; % Choose the number of time steps
dt = (365*24*60*60)/Nt; %Length of each time step in seconds (~ 6.3*10^3 seconds, or ~105 minutes)
K = 2*10^-6; % "canonical" K is 10e-6 m^2/s
T = 15*ones(Nz+1,Nt+1); %Create temperature matrix with Nz+1 rows, and Nt+1 columns
% Initial guess is that T is 15 everywhere.
time = [0:12/Nt:12];
T(1,:) = 15-10*sin(2*pi*time/12); %Set surface temperature
maxiter = 500
for iter = 1:maxiter
Tlast = T; %Save the last guess
T(:,1) = Tlast(:,end); %Initialize the temp at t=0 to the last temp
err(iter) = max(abs(T(:)-Tlast(:))); %Find difference between last two solutions
if err(iter)<1E-4
break; % Stop if solutions very similar, we have convergence
end
end
if iter==maxiter;
warning('Convergence not reached')
end
Asymptotic method solve the Non-homogenous heat Equation
The differential equation and the boundary conditions given in the problem statement are shown below.
[33]
[34]
Since w is a function of x only, the first and last terms in [34] give us an ordinary differential equation that we can solve for w. Writing this equation and integrating it two times gives.
[35]
[36]
[37]
We can combine the solution definition, u(x,t) = v(x,t) + w(x), with the initial condition, u(x,t) = f(x), to get an initial condition for v.
v(x,0) = u(x,0) - w(x) = f(x) - w(x)[38]
We would have to use this initial condition for v(x,0) in developing any eigenfunction expansion to match the initial conditions. The constants of integration in equation [37] can be found by matching boundary temperatures. If u(0,t) = w(0) = uA and u(L,t) = w(L) = uB we have the following results from equation ...