2015-02-06 6 views
0

저는 Matlab 환경에 익숙하지 않고 Matlab (2014b)에서 열전달 시뮬레이션을하고 있습니다. 나는 여러 재료로 된 다층 벽을 만들 계획입니다 (지금은 단 하나의 재료 - 구리 만 있습니다). 결과를 단일 플롯으로 표시하십시오. 플롯에 벽의 세 번째 레이어를 추가 할 때까지 모든 것이 잘 작동합니다. 아래는 PDE 솔버 (R3-R0)의 기본 변수와 형상의 정의는 : 지금MatLab PDE 플로팅 문제

k = 400; 
rho = 8960; 
specificHeat = 386; 
thick = .01; 
stefanBoltz = 5.670373e-8; 
hCoeff = 1; 
ta = 300; 
emiss = .5; 

c = thick*k; 
a = sprintf('2*%g + 2*%g*%g*u.^3', hCoeff, emiss, stefanBoltz); 
f = 2*hCoeff*ta + 2*emiss*stefanBoltz*ta^4; 
d = thick*rho*specificHeat; 

r0 = [3 4 0 1 1 0 1 1 1.3 1.3]; 
r1 = [3 4 0 1 1 0 0.6 0.6 1 1]; 
r2 = [3 4 0 1 1 0 0.3 0.3 0.6 0.6]; 
r3 = [3 4 0 1 1 0 0 0 0.3 0.3]; 

코드 조각에 이어 입력과 벽의 ​​하부 층 (R3)을 통하여 열 전달을 계산 1000 K의 온도, I는 기본적으로 "U (4)"(이전 층의 출력)의 입력 온도는 "R2"구형 이전 코드 반복 "잡아"후

gdm = r3'; 
g = decsg(gdm, 'R3', ('R3')'); 
hmax = .1; % element size 
[p, e, t] = initmesh(g, 'Hmax', hmax);  

numberOfPDE = 1; 
pb = pde(numberOfPDE); 
pg = pdeGeometryFromEdges(g); 
uBottom = pdeBoundaryConditions(pg.Edges(1),'u',1000); 
pb.BoundaryConditions = uBottom; 

u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped'); 
fprintf('Temperature at the top edge of the plate = %5.1f degrees-K\n', ... 
u(4)); 

figure 
pdeplot(p, e, t, 'xydata', u, 'contour', 'on', 'colormap', 'jet') 

hold on 

, 이 마지막 코드 비트가 이어집니다.

hold off 
axis([0,1,0,2]) 
caxis manual 
caxis([u(4) 1000]); 
colorbar; 

내가 말했듯이, 이것은 모두 작동하며 첫 번째 레이어와 두 번째 레이어의 결과는 같은 플롯에 있습니다. 그러나 세 번째 레이어 (r1)에 대한 프로세스를 반복하고 원래 그림에 결과를 플로팅 한 후 (물론 코드의 맨 끝에있는 "홀드 오프"비트를 사용하여) 플롯에 대한 결과 만 표시합니다. 제 3 층 이것이 Matlab의 제한 사항인지 또는 내 솔루션이 잘못되었는지 확실하지 않아서 약간의 도움이나 방향을 묻고 싶습니다.

k = 400; 
rho = 8960; 
specificHeat = 386; 
thick = .01; 
stefanBoltz = 5.670373e-8; 
hCoeff = 1; 
ta = 300; 
emiss = .5; 

c = thick*k; 
a = sprintf('2*%g + 2*%g*%g*u.^3', hCoeff, emiss, stefanBoltz); 
f = 2*hCoeff*ta + 2*emiss*stefanBoltz*ta^4; 
d = thick*rho*specificHeat; 

r0 = [3 4 0 1 1 0 1 1 1.3 1.3]; 
r1 = [3 4 0 1 1 0 0.6 0.6 1 1]; 
r2 = [3 4 0 1 1 0 0.3 0.3 0.6 0.6]; 
r3 = [3 4 0 1 1 0 0 0 0.3 0.3]; 
%--------------------------------------------------------- 

gdm = r3'; 
g = decsg(gdm, 'R3', ('R3')'); 
hmax = .1; % element size 
[p, e, t] = initmesh(g, 'Hmax', hmax); 

numberOfPDE = 1; 
pb = pde(numberOfPDE); 
pg = pdeGeometryFromEdges(g); 
uBottom = pdeBoundaryConditions(pg.Edges(1),'u',1000); 
pb.BoundaryConditions = uBottom; 

u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped'); 
fprintf('Temperature at the top edge of the plate = %5.1f degrees-K\n', ... 
u(4)); 

figure 
pdeplot(p, e, t, 'xydata', u, 'contour', 'on', 'colormap', 'jet') 

hold on 

%---------------------------------------------------------------------- 
gdm = r2'; 
g = decsg(gdm, 'R2', ('R2')'); 
hmax = .1; % element size 
[p, e, t] = initmesh(g, 'Hmax', hmax); 

numberOfPDE = 1; 
pb = pde(numberOfPDE); 
pg = pdeGeometryFromEdges(g); 
uBottom = pdeBoundaryConditions(pg.Edges(1),'u',u(4)); 
pb.BoundaryConditions = uBottom; 

u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped'); 
fprintf('Temperature at the top edge of the plate = %5.1f degrees-K\n', ... 
u(4)); 

pdeplot(p, e, t, 'xydata', u, 'contour', 'on', 'colormap', 'jet') 

%---------------------------------------------------------------------------- 
gdm = r1'; 
g = decsg(gdm, 'R1', ('R1')'); 
hmax = .1; % element size 
[p, e, t] = initmesh(g, 'Hmax', hmax); 

numberOfPDE = 1; 
pb = pde(numberOfPDE); 
pg = pdeGeometryFromEdges(g); 
uBottom = pdeBoundaryConditions(pg.Edges(1),'u',u(4)); 
pb.BoundaryConditions = uBottom; 

u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped'); 
fprintf('Temperature at the top edge of the plate = %5.1f degrees-K\n', ... 
u(4)); 

pdeplot(p, e, t, 'xydata', u, 'contour', 'on', 'colormap', 'jet') 

%---------------------------------------------------------------------------- 
gdm = r0'; 
g = decsg(gdm, 'R0', ('R0')'); 
hmax = .1; % element size 
[p, e, t] = initmesh(g, 'Hmax', hmax); 

numberOfPDE = 1; 
pb = pde(numberOfPDE); 
pg = pdeGeometryFromEdges(g); 
uBottom = pdeBoundaryConditions(pg.Edges(1),'u',u(4)); 
pb.BoundaryConditions = uBottom; 

u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped'); 
fprintf('Temperature at the top edge of the plate = %5.1f degrees-K\n', ... 
u(4)); 

pdeplot(p, e, t, 'xydata', u, 'contour', 'on', 'colormap', 'jet') 

%hold off 

axis([0,1,0,2]) 
%caxis manual 
caxis([u(4) 1000]); 
+1

끝에 'hold off'나 마지막에 'caxis manual'을 둘 필요가 없습니다. 삭제할 수 있습니다. – Ratbert

+0

고마워,하지만 여전히 그 벽의 한 레이어를 표시 플롯 내 문제를 해결하지 않는다 –

+0

전체 프로그램을 게시 할 수 있습니까? – Ratbert

답변

1

어떤 이유로 (나에게 완전히 명확하지 않다 있음) pdeplot 함수가 내부적으로 hold off를 호출하는 경우 :

사전

감사드립니다 다음은 더 잘 이해의 전체 코드입니다.

따라서 원하는 결과를 얻으려면 pdeplot을 호출 할 때마다 hold on을 추가해야합니다.

+0

실제로 이상한 동작이 있지만 그게 내 문제를 완전히 해결했습니다. 고마워요 :) –