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

Transition of Gauss-Seidel method to Jacobi method

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By iordtila

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 22, 2020, 22:34
Default Transition of Gauss-Seidel method to Jacobi method
  #1
New Member
 
Iordanis
Join Date: Apr 2020
Posts: 2
Rep Power: 0
iordtila is on a distinguished road
I am currently writing my thesis in accelerating the Gauss-Seidel smoother of the OpenFoam project. I have trouble understanding the OpenFoam implementation of the Gauss-Seidel method. The exact part I need to change is

Code:
double psii;
    int fStart;
    int fEnd = ownStartPtr[0];

    for (int celli=0; celli<nCells; celli++)
    {

        fStart = fEnd;
        fEnd = ownStartPtr[celli + 1];


        psii = bPrimePtr[celli];


        for (int facei=fStart; facei<fEnd; facei++)
        {
            psii -= upperPtr[facei]*psiPtr[uPtr[facei]];
        }


        psii /= diagPtr[celli];


        for (int facei=fStart; facei<fEnd; facei++)
        {
            bPrimePtr[uPtr[facei]] -= lowerPtr[facei]*psii;
        }

        psiPtr[celli] = psii;
    }
}
How can I change this part to the Jacobi method?
HPE likes this.
iordtila is offline   Reply With Quote

Old   April 24, 2020, 08:34
Default
  #2
Senior Member
 
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 219
Rep Power: 18
tas38 is on a distinguished road
Quote:
Originally Posted by iordtila View Post
I am currently writing my thesis in accelerating the Gauss-Seidel smoother of the OpenFoam project. I have trouble understanding the OpenFoam implementation of the Gauss-Seidel method. The exact part I need to change is

Code:
double psii;
    int fStart;
    int fEnd = ownStartPtr[0];

    for (int celli=0; celli<nCells; celli++)
    {

        fStart = fEnd;
        fEnd = ownStartPtr[celli + 1];


        psii = bPrimePtr[celli];


        for (int facei=fStart; facei<fEnd; facei++)
        {
            psii -= upperPtr[facei]*psiPtr[uPtr[facei]];
        }


        psii /= diagPtr[celli];


        for (int facei=fStart; facei<fEnd; facei++)
        {
            bPrimePtr[uPtr[facei]] -= lowerPtr[facei]*psii;
        }

        psiPtr[celli] = psii;
    }
}
How can I change this part to the Jacobi method?
I think something like the following

Code:
double psii;
    int fStart;
    int fEnd = ownStartPtr[0];

    for (int celli=0; celli<nCells; celli++)
    {

        fStart = fEnd;
        fEnd = ownStartPtr[celli + 1];


        psii = bPrimePtr[celli];


        for (int facei=fStart; facei<fEnd; facei++)
        {
            psii -= upperPtr[facei]*psiPtr[uPtr[facei]];
            psii -= lowerPtr[facei]*psiPtr[lPtr[facei]];
        }

        psii /= diagPtr[celli];

        psiPtr[celli] = psii;
    }
}
where you have added something like...

Code:
const label* const __restrict__ lPtr =
         matrix_.lduAddr().lowerAddr().begin();
to the member function definition
tas38 is offline   Reply With Quote

Old   April 27, 2020, 09:07
Default
  #3
New Member
 
Iordanis
Join Date: Apr 2020
Posts: 2
Rep Power: 0
iordtila is on a distinguished road
Quote:
Originally Posted by tas38 View Post
I think something like the following

Code:
double psii;
    int fStart;
    int fEnd = ownStartPtr[0];

    for (int celli=0; celli<nCells; celli++)
    {

        fStart = fEnd;
        fEnd = ownStartPtr[celli + 1];


        psii = bPrimePtr[celli];


        for (int facei=fStart; facei<fEnd; facei++)
        {
            psii -= upperPtr[facei]*psiPtr[uPtr[facei]];
            psii -= lowerPtr[facei]*psiPtr[lPtr[facei]];
        }

        psii /= diagPtr[celli];

        psiPtr[celli] = psii;
    }
}
where you have added something like...

Code:
const label* const __restrict__ lPtr =
         matrix_.lduAddr().lowerAddr().begin();
to the member function definition



using potentialFoam it takes way too much time for an output (100 times more than gauss seidel method) and using simpleFoam I get a Floating point excepton... I tried updating the bPrimePtr[ ] as well the same way with:
Code:
for (int facei=fStart; facei<fEnd; facei++)
{
bPrimePtr[uPtr[facei]] -= psii;
}
but I keep getting Floating point exception in potentialFoam too now.

Thank you for helping if you have any more ideas I'd appreciate it!
iordtila is offline   Reply With Quote

Reply

Tags
gauss-seidel, jacobi, openfoam 7


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
icoFoam Courant number growth problem tdof OpenFOAM Running, Solving & CFD 12 May 24, 2023 14:00
Suppress twoPhaseEulerFoam energy AlmostSurelyRob OpenFOAM Running, Solving & CFD 33 September 25, 2018 17:45
BC for turbulent internal flow yhoarau OpenFOAM Running, Solving & CFD 3 January 22, 2015 08:02
Where can I get a free software with e^N method for transition prediction? peter.zhao Main CFD Forum 4 January 4, 2010 09:28
Water pump OpenFOAM 15 ANSYS CFX 110 comparation waynezw0618 OpenFOAM Running, Solving & CFD 39 March 5, 2009 12:57


All times are GMT -4. The time now is 16:30.