Difference between revisions of "2D MPM Shape Commands"

From OSUPDOCS
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 15: Line 15:
where
where


* <tt>(xmin),(xmax),(ymin)</tt>, and <tt>(ymax)</tt> are the x and y extents of the rectangle (or R and Z extents if axisymmetric). If xmax<xmin or ymax<ymin, they will be automatically switched to define the rectangle. The units are [[ConsistentUnits Command#Legacy and Consistent Units|length units]] (or determined by a [[Units Attribute|units attribute]] in <tt>XML</tt> files).
* <tt>(xmin),(xmax),(ymin)</tt>, and <tt>(ymax)</tt> are the x and y extents of the rectangle (or R and Z extents if axisymmetric). If xmax<xmin or ymax<ymin, they will be automatically switched to define the rectangle. The units are [[ConsistentUnits Command#Legacy and Consistent Units|length units]] (or determined by a [[Units Attribute|units attribute]] in <tt>XML</tt> files). In <tt>XML</tt> files, the coordinates can alternatively be specified [[#Relative Grid Locations|relative to the mesh edges]].
* <tt>(arcStart)</tt> and <tt>(arcEnd)</tt> are optional parameters that limit the shape to an to arc of the rectangle (ccw from start to end in degrees with 0 degrees along the x axis, 0&le;<tt>(arcStart)</tt>&lt;360, and <tt>(arcEnd)</tt>><tt>(arcStart)</tt>).
* <tt>(arcStart)</tt> and <tt>(arcEnd)</tt> are optional parameters that limit the shape to an to arc of the rectangle (ccw from start to end in degrees with 0 degrees along the x axis, 0&le;<tt>(arcStart)</tt>&lt;360, and <tt>(arcEnd)</tt>><tt>(arcStart)</tt>).


Line 34: Line 34:
where
where


* <tt>(xmin),(xmax),(ymin)</tt>, and <tt>(ymax)</tt> are the x and y extents of the rectangle (or R and Z extents if axisymmetric) that encloses the oval. If xmax<xmin or ymax<ymin, they will be automatically switched to define the oval. The units are [[ConsistentUnits Command#Legacy and Consistent Units|length units]] (or determined by a [[Units Attribute|units attribute]] in <tt>XML</tt> files).
* <tt>(xmin),(xmax),(ymin)</tt>, and <tt>(ymax)</tt> are the x and y extents of the rectangle (or R and Z extents if axisymmetric) that encloses the oval. If xmax<xmin or ymax<ymin, they will be automatically switched to define the oval. The units are [[ConsistentUnits Command#Legacy and Consistent Units|length units]] (or determined by a [[Units Attribute|units attribute]] in <tt>XML</tt> files). In <tt>XML</tt> files, the coordinates can alternatively be specified [[#Relative Grid Locations|relative to the mesh edges]].
* <tt>(arcStart)</tt> and <tt>(arcEnd)</tt> are optional parameters that limit the shape to an to arc of the oval (ccw from start to end in degrees with 0 degrees along the x axis).
* <tt>(arcStart)</tt> and <tt>(arcEnd)</tt> are optional parameters that limit the shape to an to arc of the oval (ccw from start to end in degrees with 0 degrees along the x axis, 0&le;<tt>(arcStart)</tt>&lt;360, and <tt>(arcEnd)</tt>><tt>(arcStart)</tt>).


If the defined oval overlaps areas that already have material points or previously was defined as a hole, those areas will be ignored.
If the defined oval overlaps areas that already have material points or previously was defined as a hole, those areas will be ignored.
Line 60: Line 60:
where
where


* <tt>(xi),(yi)</tt> (for i = 1 to n) are the <tt>x</tt> and <tt>y</tt> coordinates of the each point in the polygon (or <tt>R</tt> and <tt>Z</tt> if axisymmetric) with the last point <tt>(xn),(yn)</tt>) being connected to the first (<tt>(x1),(y1)</tt>). If the <tt>PolyPt</tt> arguments are omitted, the polygon is closed. The units are [[ConsistentUnits Command#Legacy and Consistent Units|length units]] (or determined by a [[Units Attribute|units attribute]] in <tt>XML</tt> files).
* <tt>(xi),(yi)</tt> (for i = 1 to n) are the <tt>x</tt> and <tt>y</tt> coordinates of the each point in the polygon (or <tt>R</tt> and <tt>Z</tt> if axisymmetric) with the last point <tt>(xn),(yn)</tt>) being connected to the first (<tt>(x1),(y1)</tt>). If the <tt>PolyPt</tt> arguments are omitted, the polygon is closed. The units are [[ConsistentUnits Command#Legacy and Consistent Units|length units]] (or determined by a [[Units Attribute|units attribute]] in <tt>XML</tt> files). In <tt>XML</tt> files, the coordinates can alternatively be specified [[#Relative Grid Locations|relative to the mesh edges]].


A blank <tt>PolyPt</tt> command in scripted files is only needed if you need to define more than one polygon in the same region. The blank command will finish the current one and the next one will start with the next <tt>PolyPt</tt> command. Intervening [[#Rect Command|<tt>Rect</tt>]] and [[#Oval Command|<tt>Oval</tt>]] commands or the end of a block will also stop the current polygon; in these cases the blank <tt>PolyPt</tt> is not needed.
A blank <tt>PolyPt</tt> command in scripted files is only needed if you need to define more than one polygon in the same region. The blank command will finish the current one and the next one will start with the next <tt>PolyPt</tt> command. Intervening [[#Rect Command|<tt>Rect</tt>]] and [[#Oval Command|<tt>Oval</tt>]] commands or the end of a block will also stop the current polygon; in these cases the blank <tt>PolyPt</tt> is not needed.


If the defined polygon overlaps areas that already have material points or previously was defined as a hole, those areas will be ignored.
If the defined polygon overlaps areas that already have material points or previously was defined as a hole, those areas will be ignored.
== Line Command ==
A scripted <tt>Line</tt> command defines a region to be filled with material points or to be defined as a hole:
Line (x1),(x2),(y1),(y2),&lt;(tolerance)&gt;
In <tt>XML</tt> files, the command is:
<Line x1='(x1)' x2='(x2)' y1='(y1)' y2='(y2)' tolerance='(tol)'/>
where the line is from <code>(x1,y1)</code> to <code>(x2,y2)</code>. The region will include points within <code>(tolerance)</code> of the line. The region will be rectangle with edges normal to the line and width of <code>2*(tolerance)</code>.
Note that <tt>xmin</tt>, <tt>xmax</tt>, <tt>ymin</tt>, and <tt>ymax</tt> can be used in place of <tt>x1</tt>, <tt>x2</tt>, <tt>y1</tt>, and <tt>y2</tt>.
== Arc Command ==
A scripted <tt>Arc</tt> command defines a region to be filled with material points or to be defined as a hole:
Arc (xmin),(xmax),(ymin),(ymax),(arcStart)>,(arcEnd),&lt;(tolerance)&gt;
In <tt>XML</tt> files, the command is:
<Arc xmin='(xmin)' xmax='(xmax)' ymin='(ymin)' ymax='(ymax)'
      start='(arcStart)' end='(arcEnd)' tolerance='(tolerance)'/>
where
* <tt>(xmin),(xmax),(ymin)</tt>, and <tt>(ymax)</tt> are the x and y extents of an oval (or R and Z extents if axisymmetric) that encloses the oval. If xmax<xmin or ymax<ymin, they will be automatically switched to define the oval. The units are [[ConsistentUnits Command#Legacy and Consistent Units|length units]] (or determined by a [[Units Attribute|units attribute]] in <tt>XML</tt> files). In <tt>XML</tt> files, the coordinates can alternatively be specified [[#Relative Grid Locations|relative to the mesh edges]].
* <tt>(arcStart)</tt> and <tt>(arcEnd)</tt>: The arc will be path traced along border of the oval in the counterclockwise direction from angles specified in <tt>(arcStart)</tt> and <tt>(arcEnd)</tt>, where 0 degrees is the positive x axis direction.  These must be entered as 0&le;<tt>(arcStart)</tt>&lt;360 and <tt>(arcStart)</tt>&lt;<tt>(arcEnd)</tt>&lt;<tt>(arcStart)</tt>+360.
* <tt>(tolerance)</tt>: The arc region will be distance <code>(tolerance)</code> on either side of the arc path.
== Relative Grid Locations ==
Rather than hard code positions for boundary conditions or shapes that define material points, any coordinate specified in <tt>XML</tt> files (''e.g''., an entry for <tt>(x1)</tt>, <tt>(x2)</tt>, <tt>(xmin)</tt>, <tt>(xmax)</tt>, ''etc.'') can be the text <tt>'min'</tt>, <tt>'max'</tt>, <tt>'min-3'</tt>, <tt>'min+1.2'</tt>, <tt>'max-3.8'</tt>, <tt>'max+2'</tt>, ''etc.'', meaning the minimum, the maximum, or a specified number of cells relative to the minimum or maximum of the [[MPM Grid Generation|current mesh]]. For [[MPM Methods and Simulation Timing|GIMP calculations]] <tt>'min'</tt> and <tt>'max'</tt> will be limits of useable mesh while <tt>'min-1'</tt> and <tt>'max+1'</tt> will be limits to the total mesh. For backward compatibility, <tt>min+</tt>, <tt>min-</tt>, <tt>max+</tt>, and <tt>max-</tt> refer to plus or minus one cell from the minimum or maximum of the current mesh.
== Nested Commands ==
You [[Nested Shapes|can nest shapes]] in other shapes to create a wide variety of new shapes.


== Using 2D Images ==
== Using 2D Images ==


You can convert pixels in 2D images into material points using [[BMPRegion Command|BMRegion commands]].
You can convert pixels in 2D images into material points using [[BMPRegion Command|BMRegion commands]].

Latest revision as of 11:42, 13 March 2020

These shape commands are used in 2D or axisymmetric MPM simulations within Region and Hole commands to discretize an object for the calculations.

Rect Command

A scripted Rect command defines a region to be filled with material points or to be defined as a hole:

Rect (xmin),(xmax),(ymin),(ymax),<(arcStart)>,<(arcEnd)>

In XML files, the command is:

<Rect xmin='(xmin)' xmax='(xmax)' ymin='(ymin)' ymax='(ymax)'>
   <arc start='(arcStart)' end='(arcEnd)'/>
</Rect>

where

  • (xmin),(xmax),(ymin), and (ymax) are the x and y extents of the rectangle (or R and Z extents if axisymmetric). If xmax<xmin or ymax<ymin, they will be automatically switched to define the rectangle. The units are length units (or determined by a units attribute in XML files). In XML files, the coordinates can alternatively be specified relative to the mesh edges.
  • (arcStart) and (arcEnd) are optional parameters that limit the shape to an to arc of the rectangle (ccw from start to end in degrees with 0 degrees along the x axis, 0≤(arcStart)<360, and (arcEnd)>(arcStart)).

If the defined rectangle overlaps areas that already have material points or previously was defined as a hole, those areas will be ignored.

Oval Command

A scripted Oval command defines a region to be filled with material points or to be defined as a hole:

Oval (xmin),(xmax),(ymin),(ymax),<(arcStart)>,<(arcEnd)>

In XML files, the command is:

<Oval xmin='(xmin)' xmax='(xmax)' ymin='(ymin)' ymax='(ymax)'>
   <arc start='(arcStart)' end='(arcEnd)'/>
</Oval>

where

  • (xmin),(xmax),(ymin), and (ymax) are the x and y extents of the rectangle (or R and Z extents if axisymmetric) that encloses the oval. If xmax<xmin or ymax<ymin, they will be automatically switched to define the oval. The units are length units (or determined by a units attribute in XML files). In XML files, the coordinates can alternatively be specified relative to the mesh edges.
  • (arcStart) and (arcEnd) are optional parameters that limit the shape to an to arc of the oval (ccw from start to end in degrees with 0 degrees along the x axis, 0≤(arcStart)<360, and (arcEnd)>(arcStart)).

If the defined oval overlaps areas that already have material points or previously was defined as a hole, those areas will be ignored.

PolyPt Command

In scripted files, a series of PolyPt commands is used to define a polygonal region to be filled with material points or to be defined as a hole:

PolyPt (x1),(y1)
PolyPt (x2),(y2)
  ...
PolyPt (xn),(yn)
PolyPt

In XML files, a polygon is defined with a <Polygon> block:

<Polygon>  
  <pt x='(x1)' y='(y1)'/>  
  <pt x='(x2)' y='(x2)'/>
    ...
  <pt x='(xn)' y='(yn)'/>
</Polygon>

where

  • (xi),(yi) (for i = 1 to n) are the x and y coordinates of the each point in the polygon (or R and Z if axisymmetric) with the last point (xn),(yn)) being connected to the first ((x1),(y1)). If the PolyPt arguments are omitted, the polygon is closed. The units are length units (or determined by a units attribute in XML files). In XML files, the coordinates can alternatively be specified relative to the mesh edges.

A blank PolyPt command in scripted files is only needed if you need to define more than one polygon in the same region. The blank command will finish the current one and the next one will start with the next PolyPt command. Intervening Rect and Oval commands or the end of a block will also stop the current polygon; in these cases the blank PolyPt is not needed.

If the defined polygon overlaps areas that already have material points or previously was defined as a hole, those areas will be ignored.

Line Command

A scripted Line command defines a region to be filled with material points or to be defined as a hole:

Line (x1),(x2),(y1),(y2),<(tolerance)>

In XML files, the command is:

<Line x1='(x1)' x2='(x2)' y1='(y1)' y2='(y2)' tolerance='(tol)'/>

where the line is from (x1,y1) to (x2,y2). The region will include points within (tolerance) of the line. The region will be rectangle with edges normal to the line and width of 2*(tolerance).

Note that xmin, xmax, ymin, and ymax can be used in place of x1, x2, y1, and y2.

Arc Command

A scripted Arc command defines a region to be filled with material points or to be defined as a hole:

Arc (xmin),(xmax),(ymin),(ymax),(arcStart)>,(arcEnd),<(tolerance)>

In XML files, the command is:

<Arc xmin='(xmin)' xmax='(xmax)' ymin='(ymin)' ymax='(ymax)' 
     start='(arcStart)' end='(arcEnd)' tolerance='(tolerance)'/>

where

  • (xmin),(xmax),(ymin), and (ymax) are the x and y extents of an oval (or R and Z extents if axisymmetric) that encloses the oval. If xmax<xmin or ymax<ymin, they will be automatically switched to define the oval. The units are length units (or determined by a units attribute in XML files). In XML files, the coordinates can alternatively be specified relative to the mesh edges.
  • (arcStart) and (arcEnd): The arc will be path traced along border of the oval in the counterclockwise direction from angles specified in (arcStart) and (arcEnd), where 0 degrees is the positive x axis direction. These must be entered as 0≤(arcStart)<360 and (arcStart)<(arcEnd)<(arcStart)+360.
  • (tolerance): The arc region will be distance (tolerance) on either side of the arc path.

Relative Grid Locations

Rather than hard code positions for boundary conditions or shapes that define material points, any coordinate specified in XML files (e.g., an entry for (x1), (x2), (xmin), (xmax), etc.) can be the text 'min', 'max', 'min-3', 'min+1.2', 'max-3.8', 'max+2', etc., meaning the minimum, the maximum, or a specified number of cells relative to the minimum or maximum of the current mesh. For GIMP calculations 'min' and 'max' will be limits of useable mesh while 'min-1' and 'max+1' will be limits to the total mesh. For backward compatibility, min+, min-, max+, and max- refer to plus or minus one cell from the minimum or maximum of the current mesh.

Nested Commands

You can nest shapes in other shapes to create a wide variety of new shapes.

Using 2D Images

You can convert pixels in 2D images into material points using BMRegion commands.