# Is There Any Way to Speed Up My Model?

There are several common techniques that users can employ to help speed-up their models somewhat. If used correctly, some of these methods can yield significant runtime and memory efficiencies.

## Defining Computational Zones for the Model

Different regions of the model require different time steps for stability. For example, for equal-sized elements in water (wave velocity 1500 m/s) and steel (wave velocity 5900 m/s), water has a maximum stable time step 3.93 (5900/1500) times larger than the steel. The base time step for the model is set by the faster material, steel, so 3.93 times as many time steps are carried out during a simulation in water than is needed for stability. Zoning a model is a way to use that "overly stable" time step to regain computational speed. By running only every nth time step in a region of the model with a higher stable time step, a stable solution can be obtained in a shorter time. The ratio in each region, N, must be an integer that is less than or equal to the maximum ratio. Therefore the ratio in each region is rounded down to the nearest integer. In the example of water and steel, the water can be sub-cycled every 3rd time step (as opposed to every 4th,), as 3.93 is rounded down to 3.

At the interface of two materials, the contacting elements (e.g., water and steel) share a common surface. For the purposes of zoning, OnScale considers both elements to have the wave velocity of the faster material. This means that a zone must be moved one element into the slower material to gain maximum benefit from zoning.

OnScale automatically zones the entire model into a single zone by default. Further enhancement must be done manually. Following are guidelines for manual zoning:

1. All elements must be included in a zone.
2. An element can be included only in a single zone (no overlap).
3. Each zone is rectangular in shape.
4. A zone cannot cross the standard/skewed partition boundary (advanced).
5. As there is a small overhead for each zone, you should not create a large number of very small zones.

The zone command, which defines a zone, is:

`zone iratio ibegin iend jbegin jend kbegin kend zonestep`

where iratio is the integer multiple of the zone time step to the model time step.

Note: We recommend that iratio remain in its default value.

The nodal indices ranges define the region of the model in ijk space to be assigned to the zone. The zonestep parameter is a master override of the zone time step. When entered, this value is used for the zone

time step even if it violates the stability criterion. It also overrides the iratio parameter. An example of the zone command for a 2D model is:

`zone * 1 20 1 15`

where the zone time step is default for all elements bounded by nodes with an i-index from 1 to 20, and a j-index from 1 to 15.

Overriding of the default ratio is usually used with a manual entry when an extrapolation (extr) surface is in several different zones, as extr surfaces must be in zones of identical time step.

Further detail on zones in a model can be found in the print file (.flxprt) just after the prcs command is entered.

## Adjusting Time Stability Factor (TSF)

The Time Stability Factor is calculated by in order to find the maximum timestep for stable simulation. It is calculated from the fastest velocity in the model, over the shortest distance (two closest nodes) and set at 80% of this value.

Although 80% is default, it can be on the conservative side for some models. Users can adjust this upwards using the time command (must be issued before the prcs command) to help:

1. Reduce simulation time (larger timestep means less steps for a set simulation time)
2. Increase accuracy (reducing the amount of sampling in the time domain)

However, it is important to note than increasing it too much will eventually cause the model to become unstable, and care should be taken. A good value to try initially is 0.95:

`time * * 0.95`

Increasing the TSF is also useful if you are running a model that propagates over longer distances (>25 wavelengths). By reducing the effect of sampling in the time domain, the solution at each timestep is more accurate, and therefore the cumulative effects of numerical dispersion can be lessened somewhat.

## Setting an Initial Computational Window Region

Quite often in OnScale models, the excitation source comprises a of a relatively small region in comparison to the overall size of the model. In cases such as this, it makes little sense to solve for all the elements in the model when only a known fraction will require calculation.

Therefore, to provide some additional efficiency to the model computation, the WNDO command can be used to set an 'initial' computation zone around the source. The computational window is then increase by 1 element in every direction at each timestep to make sure that it will always included the mechanical wave.

Again, this command must be issued before the PRCS command. For example:

`wndo \$i1 \$i2+1 \$j1 \$j2+1 \$k1 \$k2+1 `