Difference between revisions of "FEA Mesh Generation Commands"

From OSUPDOCS
Jump to navigation Jump to search
 
(54 intermediate revisions by the same user not shown)
Line 1: Line 1:
The best way to generate an FEA mesh is to use [[Keypoint]], [[Path]], and [[Area]] commands and possible combine them with image files or shape commands .
The best way to generate an FEA mesh is to use [[Keypoint Command|Keypoint]], [[Path Command|Path]], and [[Area Command|Area]] commands.
__TOC__
== Scripted Input Files ==


== Scripted Input Files ==
In scripted input files, you build the mesh by using multiple [[#mesh_cmds|mesh generation commands]]. These commands are usually grouped together, but may be at various locations in the input file. For example, a simple 2D, rectangular mesh of width <tt>#length</tt>, height <tt>#height</tt>, and thickness <tt>#thick</tt> with <tt>#horiz</tt> elements in the horizontal direction and <tt>#vert</tt> elements in the vertical direction (where terms beginning in number signs are [[Variable Names|script variables]]) can be created with:


In scripted input files, you build the mesh by using multiple [[Mesh Generation Commands]]. These commands are usually grouped together, but may be at various locations in the input file. The commands are:
Area #matname$,#thick
  Path "Bottom",#horiz
    Keypoint "BotLeft",0,0
    Keypoint "BotRight",#length,0
  EndPath
  Path "Right",#vert
    Keypoints "BotRight"
    Keypoint "TopRight",#length,#height
  EndPath
  Path "Top",#horiz
    Keypoints "TopRight"
    Keypoint "TopLeft",0,#height
  EndPath
  Path "Left",#vert
    Keypoints "TopLeft","BotRight"
  EndPath
EndArea
Resequence "BotRight"


==== Basic Commands ====
<span id="mesh_cmds"></span>The following commands are used for generating the mesh in scripted files.


* [[Area Command|Area]]: Define an area for mesh generation.
* [[Path Command|Path]]: Define a path used in defining [[Area Command|areas]].
* [[Path Command|Paths]]: Add multiple defined paths to an [[Area Command|area]].
* [[Keypoint Command|Keypoint]]: Define a keypoint used in defining [[Path Command|paths]]
* [[Keypoint Command|Keypoint]]: Define a keypoint used in defining [[Path Command|paths]]
* [[Keypoints Command|Keypoints]]: Add multiple defined keypoints to a [[Path Command|path]].
* [[Keypoint Command|Keypoints]]: Add multiple defined keypoints to a [[Path Command|path]].
* [[Path Command|Path]]: Define a path used in defining [[Area Command|areas]].
* [[Resequence Command]]: To turn on the option to resequence the nodes, which will minimize the bandwidth of the problem and speed the calculations.
* [[Paths Command|Paths]]: Add multiple defined paths to an [[Area Command|area]].
* [[Area Command|Area]]: Define an area for mesh generation.
 
==== Mesh Attribute Commands ====
 
* <a href="Origin.html">Origin</a>: Define coordinate system origin for entry of <a href="keypoint.html">Keypoints</a> using polar coordinates.
* <a href="element.html">Element</a>: Define type of element to use in the mesh.
* <a href="fliptriangles.html">FlipTriangles</a>: Select the direction of triangular elements in meshes that use those elements.
* <a href="resequence.html">Resequence</a>: To turn on the option to resequence the nodes, which will minimize the bandwidth of the problem and speed the calculations.
 
==== Creating a Mesh Using Image and Shape Commands ====
 
* <a href="bmpregion.html">BMPRegion</a> ... <a href="endregion.html">EndRegion</a>: Generate elements from an image in a BMP file.
* <a href="hole.html">Hole</a> ... <a href="endhole.html">EndHole</a>: Remove elements using a series of shape commands.
* <a href="oval.html">Oval</a>: Define oval to set element material type.
* <a href="polypt.html">PolyPt</a>: Define polygon to set element material type
* <a href="rect.html">Rect</a>: Define rectangle to set element material type.
* <a href="region.html">Region</a> ... <a href="endregion.html">EndRegion</a>: Generate elements for a series of shape commands.


== XML Input Files ==
== XML Input Files ==


In <tt>XML</tt> input files, all [[Mesh Generation Commands]] must be within a single Mesh block:
In <tt>XML</tt> input files, you build the mesh with [[#mesh_cmds_xml|mesh generation commands]] that must be within a single <tt><Mesh></tt> block. Here is a <tt><Mesh></tt> block that creates at 50X10 rectangular mesh with 6 elements in the horizontal direction and 3 in the vertical direction:


<pre>
<pre>
&lt;Mesh&gt;
&lt;Mesh&gt;
   &lt;<a href="#Keypoints"><code>Keypoints</code></a>&gt;
   &lt;Keypoints&gt;
     &lt;pt x='0' y='0' id='lowerleft'/&gt;
     &lt;pt x='0' y='0' id='lowerleft'/&gt;
     &lt;pt x='0' y='10' id='upperleft'/&gt;
     &lt;pt x='0' y='10' id='upperleft'/&gt;
Line 42: Line 46:
   &lt;/Keypoints&gt;
   &lt;/Keypoints&gt;


   &lt;<a href="#Paths"><code>Path</code></a> id="bottom" intervals='6' ratio='1'&gt;
   &lt;Path id="bottom" intervals='6' ratio='1'&gt;
     &lt;keypt id='lowerleft'/&gt;
     &lt;keypt id='lowerleft'/&gt;
     &lt;keypt id='lowerright'/&gt;
     &lt;keypt id='lowerright'/&gt;
Line 59: Line 63:
   &lt;/Path&gt;
   &lt;/Path&gt;


   &lt;<a href="#Areas"><code>Area</code></a> mat="1" thick="10" type="4" flip="0" angle="0"&gt;
   &lt;Area mat="1" thick="10" type="4" flip="0" angle="0"&gt;
     &lt;path id="bottom"/&gt;
     &lt;path id="bottom"/&gt;
     &lt;path id="right"/&gt;
     &lt;path id="right"/&gt;
Line 66: Line 70:
   &lt;/Area&gt;
   &lt;/Area&gt;
&lt;/Mesh&gt;
&lt;/Mesh&gt;
&lt;!-- image and shape methods to set element properties --&gt;
&lt;BMP name="MatImage.bmp" width="50" angles="MatAngles.bmp"&gt;
  &lt;Origin x="0" y="0"/&gt;
  &lt;Intensity mat="2" imin="76" imax="255"&gt;
    &lt;Thickness units="mm"&gt;1&lt;/Thickness&gt;
  &lt;/Intensity&gt;
  &lt;Intensity mat="3" imin="1" imax="75"&gt;
    &lt;Thickness units="mm"&gt;1&lt;/Thickness&gt;
  &lt;/Intensity&gt;
  &lt;Intensity imin="0" imax="255" minAngle="0.000000" maxAngle="90.000000"/&gt;
&lt;/BMP&gt;
&lt;Body mat='1' angle='0' thick='1'&gt;
  &lt;Oval units='mm' xmin='10' xmax='40' ymin='10' ymax='40'/&gt;
  &lt;Rect units='mm' xmin='10' xmax='40' ymin='10' ymax='40'/&gt;   
&lt;/Body&gt;
&lt;Hole&gt;
  &lt;Rect xmin='20' xmax='30' ymin='20' ymax='30'/&gt;   
&lt;/Hole&gt;
</pre>
</pre>


==== Keypoints ====
<span id="mesh_cmds_xml"></span>The fundamental <tt>XML</tt> commands for generating a mesh are:
 
The <tt>&lt;Keypoints&gt;</tt> section must come first. It can define any number of key points. Each subordinate <tt>&lt;pt&gt;</tt> command defines a key point, provides its <tt>x</tt> and <tt>y</tt> coordinates and gives it an <tt>id</tt>. The <tt>id</tt>'s can be text or numbers and must all be unique among key points.
 
==== Paths ====
 
Following the <tt>&lt;Keypoints&gt;</tt>, there are a series of <tt>&lt;Path&gt;</tt> commands that link the key points into lines or arcs and define mesh information along those paths. Subordinate to each <tt>&lt;Path&gt;</tt> command are a series of <tt>&lt;keypt&gt;</tt> commands that list the key points that define the path. Use two key points to define a line or three key points to define an arc. Currently the path can only have two or three key points. The key points are selected by their <tt>id</tt>. The attributes for a <tt>&lt;Path&gt;</tt> command are:
 
*<tt>id</tt>: An <tt>id</tt> for the path. The <tt>id</tt>'s can be text or numbers and must be unique among all paths.
*<tt>intervals</tt>: Number of elements along this path when it is meshed into an area.
* <tt>ratio</tt>: Ratio of the size of the first element along the path to the last one. If <tt>ratio<0</tt>, then the absolute size of the first element on the path with be <tt>|ratio|</tt>. The default is 1.0 which gives equally sized elements.
 
==== Areas ====
 
Finally, the FEA mesh is created by a series of <tt>&lt;Area&gt;</tt> commands. An <tt>&lt;Area&gt;</tt> command links a series of paths into a region to be meshed. Subordinate to each <tt>&lt;Area&gt;</tt> command are a series of <tt>&lt;path&gt;</tt> commands that list the paths that define the area. Currently [[NairnFEA]] only supports areas with four paths, to mesh quadrilateral areas, or areas with two paths, to mesh interfaces.
 
For quadrilateral areas, the end of the last path must connect to the start of the first path. The direction of each path does not matter as they will be rearranged if needed to define the area; but the paths must circumnavigate the area in the counter-clockwise direction. If <tt>n<sub>1</sub></tt>, <tt>n<sub>2</sub></tt>, <tt>n<sub>3</sub></tt>, and <tt>n<sub>4</sub></tt> are the number of nodes along each of the four paths, the meshing algorithm requires that <tt>n<sub>1</sub>+n<sub>2</sub>=n<sub>3</sub>+n<sub>4</sub></tt>.
 
For interface meshing, the two paths must be different, but indentical paths. In other words, they must connect different keypoints, but the coordinates of the keypoints, the number of intervals along the path, and the path ratios must be identical. The order and orientation of the two paths in the area command does not matter. Finally, interfaces only function when they connect two areas. To insure this connection, the paths for an interface must have each been previously used in exactly one quadrilateral area.
 
The attributes for a <tt>&lt;Area&gt;</tt> command are:
 
* <tt>mat</tt>: Material number in the list of [[Material Command Block#XML Input Commands|defined materials]] when referring to material [[Material Command Block#Referencing Materials in XML Files|"By Number"]]. If you are using the optional [[BMP, Region, and Hole Commands|BMP, Body, and Hole commands method to set element properties, the <tt>mat</tt> should be 0 for elements that will be set later by other commands.
* <tt>matname</tt>: Alternatively, materials can be specified [[Material Command Block#Referencing Materials in XML Files|"By Name"]].
* <tt>angle</tt>: Optional material angle relevant to [[FEA Material Models|anisotropic materials]]. It can be entered as a number or as a [[user-defined function]]. A function is evaluated at the midpoint of an element. Triangular elements are created in pairs and the function is evaluated at the midpoint of each pair.
* <tt>thick</tt>: Thickness in mm for plane stress or plain strain analysis; not needed for axisymmetric analysis.
* <tt>type</tt>: The type of [[FEA Elements|element to create by number]. The first <tt>&lt;Area&gt;</tt> command must define an element type. Subsequent <tt>&lt;Area&gt;</tt> commands can omit the element type unless the element type is changed to have an analysis with mixed elements. When mixed elements are used, they must be compatible elements (<i>i.e.</i>, you can mix linear elements (types 1, 2, and 5) with each other or quadratic elements (types 3, 4, 6, and 8) with each other, but cannot mix linear elements with quadratic elements). Whenever a <tt>type</tt> attribute is used, it will apply to that area and all subsequent areas until it is changed. Finally, quadrilateral areas can only use solid elements (types 1, 2, 3, 4, and 8) and interface areas can use only interface elements (type 5 and 6).
* <tt>flip</tt>: For triangular elements, the initially created quadrilaterials are split into two elements by drawing a diagonal across the quadrilaterial. The <tt>flip</tt> option can change which diagonal is used. It should be 0 or 1. Once it is set, it will apply to that area and all subsequent areas until it is changed.
 
==== BMP, Region, and Hole Commands ====
 
A powerful way to mesh complicated structures or composite materials with complicated morphologies is to do most of the work in <tt>&lt;BMP&gt;</tt> commands or using shapes in <tt>&lt;Body&gt;</tt> or <tt>&lt;Hole&gt;</tt> commands. The process is:
 
# Create a standard mesh as described above. For sections of the mesh that will be set from a <tt>BMP</tt> file or from shapes, set the material attribute to 0.
# One the <tt>&lt;Mesh&gt;</t> section is done, use one or more interspersed <tt>&lt;BMP&gt;</tt>, <tt>&lt;Body&gt;</tt>, or <tt>&lt;Hole&gt;</tt> commands. They will map elements they cover currently with material 0 to the the material defined by the image or the region settings. The grid can be regular or irregular. The material will be selected from the image information at the centroid of the element; for shapes it will be set if the centroid of the element is in the shape. To resolve complicated structures, the grid has to be fine enough to resolve object details.
# When the mesh is done, any elements initialized to material 0 but not assigned to a material by <tt>&lt;BMP&gt;</tt>, <tt>&lt;Body&gt;</tt>, or <tt>&lt;Hole&gt;</tt> commands will automatically be removed from the mesh. This feature allows calculations on materials with voids or irregular edges without needing to use <tt>&lt;Area&gt;</tt></a> commands to construct all details of the shape. If these removals cause the mesh to be partitioned into disconnected sections, however, the FEA analysis will fail. A good way to verify connectivity is to attempt to [[resequence the nodes]]
 
The image and shape commands are:
 
<dl>
 
<dt><a name="body"></a><code>&lt;BMP&gt;</code></dt>
<dd>The details on the <code>&lt;BMP&gt;</code> command and the meaning of its attributes and subordinate commands are given <a href="definempm.html#BMPShape">here</a> (in the MPM documentation).</dd>


<dt><a name="body"></a><code>&lt;Body&gt;</code></dt>
* [[Keypoint Command#XML Keypoints Block|<tt><Keypoints></tt>]]: Define all key point to be used in defining [[Path Command|paths]]
<dd>Defines a block of material. All material points in the block will be assigned the same material
* [[Path Command#XML Path Command|<tt><Path></tt>]]: Define a path to be used in defining [[Area Command#XML Area Block|areas]].
number (<code>mat</code>, see <a href="definematl.html">Defining Materials</a>;
* [[Area Command#XML Area Block|<tt><Area></tt>]]: Define an area for mesh generation.
numbers can be replaced by names using a <code>matname</code> attribute
* [[Resequence Command]]: To turn on the option to resequence the nodes, which will minimize the bandwidth of the problem and speed the calculations.
as explained <a href="definematl.html#usemats">here</a>), material angle
(<code>angle</code> in degrees which is used for some <a href="definematl.html">anisotropic
materials</a>; t can be entered as a number or as a <a href="function.html">user-defined function</a>), and thickness (<code>thick</code> in mm)
A single <code>&lt;Body&gt;</code> for 2D FEA can contain any number of the <a href="definempm.html#2DShapes">2D shape commands</a>. The shapes can overlap; if they do the element material will be for the first shape command that intersects that elements centroid.
If not specified angle will be zero and the thickness will be 1 mm.</dd>


<dt><code>&lt;Hole&gt;</code></dt>
== Using Images and Shapes ==
<dd>Defines empty space within a body. A single <code>&lt;Hole&gt;</code> group for 2D FEA can contain any number of the <a href="definempm.html#2DShapes">2D shape commands</a>. Any subsequent <code>&lt;BMP&gt;</code> or <code>&lt;Body&gt;</code> structures that overlap the hole will not assign those elements.</dd>


</dl>
If some elements in the generated mesh are set the material id _NONE_ (see [[Area Command]]) or mat = 0 (see [[Area Command#XML Area Block|<tt><Area></tt> Command]]), you can follow mesh creation with [[Create a Mesh with Images and Shapes|image and shape commands]] to fill in material types, angles, and define the final mesh geometry. This option is described [[Create a Mesh with Images and Shapes|here]].

Latest revision as of 13:17, 2 June 2015

The best way to generate an FEA mesh is to use Keypoint, Path, and Area commands.

Scripted Input Files

In scripted input files, you build the mesh by using multiple mesh generation commands. These commands are usually grouped together, but may be at various locations in the input file. For example, a simple 2D, rectangular mesh of width #length, height #height, and thickness #thick with #horiz elements in the horizontal direction and #vert elements in the vertical direction (where terms beginning in number signs are script variables) can be created with:

Area #matname$,#thick
  Path "Bottom",#horiz
    Keypoint "BotLeft",0,0
    Keypoint "BotRight",#length,0
  EndPath
  Path "Right",#vert
    Keypoints "BotRight"
    Keypoint "TopRight",#length,#height
  EndPath
  Path "Top",#horiz
    Keypoints "TopRight"
    Keypoint "TopLeft",0,#height
  EndPath
  Path "Left",#vert
    Keypoints "TopLeft","BotRight"
  EndPath
EndArea
Resequence "BotRight"

The following commands are used for generating the mesh in scripted files.

  • Area: Define an area for mesh generation.
  • Path: Define a path used in defining areas.
  • Paths: Add multiple defined paths to an area.
  • Keypoint: Define a keypoint used in defining paths
  • Keypoints: Add multiple defined keypoints to a path.
  • Resequence Command: To turn on the option to resequence the nodes, which will minimize the bandwidth of the problem and speed the calculations.

XML Input Files

In XML input files, you build the mesh with mesh generation commands that must be within a single <Mesh> block. Here is a <Mesh> block that creates at 50X10 rectangular mesh with 6 elements in the horizontal direction and 3 in the vertical direction:

<Mesh>
  <Keypoints>
    <pt x='0' y='0' id='lowerleft'/>
    <pt x='0' y='10' id='upperleft'/>
    <pt x='50' y='0' id='lowerright'/>
    <pt x='50' y='10' id='upperright'/>
  </Keypoints>

  <Path id="bottom" intervals='6' ratio='1'>
    <keypt id='lowerleft'/>
    <keypt id='lowerright'/>
  </Path>
  <Path id="right" intervals='3'>
    <keypt id='lowerright'/>
    <keypt id='upperright'/>
  </Path>
  <Path id="top" intervals='6'>
    <keypt id='upperright'/>
    <keypt id='upperleft'/>
  </Path>
  <Path id="left" intervals='3'>
    <keypt id='upperleft'/>
    <keypt id='lowerleft'/>
  </Path>

  <Area mat="1" thick="10" type="4" flip="0" angle="0">
    <path id="bottom"/>
    <path id="right"/>
    <path id="top"/>
    <path id="left"/>
  </Area>
</Mesh>

The fundamental XML commands for generating a mesh are:

  • <Keypoints>: Define all key point to be used in defining paths
  • <Path>: Define a path to be used in defining areas.
  • <Area>: Define an area for mesh generation.
  • Resequence Command: To turn on the option to resequence the nodes, which will minimize the bandwidth of the problem and speed the calculations.

Using Images and Shapes

If some elements in the generated mesh are set the material id _NONE_ (see Area Command) or mat = 0 (see <Area> Command), you can follow mesh creation with image and shape commands to fill in material types, angles, and define the final mesh geometry. This option is described here.