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

Foam::pow function in parallel

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 22, 2016, 20:32
Default Foam::pow function in parallel
  #1
Senior Member
 
Join Date: Sep 2010
Posts: 226
Rep Power: 16
T.D. is on a distinguished road
Hi Foamer,

I have the following code that uses a Foam:ow function. The solution is working fine on one processor, but the solution is not correct (distorted) if i do run the code in parallel, any ideas ?

Code:
-----------------------------------------------------------------------------
            Epow = DF;
            forAll(mesh.C(),i)
            {
              Sens[i] = Foam::pow(Epow[i], 0.5); 
            }
            alpha = Foam::max(a,Foam::max(alpha-half,Foam::min(b,Foam::min(alpha+half,alpha*Sens*lambda))));
-----------------------------------------------------------------------------

Note : The types of the different variables above are either a volScalarField or a dimensionedScalar


regards,
T.D.
T.D. is offline   Reply With Quote

Old   July 23, 2016, 08:56
Default
  #2
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
I don't think the problem comes from ``pow`` function. It is probably due to using ``max`` and ``min`` which are working locally on each processor. You can try ``gMin`` and ``gMax`` which work globally.
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   July 23, 2016, 10:12
Default
  #3
Senior Member
 
Join Date: Sep 2010
Posts: 226
Rep Power: 16
T.D. is on a distinguished road
Hi Hassan,

Thanks. It tried, but the problem seems to be due to looping on mesh.C(). For example, i tried to update a "volScalarField alpha" in the following simple code:
Code:
scalar k=0.;
scalar gg=mesh.C().size();
forAll(mesh.C(),i)
{
alpha[i]=k/gg;
k++;
}
alpha.write();
return 0;
It works fine in serial, but not in parallel. In parallel the field "alpha" is distorted at the processors shared interfaces ! ?

Foamers, any ideas, help ?

Thanks
T.D.
T.D. is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 17:22
foamToTecplot360 thomasduerr OpenFOAM Post-Processing 121 June 11, 2021 10:05
[snappyHexMesh] How to define to right point for locationInMesh Mirage12 OpenFOAM Meshing & Mesh Conversion 7 March 13, 2016 14:07
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 14:11
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 10:23


All times are GMT -4. The time now is 05:48.