How to combine 2 cells to make one pde model?

12 次查看(过去 30 天)
I receive this error ''Undefined function 'addCell' for input arguments of type 'pde.DiscreteGeometry'. Error in NEW (line 134) TPMSDomainCombine = addCell(gm,gk);'' I was following https://www.mathworks.com/help/pde/ug/discretegeometry.addcell.html
clc
clear
close all
%Create a PDEModel container for a system of three equations.
model = createpde("thermal","transient");
%Import geometry into the container.
gm = importGeometry(model,"D:\GPDnow.stl");
Error using importGeometry
File D:\GPDnow.stl does not exist.

Error in pde.EquationModel/importGeometry (line 46)
gm = importGeometry(geofilename,varargin{:});
pdegplot(gm,"CellLabels","on","FaceAlpha",0.5)
Nx = 20;
Ny = 20;
Nz = 20;
x = linspace(-5, 5, Nx*10);
y = linspace(0, 1, Ny*1);
z = linspace(0, 1, Nz*1);
[xg, yg, zg] = meshgrid(x, y, z);
Pcube = [xg(:) yg(:), zg(:)];
ttq = alphaShape(Pcube(:,1), ...
Pcube(:,2), ...
Pcube(:,3));
% figure
% plot(ttq,'FaceAlpha',0.4)
% title('domain')
%Recover the triangulation that defines the domain of the alphaShape object.
[tri,loc] = alphaTriangulation(ttq);
%Create a PDE model.
modelCube = createpde;
%Create a geometry from the mesh and import the geometry and the mesh into the model.
gk = geometryFromMesh(modelCube,loc',tri');
pdegplot(gk,"FaceAlpha",0.5,"CellLabels","on")
% title("PDEModel: Cube with Spherical Cavity")
%Combine the models
TPMSDomainCombine = addCell(gm,gk);
pdegplot(TPMSDomainCombine,"FaceAlpha",0.5,"CellLabels","on")
title('()TPMS model')

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by