Debugging Utilities#

Debug prints#

To inspect intermediate values and help debug your code, you can print information in two different ways.

Printing directly to the screen#

You can use Out to print values directly to the terminal. This method is useful for quick checks or small amounts of output or temporary debugging.

Using prn(message, variable)#

A cleaner and more controlled approach is to use the prn function.

  1. Insert prn(message, variable) at the locations in the code where you want to monitor values. Check the function arguments in header file $Z7PATH/include/Print.h.

  2. Run the program in debug mode

    Zrun -debug problem.inp
    
  3. After execution, a file named OUT_83 will be generated. The OUT_83 file contains:

    • All messages and variables printed using prn

    • Additional diagnostic output, including license-related information

This file is also used when working with the integration method theta_perturbation e.g.,

***material
  *integration theta_perturbation 1. 1.e-12 100 print_diff

If the option print_diff is enabled and the problem is launched with

Zrun -debug problem.inp

the file OUT_83 will additionally contain:

  • the element consistent material tangent matrix obtained from the analytical formulation,

  • the corresponding tangent matrix computed by numerical perturbation,

  • the matrix difference between the analytical and perturbed results.

This output enables a direct verification of the analytical consistent tangent.

Running in gdb (Linux)#

Running in VC debugger (Windows)#