MATLAB Answers

NAN YANG
0

Maybe the new version of the 2019pde toolbox has bugs when building the grid.

Asked by NAN YANG
on 11 Jun 2019
Latest activity Commented on by NAN YANG
on 16 Jun 2019
r=6;rr=0.2;
a=0.8;b=0.4;
%% Geometry
scattering_model = createpde;
%%
% Define a circle in a rectangle, place these in one matrix, and create a
% set formula that subtracts the circle from the rectangle.
C1 = [1,0,0,r]';
C2 = [1,0,0,rr]';
E2 = [4,0,0,a,b,0]';
C1 = [C1;zeros(length(E2)-length(C1),1)];
C2 = [C2;zeros(length(E2)-length(C2),1)];
gm = [C1,E2,C2];
sf = 'C1+E2+C2';
%%
% Create the geometry.
ns = char('C1','E2','C2');
ns = ns';
g = decsg(gm,sf,ns);
%%
% Include the geometry in the model and plot it.
geometryFromEdges(scattering_model,g);
pdegplot(scattering_model,'EdgeLabels','on')
axis equal
generateMesh(scattering_model,'Hmax',0.1);
pdeplot(scattering_model)
%%
V=scattering_model.Mesh.Nodes';
F=scattering_model.Mesh.Elements';
F1=F(:,1:3);F2=F(:,4:6);F=[F1;F2];
F=unique(F,'rows');
When I was using matlab 2016b, there was no problem in building the grid. The same program appeared in the 2019a version with a significant error. The 2019a has the wrong grid as follows:
The green point in the figure is the adjacent point of the red point. There should be no such arrangement in the correct grid F.
微信图片_20190611170916.png
And this kind of grid is not allowed in finite elements, right? Caused a lot of trouble for subsequent programming.

  2 Comments

I am not sure I understand the issue. Can you please elobrate what I should be looking to notice to problem?
Hi kumar, in the 2019a version, generateMesh iterates out the grid shown in the last picture. I think this kind of grid can't be used as a finite element mesh, and the behavior of storage of elements information compared with which in the previous version 2016b is not quite the same, this has caused a lot of trouble for subsequent programming.

Sign in to comment.

1 Answer

Answer by Gaurav Tyagi on 11 Jun 2019
 Accepted Answer

Yes

  0 Comments

Sign in to comment.