Fortran Run Fortran Code - Tips from Ilango

AI Thread Summary
Ilango, a newcomer to Fortran, is attempting to run a battery model program called "dualfoin5.2.f" but encounters numerous errors related to missing variables. The program attempts to open a file named "li-ion.in," which seems to be essential for loading necessary variables. The discussion highlights that the errors may stem from a compiler or linker issue, and there is a specific coding error in the program where comments are incorrectly formatted, preventing successful compilation. Suggestions include providing more detailed error messages and contacting the original authors for clarification, as the code appears untested and contains significant mistakes.
Ilango
Messages
3
Reaction score
0
Dear all,
Let me introduce myself first. I am Ilango from India. I am new to Fortran, mostly working on Matlab, Modelica & Dymola. Working in an automobile company I was required to go through some battery models and hence landed at this page. http://www.cchem.berkeley.edu/jsngrp/fortran.html
It contains a model of a battery entirely built in Fortran. The author claims it to be a full running model. In spite of following the instructions to run the model at the end of the same page, I only get a page full of errors due to missing variables. Any help in getting this model run would be greatly appreciated. Thank you.
Regards,
Ilango
 
Technology news on Phys.org
Ilango said:
I only get a page full of errors due to missing variables.
Ilango

"missing variables" is vague. This sounds like a compiler or linker error. Are you running the executable program, compiling the Fortran, or linking the final executable? You need to give more detail about what you did and exactly what the errors are.
 
FactChecker said:
"missing variables" is vague. This sounds like a compiler or linker error. Are you running the executable program, compiling the Fortran, or linking the final executable? You need to give more detail about what you did and exactly what the errors are.

Hi Fastchecker,
The link pasted in my first post contains a fortran program by name "dualfoin5.2.f". I had compiled it in DOS by typing g77 dualfoin5.2.f. Ideally, I should receive an executable file by name a.exe.

Some where after the start of the program it reads, "open (1, FILE = 'li-ion.in', status = 'old')", which I think the program has to open a file called "li-ion.in". In the attached picture showing the error message, the first few lines mean that the missing variables which have to be loaded from "li-ion.in" is not being loaded. The rest of the error message is releated to an error in calling a function by name "vardc" coded inside "dualfoil5.2.f" itself. Looking for a way to run this.

Also attached is the code of dualfoin5.2.f. Please rename it from *.txt to *.f
 

Attachments

  • Error.jpg
    Error.jpg
    40 KB · Views: 510
  • dualfoil5.2.txt
    dualfoil5.2.txt
    214.3 KB · Views: 524
The first problem encountered is in the piece of code
Code:
c     Split of RG into its components;Test for first leg. WHT 3/10/14
      RG=RGin(1) total resistance in foils, leads, and contacts, ohm-m2
      RGn=RG/3.0d0 resistance affecting negative half cell
      RGp=RG-RGn resistance affecting positive half cell
      RGext=RG/4.0d0  resistance outside cell
There is a blaring mistake here, as comments are not preceded by a !. It should read
Code:
c     Split of RG into its components;Test for first leg. WHT 3/10/14
      RG=RGin(1) ! total resistance in foils, leads, and contacts, ohm-m2
      RGn=RG/3.0d0 ! resistance affecting negative half cell
      RGp=RG-RGn ! resistance affecting positive half cell
      RGext=RG/4.0d0  ! resistance outside cell
The first commented line makes me think that this was a later modification. It obviously has never been tested, as no compiler would be able to compile this code. It might be that the authors have put a link to the wrong file.

I strongly suggest contacting those who wrote the code and ask them. I wouldn't trust any program that has such blatant errors, since it is not debugged.
 
Thank you DrClaude. You were really quick. Will get in touch with the author. Thank you.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top