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

codedFixedValue boundaries in parallel

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 18, 2013, 11:15
Default codedFixedValue boundaries in parallel
  #1
Member
 
Join Date: Sep 2012
Posts: 48
Rep Power: 4
Hiroshiman is on a distinguished road
Hello,
I'm using the codedFixedValue to set the pressure on the outlet on my case (flowRate at the inlet, pressure on the outlets).
I used the flowRate on the outlets to set the pressure. When the run is sequential, everything works fine but in parallel, the pressure isn't applied correctly.

My codeDict:
Code:
 
//reading the pressure on the considered patch       
        const volScalarField& p = db().lookupObject<volScalarField>("p");
        const fvPatchField<scalar>& pip = patch().patchField<volScalarField, scalar>(p);

//reading the flowRate on the considered patch       
        const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>("phi");
        const fvsPatchField<scalar>& phip = patch().patchField<surfaceScalarField, scalar>(phi);


        int k=0;
        dimensionedScalar h("h",dimless, tstep.value());
        dimensionedScalar pp("pp",dimless, average(pip));     //average pressure on the patch
        dimensionedScalar res("res",dimless,1E6); 
        dimensionedScalar p0("p0",dimless, 1E6);      
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

      pp += h * sum(phip); //test

        (*this)==(pp.value());
        #};
The average of the pressure isn't working well in parallel as it tries to do it where there the patch area is null:
Code:
--> FOAM Warning : 
    From function average(const UList<Type>&)
    in file /home/apps/Logiciels/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/FieldFunctions.C at line 467
    empty field, returning zero

I guess I'm reading and writing the pressure and flowRate correctly but I don't really know what to do.



edit : I think the problem is only the access of the data on the processor patch and not the whole BC ; how can I get these data ?
If someone is able to help, thank you a lot.

Florian

Last edited by Hiroshiman; September 18, 2013 at 14:37.
Hiroshiman is offline   Reply With Quote

Old   September 19, 2013, 04:47
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 291
Rep Power: 9
jherb is on a distinguished road
I think you have to use the OpenFOAM reduce functions to collect the data of all processors. These examples should help:
Face weighted Velocity average at a boundary patch
https://github.com/OpenFOAM/OpenFOAM...patchAverage.C
jherb is offline   Reply With Quote

Old   September 19, 2013, 13:45
Default
  #3
Member
 
Join Date: Sep 2012
Posts: 48
Rep Power: 4
Hiroshiman is on a distinguished road
Thank you for the answer.
Actually, I'm a bit lost :
I'm using the codedFixedValue BC and the structure of the code is quite different from what I see in the "real" BCs codes.
For example, to get the patch area, I do :
Code:
dimensionedScalar area("area",dimless, gSum(patch().magSf()));
and even if the patch is shared between several cpus, the area is ok. However, the pressure applied is not ok (several different values on the patch, dependant on the cpu).
I tried to assign on cpu for each outlets but it simply crashes...
Hiroshiman is offline   Reply With Quote

Old   September 19, 2013, 19:58
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Hiroshiman View Post
Thank you for the answer.
Actually, I'm a bit lost :
I'm using the codedFixedValue BC and the structure of the code is quite different from what I see in the "real" BCs codes.
For example, to get the patch area, I do :
Code:
dimensionedScalar area("area",dimless, gSum(patch().magSf()));
and even if the patch is shared between several cpus, the area is ok. However, the pressure applied is not ok (several different values on the patch, dependant on the cpu).
I tried to assign on cpu for each outlets but it simply crashes...
It never occurred to you that there might be a difference between gSum and sum (which you're using in your BC)?
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   September 19, 2013, 20:52
Default
  #5
Member
 
Join Date: Sep 2012
Posts: 48
Rep Power: 4
Hiroshiman is on a distinguished road
Ahem, I totally missed that obviously... Thank you for noticing, I'll try with the global sum and see how it behaves.

----------

edit
Thank you very much, my results are identical between sequential and parallel runs.

Best regards,

Florian

Last edited by Hiroshiman; September 20, 2013 at 10:21.
Hiroshiman is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
simpleFoam in parallel issue plucas OpenFOAM Running, Solving & CFD 3 July 17, 2013 11:30
parallel Grief: BoundaryFields ok in single CPU but NOT in Parallel JR22 OpenFOAM Running, Solving & CFD 2 April 19, 2013 16:49
Parallel refineMesh with Cyclic Boundaries mchurchf OpenFOAM 6 June 20, 2012 13:06
dynamic mesh interDyMFoam parallel run and processor boundaries lukasfischer OpenFOAM Running, Solving & CFD 0 August 12, 2009 06:36
Parallel Computing Classes at San Diego Supercomputer Center Jan. 20-22 Amitava Majumdar Main CFD Forum 0 January 5, 1999 13:00


All times are GMT -4. The time now is 20:37.