Kratos Structure: Strategies and Processes
We will briefly present the classes used to implement a solver in Kratos Multiphysics. In the previous sections of this overview, we have described the different components that are used to describe the model: ModelPart, Mesh, Element, Condition, Node. Here, we will examine a different group of classes that can be used to implement a solver for a particular problem. Again, the design is based in providing a modular system, where different components can be used interchangeably or reused to implement different solvers.
The time scheme implements the time discretization of the problem, as well as the update of the problem unknowns once the problem ends. Its task is to ask elements and conditions for their local contributions to the system matrix. Each element/condition can define up to three different local matrices (and their corresponding right hand side vector):
- Local system contribution matrices that multiply the system unknowns.
- Damp matrix matrices that multiply the first derivatives in time of the system unknowns.
- Mass matrix matrices that multiply the second derivatives in time of the system unknowns.
The time scheme collect these matrices and combine them using an appropriate time iteration to form a single local contribution, that will then be passed to the builder and solver.
Builder and solver
For implicit problems, the builder and solver manages the assembly and solution of the system matrix. Its work flow can be summarized as
- At the start of the problem (or on demand, if the mesh changes) the builder and solver calculates the dimensions of the system matrix by counting the degrees of freedom in the system, and assigns a row in the final system to each unknown.
- At each solution iteration, the builder and solver asks the time scheme to provide the local contributions for each element and condition and assembles them in the corresponding positions of the global system.
- Once the system matrix and right hand side vector have been assembled, the builder and solver calls a linear solver (provided at runtime) to solve the system.