Fort 77 and gnuplot iterative output jpegs

In summary, the programmer is trying to create a jpeg for every time step, but the program keeps resetting the picture.
  • #1
ParticlesRule
1
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
  • #2
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:

1. What is "Fort 77" and how is it related to gnuplot?

"Fort 77" refers to the FORTRAN 77 programming language, which is a popular choice for scientific computing. Gnuplot is a software program that is commonly used for creating graphs and plots. Fort 77 can be used in conjunction with gnuplot to generate graphs and plots from data.

2. What is iterative output in gnuplot?

Iterative output in gnuplot refers to the process of repeatedly generating graphs or plots with different parameters or data. This allows for a more comprehensive analysis of the data and can help identify patterns or trends.

3. How do I save gnuplot output as JPEG files?

To save gnuplot output as JPEG files, you can use the "set terminal" command in gnuplot to specify the output format as JPEG. Then, use the "set output" command to specify the filename and location for the JPEG file. Finally, use the "plot" command to generate the graph or plot, and the output will be saved as a JPEG file.

4. Can gnuplot automatically generate iterative output as JPEG files?

Yes, gnuplot can automatically generate iterative output as JPEG files by using a loop in the script. This allows for the efficient generation of multiple graphs or plots with different parameters or data, all saved as JPEG files.

5. How can I use Fort 77 and gnuplot to create professional-looking graphs and plots?

To create professional-looking graphs and plots with Fort 77 and gnuplot, it is important to have a good understanding of the syntax and commands for both programs. Additionally, using appropriate formatting and labeling, as well as choosing visually appealing styles and colors, can greatly enhance the appearance of the output. Practice and experimentation can also help improve the quality of the graphs and plots.

Similar threads

  • Programming and Computer Science
Replies
4
Views
3K
Replies
1
Views
4K
  • Programming and Computer Science
Replies
3
Views
4K
  • Programming and Computer Science
Replies
4
Views
7K
  • Programming and Computer Science
Replies
5
Views
6K
  • Programming and Computer Science
Replies
1
Views
944
  • Programming and Computer Science
2
Replies
41
Views
3K
  • Programming and Computer Science
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Programming and Computer Science
Replies
3
Views
2K
Back
Top