Question: PROBLEM 3 : Finish the code heat 2 Dimplicit.m ( shared in Files ) , by programming the implicit finite difference approximation of the 2
PROBLEM :
Finish the code heatDimplicit.m shared in Files by programming the implicit finite difference approximation of the D temperature equation:
Solves the D heat equation with an explicit finite difference scheme
clear
Physical parameters
L e; Width of lithosphere m
H e; Height of lithosphere m
Tbot ; Temperature of bottom lithosphere C
Tsurf ; Temperature of country rock C
Tplume ; Temperature of plume C
kappa e; Thermal diffusivity of rock ms
Wplume e; Width of plume m
day ; # seconds per day
year day; # seconds per year
Numerical parameters
nx ; # gridpoints in xdirection
nz ; # gridpoints in zdirection
nt ; Number of timesteps to compute
dx Lnx; Spacing of grid in xdirection
dz Hnz; Spacing of grid in zdirection
xdzd meshgridL:dx:LH:dz:; create grid
Compute stable timestep
dt mindxdzkappa;
Setup initial linear temperature profile
T abszdHTbot;
Imping plume beneath lithosphere
ind findabsxd: Wplume;
Tind Tplume;
time ;
for n:nt
Compute new temperature
Tnew zerosnznx;
sx kappadtdx;
sz kappadtdz;
for j:nx
for i:nz
Tnewij;
end
end
Set boundary conditions
Tnew: T: ;
Tnewnz:;
for i:nz
Tnewi
Tnewinx
end
T Tnew;
time timedt;
Plot solution every timesteps
if modn
figure clf
pcolorxdezdeTnew; shading interp, colorbar
hold on
contourxdezdeTnew,::k;
xlabelx km
ylabelz km
zlabelTemperature oC
titleTemperature evolution after numstrtimeyeare Myrs
drawnow
end
end
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
