CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Understanding matrix_.Amul(..) in PCG.C

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 26, 2009, 11:37
Default Understanding matrix_.Amul(..) in PCG.C
  #1
New Member
 
Michael Wurst
Join Date: Mar 2009
Location: Munich, Germany
Posts: 6
Rep Power: 8
michi is on a distinguished road
Hallo everybody!

I am trying to understand the implementation of the linear solvers, for example the PCG solver. Most iterative methods have a matrix-vector multiplication which is performed in OpenFOAM by

matrix_.Amul(result, psi, interfaceBouCoeffs_, interfaces_, cmpt);

If we then have a further look in the implementation of Amul the following design can be found:
1. initMatrixInterfaces
(
interfaceBouCoeffs,
interfaces,
psi,
result,
cmpt
);
2. Do the calculation: result = A*psi

3. updateMatrixInterfaces
(
interfaceIntCoeffs,
interfaces,
psi,
result,
cmpt
);

I tried now to unterstand steps 1 and 3. As far as I see, steps 1 and 3 belong to some kind of correction of the final result. For example, if a case runs in parallel we have to transport some values of psi from one processor to the other. That are the values(cells) of psi which are close to the processor boundary. My question is now:
What exactly is the task of initMatrixInterfaces(....) and updateMatrixInterfaces(....)? Why is this correction of the result vector split into two steps and not just performed in one step?

It would be great if someone could help me!
Michael
michi is offline   Reply With Quote

Old   June 1, 2011, 10:52
Default
  #2
Member
 
Lukasz Miroslaw
Join Date: Dec 2009
Location: Poland
Posts: 64
Rep Power: 7
Lukasz is on a distinguished road
Send a message via Skype™ to Lukasz
Michael,

Have you received the answer for this question? I know OF uses zero halo layer approach but still have to figure out how does it refers to updatematrixinterfaces().

Let me know if you know the answer.

Thanks,
Lukasz
Lukasz is offline   Reply With Quote

Old   June 1, 2011, 14:26
Default
  #3
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
I haven't delved too deeply into this, but I'm pretty sure these interfaces are used only for boundary conditions that contribute to off-diagonal matrix terms - cyclic, processor, possibly GGI (?). The regular boundary conditions are absorbed into the diagonal and source term of the matrix before calling an ldu solver... but the off-diagonal ones cannot be, as different ldu solvers handle them differently. Ultimately, that is why boundary coefficients and interfaces are given to the solver.

I'm guessing the Amul function is one of the ldu solver's methods for handling these off-diagonal contributions.
marupio is offline   Reply With Quote

Old   August 27, 2013, 04:14
Default
  #4
New Member
 
Amin
Join Date: Dec 2012
Posts: 2
Rep Power: 0
Amiin is on a distinguished road
Hope to find my answer in this old thread!

My question is about the second part. (result = A*psi)
I know that OpenFOAM uses LDU method (lower, upper and diagonal) to store a matrix.
Is it a simple matrix multiplication as I show below?
[ApsiPtr](vector) = [lowerPtr + upperPtr + diagPtr](matrix) * [psiPtr](vector)

It seems a little bit different!
//Quote from lduMatrixATmul.C in OpenFOAM 2.2.0
for (register label cell=0; cell<nCells; cell++)
{
ApsiPtr[cell] = diagPtr[cell]*psiPtr[cell];
}

for (register label face=0; face<nFaces; face++)
{
ApsiPtr[uPtr[face]] += lowerPtr[face]*psiPtr[lPtr[face]];
ApsiPtr[lPtr[face]] += upperPtr[face]*psiPtr[uPtr[face]];
}

Best regards,

Amin
Amiin is offline   Reply With Quote

Old   September 23, 2013, 10:47
Default
  #5
Member
 
Hassan
Join Date: Oct 2012
Location: Iran
Posts: 62
Rep Power: 4
luckycfd is on a distinguished road
Hi,
Dear Amiin;
Are you find your question?
Is the second part(result = A*psi) refers to the matrix multiplication?

Regards,
Hassan
luckycfd is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing the motionU matrix in OF ver 14 philippose OpenFOAM Running, Solving & CFD 2 April 16, 2007 18:16
Matrix solver Yang Main CFD Forum 5 May 13, 2006 22:20
convective stiffness matrix for FEM Juergen Kertz Main CFD Forum 5 December 23, 2005 06:55
A question about matrix eigenvalues. Demidov Main CFD Forum 0 November 14, 2004 05:51
Elemtary matrix to CSR global matrix xueying Main CFD Forum 2 September 24, 2002 09:44


All times are GMT -4. The time now is 23:55.