93 sessionName = session->GetSessionName();
94 scheme = session->GetSolverInfo(
"TimeIntegrationMethod");
95 nSteps = session->GetParameter(
"NumSteps");
96 delta_t = session->GetParameter(
"TimeStep");
97 epsilon = session->GetParameter(
"epsilon");
98 lambda = 1.0/delta_t/epsilon;
108 fields[0] = field->UpdatePhys();
111 unsigned int nq = field->GetNpoints();
113 field->GetCoords(x0,x1,x2);
117 = session->GetFunction(
"InitialConditions",
"u");
118 icond->Evaluate(x0,x1,x2,0.0,field->UpdatePhys());
129 CreateInstance(scheme);
134 u = IntScheme->InitializeScheme(delta_t, fields, 0.0, ode);
137 Vmath::Zero(field->GetNcoeffs(), field->UpdateCoeffs(), 1);
139 for (
int n = 0; n < nSteps; ++n)
141 fields = IntScheme->TimeIntegrate(n, delta_t, u, ode);
143 Vmath::Vcopy(field->GetNpoints(), fields[0], 1, field->UpdatePhys(), 1);
160 for (
int i = 0; i < inarray.num_elements(); ++i)
168 field->HelmSolve(outarray[i],
169 field->UpdateCoeffs(),
173 field->BwdTrans (field->GetCoeffs(), outarray[i]);
180 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
181 = field->GetFieldDefinitions();
182 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
183 for(
int i = 0; i < FieldDef.size(); ++i)
185 FieldDef[i]->m_fields.push_back(
"u");
186 field->AppendFieldData(FieldDef[i], FieldData[i]);
188 fld->Write(session->GetSessionName() +
".fld", FieldDef, FieldData);
195 unsigned int nq = field->GetNpoints();
197 field->GetCoords(x0,x1,x2);
200 session->GetFunction(
"ExactSolution",0);
206 ex_sol->Evaluate(x0, x1, x2, (nSteps)*delta_t, exact);
209 cout <<
"L inf error: "
210 << field->Linf(field->GetPhys(), exact) << endl;
211 cout <<
"L 2 error: "
212 << field->L2(field->GetPhys(), exact) << endl;
213 cout <<
"H 1 error: "
214 << field->H1(field->GetPhys(), exact) << endl;
219 int main(
int argc,
char *argv[])
226 catch (
const std::runtime_error& e)
230 catch (
const std::string& eStr)
232 cout <<
"Error: " << eStr << endl;
LibUtilities::TimeIntegrationWrapperSharedPtr IntScheme
MultiRegions::ContField2DSharedPtr field
static boost::shared_ptr< MeshGraph > Read(const LibUtilities::SessionReaderSharedPtr &pSession, DomainRangeShPtr &rng=NullDomainRangeShPtr)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
Diffusion(int argc, char *argv[])
int main(int argc, char *argv[])
boost::shared_ptr< TimeIntegrationWrapper > TimeIntegrationWrapperSharedPtr
LibUtilities::TimeIntegrationSolutionSharedPtr u
LibUtilities::FieldIOSharedPtr fld
boost::shared_ptr< ContField2D > ContField2DSharedPtr
std::map< ConstFactorType, NekDouble > ConstFactorMap
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Array< OneD, Array< OneD, NekDouble > > fields
boost::shared_ptr< FieldIO > FieldIOSharedPtr
TimeIntegrationWrapperFactory & GetTimeIntegrationWrapperFactory()
boost::shared_ptr< Equation > EquationSharedPtr
LibUtilities::SessionReaderSharedPtr session
void DoImplicitSolve(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const NekDouble lambda)
SpatialDomains::MeshGraphSharedPtr graph
LibUtilities::TimeIntegrationSchemeOperators ode
boost::shared_ptr< TimeIntegrationSolution > TimeIntegrationSolutionSharedPtr
void Zero(int n, T *x, const int incx)
Zero vector.
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
static FlagList NullFlagList
An empty flag list.