Plot along line from. PDE solution
The code below solves a 1-D, transient heat transfer problem set up as in general PDE format. The solution is plotted in color across the domain from 0 to 0.1 after 10 seconds have elapsed. What is the best way to plot the temperature across the length of this domain at this final time?
Thanks
clear all;
%% Create transient thermal model
thermalmodel = createpde(1);
R1= [3,4,0,0.1,0.1,0,0,0,1,1]’;
gd= [R1];
sf= ‘R1’;
ns = char(‘R1’);
ns = ns’;
dl = decsg(gd,sf,ns);
%% Create & plot geometry
geometryFromEdges(thermalmodel,dl);
pdegplot(thermalmodel,"EdgeLabels","on","FaceLabels","on")
xlim([0 0.1])
ylim([-1 1])
% axis equal
%% Generate and plot mesh
generateMesh(thermalmodel)
figure
pdemesh(thermalmodel)
title("Mesh with Quadratic Triangular Elements")
%% Apply BCs
% Edge 4 is left edge; Edge 2 is right side
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[4],u=100);
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[2],u=20);
%% Apply thermal properties [copper]
rho= 8933 %
cp= 385 %
rhocp= rho*cp %
k= 401 % W/mK
%% Define uniform volumetric heat generation rate
Qgen= 0 % W/m3
%% Define coefficients for generic Governing Equation to be solved
m= 0
a= 0
d= rhocp
c= [k]
f= [Qgen]
specifyCoefficients(thermalmodel, m=0, d=rhocp, c=k, a=0, f=f);
%% Apply initial condition
setInitialConditions(thermalmodel, 20);
%% Define time limits
tlist= 0: 1: 10;
thermalresults= solvepde(thermalmodel, tlist);
% Plot results
sol = thermalresults.NodalSolution;
subplot(2,2,1)
pdeplot(thermalmodel,"XYData",sol(:,11), …
"Contour","on",…
"ColorMap","jet")The code below solves a 1-D, transient heat transfer problem set up as in general PDE format. The solution is plotted in color across the domain from 0 to 0.1 after 10 seconds have elapsed. What is the best way to plot the temperature across the length of this domain at this final time?
Thanks
clear all;
%% Create transient thermal model
thermalmodel = createpde(1);
R1= [3,4,0,0.1,0.1,0,0,0,1,1]’;
gd= [R1];
sf= ‘R1’;
ns = char(‘R1’);
ns = ns’;
dl = decsg(gd,sf,ns);
%% Create & plot geometry
geometryFromEdges(thermalmodel,dl);
pdegplot(thermalmodel,"EdgeLabels","on","FaceLabels","on")
xlim([0 0.1])
ylim([-1 1])
% axis equal
%% Generate and plot mesh
generateMesh(thermalmodel)
figure
pdemesh(thermalmodel)
title("Mesh with Quadratic Triangular Elements")
%% Apply BCs
% Edge 4 is left edge; Edge 2 is right side
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[4],u=100);
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[2],u=20);
%% Apply thermal properties [copper]
rho= 8933 %
cp= 385 %
rhocp= rho*cp %
k= 401 % W/mK
%% Define uniform volumetric heat generation rate
Qgen= 0 % W/m3
%% Define coefficients for generic Governing Equation to be solved
m= 0
a= 0
d= rhocp
c= [k]
f= [Qgen]
specifyCoefficients(thermalmodel, m=0, d=rhocp, c=k, a=0, f=f);
%% Apply initial condition
setInitialConditions(thermalmodel, 20);
%% Define time limits
tlist= 0: 1: 10;
thermalresults= solvepde(thermalmodel, tlist);
% Plot results
sol = thermalresults.NodalSolution;
subplot(2,2,1)
pdeplot(thermalmodel,"XYData",sol(:,11), …
"Contour","on",…
"ColorMap","jet") The code below solves a 1-D, transient heat transfer problem set up as in general PDE format. The solution is plotted in color across the domain from 0 to 0.1 after 10 seconds have elapsed. What is the best way to plot the temperature across the length of this domain at this final time?
Thanks
clear all;
%% Create transient thermal model
thermalmodel = createpde(1);
R1= [3,4,0,0.1,0.1,0,0,0,1,1]’;
gd= [R1];
sf= ‘R1’;
ns = char(‘R1’);
ns = ns’;
dl = decsg(gd,sf,ns);
%% Create & plot geometry
geometryFromEdges(thermalmodel,dl);
pdegplot(thermalmodel,"EdgeLabels","on","FaceLabels","on")
xlim([0 0.1])
ylim([-1 1])
% axis equal
%% Generate and plot mesh
generateMesh(thermalmodel)
figure
pdemesh(thermalmodel)
title("Mesh with Quadratic Triangular Elements")
%% Apply BCs
% Edge 4 is left edge; Edge 2 is right side
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[4],u=100);
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[2],u=20);
%% Apply thermal properties [copper]
rho= 8933 %
cp= 385 %
rhocp= rho*cp %
k= 401 % W/mK
%% Define uniform volumetric heat generation rate
Qgen= 0 % W/m3
%% Define coefficients for generic Governing Equation to be solved
m= 0
a= 0
d= rhocp
c= [k]
f= [Qgen]
specifyCoefficients(thermalmodel, m=0, d=rhocp, c=k, a=0, f=f);
%% Apply initial condition
setInitialConditions(thermalmodel, 20);
%% Define time limits
tlist= 0: 1: 10;
thermalresults= solvepde(thermalmodel, tlist);
% Plot results
sol = thermalresults.NodalSolution;
subplot(2,2,1)
pdeplot(thermalmodel,"XYData",sol(:,11), …
"Contour","on",…
"ColorMap","jet") plotting MATLAB Answers — New Questions