|
[Sponsors] |
get all cells x>0 for postProcessing with Solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 10, 2022, 11:31 |
get all cells x>0 for postProcessing with Solver
|
#1 | |
New Member
Sebastian
Join Date: Apr 2019
Location: Germany
Posts: 12
Rep Power: 7 |
Hi there,
Unfortunately, I am an early beginner with programming in OpenFOAM. I would like to get a for each time step a value (here U) averaged over all cells in the (inner) mesh that are at positions x>0 (or other values). Is it possible to split the field into two areas: before (x<0) and after the object (x>0) and output each value via Quote:
|
||
February 12, 2022, 06:07 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40 |
For this particular requirement do it yourself will be the best approach. Build two quantities during the loop, followed by any reductions. For example,
Code:
scalar volNeg = 0, volPos = 0; for (label celli=0; celli < mesh.nCells(); ++celli) { const scalar vol = mesh.V()[celli]; if (mesh.C()[celli].x() >= 0) { volPos += vol; } else { volNeg += vol; } } reduce(volNeg, sumOp<scalar>()); reduce(volPos, sumOp<scalar>()); Last edited by olesen; February 12, 2022 at 11:15. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SimpleFoam & Theater | jipai | OpenFOAM Running, Solving & CFD | 3 | June 18, 2019 10:11 |
Problem with divergence | TDK | FLUENT | 13 | December 14, 2018 06:00 |
fluent divergence for no reason | sufjanst | FLUENT | 2 | March 23, 2016 16:08 |
killed "snappyHexMesh" | parkh32 | OpenFOAM Pre-Processing | 2 | April 8, 2012 17:12 |
physical boundary error!! | kris | Siemens | 2 | August 3, 2005 00:32 |