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

ldUMatrix building indexing in parallel

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 16, 2019, 01:19
Unhappy ldUMatrix building indexing in parallel
  #1
Member
 
Join Date: Oct 2013
Posts: 92
Rep Power: 13
fedvasu is on a distinguished road
Hi Foamers,

I am using a simple internal faces only scheme for smoothing, I can do this just fine in serial.

Basically I am by hand setting coefficients of the matrices.

my system is Gx=W, I have verified that this is exactly what I need.

Code:
    fvScalarMatrix W(fvm::Sp(rho,rhoNew)); //my rhs matrix
    fvScalarMatrix G(fvm::Sp(rho,rhoNew)); //lhs matrix


    W.diag() = rho.primitiveField();

    const labelUList& owner = mesh.owner(); //internal faces 
    const labelUList& neighbour = mesh.neighbour(); // internal faces neighbour

    forAll(owner,facei)
    {
        G.upper()[facei] += (-alpha*(rho[owner[facei]] + rho[neighbour[facei]])/2); // r[facei] = (r[owner] + r[neighbour]) /2;
    }

    G.negSumDiag();
    G.source() += W.diag()*rho.primitiveField(); //rhs 

    G.relax();
    G.solve();
I would like to know how to handle special procBoundary "boundary patches", how should I index my G and W
fedvasu is offline   Reply With Quote

Old   April 25, 2019, 01:45
Default
  #2
Member
 
Join Date: Oct 2013
Posts: 92
Rep Power: 13
fedvasu is on a distinguished road
Quote:
Originally Posted by fedvasu View Post
Hi Foamers,

I am using a simple internal faces only scheme for smoothing, I can do this just fine in serial.

Basically I am by hand setting coefficients of the matrices.

my system is Gx=W, I have verified that this is exactly what I need.

Code:
    fvScalarMatrix W(fvm::Sp(rho,rhoNew)); //my rhs matrix
    fvScalarMatrix G(fvm::Sp(rho,rhoNew)); //lhs matrix


    W.diag() = rho.primitiveField();

    const labelUList& owner = mesh.owner(); //internal faces 
    const labelUList& neighbour = mesh.neighbour(); // internal faces neighbour

    forAll(owner,facei)
    {
        G.upper()[facei] += (-alpha*(rho[owner[facei]] + rho[neighbour[facei]])/2); // r[facei] = (r[owner] + r[neighbour]) /2;
    }

    G.negSumDiag();
    G.source() += W.diag()*rho.primitiveField(); //rhs 

    G.relax();
    G.solve();
I would like to know how to handle special procBoundary "boundary patches", how should I index my G and W

This took 4-5 days for me to actually figure out, but this book is quite helpful
https://www.springer.com/us/book/9783319168739

Code:
    fvScalarMatrix W(fvm::Sp(rho,rhoNew)); //my rhs matrix
    fvScalarMatrix G(fvm::Sp(rho,rhoNew)); //lhs matrix


    W.diag() = rho.primitiveField();

    const labelUList& owner = mesh.owner(); //internal faces 
    const labelUList& neighbour = mesh.neighbour(); // internal faces neighbour

   //this instead of doing the main loop by hand
   surfaceScalarField rhoS("rhoS",fvc::interpolate(rho,"midPoint"));
    A.upper() = -alphaS*rhoS;
    A.negSumDiag();
  


    G.diag() = A.diag() + W.diag();
    G.upper() = A.upper();

    //works
    G.source() = W.diag()*sfield.primitiveField();

    //this is how you handle parallelism using boundaryCoeffs and internallCoeffs on processor patches
    forAll(mesh_.boundary(), patchi)
    {
        const polyPatch &ppatch = mesh_.boundaryMesh()[patchi];

        if (isA<processorPolyPatch>(ppatch))
        {
            auto rhoSBf = rhoS.boundaryFieldRef()[patchi];
            G.internalCoeffs()[patchi] = alphaS*rhoSBf;
            G.boundaryCoeffs()[patchi] = alphaS*rhoSBf;
        }
    }

    G.relax();
    G.solve();
This specific issue is solved for me.

Last edited by fedvasu; April 28, 2019 at 23:15.
fedvasu is offline   Reply With Quote

Old   April 28, 2019, 15:20
Default
  #3
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 798
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
Thanks for sharing.
Domenico Lahaye.
dlahaye is offline   Reply With Quote

Reply

Tags
lduaddressing, ldumatrix, parallel, processor boundary


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
simpleFoam parallel AndrewMortimer OpenFOAM Running, Solving & CFD 12 August 7, 2015 19:45
Any Parallel install procedure on Mac OS JinZhiyi SU2 Installation 2 March 11, 2014 02:12
simpleFoam in parallel issue plucas OpenFOAM Running, Solving & CFD 3 July 17, 2013 12:30
Paraview Compiling Error (OpenFOAM 2.1.x + openSUSE 12.2) sfigato OpenFOAM Installation 22 January 31, 2013 11:16
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 02:40.