BMPRegion Command

From OSUPDOCS
Jump to navigation Jump to search

An advanced feature of both NairnMPM and NairnFEA is that you can digitize objects directly from images.

Introduction

An alternative method for creating meshes in NairnFEA or material points in NairnMPM to to create them from an image file. The image file can be one you draw in a CAD program or can be a photo of object. The later options lets you create realistic numerical models of complex objects in a single command. In 2D or axisymmetric calculations, the image fills in an FEA mesh or adds material points to the grid. in 3D MPM simulations, the image represents one slice of the object in the x-y plane at a fixed value of z. By combining a stack of slices, those images can create all material points for a complex 3D object.

BMPRegion Commands

The command to digitize images is the same for both FEA and MPM input files. In scripted files, an image is converted into material points using:

BMPRegion (bmpPath),(width),<(height)>,<(anglesPath)>
  Origin (xO),(yO),<(zO>,<(flip)>
  Intensity (matID),(grayMin),(grayMax),<(prop),(value)>,...
    . . .
  Intensity "angles",(gray1),(gray2),(angle1),(angle2)
  (optional rotation command - MPM only)
EndRegion

In XML files, the command block is (must be within the single <MaterialPoints> element for MPM input files):

<BMP name="(bmpPath)" width="(width)" height="(height)" angles="(anglesPath)">
  <Origin x="(xO)" y="(yO)" z="(zO)" flipped="(flip)"/>
  <Intensity mat="(matID)" imin="(gramMin)" imax="(grayMax)">
     (property command options)
  </Intensity>
    . . .
  <Intensity imin="(gray1)" imax="(gray2)" minAngle="(angle1)" maxAngle="(angle2)"/>
  (optional rotation commands - MPM only)
</BMP>

where

  • (bmpPath) is the full or relative path name to the BMP file. The file must be an uncompressed, gray-scale, BMP file with 8 or less bits per pixel. The most useful is an 8-bit file with 256 levels of gray.
  • (width) and (height) specify the width and height for the image, but there are several ways to specify them.
  • (anglesPath) is an optional full or relative path name to a mask BMP file whose intensities determine the material angle for rotation about eh z axis when setting anisotropic material points. The file must be an uncompressed, gray-scale, BMP file with 8 or less bits per pixel. The file must be exactly the same size (horizontal and vertical pixels) as the image file in (bmpPath).

Inside BMPRegion block, you include various commands to determine how the pixels are converted into material points. The possible subordinate commands are:

  • Origin command - used to connected the image coordinates the the MPM grid coordinates.
  • Intensity command - used to determine conversion of gray scale values in the images into material points or rotation angles
  • (optional rotation commands) - these optional commands provide alternative methods for setting initial material orientation when modeling with anisotropic materials, but are only allowed in MPM input files.

Image Width and Height

The (width) and (height) parameters specify the width and height of the image, but they can be specified using different styles. The options are:

  1. Give both as positive numbers - if both numbers are provided and are positive, they give width and height of the image in mm (or determined by a units attribute in XML files). They need not match the aspect ratio of actual image, but if they differ the image will be scaled.
  2. Use a negative number - if either (width) or (height) is negative, the absolute value is taken as the number of mm per pixel (or other units per pixel as determined by a units attribute in XML files). The total width or height is calculated from the number of pixels in the BMP image.
  3. Give only one dimension - if only (width) or only (height) are given, the entered parameter gives that dimension of the image in mm, if positive, or mm per pixel, if negative (or other units as determined by a units attribute in XML files). The other dimension is calculated from the aspect ratio of the BMP file. To specify only (height) in scripted files, the (width) parameter has to be more negative than -1e8. To specify only (width) in scripted files that are using the optional (anglesPath) parameter, the (height) parameter has to be more negative than -1e8.

Origin Command

The Origin command within a BMPRegion block (or <BMP> element in XML files) is used to map the image in the associated BMP File to the background MPM grid or the existing FEA mesh. In script scripted files, the command is

Origin (x0),(y0),<(z0)>,<(flip)>

In XML files, the command is:

<Origin x="(xO)" y="(yO)" z="(zO)" flipped="(flip)"/>

where

  • (xO), (yO), and (zO) give the (x,y,z) coordinate for the origin of the image when mapped to the grid or mesh in mm (or determined by a units attribute in XML files). The (zO) coordinate is only needed for 3D calculations and is not allowed in FEA input files.
  • If the optional (flip) is "yes", the origin will move to the upper-left corner of the image with y increasing in the downward direction and x increasing to the right. This change will flip the image in the y direction in the analysis compared to the image graphics. To provide (flip) parameter in scripted FEA files, you have to provide the (zO) parameter for proper argument alignment; it can be any number because it will be ignored.

If a BMPRegion block does not have an Origin command, the origin will be set to (0,0,0).

Intensity Command

The Intensity command within a BMPRegion block (or <BMP> element in XML files) has two uses to map wither materials or angles to the grid or elements.

Mapping Material Type

In this form, an Intensity command is used to map levels in the gray-scale of the associated BMP File to different types of material points or to different material initial conditions in an MPM analysis. For FEA calculations, it is used to map the image to different types of materials to assign to mesh elements. In scripted files, this use has the format:

Intensity (matID),(grayMin),(grayMax),<(prop),(value)>,…

In XML files, this use has the format:

<Intensity mat="(matID)" imin="(grayMin)" imax="(grayMax)">
    (property command options)
</Intensity>

where

  • (matID) is the material ID for a previously defined material.
  • (grayMin) to (grayMax) defines a range in gray-scale intensities to map to this material. The numbers must be from 0 (for black) to 255 (for white) and (grayMin) must be less than or equal to (grayMax).

In scripted files, the optional pairs of arguments, <(prop),(value)> are used to specify other initial conditions for the particles in the intensity range In each pair, the first parameter defines the property and the second parameter defines the value. The properties that are valid for both FEA and MPM input files are:

  • "thick" for particle or element thickness in planar 2D calculations. The units are mm.
  • "angle" for rotation angle fofor the material about the z axis, which is only relevant for anisotropic materials. The units are degrees.
  • "temp" for particle temperature. The units are degrees.

The additional property options for MPM input files are:

  • "vx" for particle x-direction velocity (R direction is axisymmetric). The units are mm/sec.
  • "vy" for particle y-direction velocity (Z direction is axisymmetric). The units are mm/sec.
  • "vz" for particle z-direction velocity in 3D MPM. The units are mm/sec.
  • "conc" for particle concentration (set as concentration potential from 0 to 1).

In XML files, all properties are set by commands that are subordinate to the <Intensity> element. The properties that are valid for both FEA and MPM input files are:

<Thickness>(value)</Thickness>
<Angle>(value)</Angle>
<Temperature>(value)</Temperature>

The additional property options for MPM input files are:

<vel x="(value)" y="(value)" z="(value)"/>
<Concentration>(value)</Concentration>

The units for each property (value) are the same as of script files (or determined by a units attribute).

Mapping Angles

When the first argument to the Intensity command is "angles" (or actually any text that is not a material ID), then that command is used to map gray-scale values in the associated angles mask BMP file to material angle for elements in an FEA mesh or material points in an MPM model. This use of the Intensity command only makes sense when the optional (angleMask) is used in the BMPRegion command. In scripted files, this form of the command is:

Intensity "angles",(gray1),(gray2),(angle1),(angle2)

In XML files, this form of the command is:

<Intensity imin="(gray1)" imax="(gray2)" minAngle="(angle1)" maxAngle="(angle2)"/>

where ((gray1),(angle1)) and ((gray2),(angle3)) define two points. The angle will be calculated by a linear interpolation of gray scale to angle (in degrees) using the line that goes through these two points. The resulting angle, θ, for any given gray-scale value, g, will be:

      [math]\displaystyle{ \theta = (angle1) + {(angle2)-(angle1)\over (gray2)-(gray1)} \bigl(g-(gray1)\bigr) }[/math]

This interpolation applies to all gray scale values, including those outside the range (gray1) to (gray2)