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

Calculate surfaceScalarField in parallel (boundary processor)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By fedez91

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 2, 2021, 20:42
Default Calculate surfaceScalarField in parallel (boundary processor)
  #1
Member
 
Federico Zabaleta
Join Date: May 2016
Posts: 47
Rep Power: 9
fedez91 is on a distinguished road
Hi everyone,

I have a diffusivity "D" calculated in the faces of the cell. I want to limit D on some faces (make it zero), when a parameter "P" (also defined in the faces) is smaller than "epsilon". The code I use works well, EXCEPT ON THE BOUNDARIES BETWEEN PROCESSORS. Attached is a figure of D calculated in series, and D calculated in parallel with 32 processors. You'll see that they are different ONLY in the boundaries between processors (indicated with the glyphs)



Following the implementation of flux limiters on MULES, I do the following (simplified code):

Code:
surfaceScalarField D(fvc::interpolate(D_cell));
scalarField allLambda(mesh.nFaces(), 1.0);

slicedSurfaceScalarField lambda
(
    IOobject
    (
        "lambda",
        mesh.time().timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE,
        false
    ),
    mesh,
    dimless,
    allLambda,
    false   // Use slices for the couples
);


scalarField& lambdaIf = lambda;
surfaceScalarField::Boundary& lambdaBf = lambda.boundaryFieldRef();

forAll(lambdaIf, facei)
{
    if(P[facei] < epsilon) {lambdaIf[facei] = 0;}
}

forAll(lambdaBf, patchi)
{
    scalarField& lambdaPf = lambdaBf[patchi];
    forAll(lambdaPf, pFacei)
    {
        if(P[pFacei] < epsilon) {lambdaIf[pFacei] = 0;}
    }
}

syncTools::syncFaceList(mesh,allLambda,minEqOp<scalar>());

D*=lambda;
I really don't understand where is my error or what I'm missing! I've been struggling a lot with this. Pleas HELP!
Attached Images
File Type: jpg Screenshot from 2021-10-02 17-37-49.jpg (30.6 KB, 15 views)
fedez91 is offline   Reply With Quote

Old   October 2, 2021, 22:39
Default
  #2
Member
 
Federico Zabaleta
Join Date: May 2016
Posts: 47
Rep Power: 9
fedez91 is on a distinguished road
Found the error. It was a stupid typo. It should have said lambdaPf and not lambdaIf on the boundary fields.

Code:
forAll(lambdaBf, patchi)
{
    scalarField& lambdaPf = lambdaBf[patchi];
    forAll(lambdaPf, pFacei)
    {
        if(P[pFacei] < epsilon) {lambdaPf[pFacei] = 0;}
    }
}
CorbinMG likes this.
fedez91 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
Boundary condition problem (Freestream) KAYANO OpenFOAM Running, Solving & CFD 5 June 1, 2021 05:57
foam-extend_3.1 decompose and pyfoam warning shipman OpenFOAM 3 July 24, 2014 08:14
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 15:55


All times are GMT -4. The time now is 14:51.