Commit 0ce7782c authored by Douglas Serson's avatar Douglas Serson
Browse files

Use simplified seed logic in ForcingNoise

parent 106cb643
...@@ -97,14 +97,14 @@ namespace SolverUtils ...@@ -97,14 +97,14 @@ namespace SolverUtils
m_Forcing = Array<OneD, Array<OneD, NekDouble> > (m_NumVariable); m_Forcing = Array<OneD, Array<OneD, NekDouble> > (m_NumVariable);
// Fill forcing: use i and rank in seed to avoid repeated results // Fill forcing: use rank in seed to avoid repeated results
int rank = m_session->GetComm()->GetRank(); int seed = - m_session->GetComm()->GetRank();
int seed = - (rank * m_NumVariable); m_Forcing[0] = Array<OneD, NekDouble> (nq, 0.0);
for (int i = 0; i < m_NumVariable; ++i) Vmath::FillWhiteNoise(nq,m_noise,m_Forcing[0],1,seed);
for (int i = 1; i < m_NumVariable; ++i)
{ {
m_Forcing[i] = Array<OneD, NekDouble> (nq, 0.0); m_Forcing[i] = Array<OneD, NekDouble> (nq, 0.0);
Vmath::FillWhiteNoise(nq,m_noise,&m_Forcing[i][0],1,seed); Vmath::FillWhiteNoise(nq,m_noise,m_Forcing[i],1);
--seed;
} }
m_index = 0; m_index = 0;
...@@ -125,15 +125,10 @@ namespace SolverUtils ...@@ -125,15 +125,10 @@ namespace SolverUtils
// Update forcing (change seed to avoid getting same result) // Update forcing (change seed to avoid getting same result)
if(m_updateFreq && m_index && !((m_index)%m_updateFreq)) if(m_updateFreq && m_index && !((m_index)%m_updateFreq))
{ {
int rank = m_session->GetComm()->GetRank();
int nProcs = m_session->GetComm()->GetSize();
int seed = - (rank* m_NumVariable + m_index*m_NumVariable*nProcs);
for (int i = 0; i < m_NumVariable; ++i) for (int i = 0; i < m_NumVariable; ++i)
{ {
Vmath::FillWhiteNoise(outarray[i].num_elements(), Vmath::FillWhiteNoise(outarray[i].num_elements(),
m_noise,&m_Forcing[i][0],1, m_noise,m_Forcing[i],1);
seed);
--seed;
} }
} }
......
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