Fortran Data Deviation Occurs
Fault Locating
The program is running properly, but the output is different from the expected result. Figure 1 shows how to locate and rectify the fault.
- Confirm that data deviation occurs based on the command output.
- Streamline the calculation process where data deviation occurs.
- Analyze the possible causes, add the print information, and analyze the print result.
- Confirm the cause and modify the code. Then perform a verification.
- If the problem persists, check other possible causes.
Case: Data Deviation Caused by Uninitialized Arrays
Symptom
Some data in the software running result is inaccurate.
Fault Locating
- Confirm that the calculation result of the rad_clr7.3 table is inaccurate.
- Confirm that the error data range is [855,856;1190,1191]. Print key variables in the range. See the following figure:

- Compare the key variable values with the output.

- Check the calculation process. It is found that the tau array contains a large amount of abnormal data. It is possible that the data is dirty.

- Check the calling position of the tau array. It is found that the array is not initialized. Initialize the array.

- Modify the code and verify that the data deviation problem is resolved.
Parent topic: Troubleshooting
