Typical Errors

From KratosWiki
Jump to: navigation, search

Typical Errors are errors that occur frequently to novice users who develop their own Applications in KRATOS. This Article is intended to act as a kind of updated collection of errors that have a simple solution that is, however, hard to find. This list is oriented at the phenotype of an occurring error rather than at the origin of it. Therefore, the list is divided into the following groups of errors:

  • Compiler Errors Error messages from the compiler that are not obviously understandable but have a rather trivial origin.
  • Runtime Errors Errors that occur despite of a flawless compilation and result in Python runtime errors or Segmentation Faults.
  • Behaviour Errors Errors that do not cause the program to fail but produce incorrect and/or strange results of the calculation.


Compiler Errors

Avoid using 'unsigned int' declaration in OpenMP loops. It does not compile in Windows. Instead, use 'int'. If you get the warning about comparisons between unsigned and signed ints cast the 'unsigned int' to 'int' as follows:

#pragma omp parallel for
for (int i = 0; i < (int)some_vector.size(); i++) {

In principle, this gets the same performance as:

#pragma omp parallel for
for (int i = 0; i < static_cast<int>(some_vector.size()); i++) {

Runtime Errors

Base class function called instead of derived one

Phenotype: The program terminates with an error like "Calling virtual / base class function for ... instead of derived class one".

Explanation: Some functions have to be defined in the derived classes (e.g. of ConstitutiveLaw or Element) to perform with the desired effect. If, for example, a certain value should be returned that cannot be sensibly retrieved from the base class, the developers might have put an error message in the base class, that is thrown if the (virtual) function in the base class should be accessed by accident. This may happen if there is no (or a wrong) implementation for this actual function in the used derived class.

Solution: Check carefully the implementation of the derived class for any missing implementation of virtual functions in its base class. Warnings on compile time may give a hint on where to look at. In order to prevent this error from happening, you can also declare all your derived functions as override, so the compiler itself will tell you if the functions are actually substituting (overriding) the base class functions or not.

Boost not found

If the compilation was ok but Kratos is not finding boost when you run some problem, copy the compiled boost libraries (or make links) into the 'libs' folder in Kratos.

Behaviour Errors

Results depend on whether the Python script is recompiled

Phenotype: The (in this case usually erroneous) output or calculation behaviour (e.g. convergence) changes depending on whether the Python script of the calculation is newly written or re-used.

Explanation: Python code is compiled to byte code prior to its execution. However, this is done only if the Python source code has been changed, i.e. it has a younger time stamp than the respective byte code (.pyc).


Personal tools