Commit 72805b03 authored by Spencer Sherwin's avatar Spencer Sherwin
Browse files

Updated the setting of m_rhs_magnitude and modified LowEnergy method option

parent 68ea848c
......@@ -890,6 +890,32 @@ namespace Nektar
}
Vmath::Vcopy(m_numGlobalBndCoeffs-offset, tmp.get()+offset, 1, global.get(), 1);
}
void AssemblyMap::LocalBndToGlobal(
const NekVector<NekDouble>& loc,
NekVector<NekDouble>& global) const
{
LocalBndToGlobal(loc.GetPtr(), global.GetPtr());
}
void AssemblyMap::LocalBndToGlobal(
const Array<OneD, const NekDouble>& loc,
Array<OneD,NekDouble>& global) const
{
ASSERTL1(loc.num_elements() >= m_numLocalBndCoeffs,"Local vector is not of correct dimension");
ASSERTL1(global.num_elements() >= m_numGlobalBndCoeffs,"Global vector is not of correct dimension");
if(m_signChange)
{
Vmath::Scatr(m_numLocalBndCoeffs, m_localToGlobalBndSign.get(), loc.get(), m_localToGlobalBndMap.get(), global.get());
}
else
{
Vmath::Scatr(m_numLocalBndCoeffs, loc.get(), m_localToGlobalBndMap.get(), global.get());
}
}
void AssemblyMap::AssembleBnd(
const NekVector<NekDouble>& loc,
......
......@@ -197,11 +197,19 @@ namespace Nektar
NekVector<NekDouble>& global,
int offset) const;
MULTI_REGIONS_EXPORT void LocalBndToGlobal(
const NekVector<NekDouble>& loc,
NekVector<NekDouble>& global) const;
MULTI_REGIONS_EXPORT void LocalBndToGlobal(
const Array<OneD, const NekDouble>& loc,
Array<OneD,NekDouble>& global,
int offset) const;
MULTI_REGIONS_EXPORT void LocalBndToGlobal(
const Array<OneD, const NekDouble>& loc,
Array<OneD,NekDouble>& global) const;
MULTI_REGIONS_EXPORT void AssembleBnd(const NekVector<NekDouble>& loc,
NekVector<NekDouble>& global, int offset) const;
......
......@@ -449,7 +449,7 @@ namespace Nektar
{
cout << "CG iterations made = " << m_totalIterations
<< " using tolerance of " << m_tolerance
<< " (error = " << sqrt(vExchange[2]) << ")" << endl;
<< " (error = " << sqrt(eps/m_rhs_magnitude) << ")" << endl;
}
m_rhs_magnitude = NekConstants::kNekUnsetDouble;
return;
......@@ -528,6 +528,7 @@ namespace Nektar
mu = vExchange[1];
eps = vExchange[2];
m_totalIterations++;
// test if norm is within tolerance
if (eps < m_tolerance * m_tolerance * m_rhs_magnitude)
{
......@@ -550,7 +551,6 @@ namespace Nektar
rho = rho_new;
k++;
m_totalIterations++;
}
}
......
......@@ -175,6 +175,7 @@ namespace Nektar
{
bool dirForcCalculated = (bool) dirForcing.num_elements();
bool atLastLevel = pLocToGloMap->AtLastLevel();
int scLevel = pLocToGloMap->GetStaticCondLevel();
int nGlobDofs = pLocToGloMap->GetNumGlobalCoeffs();
int nGlobBndDofs = pLocToGloMap->GetNumGlobalBndCoeffs();
......@@ -210,9 +211,13 @@ namespace Nektar
NekVector<NekDouble> V_GlobHomBndTmp(nGlobHomBndDofs,0.0);
// set up normalisation factor for right hand side
Set_Rhs_Magnitude(F_GlobBnd);
// set up normalisation factor for right hand side on first SC level
if(scLevel == 0)
{
Set_Rhs_Magnitude(F_GlobBnd);
}
if(nGlobHomBndDofs)
{
if(pLocToGloMap->GetPreconType() != MultiRegions::eLowEnergy)
......@@ -251,7 +256,6 @@ namespace Nektar
// those lower levels, whilst not sending anything to the
// other partitions, and includes them in the modified right
// hand side vector.
int scLevel = pLocToGloMap->GetStaticCondLevel();
int lcLevel = pLocToGloMap->GetLowestStaticCondLevel();
if(atLastLevel && scLevel < lcLevel)
{
......@@ -318,15 +322,13 @@ namespace Nektar
if(atLastLevel)
{
Array<OneD, NekDouble> pert(nGlobBndDofs,0.0);
NekVector<NekDouble> Pert(nGlobBndDofs,pert,eWrapper);
Timer t;
t.Start();
// Solve for difference from initial solution given inout;
SolveLinearSystem(nGlobBndDofs, F, pert, pLocToGloMap, nDirBndDofs);
// Add back initial conditions onto difference
Vmath::Vadd(nGlobHomBndDofs,&out[nDirBndDofs],1,
&pert[nDirBndDofs],1,&out[nDirBndDofs],1);
t.Stop();
......@@ -335,12 +337,15 @@ namespace Nektar
{
DNekScalBlkMat &RT = *m_RTBlk;
pLocToGloMap->GlobalToLocalBnd(V_GlobHomBnd,V_LocBnd, nDirBndDofs);
pLocToGloMap->GlobalToLocalBnd(Pert,V_LocBnd);
V_LocBnd=RT*V_LocBnd;
pLocToGloMap->LocalBndToGlobal(V_LocBnd,V_GlobHomBnd, nDirBndDofs);
pLocToGloMap->LocalBndToGlobal(V_LocBnd,Pert);
}
// Add back initial conditions onto difference
Vmath::Vadd(nGlobHomBndDofs,&out[nDirBndDofs],1,
&pert[nDirBndDofs],1,&out[nDirBndDofs],1);
}
else
{
......
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