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

findMax not working in parallel with scalarField

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 3, 2011, 10:47
Default findMax not working in parallel with scalarField
  #1
Senior Member
 
Pablo
Join Date: Mar 2009
Posts: 102
Rep Power: 17
pablodecastillo is on a distinguished road
hello,

I found that findMax not working in parallel with scalarField.

I want to find the min coordinate_X for my pacht and at the same time with coordinate_Z <= 0.

Any idea?

Thanks
pablodecastillo is offline   Reply With Quote

Old   November 3, 2011, 11:17
Default
  #2
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
I've never tried to use findMax, but this should work:

Code:
scalar whatever = findMax...;

reduce(whatever, maxOp<scalar>());
There are other options depending on your needs: minOp, sumOp...

Regards
Phicau is offline   Reply With Quote

Old   November 3, 2011, 11:25
Default
  #3
Senior Member
 
Pablo
Join Date: Mar 2009
Posts: 102
Rep Power: 17
pablodecastillo is on a distinguished road
So it would be;

label whatever = findMax...;

reduce(whatever, maxOp<label>());

I am using gMax, so get the max value, but now how can i get what label is the max value (and working in parallel)

Thanks
pablodecastillo is offline   Reply With Quote

Old   November 3, 2011, 11:50
Default
  #4
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Just loop the entire patch:

Code:
    vectorField coord = patch().Cf();
    scalar auxiliar = 999999.0;

    forAll(coord.component(2), index) 
    {
        if(coord.component(2)[index]<=0.0)
        {
            if(coord.component(0)[index]<auxiliar)
            {
                auxiliar = coord.component(0)[index];
            } 
        } 
    }

reduce(auxiliar, minOp<scalar>());
Phicau is offline   Reply With Quote

Old   November 3, 2011, 12:38
Default
  #5
Senior Member
 
Pablo
Join Date: Mar 2009
Posts: 102
Rep Power: 17
pablodecastillo is on a distinguished road
thank you, but still i can not get the label for the value, any idea?

Pablo
pablodecastillo is offline   Reply With Quote

Old   November 3, 2011, 12:55
Default
  #6
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Another loop...
Code:
    label auxiliarLabel = -999999;

    forAll(coord.component(2), index2) 
    {
             if(coord.component(2)[index2]<=0.0)
             {
                      if(coord.component(0)[index2]==auxiliar)
                      {
                               auxiliarLabel = index2;
                               break;
                      } 
             } 
    }

reduce(auxiliarLabel, maxOp<label>());
Phicau is offline   Reply With Quote

Old   November 3, 2011, 13:28
Default
  #7
Senior Member
 
Pablo
Join Date: Mar 2009
Posts: 102
Rep Power: 17
pablodecastillo is on a distinguished road
the second loop to find the cell is not working; i mean it is not giving the correct label

label celdabuscada = -99999;
scalar pto_X = -10000.0;

forAll(mesh.boundary()[patchK], faceI)
{
if (NN2[faceI].component(vector::Z) <= 0.0) {
if (NN2[faceI].component(vector::X) >= pto_X){
pto_X=NN2[faceI].component(vector::X);
}
}
}
reduce(pto_X, maxOp<scalar>());
forAll(mesh.boundary()[patchK], face2)
{
if (NN2[face2].component(vector::Z) <= 0.0) {
if (NN2[face2].component(vector::X)==pto_X){
celdabuscada=face2;
Info <<"////celda buscada " << celdabuscada << nl;
break;
}
}
}
reduce(celdabuscada, maxOp<label>());

more ideas??
pablodecastillo 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
parallel fluent under pbs not working kharnabnew FLUENT 0 January 6, 2011 03:28
Problem on Parallel Run Setup Hamidur Rahman CFX 0 September 23, 2007 17:11
Replacing components in a scalarField grtabor OpenFOAM Running, Solving & CFD 1 February 5, 2007 12:24
OpenCFD enhances OpenFOAM's parallel communications OpenFOAM discussion board administrator OpenFOAM Announcements from ESI-OpenCFD 0 October 2, 2006 08:36
MPICH Parallel Run Error on the Windows Server2003 Saturn CFX 3 August 29, 2006 08:42


All times are GMT -4. The time now is 01:10.