FORTRAN - Error 112 Run-time Error

In summary, the individual is experiencing an error message when running simulations on a lattice model. The error occurs in larger systems and specifically references an undefined variable, array element, or function result. The individual runs each simulation multiple times to average the results and believes the error occurs approximately 0.5% of the time in their largest model. They are unsure of the cause of the error and are seeking advice on how to fix it. They are also advised to double check array sizes and to initialize all variables at the beginning of the simulation.
  • #1
Athos_F
1
0
I have strange situation where a code that generaly seems to work fine at times gives a error message.

Basicly I run simulations on a lattice model, and have experience no problems for small system, but when I go to larger systems (meaning that the simulation takes aprox. 15 min) I sometimes get into problem. To average my results I run each simulation a given number of times, and it seems that in around 0.5 % of the time my largest model gives the following error.

Run-time Error
*** Error 112, Reference to undefined variable, array element or function result (/UNDEF).

The line it conects to the problem is well defined, and should not be the problem.

Anyone know way?
 
Technology news on Phys.org
  • #2
This error indicates that you are trying to use elemnts of an array without assigning a value for them. Double check the array sizes .

Also I would recommend initializing all your variables (including arrays) at the begininig of your simulation.
 

1. What is FORTRAN - Error 112 Run-time Error?

FORTRAN - Error 112 Run-time Error is a common error that occurs in FORTRAN programming when there is an attempt to access an array element that is out of bounds or does not exist. This error is also known as a subscript out of range error.

2. What causes FORTRAN - Error 112 Run-time Error?

This error is typically caused by a mistake in the code, such as using an incorrect index value or not properly declaring the size of the array. It can also be caused by trying to access an array element that has been deleted or is not initialized.

3. How can I fix FORTRAN - Error 112 Run-time Error?

To fix this error, you will need to carefully review your code and identify where the error is occurring. Make sure all array indexes are within the declared bounds and that the array is properly initialized. You may also need to use debugging tools to help identify the source of the error.

4. Can I prevent FORTRAN - Error 112 Run-time Error from happening?

Yes, you can prevent this error by thoroughly testing your code and ensuring that all array accesses are within the declared bounds. It is also important to properly initialize arrays before using them and to check for any errors that may occur during runtime.

5. Is FORTRAN - Error 112 Run-time Error a serious issue?

FORTRAN - Error 112 Run-time Error is a common error in FORTRAN programming and can usually be easily fixed. However, if it is not addressed, it can cause your program to crash or produce incorrect results. It is important to fix this error in order to ensure the proper functioning of your program.

Similar threads

  • Programming and Computer Science
Replies
4
Views
585
  • Programming and Computer Science
Replies
6
Views
2K
  • Programming and Computer Science
3
Replies
70
Views
3K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
5
Views
3K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
4
Views
5K
  • Programming and Computer Science
Replies
1
Views
2K
Replies
2
Views
1K
  • Programming and Computer Science
Replies
4
Views
7K
Back
Top