demo09 of writeMesh
Set 'tolerance' when searching boundary node set
Overview
By default, function printInp3d will automatically find boundary nodes of a 3d mesh. 'opt.tolerance' in function printInp3d could be very useful when searching boundary nodes.
'opt.tolerance' - Numeric value. It's the tolerance for coordinates when searching boundary node set (at max & min location). Sub-routine in function printInp3d will automatically find extrema for x y z coordinates in the mesh. Those surface nodes with coordinate satisfy |coordinate - extrema|< tolerance will be considered as boundary node set (at max & min location).
Default value of 'opt.tolerance': 1E-10
Example 1
Initialize
Set default image size.
x = 250; y = 250; width = 350; height = 350;
set(groot, 'DefaultFigurePosition', [x,y,width,height])
% set(groot, 'DefaultFigurePosition', 'factory')
Load mesh
Let's load the mesh data from "mesh_data_4.mat"
We will see 3 variables in the workspace: vert, ele, tnum
Use function plotMeshes3d to plot 3d mesh.
plotMeshes3d( vert, ele, tnum );
Display boundary nodes
By default, function printInp3d will automatically search and export node sets at the boundary.
Before running function printInp3d, we can use function displayBCNode3d to check whether those boundary nodes have been correctly found.
displayBCNode3d( vert, ele, tnum, tolerance, markerSize, plane );
We noticed that some nodes are missing. So we can try a bigger tolerance.
Change 'tolerance'
displayBCNode3d( vert, ele, tnum, tolerance, markerSize, plane );
Awesome. It's much better.
Display node at 'x' boundary
To further validate the result, we can display boundary nodes at x min and x max.
displayBCNode3d( vert, ele, tnum, tolerance, markerSize, plane );
Display node at 'y' boundary
To further validate the result, we can display boundary nodes at y min and y max.
displayBCNode3d( vert, ele, tnum, tolerance, markerSize, plane );
Display node at 'z' boundary
To further validate the result, we can display boundary nodes at z min and z max.
displayBCNode3d( vert, ele, tnum, tolerance, markerSize, plane );
Export as inp file (Abaqus)
When using function printInp3d, we can specify 'opt.tolerance' explicitly.
Default value of 'opt.tolerance' is 1E-10
file_name = 'test_1.inp';
printInp3d( vert, ele, tnum, ele_type, precision, file_name, opt );
printInp3d Done! Check the inp file!
Note
It's not a good idea to set tolerance as a very large value. See below.
In this case, we see some nodes that do not belong to x min and x max. That's not what we want.
displayBCNode3d( vert, ele, tnum, tolerance, markerSize, plane );
Example 2
Load mesh
Let's load the mesh data from "mesh_data_6.mat"
We will see 3 variables in the workspace: vert, ele, tnum
Use function plotMeshes3d to plot 3d mesh.
plotMeshes3d( vert, ele, tnum );
Display boundary nodes
Before running function printInp3d, we can use function displayBCNode3d to check whether those boundary nodes have been correctly found.
displayBCNode3d( vert, ele, tnum, tolerance, markerSize, plane );
We noticed that some nodes are missing. So we can try a bigger tolerance.
Change 'tolerance'
displayBCNode3d( vert, ele, tnum, tolerance, markerSize, plane );
Awesome. It's much better.
Display node at 'x' boundary
To further validate the result, we can display boundary nodes at x min and x max.
displayBCNode3d( vert, ele, tnum, tolerance, markerSize, plane );
Display node at 'y' boundary
To further validate the result, we can display boundary nodes at y min and y max.
displayBCNode3d( vert, ele, tnum, tolerance, markerSize, plane );
Display node at 'z' boundary
To further validate the result, we can display boundary nodes at z min and z max.
displayBCNode3d( vert, ele, tnum, tolerance, markerSize, plane );
Export as inp file (Abaqus)
When using function printInp3d, we can specify 'opt.tolerance' explicitly.
Default value of 'opt.tolerance' is 1E-10
file_name = 'test_2.inp';
printInp3d( vert, ele, tnum, ele_type, precision, file_name, opt );
printInp3d Done! Check the inp file!
set(groot, 'DefaultFigurePosition', 'factory')