Commit b52f6d46 authored by Chris Cantwell's avatar Chris Cantwell
Browse files

Updated UnsteadySystem to use TimeIntegrationWrapper.

parent faaead8c
......@@ -36,6 +36,7 @@
#include <iostream>
#include <iomanip>
#include <LibUtilities/TimeIntegration/TimeIntegrationWrapper.h>
#include <LibUtilities/BasicUtils/Timer.h>
#include <MultiRegions/AssemblyMap/AssemblyMapDG.h>
#include <SolverUtils/UnsteadySystem.h>
......@@ -211,191 +212,13 @@ namespace Nektar
// - the last scheme will be used for all other time-steps
// (this will be the actual scheme)
Array<OneD, LibUtilities::TimeIntegrationSchemeSharedPtr> IntScheme;
LibUtilities::TimeIntegrationWrapperSharedPtr IntScheme;
LibUtilities::TimeIntegrationSolutionSharedPtr u;
int numMultiSteps;
switch(m_timeIntMethod)
{
case LibUtilities::eIMEXdirk_1_1_1:
case LibUtilities::eIMEXdirk_1_2_1:
case LibUtilities::eIMEXdirk_1_2_2:
case LibUtilities::eIMEXdirk_4_4_3:
case LibUtilities::eIMEXdirk_2_2_2:
case LibUtilities::eIMEXdirk_2_3_3:
case LibUtilities::eIMEXdirk_2_3_2:
case LibUtilities::eIMEXdirk_3_4_3:
case LibUtilities::eDIRKOrder2:
case LibUtilities::eDIRKOrder3:
case LibUtilities::eBackwardEuler:
case LibUtilities::eForwardEuler:
case LibUtilities::eClassicalRungeKutta4:
case LibUtilities::eIMEXOrder1:
case LibUtilities::eMidpoint:
case LibUtilities::eRungeKutta2_ModifiedEuler:
case LibUtilities::eRungeKutta2_ImprovedEuler:
{
numMultiSteps = 1;
IntScheme = Array<OneD, LibUtilities::
TimeIntegrationSchemeSharedPtr>(numMultiSteps);
LibUtilities::
TimeIntegrationSchemeKey IntKey(m_timeIntMethod);
IntScheme[0] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey];
u = IntScheme[0]->InitializeScheme(
m_timestep, fields, m_time, m_ode);
break;
}
case LibUtilities::eAdamsBashforthOrder2:
case LibUtilities::eAdamsBashforthOrder3:
{
numMultiSteps = 2;
IntScheme = Array<OneD, LibUtilities::
TimeIntegrationSchemeSharedPtr>(numMultiSteps);
// Used in the first time step to initalize the scheme
LibUtilities::
TimeIntegrationSchemeKey IntKey0(
LibUtilities::
eForwardEuler);
// Used for all other time steps
LibUtilities::
TimeIntegrationSchemeKey IntKey1(m_timeIntMethod);
IntScheme[0] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey0];
IntScheme[1] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey1];
// Initialise the scheme for actual time integration scheme
u = IntScheme[1]->InitializeScheme(
m_timestep, fields, m_time, m_ode);
break;
}
case LibUtilities::eBDFImplicitOrder2:
{
numMultiSteps = 2;
IntScheme = Array<OneD, LibUtilities::
TimeIntegrationSchemeSharedPtr>(numMultiSteps);
// Used in the first time step to initalize the scheme
LibUtilities::
TimeIntegrationSchemeKey IntKey0(
LibUtilities::
eBackwardEuler);
// Used for all other time steps
LibUtilities::
TimeIntegrationSchemeKey IntKey1(m_timeIntMethod);
IntScheme[0] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey0];
IntScheme[1] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey1];
// Initialise the scheme for actual time integration scheme
u = IntScheme[1]->InitializeScheme(
m_timestep, fields, m_time, m_ode);
break;
}
case LibUtilities::eIMEXOrder2:
case LibUtilities::eAdamsMoultonOrder2:
{
numMultiSteps = 2;
IntScheme = Array<OneD, LibUtilities::
TimeIntegrationSchemeSharedPtr>(numMultiSteps);
// Used in the first time step to initalize the scheme
LibUtilities::
TimeIntegrationSchemeKey IntKey0(LibUtilities::
eIMEXOrder1);
// Used for all other time steps
LibUtilities::
TimeIntegrationSchemeKey IntKey1(m_timeIntMethod);
IntScheme[0] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey0];
IntScheme[1] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey1];
// Initialise the scheme for actual time integration scheme
u = IntScheme[1]->InitializeScheme(
m_timestep, fields, m_time, m_ode);
break;
}
case LibUtilities::eIMEXGear:
{
numMultiSteps = 2;
IntScheme = Array<OneD, LibUtilities::
TimeIntegrationSchemeSharedPtr>(numMultiSteps);
// Used in the first time step to initalize the scheme
LibUtilities::
TimeIntegrationSchemeKey IntKey0(LibUtilities::
eIMEXdirk_2_2_2);
// Used for all other time steps
LibUtilities::
TimeIntegrationSchemeKey IntKey1(m_timeIntMethod);
IntScheme[0] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey0];
IntScheme[1] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey1];
// Initialise the scheme for actual time integration scheme
u = IntScheme[1]->InitializeScheme(
m_timestep, fields, m_time, m_ode);
break;
}
case LibUtilities::eIMEXOrder3:
case LibUtilities::eCNAB:
case LibUtilities::eMCNAB:
{
numMultiSteps = 3;
IntScheme = Array<OneD, LibUtilities::
TimeIntegrationSchemeSharedPtr>(numMultiSteps);
// Used in the first time step to initalize the scheme
LibUtilities::
TimeIntegrationSchemeKey IntKey0(LibUtilities::
eIMEXdirk_3_4_3);
LibUtilities::
TimeIntegrationSchemeKey IntKey1(LibUtilities::
eIMEXdirk_3_4_3);
// Used for all other time steps
LibUtilities::
TimeIntegrationSchemeKey IntKey2(m_timeIntMethod);
IntScheme[0] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey0];
IntScheme[1] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey1];
IntScheme[2] = LibUtilities::
TimeIntegrationSchemeManager()[IntKey2];
// Initialise the scheme for actual time integration scheme
u = IntScheme[2]->InitializeScheme(
m_timestep, fields, m_time, m_ode);
break;
}
default:
{
ASSERTL0(false, "populate switch statement for "
"integration scheme");
}
}
IntScheme = LibUtilities::GetTimeIntegrationWrapperFactory().CreateInstance(LibUtilities::TimeIntegrationMethodMap[m_timeIntMethod]);
numMultiSteps = IntScheme->GetIntegrationSteps();
u = IntScheme->InitializeScheme(m_timestep, fields, m_time, m_ode);
std::vector<FilterSharedPtr>::iterator x;
for (x = m_filters.begin(); x != m_filters.end(); ++x)
......@@ -453,8 +276,7 @@ namespace Nektar
}
timer.Start();
fields = IntScheme[min(step, numMultiSteps-1)]->TimeIntegrate(
m_timestep, u, m_ode);
fields = IntScheme->TimeIntegrate(step, m_timestep, u, m_ode);
timer.Stop();
const NekDouble elapsed = timer.TimePerTest(1);
......
Supports Markdown
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