I would like to use residuals
I would like to use residuals to observe the convergence behaviour of the SIMPLE segregated solver.
A measure for the residual R in finitevolume method nomenclature is: Single cell: R_P = a_P * u_P + \sum_nb a_nb * u_nb  b_P R = \sum_cells R_P Can the methods .A() and .H() be used for the calculation of R ? For example for the velocities from the momentum equation in a fashion like this: volVectorField b = 1.*fvc::grad(pd)+fvc::grad(rho)*gh; vector R = (sum(UEqn().A()*U)).value()(sum(UEqn().H())).value()(sum(b)).value(); Info <<mag(R.x())<< " "<<mag(R.y()))<< " "<< mag(R.z())<<endl; I know, the magnitude should be taken of R_P not of R like in the above equations. How to formulate this correctly ? Juergen 
The solver returns a solverPer
The solver returns a solverPerformance class which may have everything you need:
// Class returned by the solver // containing performance statistics class solverPerformance { word solverName_; word fieldName_; scalar initialResidual_; scalar finalResidual_; label noIterations_; bool converged_; bool singular_; ... which you can get access to simply be keeping it after solution e.g. lduMatrix::solverPerformance sp = solve(... or lduMatrix::solverPerformance sp = xEqn.solve(); then you can use the access functions to get hold of the residuals etc. e.g. sp.initialResidual() 
Hi
Can somebody please tel
Hi
Can somebody please tell me how the residuals (initial and final) are defined and where I can find the definition! Thanks! 
Me too.
Me too.

For matrix
A x = b,
resi
For matrix
A x = b, residual is defined as res = b  Ax We then apply residual scaling with the following normalisation factor procedure: Type xRef = gAverage(x); wA = A x; pA = A xRef; normFactor = gSum(cmptMag(wA  pA) + cmptMag(source  pA)) + matrix.small_; and the scaled residual is: residual = gSum(cmptMag(source  wA))/normFactor; I will save you from complications with vectors and tensors in my block solver. :) Enjoy, Hrv 
Thanks Dr. Jasak
but it is
Thanks Dr. Jasak
but it is not clear to me what is: 1. gAverage What means the g? 2. gSum What means the g 3. matrix.small_ 4. is source Best regards jens 
1. gAverage is like average, b
1. gAverage is like average, but if you're running in parallel, you do average over all processors
2. gSum is like sum, but if in parallel you sum up over all processors 3. matrix.small: lduMatrix.C const scalar lduMatrix::small_ = 1.0e20; 4. source is b Have a look at the code, always instructive :) Hrv 
hello
I need to compare the r
hello
I need to compare the residual of an analytical solution with the residual of the solution computed by simpleFoam after one iteration. actually, i need rA (=sourcewA) in each cell. the solverperformance returned in BIccG.C,are average of the residual in the domain but in my case, I would like to create a vectorField R where the scalarField Rx=R.x() is the residuals computed when soving Ux, R.y() corresponds to Uy and R.z() corresponds to Uz. My problem is that I am not able to access to the different step (solve ux, solve uy and solve Uz) in "solve UEqn" Thanks for your help! Aurelia 
Hi all and sorry for posting i
Hi all and sorry for posting in this old thread but I found it very inherent with what I'm searching.
Quote from Jasak's post:  For matrix A x = b, residual is defined as res = b  Ax We then apply residual scaling with the following normalisation factor procedure: Type xRef = gAverage(x); wA = A x; pA = A xRef; normFactor = gSum(cmptMag(wA  pA) + cmptMag(source  pA)) + matrix.small_; and the scaled residual is: residual = gSum(cmptMag(source  wA))/normFactor;  I got this problem: InitialResidual goes very low (10e7 and more) after few iteration when x gets very high values only in a small zone of domain (like turbulent specific dissipation [omega] at the wall) meaning that xRef is almost as big as xMax (most of the domain is basically not contributing) very different from the "mean" value. (Hope I have been clear enough) It follows that pA differs a lot from wA and finally the normalization factor is too big. My idea is so to do something like: residual = gSum(cmptMag((source  wA)/wA)) I have no need to change directly lduMatrix::solverPerformance.initialResidual() I just want to use this variable to monitor convergence properties but I'm not sure if I have undersood correctly how the following methods and classes work: 1) Let xEqn be a fvScalarMatrix then volScalarField xEqn.residuals() = source  wA (without scaling) 2) lduMatrix::solverPerformance sp = xEqn().solve() scalar sp.initialResidual() = gSum(cmptMag(source  wA))/normFactor (with normFactor like in Jasak's post) 3) errorEstimate<scalar> eE(x_,x_.dimensions(),xEqn().residuals(),x.interna lField()); eE.error()= gSum(cmptMag(source  wA)/cmptMag(wA)) Is it true? I'm in the need for sharing my thoughts to be sure not have misunderstood everything. Thanks a lot for comment on these. Best Regards Cosimo 
(1) In Ferziger and Peric book
(1) In Ferziger and Peric book,
they say that sometimes the residuals can be small even when the error is large and that this is even worse for poorly conditioned matrix. How does the poorly conditioning cause that? (2) In case we choose our residual criterion based on Tol, is such argument valid here. I ask because in the documention it was mentioned that the objective of normalization is to make the residuals independent of problem scale (not to condition the matrix). (3) They recommend that we should use residual drop to be 12 order of magnitude for inner iterations (that is the pressure equation) and 35 for outer iterations (that would be the difference between the initial residual in pressure correction 1 compared to its value at pressure correction n). What do you think? Any experience with that. Thanks. Best regards, Maka. 
Dear All,
Is it possible to
Dear All,
Is it possible to access the residuals from the turbulence model object? I've rewritten (just for fun) simpleFoam to use a do...while loop which exits when the p and U residuals drop below specified values. I would like to be able to monitor the solution of the k and epsilon equations, but can't see how to do this (other than rewriting the whole of RASmodels). Gavin 
"checkConvergence()" for fvVectorMatrix??
Hi!
I would like to check "UEqn" convergence inside an internal loop of my own solver. [...] > I fixed it! I missed that UEqn was defined as a tmp! Now it works fine. tmp<fvVectorMatrix> UEqn ( fvm::div(phi, U)  fvm::Sp(fvc::div(phi), U) + turbulence> divRhoR(U) ); lduMatrix::solverPerformance spU = UEqn().solve(); > For more info about checking convergence have a look at: ~/OpenFOAM/OpenFOAM1.5dev/applications/solvers/compressible/rhoSimpleFoam :) 
All times are GMT 4. The time now is 09:22. 