During the initialization, a grid component as shown in the following diagram is first created to separate the implementation of the grid data structures and the parallel operations required to update grid “ghost” nodes (neighboring grid nodes that are owned by other processors) from the remainder of the application code. The grid component is used to distribute data across processors using domain decomposition, provide a mapping from local numbering scheme to global numbering scheme, manage the creation and destruction of data fields on the grid and set up the communication that allows the application to update ghost node, fields with data from other processors. The data model that the grid component supports describes the grid that is distributed across multiple processors in terms of nodes extended to incorporate ghost nodes, connections between nodes, and boundary connections on each processor.
Figure 2. Schematic diagram of eSTOMP code showing the relationship of different functionalities and communication libraries. The boxes in green show different functionalities (except for the data model) that could be extracted as individual components in the future. The grid interface is implemented in the grid component and used in the eSTOMP kernel. The red boxes show the parallel communication libraries used to implement the different functionalities.
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.