Sie sind auf Seite 1von 7

1

1a)
l=100;
dx=0.1;
kappa=30e-6;
x=0:dx:l;
n=length(x);
T=zeros(1,n);
t=0;

%length of the domain in km


%grid spacing
%thermal diffusivity in km2/a
%number of elements

dt=100;
Tm=1250;

%in years

T=Tm*(1-x/l);
T(1)=Tm;
T(n)=Tm;

%initial temp. distribution


%Temp. atthe left-hand boundary
%Temp. at the right-hand boundary

while t<=100000

t=t+dt
T(2:n-1)=T(2:n-1)+dt*kappa*(T(3:n)-2*T(2:n-1)+T(1:n-2))/dx^2;

plot(x,T)
xlabel('position in km');ylabel('temperature in C')
pause(0.1)
end

Obasi Martin Essuka

Martrikel-Nr. 3556554

MatLab excercise 4

2
1b)
Plot for t=0:

1400

1200

temperature in C

1000

800

600

400

200

10

20

30

40
50
60
position in km

70

80

90

100

Plot for t=10000

1400

1200

temperature in C

1000

800

600

400

200

Obasi Martin Essuka

10

20

30

40
50
60
position in km

Martrikel-Nr. 3556554

70

80

90

100

MatLab excercise 4

3
Plot for t=100000

1400

1200

temperature in C

1000

800

increasing t
600

400

200

10

Obasi Martin Essuka

20

30

40
50
60
position in km

70

Martrikel-Nr. 3556554

80

90

100

MatLab excercise 4

c)
l=100;
dx=0.1;
kappa=30e-6;
x=0:dx:l;
n=length(x);
T=zeros(1,n);
t=0;

dt=10;
Tm=1250;

%length of the domain in km


%grid spacing
%thermal diffusivity in km2/a
%number of elements

%in years

T=Tm*(1-x/l);
T(1)=1250;
T(n)=1250;
holdon
while t<=25000

t=t+dt
T(2:n-1)=T(2:n-1)+dt*kappa*(T(3:n)-2*T(2:n-1)+T(1:n-2))/dx^2;
Tmean=mean(T.*1)

plot(t,Tm-Tmean)
xlabel('time in years'),ylabel('Tm-Tmean in C')
end

Tm-Tmean in C

2.793

10

2.791

10

2.789

10

2.787

10

0.5

1.5
time in years

Obasi Martin Essuka

Martrikel-Nr. 3556554

2.5
4

x 10

MatLab excercise 4

5
d) Plot of Tm-Tmean for l = 100 km and l = 50 km

l=100km
l=50km
2.794

Tm-Tmean in C

10

2.793

10

2.792

10

200

400

600
time in years

800

1000

1200

The plot above shows that the difference between both curves increases with time. The mean of the
temperature at l = 50 km increases faster this means Tm-Tmean decreases faster, because a steadystate-condition with nearly the same temperatures everywhere in the plate is achieved earlier. In other
words, the heat is distributed faster through the plate.
In the following figure, there is also the difference between both means (for 100 km and 50 km) plotted
versus time t.

Obasi Martin Essuka

Martrikel-Nr. 3556554

MatLab excercise 4

3.2
3

Difference between the means

2.8
2.6
2.4
2.2
2
1.8
1.6
1.4

200

400

600
time in years

800

1000

1200

The last two figures were plotted by using the following code:
l=100;
m=50;
dx=0.1;
kappa=30e-6;
x=0:dx:l;
z=0:dx:m;
n=length(x);
k=length(z);
T=zeros(1,n);
t=0;

dt=10;
Tm=1250;
T=Tm*(1-x/l);
T(1)=1250;
T(n)=1250;
U=1250*(1-z/m);
U(1)=1250;
U(k)=1250;
holdon

%length of the 1st domain in km


%length of the 2nd domain in km
%grid spacing
%thermal diffusivity in km2/a
%position in domain 1
%position in domain 1
%number of elements 2nd domain
%number of elements 2nd domain

%in years

%temperature in the 2nd domain

while t<=1000

Obasi Martin Essuka

Martrikel-Nr. 3556554

MatLab excercise 4

t=t+dt
T(2:n-1)=T(2:n-1)+dt*kappa*(T(3:n)-2*T(2:n-1)+T(1:n-2))/dx^2;
Tmean=mean(T.*1);
U(2:k-1)=U(2:k-1)+dt*kappa*(U(3:k)-2*U(2:k-1)+U(1:k-2))/dx^2;
Umean=mean(U.*1);
Diff=mean(U.*1)-mean(T.*1);
holdon
figure(1)
plot(t,Tm-Tmean,'r+',t,Tm-Umean,'b.')
xlabel('time in years'),ylabel('Tm-Tmean in C')
legend('l=100km','l=50km')
figure(2)
plot(t,Diff,'gx')
xlabel('time in years'),ylabel('Difference between the means')
end

Obasi Martin Essuka

Martrikel-Nr. 3556554

MatLab excercise 4

Das könnte Ihnen auch gefallen