How to change length of arrows within PDE Toolbox plots
1 次查看(过去 30 天)
显示 更早的评论
I am modeling a cooling body with various Neumann boundary conditions, and am plotting the heat flux using arrows in Matlab's PDE Toolbox. Rather than plotting the heat flux at a single point in time, I find what the heat flux is at a certain temperature, and plot the heat flux of that point at that temperature. This creates a plot of heat flux arrows that show the heat flux at one temperature, regardless of when the point evaluated was at that temperature.
My problem is that the heat flux arrows are very large at the edge of the model, but very small on the interior - so small that you cannot see the direction or relative magnitude relating to any other arrows. I would like to scale the arrows in a logarithmic-type way, so that the difference in size is not as large between all the arrows, and the differences can be seen.
I've attached my code below to show how I've gotten the heat flux at a specified temperature, rather than at one time. I first solve everything within the PDE Toolbox GUI, and then export both my solution matrix 'u' and the mesh matrices 'p' 't' and 'e'. I'm modeling a cooling lava flow, so the temperature I'm referring to is the "column formation temperature" and I've tweaked the heat flux arrows to point in the wrong direction for my own use. Any suggestions would be helpful, thanks.
-Dan
% In PDE Toolbox GUI, first do these two steps:
% STEP 1!!!! % SELECT 'EXPORT MESH' FROM 'MESH' MENU
% STEP 2!!!! % SELECT 'EXPORT SOLUTION' FROM 'SOLVE' MENU
col=900;
% column formation temperature
ut=pdeintrp(p,t,u);
% turns node data u into triangle data ut for creating utx and uty vectors
flow=abs(col-ut);
flow(1,:)=NaN;
% sets emplacement temp space to NaN, otherwise find function gets confused
searchvector=zeros(size(flow,2),1);
% sets the searchvector size
for i=1:size(flow,2)
searchvector(i,1)=find(min(flow(:,i))==flow,1,'first');
end
% Finds the point in space and time at which flow temperature is closest to column formation temperature and puts it into searchvector. If more than one point is returned, it only places first point into searchvector
[ux,uy]=pdegrad(p,t,u(:,1));
% makes gradient of emplacement temperature (no gradient, only to find size of ux and uy)
ux(2:size(u,2),:)=0;
uy(2:size(u,2),:)=0;
% creates gradient matrix, filling rows 2:end with zeros
for i=2:size(u,2)
[ux(i,:),uy(i,:)]=pdegrad(p,t,u(:,i));
end
% fills in rest of gradients through time
utx=zeros(size(searchvector,1),1);
uty=zeros(size(searchvector,1),1);
for i=1:size(searchvector,1)
utx(i,1)=ux(searchvector(i));
uty(i,1)=uy(searchvector(i)); end
% fills vectors utx and uty with heat flow direction at time of column formation
% % Plots etc
pdeplot(p,e,t,'xydata',u(:,end-1),'flowdata',[utx,uty])
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geometry and Mesh 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!