demo06 of writeMesh
Select formats when writing inp files
Overview
When we use function printInp2d to create inp files, the arrangement of text within the inp file, or its format, can be customized.
By default, function printInp2d will automatically write an inp file in a concise format. We can use parameter 'opt.mode' to select other formats. The default value of 'opt.mode' is 1.
- When opt.mode = 1, the declaration of assembly and instance will be neglected. This is the concise format. Inp file example #1
- When opt.mode = 2, assembly and instance will be declared explicitly (normal mode). The exported inp file would have a model with one part, which contains multiple sections. Each section corresponds to one phase in the mesh. Inp file example #2
- When opt.mode = 3, assembly and instance will be declared explicitly (normal mode). The exported inp file would have a model with multiple parts, where each part corresponds to one phase in the mesh. Inp file example #3
Initialize
Set default image size.
x = 250; y = 250; width = 250; height = 250;
set(groot, 'DefaultFigurePosition', [x,y,width,height])
% set(groot, 'DefaultFigurePosition', 'factory')
Load mesh
Let's load the mesh data from "mesh_data_2.mat"
We will see 3 variables: vert, ele, tnum
Plot mesh
Use function plotMeshes to plot mesh.
plotMeshes(vert,ele,tnum);
Write inp file (opt.mode = 1)
The declaration of assembly and instance will be neglected. This is the concise format.
file_name = 'test_1.inp';
printInp2d( vert, ele, tnum, ele_type, precision, file_name, opt );
printInp2d Done! Check the inp file!
Write inp file (opt.mode = 2)
Assembly and instance will be declared explicitly (normal mode). The exported inp file would have a model with one part, which contains multiple sections. Each section corresponds to one phase in the mesh.
file_name = 'test_2.inp';
printInp2d( vert, ele, tnum, ele_type, precision, file_name, opt );
printInp2d Done! Check the inp file!
Write inp file (opt.mode = 3)
Assembly and instance will be declared explicitly (normal mode). The exported inp file would have a model with multiple parts, where each part corresponds to one phase in the mesh.
file_name = 'test_3.inp';
printInp2d( vert, ele, tnum, ele_type, precision, file_name, opt );
printInp2d Done! Check the inp file!
set(groot, 'DefaultFigurePosition', 'factory')