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.
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.Run the program in debug mode
Zrun -debug problem.inp
After execution, a file named
OUT_83will be generated. TheOUT_83file contains:All messages and variables printed using
prnAdditional 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.