pdeplot3d "value of 'colormapdata' is invalid" or "Length of colormapdata vector must equal number of nodes."

7 visualizaciones (últimos 30 días)
Hello,
I am a new user to the pde toolbox. The script I am using is at the bottom of thiis question. If I run the code as it stands, I get the output:
thermalresults =
TransientThermalResults with properties:
Temperature: [8654×11 double]
SolutionTimes: [0 0.5000 1 1.5000 2 2.5000 3 3.5000 4 4.5000 5]
XGradients: [8654×11 double]
YGradients: [8654×11 double]
ZGradients: [8654×11 double]
Mesh: [1×1 FEMesh]
Error using pdeplot3D
Length of colormapdata vector must equal number of nodes.
Error in heatTransfer_v2 (line 33)
pdeplot3D(thermalmodel,"ColorMapData",thermalresults.Temperature(:,end), ...
====================================================================
whereas if I uncomment the alternative pdeplot3D command (commented out below), I get:
========================================================
thermalresults =
TransientThermalResults with properties:
Temperature: [8654×11 double]
SolutionTimes: [0 0.5000 1 1.5000 2 2.5000 3 3.5000 4 4.5000 5]
XGradients: [8654×11 double]
YGradients: [8654×11 double]
ZGradients: [8654×11 double]
Mesh: [1×1 FEMesh]
Error using pdeplot3D
The value of 'colormapdata' is invalid. Operands to the logical AND (&&) and OR (||) operators must
be convertible to logical scalar values. Use the ANY or ALL functions to reduce operands to logical
scalar values.
Error in heatTransfer_v2 (line 29)
pdeplot3D(thermalmodel,"ColorMapData",thermalresults.Temperature, ...
================================================================================
I have looked through the various examples in the pdetoolbox such as here:
but so far I can't see what I need to do.
Thanks in advance
Chris
======================================================================
thermalmodel = createpde('thermal','transient');
pg = importGeometry(thermalmodel,'cylinder3.stl');
pdegplot(thermalmodel,'FaceLabels','on')
ylim([-1,1])
axis equal
thermalProperties(thermalmodel,'ThermalConductivity',1,...
'MassDensity',1,...
'SpecificHeat',1);
thermalBC(thermalmodel,'Face',1,'Temperature',100);
thermalBC(thermalmodel,'Face',5,'HeatFlux',10);
thermalIC(thermalmodel,0);
generateMesh(thermalmodel);
figure
pdemesh(thermalmodel)
title('Mesh with Quadratic Triangular Elements')
tlist = 0:0.5:5;
thermalresults = solve(thermalmodel,tlist)
[qx,qy] = evaluateHeatFlux(thermalresults);
%pdeplot3D(thermalmodel,"ColorMapData",thermalresults.Temperature, ...
% 'FlowData',[qx,qy], ...
% 'ColorMap','hot')
pdeplot3D(thermalmodel,"ColorMapData",thermalresults.Temperature(:,end), ...
'FlowData',[qx(:,end),qy(:,end)], ...
'ColorMap','hot')

Respuesta aceptada

Chris
Chris el 11 de Sept. de 2022
I'm not familiar with this toolbox, but...
  • You have a 3D model, but only 2D flux.
[qx,qy,qz] = evaluateHeatFlux(thermalresults);
  • It doesn't look to me like 'ColorMap' is a valid argument for pdeplot3d.
pdeplot3D(thermalmodel,'FlowData',[qx(:,end),qy(:,end),qz(:,end)],...
'ColorMapData',thermalresults.Temperature(:,end))
colormap hot
  1 comentario
Christopher
Christopher el 12 de Sept. de 2022
Thankyou, I find eliminating the FlowData helps, so that the command:
pdeplot3D(thermalmodel,"ColorMapData",thermalresults.Temperature(:,end))
works for me.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by