136 #ifdef DEBUG_ITERATIVE
137 std::cout <<
" BiCGStab New Step " <<std::endl;
166 dErrFactor *= dErr/dOldErr;
170 #ifdef DEBUG_ITERATIVE
171 std::cerr <<
"dErr " << dErr << std::endl;
176 if (!bParallel || MBDynComm.Get_rank() == 0)
179 silent_cout(
"\tIteration(" << iIterCnt <<
") " << dErr);
183 silent_cout(std::endl);
192 if (!std::isfinite(dErr)) {
195 if (iIterCnt >= std::abs(iMaxIter)) {
196 if (iMaxIter < 0 && dErrFactor < 1.) {
204 rateo = dErr*dErr/Fnorm;
212 DEBUGCOUT(
"Using BiCGStab iterative solver" << std::endl);
222 #ifdef DEBUG_ITERATIVE
223 std::cerr <<
"LocTol " << LocTol << std::endl;
241 silent_cout(
"NewtonRaphsonSolver: "
242 "rebuilding matrix..."
257 #ifdef DEBUG_ITERATIVE
258 std::cerr <<
"Jacobian " << std::endl;
263 #ifdef DEBUG_ITERATIVE
264 std::cerr <<
"rho_1 " << rho_1 << std::endl;
268 while ((resid > LocTol) && (It++ <
MaxLinIt)) {
274 #ifdef DEBUG_ITERATIVE
275 std::cerr <<
"rho_1 " << rho_1 << std::endl;
278 if (
fabs(rho_1) < std::numeric_limits<doublereal>::epsilon()) {
279 silent_cout(
"Bi-CGStab Iterative "
285 beta = (rho_1/rho_2) * (alpha/omega);
287 #ifdef DEBUG_ITERATIVE
288 std::cerr <<
"beta " << beta << std::endl;
299 #ifdef DEBUG_ITERATIVE
300 std::cout <<
"v:" << std::endl;
301 for (
int iTmpCnt = 1; iTmpCnt <=
Size; iTmpCnt++) {
302 std::cout <<
"Dof" << std::setw(4) << iTmpCnt <<
": "
303 <<
v(iTmpCnt) << std::endl;
308 alpha = rho_1 / alpha;
310 #ifdef DEBUG_ITERATIVE
311 std::cerr <<
"alpha " << alpha << std::endl;
316 #ifdef DEBUG_ITERATIVE
317 std::cerr <<
"s.Norm() " <<
s.
Norm() << std::endl;
320 if ((resid =
s.
Norm()) < LocTol) {
333 #ifdef DEBUG_ITERATIVE
334 std::cerr <<
"omega " << omega << std::endl;
343 #ifdef DEBUG_ITERATIVE
344 std::cerr <<
"resid " << resid << std::endl;
348 if (
fabs(omega) < std::numeric_limits<doublereal>::epsilon()) {
349 silent_cout(
"Bi-CGStab Iterative Solver "
350 "breakdown omega = 0 " << std::endl);
354 silent_cerr(
"Iterative inner solver didn't "
355 "converge. Continuing..."
368 if ((etaBis =
gamma*eta*eta) > .1) {
369 etaNew = (etaNew > etaBis) ? etaNew : etaBis;
373 etaBis = .5*Tol/dErr;
374 eta = (eta > etaBis) ? eta : etaBis;
376 #ifdef DEBUG_ITERATIVE
377 std::cerr <<
"eta " << eta << std::endl;
389 if (!bParallel || MBDynComm.Get_rank() == 0)
392 silent_cout(
"\t\tSolErr " << dSolErr
virtual void Reset(void)=0
virtual VectorHandler * pResHdl(void) const =0
virtual SolutionManager * pGetSolutionManager(void) const
virtual void Jacobian(MatrixHandler *pJac) const =0
bool outputIters(void) const
#define MBDYN_EXCEPT_ARGS
bool outputBailout(void) const
virtual bool MakeSolTest(Solver *pS, const VectorHandler &Vec, const doublereal &dTol, doublereal &dTest)
virtual void PrintResidual(const VectorHandler &Res, integer iIterCnt) const
virtual bool MakeResTest(Solver *pS, const NonlinearProblem *pNLP, const VectorHandler &Vec, const doublereal &dTol, doublereal &dTest, doublereal &dTestDiff)
virtual void CheckTimeStepLimit(doublereal dErr, doublereal dErrDiff) const
virtual void Solve(const NonlinearProblem *NLP, Solver *pS, const integer iMaxIter, const doublereal &Tol, integer &iIterCnt, doublereal &dErr, const doublereal &SolTol, doublereal &dSolErr)
virtual doublereal InnerProd(const VectorHandler &VH) const
virtual VectorHandler & ScalarAddMul(const VectorHandler &VH, const VectorHandler &VH1, const doublereal &d)
bool outputRes(void) const
virtual void Residual(VectorHandler *pRes) const =0
virtual integer iGetSize(void) const =0
virtual doublereal Norm(void) const
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
BiCGStab(const Preconditioner::PrecondType PType, const integer iPStep, doublereal ITol, integer MaxIt, doublereal etaMx, doublereal T, const NonlinearSolverOptions &options)
virtual void Resize(integer iSize)
int mbdyn_stop_at_end_of_iteration(void)
bool outputSol(void) const
const NonlinearProblem * pPrevNLP
virtual void EvalProd(doublereal Tau, const VectorHandler &f0, const VectorHandler &w, VectorHandler &z) const =0
virtual MatrixHandler * pMatHdl(void) const =0
virtual void MatrReset(void)=0
#define ASSERT(expression)
virtual void Precond(VectorHandler &b, VectorHandler &x, SolutionManager *pSM) const =0
virtual void MatrInitialize(void)
virtual VectorHandler & ScalarAddMul(const VectorHandler &VH, const doublereal &d)
virtual void PrintSolution(const VectorHandler &Sol, integer iIterCnt) const
virtual void Update(const VectorHandler *pSol) const =0