|
[Sponsors] |
coded FO, cellzone and new volScalarField: problem with mpirun |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 13, 2020, 09:49 |
coded FO, cellzone and new volScalarField: problem with mpirun
|
#1 |
New Member
Pietro Tavazzi
Join Date: Aug 2019
Location: Milan, Italy
Posts: 8
Rep Power: 7 |
Hi,
I'm trying to run a few tests before converting the following coded FO in an actual OpenFoam FO. This FO initialises a zero volScalarField in all the grid, then it changes its values ONLY in a previously generated cellZone (by means of topoSet). Each cell value of the volScalarField is now 0 or 1. The output consists of cells number where 0 becomes 1, printed in the logfile. I noticed differences in the output running the case with mpirun. Looking at the results in paraview it seems that there is an error in forAll cycle: the coded FO changes the values of the new volScalarField outside the defined cellzone. I thought the problem was related to the definition of the scalar "sum" and that the answer I was looking for was associated with the use of the reduce() command, but I didn't solve it. Last edited by elden; March 13, 2020 at 09:55. Reason: missing code |
|
March 13, 2020, 12:33 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
An indexing error in your code.
You want something like this instead: Code:
forAll(cz, i) { const label celli = cz[i]; .... } Code:
for (const label celli : cz) { .... } @Bruno - relocate to programming? |
|
March 13, 2020, 12:47 |
|
#3 |
New Member
Pietro Tavazzi
Join Date: Aug 2019
Location: Milan, Italy
Posts: 8
Rep Power: 7 |
Thanks a lot.
And sorry for the silly question. |
|
Tags |
cellzone, coded, mpirun |
|
|