13 int main(
int argc,
char *argv[])
17 fprintf(stderr,
"Usage: ./NonLinearEnergy file.xml \n");
18 fprintf(stderr,
"\t Method will read intiial conditions section of .xml file for input \n");
31 session->LoadSolverInfo(
"Driver", vDriverModule,
"Standard");
42 int nConvectiveFields = IncNav->GetNConvectiveFields();
43 int nphys = fields[0]->GetTotPoints();
47 for(i = 0; i < nConvectiveFields; ++i)
49 VelFields[i] = fields[i]->UpdatePhys();
53 boost::shared_ptr<NavierStokesAdvection> A
58 cout <<
"Must use non-linear Navier-Stokes advection" << endl;
63 A->Advect(nConvectiveFields, fields,
69 for(i = 0; i < nConvectiveFields; ++i)
71 fields[i]->FwdTrans_IterPerExp(NonLinear[i],fields[i]->UpdateCoeffs());
75 for(
int n = 0; n < fields[i]->GetExpSize(); ++n)
77 int offset = fields[i]->GetCoeff_Offset(n);
78 int ncoeffs = fields[i]->GetExp(n)->GetNcoeffs();
81 fields[i]->GetExp(n)->ReduceOrderCoeffs(fields[i]->GetExp(n)->GetBasisNumModes(0)-1,fields[i]->GetCoeffs()+offset,coeffsred);
83 Vmath::Vsub(ncoeffs,fields[i]->GetCoeffs()+offset,1,
84 coeffsred,1,tmp = fields[i]->UpdateCoeffs()+
90 string name =
"NL_TopMode_"+session->GetVariable(i);
91 session->SetVariable(i,name.c_str());
96 std::string outname = IncNav->GetSessionName();
98 outname +=
"_NonLinear_Energy";
99 IncNav->ResetSessionName(outname);
103 catch (
const std::runtime_error&)
107 catch (
const std::string& eStr)
109 cout <<
"Error: " << eStr << endl;
int main(int argc, char *argv[])
boost::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
boost::shared_ptr< IncNavierStokes > IncNavierStokesSharedPtr
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
boost::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
This class is the base class for Navier Stokes problems.
DriverFactory & GetDriverFactory()
SOLVER_UTILS_EXPORT void SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
Initialise the data in the dependent fields.