44 using namespace Nektar;
55 const Array<
OneD,
const Array<OneD, NekDouble> >&inarray,
56 Array<
OneD, Array<OneD, NekDouble> >&outarray,
71 Array<OneD, Array<OneD, NekDouble> >
fields;
94 fileName = session->GetFilename();
95 sessionName = session->GetSessionName();
96 scheme = session->GetSolverInfo(
"TimeIntegrationMethod");
97 nSteps = session->GetParameter(
"NumSteps");
98 delta_t = session->GetParameter(
"TimeStep");
99 epsilon = session->GetParameter(
"epsilon");
100 lambda = 1.0/delta_t/epsilon;
109 fields = Array<OneD, Array<OneD, NekDouble> >(1);
110 fields[0] = field->UpdatePhys();
113 unsigned int nq = field->GetNpoints();
114 Array<OneD,NekDouble> x0(nq), x1(nq), x2(nq);
115 field->GetCoords(x0,x1,x2);
119 = session->GetFunction(
"InitialConditions",
"u");
120 icond->Evaluate(x0,x1,x2,0.0,field->UpdatePhys());
131 CreateInstance(scheme);
136 u = IntScheme->InitializeScheme(delta_t, fields, 0.0, ode);
139 Vmath::Zero(field->GetNcoeffs(), field->UpdateCoeffs(), 1);
141 for (
int n = 0; n < nSteps; ++n)
143 fields = IntScheme->TimeIntegrate(n, delta_t, u, ode);
145 Vmath::Vcopy(field->GetNpoints(), fields[0], 1, field->UpdatePhys(), 1);
154 const Array<
OneD,
const Array<OneD, NekDouble> >&inarray,
155 Array<
OneD, Array<OneD, NekDouble> >&outarray,
162 for (
int i = 0; i < inarray.num_elements(); ++i)
170 field->HelmSolve(outarray[i],
171 field->UpdateCoeffs(),
175 field->BwdTrans (field->GetCoeffs(), outarray[i]);
182 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
183 = field->GetFieldDefinitions();
184 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
185 for(
int i = 0; i < FieldDef.size(); ++i)
187 FieldDef[i]->m_fields.push_back(
"u");
188 field->AppendFieldData(FieldDef[i], FieldData[i]);
190 fld->Write(session->GetSessionName() +
".fld", FieldDef, FieldData);
197 unsigned int nq = field->GetNpoints();
198 Array<OneD,NekDouble> x0(nq), x1(nq), x2(nq);
199 field->GetCoords(x0,x1,x2);
202 session->GetFunction(
"ExactSolution",0);
207 Array<OneD, NekDouble> exact(nq);
208 ex_sol->Evaluate(x0, x1, x2, (nSteps)*delta_t, exact);
211 cout <<
"L inf error: "
212 << field->Linf(field->GetPhys(), exact) << endl;
213 cout <<
"L 2 error: "
214 << field->L2(field->GetPhys(), exact) << endl;
215 cout <<
"H 1 error: "
216 << field->H1(field->GetPhys(), exact) << endl;
221 int main(
int argc,
char *argv[])
228 catch (
const std::runtime_error& e)
232 catch (
const std::string& eStr)
234 cout <<
"Error: " << eStr << endl;