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

cellSet volume across processor.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 19, 2019, 05:03
Default cellSet volume across processor.
  #1
New Member
 
Join Date: Aug 2018
Posts: 18
Rep Power: 7
nago is on a distinguished road
hi!

i use OF 2.3.1, want to get cells total volume in cellSet PPP.
i can get it in single-core calculation.
but i can't in parallel calculation.


>>(code i wrote)----------------------------------------------------------------
double vol_PPP = 0;
cellSet ppp(mesh, "PPP");

forAll(mesh.C(),i)
{
if (ppp[i]){
vol_PPP += mesh.V()[i];
Info << "vol_Mesh : " << mesh.V()[i] << " [m3] " << endl;
}
}
Info << "vol_PPP_total : " << vol_PPP << " [m3] " << endl;
------------------------------------------------------------------------

i found function "reduce()" or "sum()", but don't know how to use it in cellSet !

please tell me the way of getting total volume...

regard.
nago is offline   Reply With Quote

Old   May 7, 2019, 08:40
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
You need to specify the reduction operator as well. Eg,
Code:
 scalar vol = ...;  // your loop over cellSet
reduce(vol, sumOp<scalar>());
olesen is offline   Reply With Quote

Old   May 9, 2019, 03:03
Default
  #3
New Member
 
Join Date: Aug 2018
Posts: 18
Rep Power: 7
nago is on a distinguished road
Dear olesen,

thank you for your reply.
I could get cellSet-volume by your way !!
Thanks a lot.

nago
nago is offline   Reply With Quote

Reply

Tags
coding style, mesh, openfoam2.3.1


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
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 06:09
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 05:38
[Other] Equal decomposition of cylindrical fluid domain Sean95 OpenFOAM Meshing & Mesh Conversion 3 February 12, 2019 03:34
Problem of simulating of small droplet with radius of 2mm liguifan OpenFOAM Running, Solving & CFD 5 June 3, 2014 02:53
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06


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