CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Writing all continuity errors to a file using custom solver in parallel mode

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 14, 2022, 04:28
Default Writing all continuity errors to a file using custom solver in parallel mode
  #1
New Member
 
Saurabh
Join Date: Nov 2017
Posts: 6
Rep Power: 9
saurabh1011 is on a distinguished road
Hi,
This is my first time on making custom openfoam solver. I made a custom solver using chtMultiRegionFoam as template. I am trying to print out all continuity errors to a file. Then I added a code inside solver code to plot all continuity, residuals and average fields values at boundaries using gnuplot. However, this seems to work fine when run in the serial mode. But parallel mode is plotting graph 4 times and writing files 4 times (I am using 4 cores for parallelization). Is there any way to make openfoam solver to run in serial mode for few lines and run in parallel mode for the rest of the code?


I tried to assign integer value to each thread using MPI then use If loops to call them to run specific commands. but MPI_Init command fails everytime when I run the solver. The error says that MPI_Init can't be initialized multiple times. It seems that multiple threads are initializing MPI. Is there any workaround this error?
saurabh1011 is offline   Reply With Quote

Old   September 14, 2022, 21:44
Default
  #2
New Member
 
Saurabh
Join Date: Nov 2017
Posts: 6
Rep Power: 9
saurabh1011 is on a distinguished road
hi,
I found this post that solves my problem. In this post, instead of using MPI_Int in the main solver code, I can call each processor by using Foam::UPstream::myProcNo() and plot gnuplot only one time.


How to extract MPI rank?


However, using this method, I found that running same code in parallel is slowing down the simulation compared to the case where I run same simulation in serial mode.


I think that since only one processor is plotting the graph, all other processor are waiting for it to finish plotting and it is causing the simulation slowdown.

is there any way to divide the work of gnuplot plotting process among all processors without plotting same graph 4 times?
saurabh1011 is offline   Reply With Quote

Reply

Tags
custom solver, gnuplot, openfoam, openmpi, parallel


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
[Other] Tabulated thermophysicalProperties library chriss85 OpenFOAM Community Contributions 62 October 2, 2022 04:50
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 19:13
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 18:34
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 02:41


All times are GMT -4. The time now is 22:25.