|
[Sponsors] |
February 22, 2022, 04:55 |
Own code - Writing timestep in parallel
|
#1 |
Member
UOCFD
Join Date: Oct 2020
Posts: 40
Rep Power: 6 |
I have coded this switch to write and end the simulation when pressure reaches a defined value.
The code works nice in serial mode but in parallel it gets stuck while writing, it creates only a few fields in the processor0 folder and nothing in others proc folders. What could be the problem? Code:
pimple { ... rho = thermo.rho(); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; if (pressureOpening=="on") { #include "Panels.H" if (valueDiffAvg >= pStatAbs.value()) { Info << "Aborting: pressure threshold has been reached. \n" ; Info << "valueDiffAvg: " << valueDiffAvg << " pStatAbs: " << pStatAbs.value() << endl ; runTime.writeAndEnd(); } } } Info<< "End\n" << endl; return 0; |
|
February 22, 2022, 12:58 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
Your code very likely has different branching logic. I.e. some processes think they are finished, but others do not. The volField write however is parallel-aware, so if you only call it from one process things will simply "block". This usually looks like some really ugly MPI error at exit. You probably want to test something like the following: Code:
if (returnReduce((valueDiffAvg >= pStatAbs.value()), orOp<bool>())) { Info<< "Aborting: pressure threshold has been reached" << nl << "valueDiffAvg: " << valueDiffAvg << " pStatAbs: " << pStatAbs.value() << endl ; runTime.writeAndEnd(); } |
||
February 23, 2022, 04:28 |
|
#3 | |
Member
UOCFD
Join Date: Oct 2020
Posts: 40
Rep Power: 6 |
Quote:
Thanks a lot mate, you gave sense to the OF "community". I wondered it should be something related with processors but my attempt was to include an if Pstream::master(), write, what neither work. In a new attempt with your improvement seems that at least it is stopping and writing nicely, I will try further validation. Thanks again |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field | lakeat | OpenFOAM Community Contributions | 58 | December 23, 2021 03:36 |
Parallel Fortran 95 code using Openmp | Shiv1510 | Main CFD Forum | 5 | February 14, 2020 12:36 |
How to Mix AIR and WATER | Elvis1991 | FLUENT | 12 | December 1, 2016 13:28 |
[snappyHexMesh] crash sHM | H25E | OpenFOAM Meshing & Mesh Conversion | 11 | November 10, 2014 12:27 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 16:56 |