Refine
Refine a mesh.
Syntax
model.component(<ctag>).mesh(<tag>).create(<ftag>,"Refine");
model.component(<ctag>).mesh(<tag>).feature(<ftag>).selection();
model.component(<ctag>).mesh(<tag>).feature(<ftag>).set(property,<value>);
model.component(<ctag>).mesh(<tag>).feature(<ftag>).getType(property);
Description
Use model.component(<ctag>).mesh(<tag>).create(<ftag>,"Refine") to refine the mesh. Mesh refinement is available both for generated and imported meshes.
Use model.component(<ctag>).mesh(<tag>).feature(<ftag>).selection() to specify the domain selection. The default selection is the entire geometry, meaning that all elements in the mesh are refined.
The following properties are available:
on | off
longest | regular
xmax, xmin, ymax, ymin, zmax, zmin
Use the boxcoord property to refine elements inside a bounding box. To define the bounding box, set the properties xmin, xmax, ymin, ymax, zmax, and zmin on the feature, where (xmin,ymin,zmin) defines the lower-left corner, and (xmax,ymax,zmax) defines the upper-right corner of the bounding box. The elements that have all its corner points in the bounding box are refined once. boxcoord is automatically set to on if one of the coordinates are set.
The default refinement method in 2D is regular refinement, where all edges of the element are bisected. Longest edge refinement, where the longest edge of each specified element is bisected, can be selected by giving longest as rmethod. Using regular as rmethod results in regular refinement. Some elements outside of the specified set can also be refined due to propagation.
In 3D, the default refinement method is longest. If the mesh contains nonsimplex elements, consider using regular refinement instead because this method preserves the structure of the mesh.
In 1D, regular refinement, where each element is divided into two elements of the same shape, is always used.
By default, all elements are refined once. The numrefine property specifies how many times the elements is refined.
Example
Mesh two squares with free mesh. Refine the mesh on sq2 once and refine the elements inside a box in sq1 twice.
Code for Use with Java
Model model = ModelUtil.create("Model");
model.component().create("comp1");
GeomSequence g = model.component("comp1").geom().create("geom1", 2);
MeshSequence m = model.component("comp1").mesh().create("mesh1", "geom1");
 
g.create("sq1", "Square");
g.create("sq2", "Square");
g.feature("sq2").setIndex("pos", "1", 0);
g.run();
 
m.create("ftri1", "FreeTri");
m.create("ref1", "Refine");
m.feature("ref1").selection().geom("geom1", 2).set(new int[]{2});
m.create("ref2", "Refine");
m.feature("ref2").set("xmin", "0.2");
m.feature("ref2").set("xmax", "0.8");
m.feature("ref2").set("ymin", "0.2");
m.feature("ref2").set("ymax", "0.6");
m.run();
Code for Use with MATLAB
model = ModelUtil.create('Model');
model.component().create('comp1');
g = model.component('comp1').geom.create('geom1', 2);
m = model.component('comp1').mesh.create('mesh1', 'geom1');
 
g.create('sq1', 'Square');
g.create('sq2', 'Square');
g.feature('sq2').setIndex('pos', '1', 0);
g.run;
 
m.create('ftri1', 'FreeTri');
m.create('ref1', 'Refine');
m.feature('ref1').selection().geom('geom1', 2).set(2);
m.create('ref2', 'Refine');
m.feature('ref2').set('xmin', '0.2');
m.feature('ref2').set('xmax', '0.8');
m.feature('ref2').set('ymin', '0.2');
m.feature('ref2').set('ymax', '0.6');
m.run();
See Also
Adapt, Convert