|
[Sponsors] |
User fortran to input/output file in a parallel run |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 30, 2017, 05:18 |
User fortran to input/output file in a parallel run
|
#1 |
New Member
Tony
Join Date: Mar 2016
Posts: 24
Rep Power: 10 |
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. |
|
Tags |
parallel, read, user fortran, user routine, write |
|
|
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 |