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

reduce an equal operation

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By jherb

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 6, 2016, 05:53
Default reduce an equal operation
  #1
Senior Member
 
Join Date: Sep 2010
Posts: 226
Rep Power: 16
T.D. is on a distinguished road
Dear Foamers,

I am looking for a "reduce" function but on an "equal operation".

For example, we know that reduce function is already Ok for:
sumOp, minOp and maxOp

How to do it (or extend it) for an "equal operation" and a "pow operation".

I need to make the following code to work also in parallel:
Code:
            forAll(mesh.C(),celli)
            {
            Sens[celli] = Foam::pow(SSS[celli], 0.5) ;
            }

           // Sens and SSS are both volScalarField type
Thank you and regards,
T.D.
T.D. is offline   Reply With Quote

Old   September 6, 2016, 12:00
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
Your code should run without modification in multi process mode. Each processor has its own mesh with the cells of that fluid partition it is responsible for. So no need for any reduce operation. The latter would only be necessary if data from all processors should be put together, e.g. the sum of a value of all cells of all the meshes on all the processors/processes.

But your equal and pow operation only uses local information. So also no need for data exchange between processors. This would become much more complicate, if values of neighbor cells should be used.
Traction likes this.
jherb is offline   Reply With Quote

Reply


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
loading issue libraries:libsimpleFunctionObjects.so libsimpleSwakFunctionObjects.so immortality OpenFOAM Pre-Processing 15 April 7, 2024 12:35
Reduce operation for an array xiao OpenFOAM Running, Solving & CFD 10 June 21, 2022 10:01
Hi Do mesh have to do to reduce the temperature at the outlet? i need the reduce temp reslan FLUENT 0 March 16, 2016 02:10
Incompatible dimensions for operation ruben23 OpenFOAM Running, Solving & CFD 2 June 12, 2015 04:14
openfoam reduce() and MPI_barrier mechy OpenFOAM Programming & Development 3 October 7, 2013 09:11


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