Commit 7047e194 authored by Pavel Burovskiy's avatar Pavel Burovskiy
Browse files

Changing NekVector to Svtvp in Conjugate Gradient

parent 6e95fa08
///////////////////////////////////////////////////////////////////////////////
//
// File GlobalLinSysIterative.cpp
// File: GlobalLinSysIterative.cpp
//
// For more information, please see: http://www.nektar.info
//
......@@ -489,14 +489,18 @@ namespace Nektar
"Exceeded maximum number of iterations (5000)");
// Compute new search direction p_k, q_k
p = w + beta * p;
q = s + beta * q;
//p = w + beta * p;
//q = s + beta * q;
Vmath::Svtvp(nNonDir, beta, &p_A[0], 1, &w_A[nDir], 1, &p_A[0], 1);
Vmath::Svtvp(nNonDir, beta, &q_A[0], 1, &s_A[nDir], 1, &q_A[0], 1);
// Update solution x_{k+1}
out = out + alpha * p;
//out = out + alpha * p;
Vmath::Svtvp(nNonDir, alpha, &p_A[0], 1, &pOutput[nDir], 1, &pOutput[nDir], 1);
// Update residual vector r_{k+1}
r = r - alpha * q;
//r = r - alpha * q;
Vmath::Svtvp(nNonDir, -alpha, &q_A[0], 1, &r_A[0], 1, &r_A[0], 1);
// Apply preconditioner
m_precon->DoPreconditioner(r_A, tmp = w_A + nDir);
......@@ -557,10 +561,10 @@ namespace Nektar
void GlobalLinSysIterative::Set_Rhs_Magnitude(const NekVector<NekDouble> &pIn)
{
Array<OneD, NekDouble> vExchange(1);
Array<OneD, NekDouble> vExchange(1);
vExchange[0] = Vmath::Dot(pIn.GetDimension(),&pIn[0],&pIn[0]);
m_expList.lock()->GetComm()->GetRowComm()->AllReduce(vExchange, Nektar::LibUtilities::ReduceSum);
m_rhs_magnitude = (vExchange[0] > 1e-6)? vExchange[0]:1.0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment