21.01.2015 Views

COMSOL Multiphysics™

COMSOL Multiphysics™

COMSOL Multiphysics™

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

meshplot<br />

2D Example<br />

Start by creating the geometry and a coarse mesh.<br />

clear fem<br />

sq1 = square2;<br />

sq2 = move(sq1,0,-1);<br />

sq3 = move(sq1,-1,-1);<br />

fem.geom = sq1+sq2+sq3;<br />

fem.mesh = meshinit(fem,'hmax',0.4);<br />

Then plot the mesh as a line plot of the edges of the elements. The element edges<br />

are blue except on the boundary elements, where they are red. This is the default<br />

mesh plot type.<br />

meshplot(fem)<br />

You can change the colors of the element edges to yellow and green.<br />

meshplot(fem,'edgecolor','y','boundcolor','g')<br />

Now, plot the mesh as a patch plot. You need to disable both the element edge and<br />

boundary element plots, and enable the element plot.<br />

meshplot(fem,'edgemode','off','boundmode','off','elmode','on')<br />

You can change the color of the elements to red, with white edges, and add mesh<br />

vertex labels by<br />

meshplot(fem,'edgemode','off','boundmode','off','elmode',...<br />

'on','elcolor','r','eledgecolor','w')<br />

1D Example<br />

Start by creating the geometry and mesh.<br />

clear fem<br />

s1 = solid1([0 0.1 4]);<br />

s2 = solid1([3 4]);<br />

fem.geom = s1+s2;<br />

fem.mesh = meshinit(fem,'hmax',0.4);<br />

The standard mesh plot in 1D is the following plot.<br />

meshplot(fem)<br />

You can turn on node labeling, change the element color to red, and change the<br />

element edge boundary coloring to green by<br />

meshplot(fem,'elcolor','r','boundcolor','g')<br />

Compatibility<br />

meshplot no longer supports the properties boundlabels, curvelabels,<br />

ellabels, labelcolor, and nodelabels from FEMLAB 2.3.<br />

286 | CHAPTER 1: COMMAND REFERENCE

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!