18 fprintf(stderr,
"Usage: ./NonLinearEnergy file.xml \n");
19 fprintf(stderr,
"\t Method will read intiial conditions section of .xml file for input \n");
30 session = LibUtilities::SessionReader::CreateInstance(argc, argv);
33 graph = SpatialDomains::MeshGraph::Read(session);
36 session->LoadSolverInfo(
"Driver", vDriverModule,
"Standard");
47 int nConvectiveFields = IncNav->GetNConvectiveFields();
48 int nphys = fields[0]->GetTotPoints();
52 for(i = 0; i < nConvectiveFields; ++i)
54 VelFields[i] = fields[i]->UpdatePhys();
58 std::shared_ptr<NavierStokesAdvection>
A
59 = std::dynamic_pointer_cast<NavierStokesAdvection>(IncNav->GetAdvObject());
63 cout <<
"Must use non-linear Navier-Stokes advection" << endl;
68 A->Advect(nConvectiveFields, fields,
74 for(i = 0; i < nConvectiveFields; ++i)
76 fields[i]->FwdTrans_IterPerExp(NonLinear[i],fields[i]->UpdateCoeffs());
80 for(
int n = 0; n < fields[i]->GetExpSize(); ++n)
82 int offset = fields[i]->GetCoeff_Offset(n);
83 int ncoeffs = fields[i]->GetExp(n)->GetNcoeffs();
86 fields[i]->GetExp(n)->ReduceOrderCoeffs(fields[i]->GetExp(n)->GetBasisNumModes(0)-1,fields[i]->GetCoeffs()+offset,coeffsred);
88 Vmath::Vsub(ncoeffs,fields[i]->GetCoeffs()+offset,1,
89 coeffsred,1,tmp = fields[i]->UpdateCoeffs()+
95 string name =
"NL_TopMode_"+session->GetVariable(i);
96 session->SetVariable(i,
name.c_str());
101 std::string outname = IncNav->GetSessionName();
103 outname +=
"_NonLinear_Energy";
104 IncNav->ResetSessionName(outname);
108 catch (
const std::runtime_error&)
112 catch (
const std::string& eStr)
114 cout <<
"Error: " << eStr << endl;
This class is the base class for Navier Stokes problems.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
SOLVER_UTILS_EXPORT void SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
Initialise the data in the dependent fields.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
DriverFactory & GetDriverFactory()
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::shared_ptr< IncNavierStokes > IncNavierStokesSharedPtr
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.