CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Siemens (https://www.cfd-online.com/Forums/siemens/)
-   -   file call (https://www.cfd-online.com/Forums/siemens/53516-file-call.html)

CMB October 17, 2003 11:29

file call
 
Hi,

This is a problem that is more related to Fortran than to star cd I guess, but here it is: I have two sets of cells separated from one another. In POSDAT I constructed two separate lists of cell numbers and centroids of these cells e.g. IP1, IP2 and CX1 and CX2, then I calculated the list of matched cells MATCH12, i.e. MATCH12(7,1) is the prostar cell number of the type 1 in pair 7. And then I wrote that list to a file, so that it could be accessed directly from another subroutine before POSDAT is called for restart runs, with:

OPEN (101,File='Match.list')

DO IM=1,ICOUNT5

write (101,*) IM,MATCH12(IM,1),MATCH12(IM,2)

END DO

close (101) Now, my question is how do I open this file when I would like to access this list in another subroutine, I know this should be very basic but I am a preety bad programer.

Many thanks

jimbob October 17, 2003 12:05

Re: file call
 
Hi Carlos,

I think you should invest in a book on fortran! Once you have created your file, you can open it in the same way you did before; open (101,file='Match.list') and then read the data from the file.

If you want to be safe, use "inquire" to check if the file is there.

If you want to pass information from one subroutine to anther, during the same simulation, look into using "common" blocks. Cheers.


All times are GMT -4. The time now is 03:41.