Kratos Structure: Strategies and Processes

From KratosWiki
Revision as of 09:33, 6 May 2012 by Jcotela (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.


Solution strategies

Time scheme

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.


The strategy constitutes the top layer of the solution strategy components, and controls the flow of the problem. A typical example of what a strategy implements would be Newton-Raphson iterations. It uses the time scheme and the builder and solver to perform an iteration and update the unknowns, checks for convergence (with the help of a ConvergenceCriteria object, not presented in this overview) and decides when the solution process is finished.

Helper tools

In addition to the solution strategy classes, there are some classes that can be used to implement auxiliary tasks in the simulation: processes and utilities.


The Process class is used to implement general tasks that are not covered by the basic solution iteration. They are characterized by an Execute() function, that will perform the task the process was designed for.


Utilities are collections of tools used to perform a particular task, or with a common subject, such as, for example, mathematical functions, parallelization tools or calculation of surface normals.

Python solvers

All tools described to this point are compiled in C++, and have an interface to call them from Python. The user can then freely mix them in a simulation, although not all combinations will work or even make sense, obviously. We provide some pre-packaged solvers already implemented as Python classes, which combine the strategies and tools in a way that is usable out of the box. Each application defines its own solvers, but their general structure will be outlined in the following section.

Next : Kratos Structure: Workflow

Previous : Kratos Structure: Mesh and ModelPart

Personal tools