**Mesh Settings**

Meshing is one of the key components to obtaining accurate results. The elements that are used to construct a mesh must take into account a number of aspects to be able to discretise stress gradients accurately within the model. The following parameters are typically used to determine the required element size which we commonly refer to as **box**:

- Frequency of interest
- Typical variable name -
**freqint** - Set to the centre of the frequency band that you are interested in

- Typical variable name -
- Slowest wave velocity in the model
- Typical Variable name -
**vel** - Generally set to the lowest shear wave velocity in the model

- Typical Variable name -
- Shortest wavelength in the model
- Typical variable name -
**wavelength** - Calculation of the shortest wavelength based on
**vel**and**freqint**

- Typical variable name -
- Number of elements to discretise a wavelength
- Typical variable name -
**nepw** **Minimum value of 15 elements per wavelength is recommended**

- Typical variable name -
- Size of an element
- Typical variable name -
**box** **Calculated from the wavelength divided by number of elements per wavelength**

- Typical variable name -

c frequency and mesh

symb freqint = 1e6 /* frequency of interest

symb freqdamp = $freqint /* set damping frequency to frequency of interest

symb vel = 1500 /* minimum material velocity in model symb wavelength = $vel / $freqint /* calculate smallest wavelength to disctretise

symb nepw = 15 /* number of elements per wavelength

symb box = $wavelength / $nepw /* calculate element size for meshing

The **freqdamp** variable is not used as part of the meshing process but, it is usually set here with the value of **freqint** to align the damping characteristics of the materials over the correct frequency band of interest. This will be explained in a bit more detail in the next part of the tutorial.

**Note:** more elements per wavelength can be used to increase accuracy or minimise numerical dispersion*, however, this MUST be traded off against additional computational time. For example, in a 3D model, doubling the amount of elements per wavelength with multiply the model size by a factor of 8. Therefore, the effect of diminishing returns must be considered. Unless it is absolutely necessary, a small increase in accuracy is not necessarily worth the x10-20 increase in simulation time

*Numerical Dispersion is inherent in all numerical codes and is a small cumulative error that is caused due to sampling a wave in space and time. The non-physical phenomenon causes different frequencies to travel a different velocities; changing the shape of the wave with in turn can lead to amplitude (time domain) and phase (frequency domain) errors.

**Keypoint Generation and Grid Setup**

**#keycord:**

Keypoints are critical points in space that will be used to accurately map out the dimensions of your geometry. Using the variables created in the Model Inputs section, we can use the #keycord command to generate these keypoints along the X and Y axis:

c create x-y-z keypoints to accurately model dimensios

symb #keycord x 1 0.0 $pzt_rad $water-size

symb #get { idx } rootmax x /* store last keypoint indice in variable 'idx'

symb #keycord x 1 0.0 $pzt_rad $water-size

symb #get { jdx } rootmax y /* store last keypoint indice in variable 'jdx'

The #keycord command is very simple to set up:

- Access the command through symb command
- The first input argument is the direction which the keypoint will be generated:
**x,y or z (3D models)** - The indice value which the keypoint will start from
**:1** - The absolute value which the first defined keypoint
- The dimensions to define folllowin keypoints:
**variables created**

What the code will yield:

**Tip:** we always record the last indice value using the **#get rootmax** option. Note that #get operations use **braces { }** instead of regular **brackets ( )**

It is useful to have quick access the last node/keypoint on the grid to use in additional commands and for debug purposes.

**#keyindx:**

Following on from the XYZ keypoints, we need to determine how many elements are required to represent the distances along the XY direction which for the computatinal grid shall also be known as the IJ direction. We can use the dedicated symb command, #keyindx to do so:

c create i-j-k keypoints

symb #keyindx i 1 $idx 1 $box 1 /* calculate number of nodes required in i direction

symb #keyindx i 1 $idx 1 $box 1 /* calculate number of nodes required in j direction

symb indgrd = $i$idx /* last node number in i direction

symb jndgrd = $j$jdx /* last node number in j direction

- Access the command through
**symb**command - the first input argument is the direction which the keypoint will be generated -
**i, j or k(3D models)** - the first keypoint indice value -
**1** - the last keypoint indice value -
**$idx $jdx or $kdx** - keypoint incremental value -
**1**- This value allows keypoints to be skipped for the number of elements between keypoints calculation (i.e. 1 = (x1-x2-x3-x4-x5) or 2 = (x1-x3-x5) etc.)

- maximum size of element -
**$box** - minimum spacing between keypoints -
**1**- Places at least one element by default in between keypoints to prevent errors
- If value = 4, a minimum of 4 elements will always be created in between keypoints

**Note:** we recommend that element aspect ratio should not exceed 4:1 for stability and accuracy reasons so be careful when you are setting minimum spacing value to a higher integer value

**GRID and GEOM command:**

c create grid

grid $indgrd $jndgrd axiy /* generate grid of nodes and apply axisymmetric condition to model grid

c map physical geometry to grid of nodes

geom keypnt $idx $jdx /* tie in all xy keypoints (physical dimensions) to ij keypoints(nodes)

The grid command is very simple: it will generate a grid of evenly spaced nodes/elements based on the integer values input and allows the grid to be axially rotated to create axisymmetric models.

The geom command ties in the physical distances to the nodal spacing, and where there is a keypoint, a node must lie at that precise location. This means that your mesh will look more like this:

This is one of the reasons why we set up models using keypoints: so that the important aspects of our geometry are at the exact required size.

**Tutorial Tasks**

- Using the symb command, create 6 variables for the mesh settings:
- freqint - 1 MHz
- freqdamp - 1 MHz
- vel - 1500 m/s
- wavelength - vel / freqint
- nepw - 15 elements per wavelength
- box - wavelength / nepw

- Create keypoints in the along the X and Y direction using the #keycord command
- Store the last indice value in both X and Y direction using the symb #get {...} rootmax option
- Create keypoints in the along the I and J direction using the #keyindx command
- Using the symb command, create 2 variables to store the last IJ nodes:
- indgrd - $i$idx
- jndgrd - $j$jdx
- Insert in grid command to create grid of nodes and apply axisymmetric Y condition (axiy)
- Insert in geom keypnt to tie in XY keypoints to IJ keypoints

Progress to tutorial section: Materials

**Tutorial Code**

c frequency and mesh

symb freqint = 1e6 /* frequency of interest

symb freqdamp = $freqint /* set damping frequency to frequency of interest

symb vel = 1500 /* minimum material velocity in model symb wavelength = $vel / $freqint /* calculate smallest wavelength to disctretise

symb nepw = 15 /* number of elements per wavelength

symb box = $wavelength / $nepw /* calculate element size for meshing

c create x-y-z keypoints to accurately model dimensios

symb #keycord x 1 0.0 $pzt_rad $water-size

symb #get { idx } rootmax x /* store last keypoint indice in variable 'idx'

symb #keycord x 1 0.0 $pzt_rad $water-size

symb #get { jdx } rootmax y /* store last keypoint indice in variable 'jdx'

c create i-j-k keypoints

symb #keyindx i 1 $idx 1 $box 1 /* calculate number of nodes required in i direction

symb #keyindx i 1 $idx 1 $box 1 /* calculate number of nodes required in j direction

symb indgrd = $i$idx /* last node number in i direction

symb jndgrd = $j$jdx /* last node number in j direction

c create grid

grid $indgrd $jndgrd axiy /* generate grid of nodes and apply axisymmetric condition to model grid

c map physical geometry to grid of nodes

geom keypnt $idx $jdx /* tie in all xy keypoints (physical dimensions) to ij keypoints(nodes)

## Comments

0 comments

Please sign in to leave a comment.