48{
49 if (argc != 2)
50 {
51 fprintf(stderr, "Usage: ./CflStep file.xml \n");
52 fprintf(stderr, "\t Method will read intiial conditions section of "
53 ".xml file for input \n");
54 exit(1);
55 }
56
59
60 string vDriverModule;
62 try
63 {
64
65 session = LibUtilities::SessionReader::CreateInstance(argc, argv);
66
67
68 graph = SpatialDomains::MeshGraph::Read(session);
69
70
71 session->LoadSolverInfo("Driver", vDriverModule, "Standard");
73
76
79
80
82 IncNav->UpdateFields();
83 int i, n, nquad, cnt;
84 int nfields = fields.size();
85 int nexp = fields[0]->GetExpSize();
86
88
89 cout << "Max CFL: " << cfl[elmtid] << " In element " << elmtid << endl;
90
91 for (n = 0; n < nfields; ++n)
92 {
93 if (session->GetVariable(n) == "p")
94 {
95 break;
96 }
97 }
98
99 ASSERTL0(n != nfields,
"Could not find field named p in m_fields");
100
102
103 cnt = 0;
104 for (i = 0; i < fields[n]->GetExpSize(); ++i)
105 {
106 nquad = fields[n]->GetExp(i)->GetTotPoints();
108 cnt += nquad;
109 }
110
111 fields[n]->FwdTransLocalElmt(fields[n]->GetPhys(),
112 fields[n]->UpdateCoeffs());
113
114
115 session->SetVariable(n, "CFL");
116
117
118 std::string outname = IncNav->GetSessionName();
119
120 outname += "_CFLStep";
121 IncNav->ResetSessionName(outname);
122 IncNav->Output();
123 }
124 catch (const std::runtime_error &)
125 {
126 return 1;
127 }
128 catch (const std::string &eStr)
129 {
130 cout << "Error: " << eStr << endl;
131 }
132
133 return 0;
134}
#define ASSERTL0(condition, msg)
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
int Imax(int n, const T *x, const int incx)
Return the index of the maximum element in x.
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.