The primary flow path for all operational modes of the STOMP simulator comprises three principal components: 1) initialization, 2) iteration, and 3) closure. A detailed flow diagram for these components is shown below.
Figure 1. STOMP Flow Diagram
1) The initialization component of the program is executed once per simulation. The routines in the initialization component are executed sequentially, as shown in Figure 1, from the program start to the start of the first time step.
During initialization, the input file is read twice.The first read of the input file is used to allocate and initialize memory for all the global variables (i.e., those variables passed among routines via modules).The second read of the input file is used to define the problem.The input file readers are not foolproof but do report error messages when input errors are noted.Once the input file has been successfully read twice, the initial states are checked for thermodynamic consistency, phase conditions are established, and the primary variables are selected for every grid cell.The next stage of initialization involves computing all the secondary variables at grid cells and boundary surfaces.If geomechanics calculations are included in the simulation, then the initial stress state of the domain is established.If coupled wells are included in the simulation, then the well trajectories are determined and the wells are equilibrated with the formation.Once the well trajectories are defined, the coupled conservation equations and coupled well equations are sequenced such that the band width of the Jacobian matrix is minimized.If geochemistry calculations are included in the simulation, then the initial chemical state of the system is established.With the initial primary and secondary variables computed, the next stage of initialization is to compute the initial surface fluxes at both internal surfaces and boundary surfaces (e.g., volumetric phase flux, component advective/diffusive flux, heat flux).The final initialization stage is to record user requested output to the various output files (i.e., output, plot.xxx, and surface).If a zero-time-step simulation is requested, the simulator stops at the end of the initialization, after recording output.This option is very useful for computing property values or examining initial states.
2) The iteration component of the program contains a pair of nested loops. The outer loop performs time stepping and the inner loop performs Newton-Raphson iteration.
Figure 2. Transport Solution Flow Diagram
3) The closure routines are executed at the completion of a simulation (regardless of the termination cause).
If convergence has occurred for all conservation equations and for all grid cells, then the simulation proceeds to the geomechanics, solute transport and reactive transport routines. Prior to calling these routines, integrals for sources are computed and surface fluxes are updated using the converged values of the primary and secondary variables. Before starting a new time step, output is recorded and the simulation limits are checked. If the simulation time or number of time steps has reached a user defined limit, then the simulation moves to closure at which point output is recorded, all simulation files are closed, and the program stops. If convergence has not occurred, then the iteration limit is checked. If the number of Newton-Raphson iterations exceeds the user-defined limit, then the time step is reduced and the time step is repeated at a reduced time step amount. If the number of Newton-Raphson iterations is less than the user-defined limit, then another iteration loop occurs, starting with a calculation of the boundary conditions. If the iteration limit is exceeded, then the new reduced time step is checked against the minimum time step or the number of allowed consecutive time-step reductions is checked. If either of these checks fail, then the simulation transfers to closure, resulting in recording of the output and cessation of the simulation.