CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Boundary condition coding - problem in parallel (https://www.cfd-online.com/Forums/openfoam/86847-boundary-condition-coding-problem-parallel.html)

wavemaster April 4, 2011 08:06

Boundary condition coding - problem in parallel
 
Dear Forum,
I coded a boundary condition using
Code:

scalar Area        = sum(patch().magSf());
to get he patch surface area.
Everything seems fine but in parallel runs the code segfaults on the threads that run on the mesh part that does not contain the patch in the following piece of code:
Code:

        if ( fabs(directions_*celerity_*xi*dimension[1]) > SMALL )
        {
            sourcevel = (directions_*celerity_*xi*dimension[1])/Area;
        }


Using the following
Code:

        if ( fabs(directions_*celerity_*xi*dimension[1]) > SMALL && fabs(Area) > SMALL )
        {
            sourcevel = (directions_*celerity_*xi*dimension[1])/Area;
        }

solves the problem but seems a bit clumsy.
Is there a better way of doing this? Why is a patch evaluated if it is not in the part of the decomposed domain?
Thanks for comments,
Have a great day,
Pal


All times are GMT -4. The time now is 07:22.