Spring, 2024
Jewett
Plotting in 2D from Fortran or C
ATMS 502 / CSE 566
Numerical Fluid Dynamics
Updated Tue. Feb. 1

Creating 2D plots in C/Fortran

For 2D plotting there are now routines in C and Fortran in my directory on Stampede2:

You should be able to cd to your directory, and then

       cp either-Fortran-or-C-directory-above/* .

and this would copy all the files from that directory to your account.
OK, so then what?

Each directory has a couple source files and a README file.
README-Plotting-Fortran/or/C.txt how to call the routines

particularly for Fortran, do please replace your old sfc.f90 with this one.

Inside the README*.txt file is information on how to call the routine from your program. I suggest putting a call to "contr" inside your main program , which would be pgm2.f90 or pgm2.c.

The last step to prepare your code to do the contour plots is to change the Makefile so everything compiles OK. You would edit "Makefile" the way you edit anything else - it is just a text file. Here are the changes you would want to make there:

That should be all the changes you need. Then add a call to the contr routine in your main program (pgm2.f90 or pgm2.c) after you call your ic() routine, so you can plot contours of your 2D s1() array or u() array or v() array. But do know that there is a trick to not plot the ghost points of the s1 array, which is described in the README file in each directory (Fortran or C) that you are copying.

With those changes to your code and the Makefile, you can hopefully then just type "make pgm2" to build the program.