94 sessionName = session->GetSessionName();
97 if (session->DefinesTimeIntScheme())
99 timeInt = session->GetTimeIntScheme();
103 timeInt.method = session->GetSolverInfo(
"TimeIntegrationMethod");
106 nSteps = session->GetParameter(
"NumSteps");
107 delta_t = session->GetParameter(
"TimeStep");
108 epsilon = session->GetParameter(
"epsilon");
109 lambda = 1.0 / delta_t / epsilon;
113 session, graph, session->GetVariable(0));
116 fields[0] =
field->UpdatePhys();
119 unsigned int nq =
field->GetNpoints();
121 field->GetCoords(x0, x1, x2);
125 session->GetFunction(
"InitialConditions",
"u");
126 icond->Evaluate(x0, x1, x2, 0.0,
field->UpdatePhys());
137 timeInt.method, timeInt.variant, timeInt.order, timeInt.freeParams);
142 intScheme->InitializeScheme(delta_t, fields, 0.0, ode);
147 for (
int n = 0; n < nSteps; ++n)
149 fields = intScheme->TimeIntegrate(n, delta_t);
166 for (
int i = 0; i < inarray.size(); ++i)
170 inarray[i], 1, outarray[i], 1);
176 field->BwdTrans(
field->GetCoeffs(), outarray[i]);
183 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
184 field->GetFieldDefinitions();
185 std::vector<std::vector<NekDouble>> FieldData(FieldDef.size());
186 for (
int i = 0; i < FieldDef.size(); ++i)
188 FieldDef[i]->m_fields.push_back(
"u");
189 field->AppendFieldData(FieldDef[i], FieldData[i]);
191 fld->Write(session->GetSessionName() +
".fld", FieldDef, FieldData);
196 unsigned int nq =
field->GetNpoints();
198 field->GetCoords(x0, x1, x2);
201 session->GetFunction(
"ExactSolution", 0);
207 ex_sol->Evaluate(x0, x1, x2, (nSteps)*delta_t, exact);
210 cout <<
"L inf error: " <<
field->Linf(
field->GetPhys(), exact)
212 cout <<
"L 2 error: " <<
field->L2(
field->GetPhys(), exact)
214 cout <<
"H 1 error: " <<
field->H1(
field->GetPhys(), exact)
219int main(
int argc,
char *argv[])
226 catch (
const std::runtime_error &e)
230 catch (
const std::string &eStr)
232 cout <<
"Error: " << eStr << endl;
int main(int argc, char *argv[])
LibUtilities::TimeIntScheme timeInt
MultiRegions::ContFieldSharedPtr field
SpatialDomains::MeshGraphSharedPtr graph
LibUtilities::TimeIntegrationSchemeOperators ode
LibUtilities::FieldIOSharedPtr fld
void DoImplicitSolve(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const NekDouble lambda)
LibUtilities::TimeIntegrationSchemeSharedPtr intScheme
Diffusion(int argc, char *argv[])
LibUtilities::SessionReaderSharedPtr session
Array< OneD, Array< OneD, NekDouble > > fields
static std::shared_ptr< FieldIO > CreateDefault(const LibUtilities::SessionReaderSharedPtr session)
Returns an object for the default FieldIO method.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
Binds a set of functions for use by time integration schemes.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
virtual SOLVER_UTILS_EXPORT ~Diffusion()
static MeshGraphSharedPtr Read(const LibUtilities::SessionReaderSharedPtr pSession, LibUtilities::DomainRangeShPtr rng=LibUtilities::NullDomainRangeShPtr, bool fillGraph=true, SpatialDomains::MeshGraphSharedPtr partitionedGraph=nullptr)
TimeIntegrationSchemeFactory & GetTimeIntegrationSchemeFactory()
std::shared_ptr< FieldIO > FieldIOSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Equation > EquationSharedPtr
std::shared_ptr< TimeIntegrationScheme > TimeIntegrationSchemeSharedPtr
std::shared_ptr< ContField > ContFieldSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::map< ConstFactorType, NekDouble > ConstFactorMap
StdRegions::ConstFactorMap factors
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Zero(int n, T *x, const int incx)
Zero vector.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)