CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

User fortran to input/output file in a parallel run

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By doublestrong
  • 1 Post By juliom

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   March 30, 2017, 05:18
Default User fortran to input/output file in a parallel run
  #1
New Member
 
Tony
Join Date: Mar 2016
Posts: 24
Rep Power: 10
doublestrong is on a distinguished road
I managed to use user fortran to input/output file in a parallel run, but I got confused for the role of master processor.

I am using user fortran to assign value of the pressure at the outlet of my computational domain. The user fortran code is a one-dimensional unsteady simulation, whose time step is the same as three-dimensional simulation. Now you see that I need to save transient results of user fortran and, sometimes, read them as the intial solution for user fortran.

My simulation is in a parallel run. I found the help document already mentioned input/output file in a parallel run. Here it is:

The CFX-Solver is designed so that all of the numerically intensive tasks can be performed in parallel. Administrative tasks, such as simulation control and user interaction, as well as the input/output phases of a parallel run, are performed serially by the master process. This approach guarantees good parallel performance and scalability of the parallel code, as well as ensuring that the input/output files are like those of a sequential run.


Therefore I only use master processor to output file in my user fortran code, here is the code block about output:

if ((PAR_MODE .EQ. 1).OR.(RUN_MODE .EQ. 0)) then
write(ctstep,*) currenttimestep
open(12,FILE=('pipeSolutionFile'//trim(adjustl(ctstep))))
write(12,'(<xnodes>F12.4)') u
write(12,'(<xnodes>F12.4)') a
write(12,'(<xnodes>F12.4)') aA
write(12,'(<xnodes>F12.4)') lamda
write(12,'(<xnodes>F12.4)') beta
close(12)
endif


However, when my code read file at the very beginning to get initial solution, the solver crashed in a paraller run but worked well in a serial run if I only user master processor to read. After I deleted code about only using master processor to read, the input phrase got to work well in a parallel run. Here is the code block about input:

! call GET_PARALLEL_INFO ('PARMOD',PAR_MODE,CNAME,CRESLT)
! call GET_PARALLEL_INFO ('RUNMOD',RUN_MODE,CNAME,CRESLT)
! if ((PAR_MODE .EQ. 1).OR.(RUN_MODE .EQ. 0)) then
open(11,FILE='../pipeSolutionFile')
read(11,'(<xnodes>F12.4)') u
read(11,'(<xnodes>F12.4)') a
read(11,'(<xnodes>F12.4)') aA
read(11,'(<xnodes>F12.4)') lamda
read(11,'(<xnodes>F12.4)') beta
close(11)
! endif


All the u, a, aA, lamda and beta are stated by SAVE function which I think would help to share data between master and slave processors.

I have two questions:
1. when a simulation runs at the very begining, is master processor the first one to call user routine? If it is not, then the slave provessor which is called firstly may need to do the input phase in my case.
2. are slave processors able to excute READ but not able to excute WRITE?

Welcome to discuss,
Thanks.
doublestrong is offline   Reply With Quote

 

Tags
parallel, read, user fortran, user routine, write


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 09:07
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 17:18
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 05:18
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 10:23


All times are GMT -4. The time now is 15:55.