# Cycling

Introduction

The DEM formulation is an explicit, timestepping solution to Newton’s laws of motion. The model state is advanced in time by executing a series of calculation cycles. Each cycle is composed of a sequence of operations termed the cycle sequence. This section delineates the process of executing a series of cycles, including termination of the series, along with the PFC cycle sequence.

Executing a Series of Cycles

A series of cycles is launched in PFC by eliciting either the `model cycle` or `model solve` command. Cycling continues until one or more solve limits are reached. When using the `model cycle` command, a lone solve limit, corresponding to the specified number of cycles, is created and tested for completion. When using the `model solve` command, on the other hand, multiple solve limits can be specified simultaneously. Cycling is terminated when at least one solve limit has been met. A number of solve limits are built into PFC (see the `model solve` documentation for details). In addition, one or more FISH functions can be specified as solve limits, allowing for custom cycling termination criteria. The figure below presents a schematic of the process of executing a series of cycles.

During the initialization phase, contacts are created/deleted, variables used during cycling are reset, and the model state is checked for validity in the sense that cycling can commence. For instance, cycling cannot occur if any balls or clumps have 0 mass as the results would be undefined. A sequence of operations, termed the cycle sequence (see below) are performed during each calculation cycle. After the completion of the calculation cycle, the solve limits are checked and, should one or more be met or exceeded, cycling terminates. If no solve limits are met, additional calculation cycles are performed. During the finalization phase, contacts are created/deleted and data structures requiring validation are updated to ensure that the model state is consistent prior to returning the interactive console to the user for further input.

Note that one may manually terminate cycling from the toolbar in the The Editor Pane or by pressing the Shift+Esc key combination while cycling. If manual cycling termination is requested, the current calculation cycle is completed and the finalization stage is executed before returning control to the user.

The Cycle Sequence

The sequence of operations executed during each calculation cycle is termed the cycle sequence. The cycle sequence consists of an ordered set of operations where each operation has a floating point number assigned to it, termed a cycle point. The table below lists the specific operations and associated cycle points.

Table 1: Cycle Operations and Associated Cycle Points

Cycle Point

Cycle Operation

-10.0

Validate data structures

0.0

Timestep determination

10.0

Law of motion (or update thermal bodies)

15.0

Body coupling between processes

20.0

30.0

Update spatial searching data structures

35.0

Create/delete contacts

40.0

Force-displacement law (or thermal contact update)

42.0

Accumulate deterministic quantities

45.0

Contact coupling between processes

60.0

Second pass of equations of motion (not used in PFC)

70.0

Thermal calculations (not used in PFC)

80.0

Fluid calculations (not used in PFC)

This system was introduced so that additional operations could easily be added to the cycle sequence. In addition, the cycle points allow for the simple identification of cycle sequence operations so that FISH callbacks can be inserted at various points during a cycle in a strict order for execution via the `fish callback` command. Callbacks cannot be installed with cycle points exactly equal to any predefined cycle points. It is also important to note that callbacks cannot be installed between cycle points 40.0 and 42.0 and that users can only create/destroy model components with callbacks prior to cycle point 0.0. These constraints are required to protect users from introducing callbacks that could result in undefined behaviors. For instance, if a user created a ball after the timestep was determined, the newly formed contacts with this ball would not be utilized to determine the stable timestep. The resulting forces and moments generated could produce system instability during the next cycle. The tutorial “Using FISH Callbacks” demonstrates the usage of FISH callbacks.

Below are descriptions of each cycle operation. The final three cycle operations are not used in PFC and will not be discussed. These cycle points are present as the order of operations in other Itasca codes not identical to PFC. PFC does not utilize these additional operations.