Fortran [FORTRAN] How did I screw up my code?

AI Thread Summary
A user is seeking help to debug their FORTRAN code, which has been problematic for two weeks. The code involves complex calculations related to electron and baryon densities, mixing angles, and mass parameters in a neutrino sphere context. Key issues include the initialization of matrices and the handling of input data files, particularly for electron fraction and density profiles. The user has provided extensive code snippets, indicating a focus on ensuring correct calculations and matrix properties. The discussion highlights the challenges of debugging scientific computation code in FORTRAN.
  • #51
It might be useful to run a fortran lint command against your source code to see what other odd things lurk therein.

Some fortran tools to check out:

http://www.dmoz.org/Computers/Programming/Languages/Fortran/Tools/Code_Analysis/
 
Technology news on Phys.org
  • #52
Ok, after extensive testing, changing iegrid to iegrid2 (having declared it at the top of varelec_init) has solved the bug issue it seems!

myid was declared in the module parallel...I suppose it has something to do with parallelization of the code. I have not had to work with multiple processors as of yet.
 
Last edited:
  • #53
Working with multiple processors and/or threads can be very tricky, make sure you read up on it and look at simple examples and learn about ways to synchronize your code within a fortran environment. I found these examples:

http://people.sc.fsu.edu/~jburkardt/f_src/openmp/openmp.html

and this:

https://computing.llnl.gov/tutorials/parallel_comp/
 
  • #54
Just a thought, Matterwave. Maybe you could put all of your code in github so that anyone interested could look at the whole code. At least temporarily (it's pretty easy to delete the github repository). In the readme file you could put an example of the input and the expected output.
If you're interested let us know and we'll give you the commands to enter in the terminal.
 
  • #55
fluidistic said:
Just a thought, Matterwave. Maybe you could put all of your code in github so that anyone interested could look at the whole code. At least temporarily (it's pretty easy to delete the github repository). In the readme file you could put an example of the input and the expected output.
If you're interested let us know and we'll give you the commands to enter in the terminal.

This should be checked with his supervisor as some colleges and universities look dimly on posting proprietary code online.
 

Similar threads

Replies
16
Views
2K
Replies
6
Views
3K
Replies
1
Views
2K
Replies
2
Views
2K
Replies
6
Views
5K
Replies
1
Views
11K
Back
Top