lduMatrixTests.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "lduMatrix.H"
00031
00032
00033
00034 bool Foam::lduMatrix::solverPerformance::checkConvergence
00035 (
00036 const scalar Tolerance,
00037 const scalar RelTolerance
00038 )
00039 {
00040 if (debug >= 2)
00041 {
00042 Info<< solverName_
00043 << ": Iteration " << noIterations_
00044 << " residual = " << finalResidual_
00045 << endl;
00046 }
00047
00048 if
00049 (
00050 finalResidual_ < Tolerance
00051 || (
00052 RelTolerance > SMALL
00053 && finalResidual_ <= RelTolerance*initialResidual_
00054 )
00055
00056 )
00057 {
00058 converged_ = true;
00059 }
00060 else
00061 {
00062 converged_ = false;
00063 }
00064
00065 return converged_;
00066 }
00067
00068
00069 bool Foam::lduMatrix::solverPerformance::checkSingularity
00070 (
00071 const scalar residual
00072 )
00073 {
00074 if (residual > VSMALL)
00075 {
00076 singular_ = false;
00077 }
00078 else
00079 {
00080 singular_ = true;
00081 }
00082
00083 return singular_;
00084 }
00085
00086
00087 void Foam::lduMatrix::solverPerformance::print() const
00088 {
00089 if (debug)
00090 {
00091 Info<< solverName_ << ": Solving for " << fieldName_;
00092
00093 if (singular())
00094 {
00095 Info<< ": solution singularity" << endl;
00096 }
00097 else
00098 {
00099 Info<< ", Initial residual = " << initialResidual_
00100 << ", Final residual = " << finalResidual_
00101 << ", No Iterations " << noIterations_
00102 << endl;
00103 }
00104 }
00105 }
00106
00107
00108
Copyright © 2000-2009 OpenCFD Ltd