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

Reduce() and Size() functions

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes
  • 5 Post By Traction
  • 1 Post By Traction
  • 1 Post By Zeppo
  • 1 Post By Zeppo

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   August 28, 2016, 19:50
Default Reduce() and Size() functions
  #1
Senior Member
 
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 15
babakflame is on a distinguished road
Dear Fellows

I have few questions regarding the following snippet:

Code:
scalar ULeft = 0.0;
label leftI = mesh().boundaryMesh().findPatchID("left");
const fvPatchVectorField& fvp = U.boundaryField()[leftI];
if (fvp.size())
{
ULeft = fvp[0].x();
}
reduce(ULeft, maxOp<scalar>());
After labeling leftI, the 3rd line puts the velocity of the "left" ptach into fvp "object".
I assume the size of fvp is non-zero, so the "if" loop executes.
My first question is on
Code:
ULeft = fvp[0].x();
.
here, fvp is an array of vectors, since it keeps the velocity vectors of a patch, but the above command just stores the first component ".x()" of first vector "[0]" in the array of vectors. Am I correct?

For example assume
fvp = { (1 2 3) (4 5 6) (7 8 9)}
then fvp[0].x means 1
then why using the
Code:
reduce(ULeft, maxOp<scalar>());
command?

I assume that reduce() function with maxOp<scalar> finds the biggest scalar in an array of scalars, but here ULeft just has one member!!! (in my example 1)

Am I missing sth?


Regards
babakflame is offline   Reply With Quote

 


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
Reduce size of Ansys.rst file in FSI simulations? Jorn CFX 6 September 21, 2017 03:00
[ANSYS Meshing] Reduce mesh size only in one direction peppe7 ANSYS Meshing & Geometry 0 January 29, 2016 13:22
How to reduce size of autosaved .sim-files? adbuerger STAR-CCM+ 8 October 12, 2015 09:36
How can reduce the size of figures in Ms Word immortality Lounge 1 February 6, 2014 03:24
Reduce output file size!! Jonac CFX 1 September 15, 2000 03:24


All times are GMT -4. The time now is 11:27.