CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Problem with ldumatrix solver (https://www.cfd-online.com/Forums/openfoam-programming-development/128128-problem-ldumatrix-solver.html)

yfjok22 January 4, 2014 07:42

Problem with ldumatrix solver
 
Hello, friends, I'm now dealing with linear iterative solvers in Openfoam. After several days' code reading, I have got a small problem in ldumatrix solver.
I'm now reading the code of Preconditional CG method(PCG.C in Openfoam), and nearly have got through most of it. But there still exists a small problem in this part

// --- Calculate normalisation factor
scalar normFactor = this->normFactor(psi, source, wA, pA);

if (lduMatrix::debug >= 2)
{
Info<< " Normalisation factor = " << normFactor << endl;
}

// --- Calculate normalised residual norm
solverPerf.initialResidual() = gSumMag(rA)/normFactor;
solverPerf.finalResidual() = solverPerf.initialResidual();

I'm really curious with the normFactor part, which is defined in lduMatrixSolver.C

Foam::scalar Foam::lduMatrix::solver::normFactor
(
const scalarField& psi,
const scalarField& source,
const scalarField& Apsi,
scalarField& tmpField
) const
{
// --- Calculate A dot reference value of psi
matrix_.sumA(tmpField, interfaceBouCoeffs_, interfaces_);
tmpField *= gAverage(psi);

return
gSum(mag(Apsi - tmpField) + mag(source - tmpField))
+ solverPerformance::small_;


In this function, it seems to return |Ax-p|+|b-p|+Ɛ, which I can't find any relation with the definition of normalisation. In the comment, it says that the code wants to build up the normalised residual norm, but it should be rA/|rA|, so what does it mean in this part of code. Please help me figure out this problem.

Thank you for your time and regard
Frank Yu

yfjok22 January 5, 2014 23:48

Could anybody help me with this problem


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