CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   FvVectorMatrixresidual before solving (https://www.cfd-online.com/Forums/openfoam-solving/59850-fvvectormatrixresidual-before-solving.html)

cosimobianchini January 28, 2007 11:02

Hi all, I need to check conv
 
Hi all,
I need to check convergence behavior of my calculations using root-mean-square residuals.

What I need is to calculate residuals before (and after) solving the fvMatrix.

fvVectorMatrix UEqn
(
fvm::div(phi, U)
// - fvm::Sp(fvc::div(phi), U)
+ turbulence->divRhoR(U)
== -fvc::grad(p)
);

UEqn.relax();

vectorField U_residual = UEqn.residual();

scalarField u_residual = U_residual.component(0);

Info << " Normalized Initial U L2 Residuals : " <<
Foam::sqrt(sum(sqr(u_residual*massIn/uin))) << endl;

UEqn.solve();

U_residual = UEqn.residual();

Info << " Normalized Initial U L2 Residuals : " <<
Foam::sqrt(sum(sqr(u_residual*massIn/uin))) << endl;

-------

This structure works fine for fvScalarMatrix such as hentalpy,omega,k but fails in case of fvVectorMatrix: solution varies in case I calculate residuals before solving or not.
Is there anyone that ever notice such a behavior?

To my knowledge residual calculation does not change the matrix and so the solution.

I looked up in the fvMatrixsolve.H at the implementation of the member residual and it doesn't seem (I have to tell that I'm not a master in reading FOAM yet) to modify the fvVectorMatrix.

Is fvVectorMatrix.residual() influencing somehow the coefficients, is it just a bug or am I getting mad?

I hope I have been clear enough to be understood.
Thanks a lot for your answers
Cosimo


All times are GMT -4. The time now is 20:42.