40 namespace MultiRegions
51 const boost::weak_ptr<ExpList> &pExpList,
52 const boost::shared_ptr<AssemblyMap>
58 m_useProjection(false),
62 = pExpList.lock()->GetSession();
64 m_tolerance = pLocToGloMap->GetIterativeTolerance();
67 m_root = (vComm->GetRank())?
false :
true;
68 m_verbose = (vSession->DefinesCmdLineArgument(
"verbose"))?
true :
false;
72 if((successiveRHS = pLocToGloMap->GetSuccessiveRHS()))
93 const Array<OneD,const NekDouble> &pInput,
94 Array<OneD, NekDouble> &pOutput,
118 const Array<OneD,const NekDouble> &pInput,
119 Array<OneD, NekDouble> &pOutput,
125 =
m_expList.lock()->GetComm()->GetRowComm();
128 int nNonDir = nGlobal - nDir;
129 Array<OneD, NekDouble> tmp;
156 Array<OneD, NekDouble> tmp = pOutput+nDir;
162 Array<OneD, NekDouble> px_s (nGlobal, 0.0);
163 Array<OneD, NekDouble> pb_s (nGlobal, 0.0);
164 Array<OneD, NekDouble> tmpAx_s (nGlobal, 0.0);
165 Array<OneD, NekDouble> tmpx_s (nGlobal, 0.0);
177 Array<OneD, NekDouble> alpha (
m_prevLinSol.size(), 0.0);
200 pInput.get() + nDir, 1,
201 pb_s.get() + nDir, 1);
227 const Array<OneD,const NekDouble> &in,
232 =
m_expList.lock()->GetComm()->GetRowComm();
235 int nNonDir = nGlobal - nDir;
238 Array<OneD, NekDouble> tmpAx_s (nGlobal, 0.0);
247 return std::sqrt(anorm_sq);
256 const Array<OneD,const NekDouble> &newX,
260 int nNonDir = nGlobal - nDir;
264 =
m_expList.lock()->GetComm()->GetRowComm();
280 Array<OneD, NekDouble> tmpAx_s (nGlobal, 0.0);
281 Array<OneD, NekDouble> px_s (nGlobal, 0.0);
282 Array<OneD, NekDouble> tmp1, tmp2;
292 tmp1 = newX + nDir, 1,
293 tmp2 = px_s + nDir, 1);
300 Array<OneD, NekDouble> alpha (
m_prevLinSol.size(), 0.0);
333 Vmath::Smul(nNonDir, 1.0/anorm, px_s.get() + nDir, 1, px_s.get() + nDir, 1);
357 const Array<OneD,const NekDouble> &pInput,
358 Array<OneD, NekDouble> &pOutput,
365 = plocToGloMap->GetPreconType();
366 std::string PreconType
376 =
m_expList.lock()->GetComm()->GetRowComm();
379 int nNonDir = nGlobal - nDir;
382 Array<OneD, NekDouble> w_A (nGlobal, 0.0);
383 Array<OneD, NekDouble> s_A (nGlobal, 0.0);
384 Array<OneD, NekDouble> p_A (nNonDir, 0.0);
385 Array<OneD, NekDouble> r_A (nNonDir, 0.0);
386 Array<OneD, NekDouble> q_A (nNonDir, 0.0);
387 Array<OneD, NekDouble> tmp;
399 NekDouble alpha, beta, rho, rho_new, mu, eps, min_resid;
400 Array<OneD, NekDouble> vExchange(3,0.0);
432 <<
" (error = " << sqrt(eps/m_rhs_magnitude) <<
")" << endl;
439 m_precon->DoPreconditioner(r_A, tmp = w_A + nDir);
467 "Exceeded maximum number of iterations (5000)");
470 Vmath::Svtvp(nNonDir, beta, &p_A[0], 1, &w_A[nDir], 1, &p_A[0], 1);
471 Vmath::Svtvp(nNonDir, beta, &q_A[0], 1, &s_A[nDir], 1, &q_A[0], 1);
474 Vmath::Svtvp(nNonDir, alpha, &p_A[0], 1, &pOutput[nDir], 1, &pOutput[nDir], 1);
477 Vmath::Svtvp(nNonDir, -alpha, &q_A[0], 1, &r_A[0], 1, &r_A[0], 1);
480 m_precon->DoPreconditioner(r_A, tmp = w_A + nDir);
505 rho_new = vExchange[0];
517 <<
" (error = " << sqrt(eps/m_rhs_magnitude) <<
")"
524 min_resid = min(min_resid, eps);
528 alpha = rho_new/(mu - rho_new*beta/alpha);
537 Array<OneD, NekDouble> vExchange(1);