# Core structure
The main components of the core code are the discretization of the spatial domain, which includes the read in of shape models, the creation of the Finite Element Method (FEM) elements and the building of the grid. It includes the simulation environment (often referred to as Sim/SimClass within the documentation). Further it includes the linear system of equations solver infrastructure, snapshot creation and loading and all behind the scenes systems that the user doesn't directly interacts with (namely the chain system, module factory system, abstract base classes for many of the systems and IO capabilities).
The core structure of MoCSI is summarized in the following figure:
## Grid creation
Despite currently only supporting one-dimensional equations, the grid creation offers many capabilities to the user. The grid creation happens in two steps. First the bounding surfaces gets created and afterwards the depth discretization starting from said bounding surface is performed.
The default case is a one facet bounding surface (a "true" one-dimensional model), but a user can pass a path to a shape model in one of the VTK supported file types (if VTK is present on the users machine) and the model will load the shape model as bounding surface.
For the depth descretization, the user can specify either element length, or element count and maximum depth for uniform depth meshes. If a non-uniform depth discretization is needed, the user can supply a .csv file containing the depths of the nodes.
After both of these steps, the code creates the FEM elements to fill the given specification and creates the global matrices. The implementation and currently available element types can be viewed in the [FEM section](mathematical_background/finite_element_method).
## Simulation environment/ Simulation class
The main functionality and structure of MoCSI lies within the simulation class. It contains the main simulation loop and the map object storing all the field variables. For most applications, using the default simulation class object will yield satisfying results. However, if for your specific application the configuration of the simulation class is inadequate, a custom simulation class with a custom main loop can be written, inheriting from the abstract base simulation class.
## Linear system of equations solver
Currently, the only available solver is the [Tridiagonal Matrix Algorithm solver](mathematical_background/tdma_solver). This is due to any currently possible one-dimensional discretization leads to a global matrix in a tridiagonal shape. For multi-facet simulations, MoCSI still builds one global matrix where all the one-dimensional facets are contained within independent blocks on the diagonal of the global matrix.
## Snapshot creation and loading
MoCSI offers capability of creating snapshots after a simulation and load them when starting a new one. These are meant as complete restoration points, so that simulations can be run piecewise. These snapshot files contain the final temperature field and every entry in both the simulation and the module ini files. Thus they can also be used to specify simulations that were run in MoCSI.