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 Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 2, 2021, 21:42
Default Calculate surfaceScalarField in parallel (boundary processor)
  #1
Member
 
Federico Zabaleta
Join Date: May 2016
Posts: 38
Rep Power: 7
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, 1 views)
fedez91 is offline   Reply With Quote

Old   October 2, 2021, 23:39
Default
  #2
Member
 
Federico Zabaleta
Join Date: May 2016
Posts: 38
Rep Power: 7
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;}
    }
}
fedez91 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
Boundary condition problem (Freestream) KAYANO OpenFOAM Running, Solving & CFD 5 June 1, 2021 06:57
foam-extend_3.1 decompose and pyfoam warning shipman OpenFOAM 3 July 24, 2014 09:14
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 07:28
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 08:00
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 16:55


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