CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   myBC does not work in parallel (https://www.cfd-online.com/Forums/openfoam-solving/237486-mybc-does-not-work-parallel.html)

uosilos July 20, 2021 11:21

myBC does not work in parallel
 
I have tried to modify the activePressureForceBaffleVelocity BC.
It works fine in a single processor but not in parallel.
Any hint?


Code:

const fvPatch& cyclicPatch = patch().boundaryMesh()[cyclicPatchLabel_];
        const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
        const fvPatch& nbrPatch = refCast<const cyclicFvPatch>
        (
            cyclicPatch
        ).neighbFvPatch();

        const labelList& nbrFaceCells = nbrPatch.patch().faceCells();

        scalar valueDiff = 0;
        scalar valueDiffAvg = 0;
        const scalar& cyclicFacesNumber = cyclicFaceCells.size();
        //scalar cyclicFacesNumber = cyclicFaceCells.size();
        //scalar cyclicFacesNumber = 0;
       
        Info<< "Show = " << cyclicFaceCells.size() << endl;
        Info<< "Faces in each cyclic baffle1 = " << cyclicFacesNumber << endl;

        if (fBased_)
        {
            ...
        }
        else // pressure based
        {
            forAll(cyclicFaceCells, facei)
            {
                valueDiff += p[cyclicFaceCells[facei]];
            }

            forAll(nbrFaceCells, facei)
            {
                valueDiff -= p[nbrFaceCells[facei]];
            }
           
            if (cyclicFacesNumber>0)
            {
                valueDiffAvg = valueDiff/cyclicFacesNumber;
               
                Info<< "Faces in each cyclic baffle2 = " << cyclicFacesNumber << endl;
                Info<< "Baffle face-averaged deltaP = " << valueDiffAvg << endl;
            }

            Info<< "Pressure difference = " << valueDiff << endl;
        }

        //if ((mag(valueDiff) > mag(minThresholdValue_)) || baffleActivated_)
        if ((mag(valueDiffAvg) > mag(minThresholdValue_)) || baffleActivated_)



All times are GMT -4. The time now is 17:33.