#key command Answered

Hi there,

I am a new user for analyst mode. I saw many of your examples about xyz and ijk setting which are usually applied with #key command. However, I couldn’t totally understand the instruction or examples. Thus, I have these questions below: (based on the Piezoelectric Example – Meshing)

1) What’s the difference between xyz and ijk? What do xyz and ijk stand for? Are they the default variables in PzFlex? I understand the xyz can define the coordinates, but I am not quite sure about the meaning of ijk.

2) About the #keyindx, do you have a figure to explain the physical meaning just like the #keycord?

3) In the example: “symb #keyindx i 1 $idx 1 $box 1” –> Does it produce variable $i? Is it a scalar value or matrix?
What’s the value $i would be?

4) After this command from 3), what can “indgrd = $i$idx” produce? Does “$i$idx” mean multiply?
The $idx is the maximum value of x coordinate, and I am not sure the meaning of the product of that $i multiplies $idx.

5) For defining the geometry, the description from instruction:
“geom keypnt $idx $jdx /* tie in all xy keypoints (physical dimensions) to ij keypoints(nodes)”
Can you explain more details? Does that means keypoints of xyz coordinate would be tied into ijk system? What’s the specific physical mode look like?

Thanks a lot.


  • Hi Ray,

    Thanks for posting your questions. I have answered your questions below but we will look to add an article in our knowledge base with diagrams to further explain the grid set up and keypoints.

    1) xyz represents the global location and dimensions of the model geometry in terms of the xyz axis, while ijk are integer numbers that reference node locations. i represents the node numbers in the x direction, j represents in y and k represents in z. xyz coordinates can start at any dimension depending on your model but ijk values always start at 1,1,1.

    2) and 3) I will try to answer both 2 and 3 with an explanation of the #keyindx command.
    The keyindx command is used to set the number of elements between keypoints in the model. It does this by looking at the distance between adjacent keypoints and dividing this by the element size you have set – typically referred to as the box size.

    Using the example line you have used in 3), if there were 3 keypoints ($idx would equal 3), the command is effectively implementing the following commands:
    symb i1 = 1
    symb i2 = $i1 + max(1, (nint ($x2 – $x1)/ $box))
    symb i3 = $i2 + max(1, (nint ($x2 – $x1)/ $box))
    The i values generated are integers and act as a reference for the node number at each keypoint. For example, if the distance between x1 and x2 is 1mm and you have a box size of 0.1mm, the value of i2 will be 11 and there will be 10 elements between the keypoints.
    The same #keyindx command can be used to generate j and k values – the first input letter in the command determines the direction.

    4) symb indgrd = $i$idx is what we use to create a variable that contains the last node number in that direction. This can be useful to have for cases like the grid command where you input the number of nodes in each direction to create the grid.

    The use of $ allows us to access previously defined symbols and it is possible to use double or more, such as $i$idx. In this case, the solver will first get the value of $idx, for instance let’s say idx = 3, and then it will reduce $i$idx to $i3 and get the value of $i3.

    5) Yes the geom command ties the xyz and ijk values together. The generated grid is dimensionless until it is associated with real units (mm, inches, etc). The geom command specifies coordinates for the grid nodes.
    The simplest geom commands are is:
    geom xcrd $xbeg $xend $ibeg $iend
    which specifies the start and end coordinates for a range of nodes and the position of nodes inbetween ibeg and iend are linearly interpolated to generate locations for all of the nodes. The above can be repeated for ycrd and zcrd to generate locations for j and z node numbers.

    geom keypnt $idx $jdx is a short hand way of issuing xcrd and ycrd subcommands for $idx and $jdx keypoints in x and y respectively. It will issue the following commands:
    xcrd $x1 $x2 $i1 $i2
    … repeated for all x keypoints
    ycrd $y1 $y2 $j1 $j2
    … repeated for all y keypoints

    I hope this answers your questions, but please let me know if anything remains unclear.

    Comment actions Permalink
  • Thanks so much for your answers. The further questions are shown below:

    Quoting your answer above:
    a) Here might have a typo
    symb i3 = $i2 + max(1, (nint ($x2 – $x1)/ $box))–> I guess it is supposed to be symb i3 = $i2 + max(1, (nint ($x3 – $x2)/ $box))

    b) ‘nint’ seems the nearest integer number; Is it correct?

    c) I would like to describe again to be more specific in the physical world, the xyz is distance or length of the devices and x1 x2 x3… are for the keypoints which might be defined by some interface between different material or different boundary conditions. On the other hand, i1 i2 i3 … are keyindx which indicates a number of box (elements) between nodes. e.g. i1= 1 and i2= 11, it means there is a row of many nodes in 1D from node no.1 ( which is i1 ) to node no.11 (which is i2).

    d) In the physical finite element model, the point of i1 i2 i3 … actually represent x1 x2 x3… ; the difference is just the meaning of the value. In other words, although the i j k are for nodes and the x y z are for physical length/ distance, they are tied/ connected by a command “geom” to be the same points.

    Please correct me if there is any misunderstanding. Thank you again.

    Comment actions Permalink
  • Hi Ray,

    Questions answered below:

    a) Yes you are correct, slight typo.

    b) That is correct

    c) and d) Unfortunately I can’t post pictures here so will need to add a knowledge base post to help explain further.

    Keypoints are not essential but they are very useful to allow for rapid parameterization and specific control of a model. They are specific points that we can use to identify:
    • Important geometry considerations
    • Definitive material boundaries
    • Specific points for data extraction
    • Specific regions for different meshing considerations

    The use of keyindx is to create the model grid and include nodes positioned at the keypoints (this allows the above points to be accurate). The value of i1 is always 1 but the value of i2 can be any integer above 2 depending on the dimensions and element size. Keyindx allows for the number of elements between two points to be automatically calculated, even when the distance of element size is changed.

    The location of every node is required by the solver but it is also useful for us to know what node number is at each keypoint for other commands that require node inputs – for example site regn.

    I hope this helps.

    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post