Fort 77 and gnuplot iterative output jpegs

AI Thread Summary
A Fortran 77 simulation program is generating graphical outputs using gnuplot for each timestep, but the output JPEG files are being overwritten due to the same filename being used. The user seeks a solution to create unique filenames for each timestep's output, such as particles0.jpeg, particles1.jpeg, and so on. Suggestions include modifying the Fortran code to generate dynamic filenames within the loop that handles the plotting. A referenced resource may provide guidance on handling filenames in Fortran. The discussion emphasizes the need for a method to preserve each graphical output for later compilation into an MPEG.
ParticlesRule
Messages
1
Reaction score
0
Hello,

I have currently written a Fortran 77 simulation program that I need to display graphically for each timestep. So far it calls the system to have gnuplot open an include file that has the gnuplot script to plot from my data files and produce a jpeg. What I would like to do is have it do is make a jpeg for every time step that I can combine together into an mpeg so that I can watch how my system evolves graphically.

Here is what I have so far for this part of the code:

call system ("gnuplot particles.in")

Then it goes to the include file with the gnuplot script

set size 1, 1
set term jpeg 1200, 800
set output "particles0.jpeg"
plot "partx0.txt","party0.txt","partz0.txt"So for the partx0,party0, and partz0 text files, my fortran program opens them at the beginning of the time step loop, writes the data into two columns into each of them, then closes them and calls the system to have gnuplot look at the include file.

Everything works great except that at every timestep while the program is running, since the text files reset and get a new batch of data and the include file points to the same jpeg as the output, it keeps resetting the picture.

So if anyone knows what I would have to do in the fortran code or the gnuplot script to make it make as many pictures as I have timesteps (ie. particles0.jpeg,particles1.jpeg, particles2.jpeg,particles3.jpeg,...,particlest.jpeg for t timesteps) it would be very much appreciated. I have searched everywhere for the answer and the very few I found were for C, not Fort 77.

Thank you in advance!
 
Technology news on Phys.org
Well, I don't know anything about fortran. But the part the pictures are created is in a loop, right? So you might be looking for http://www.math.yorku.ca/~akuznets/gnufor2/index.html". Read the "character(len=*) :: filename" part.

When you try this, post the your result here, please! I'm learning fortran and this would be very helpful on the future.
 
Last edited by a moderator:
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...
I am trying to run an .ipynb file and have installed Miniconda as well as created an environment as such -conda create -n <env_name> python=3.7 ipykernel jupyter I am assuming this is successful as I can activate this environment via the anaconda prompt and following command -conda activate <env_name> Then I downloaded and installed VS code and I am trying to edit an .ipynb file. I want to select a kernel, via VS Code but when I press the button on the upper right corner I am greeted...
Back
Top