Nektar++
EquationSystem.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: EquationSystem.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Base class for individual solvers.
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERUTILS_EQUATIONSYSTEM_H
36#define NEKTAR_SOLVERUTILS_EQUATIONSYSTEM_H
37
51#include <boost/numeric/ublas/matrix.hpp>
52
53namespace Nektar
54{
55namespace FieldUtils
56{
57template <typename T> class Interpolator;
58}
59namespace SolverUtils
60{
61class EquationSystem;
62class FilterOperators;
63
64/// A shared pointer to an EquationSystem object
65typedef std::shared_ptr<EquationSystem> EquationSystemSharedPtr;
66/// Datatype of the NekFactory used to instantiate classes derived from
67/// the EquationSystem class.
68typedef LibUtilities::NekFactory<std::string, EquationSystem,
73
74/// A base class for describing how to solve specific equations.
75class EquationSystem : public std::enable_shared_from_this<EquationSystem>
76{
77public:
78 /// Destructor
80
81 /// Initialises the members of this object.
82 SOLVER_UTILS_EXPORT inline void InitObject(bool DeclareField = true);
83
84 /// Perform any initialisation necessary before solving the problem.
86 bool dumpInitialConditions = true);
87
88 /// Solve the problem.
89 SOLVER_UTILS_EXPORT inline void DoSolve();
90
91 /// Transform from coefficient to physical space.
93
94 /// Transform from physical to coefficient space.
96
97 /// Perform output operations after solve.
98 SOLVER_UTILS_EXPORT inline void Output();
99
100 /// Get Session name
102 {
103 return m_sessionName;
104 }
105
106 template <class T> std::shared_ptr<T> as()
107 {
108 return std::dynamic_pointer_cast<T>(shared_from_this());
109 }
110
111 /// Reset Session name
112 SOLVER_UTILS_EXPORT void ResetSessionName(std::string newname)
113 {
114 m_sessionName = newname;
115 }
116
117 /// Get Session name
119 {
120 return m_session;
121 }
122
123 /// Get pressure field if available
125
127 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
128 std::vector<std::string> &variables);
129
130 /// Print a summary of parameters and solver characteristics.
131 SOLVER_UTILS_EXPORT inline void PrintSummary(std::ostream &out);
132
133 /// Set parameter m_lambda
134 SOLVER_UTILS_EXPORT inline void SetLambda(NekDouble lambda);
135
136 /// Get a SessionFunction by name
138 GetFunction(std::string name,
141 bool cache = false);
142
143 /// Initialise the data in the dependent fields.
145 NekDouble initialtime = 0.0, bool dumpInitialConditions = true,
146 const int domain = 0);
147
148 /// Evaluates an exact solution
150 int field, Array<OneD, NekDouble> &outfield, const NekDouble time);
151
152 /// Compute the L2 error between fields and a given exact
153 /// solution.
155 L2Error(unsigned int field, const Array<OneD, NekDouble> &exactsoln,
156 bool Normalised = false);
157
158 /// Compute the L2 error of the fields
160 bool Normalised = false)
161 {
162 return L2Error(field, NullNekDouble1DArray, Normalised);
163 }
164
165 /// Linf error computation
167 LinfError(unsigned int field,
169
170 /// Compute error (L2 and L_inf) over an larger set of quadrature
171 /// points return [L2 Linf]
173 unsigned int field);
174
175 /// Write checkpoint file of #m_fields.
176 SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n);
177
178 /// Write checkpoint file of custom data fields.
181 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
182 std::vector<std::string> &variables);
183
184 /// Write base flow file of #m_fields.
186
187 /// Write field data to the given filename.
188 SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname);
189
190 /// Write input fields to the given filename.
192 const std::string &outname, MultiRegions::ExpListSharedPtr &field,
193 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
194 std::vector<std::string> &variables);
195
196 /// Input field data from the given file.
198 const std::string &infile,
200
201 /// Input field data from the given file to multiple domains
203 const std::string &infile,
205 const int ndomains);
206
207 /// Output a field.
208 /// Input field data into array from the given file.
210 const std::string &infile, std::vector<std::string> &fieldStr,
212
213 /// Output a field.
214 /// Input field data into ExpList from the given file.
215 SOLVER_UTILS_EXPORT void ImportFld(const std::string &infile,
217 std::string &pFieldName);
218
219 /// Write out a session summary.
221
223 UpdateFields();
224
225 /// Get hold of FieldInfoMap so it can be updated
228
229 /// Return final time
231
232 SOLVER_UTILS_EXPORT inline int GetNcoeffs();
233
234 SOLVER_UTILS_EXPORT inline int GetNcoeffs(const int eid);
235
237
239
241
242 SOLVER_UTILS_EXPORT inline const std::string GetVariable(unsigned int i);
243
245
247
248 SOLVER_UTILS_EXPORT inline int GetExpSize();
249
250 SOLVER_UTILS_EXPORT inline int GetPhys_Offset(int n);
251
252 SOLVER_UTILS_EXPORT inline int GetCoeff_Offset(int n);
253
255
256 SOLVER_UTILS_EXPORT inline int GetTotPoints(int n);
257
258 SOLVER_UTILS_EXPORT inline int GetNpoints();
259
260 SOLVER_UTILS_EXPORT inline int GetSteps();
261
263
265 const int i, Array<OneD, NekDouble> &output);
266
268 const int i, const Array<OneD, const NekDouble> &input);
269
271 const int i);
272
273 SOLVER_UTILS_EXPORT inline void SetSteps(const int steps);
274
276
278
279 SOLVER_UTILS_EXPORT inline void SetModifiedBasis(const bool modbasis);
280
282 {
283 return m_nchk;
284 }
285
287 {
288 m_nchk = num;
289 }
290
292 {
293 return m_checksteps;
294 }
295
297 {
298 m_checksteps = num;
299 }
300
302 {
303 return m_infosteps;
304 }
305
307 {
308 m_infosteps = num;
309 }
310
312 {
313 m_iterPIT = num;
314 }
315
317 {
318 m_windowPIT = num;
319 }
320
322 {
323 return m_traceNormals;
324 }
325
327 {
328 m_time = time;
329 }
330
332 {
333 m_timestep = timestep;
334 }
335
337 {
338 m_initialStep = step;
339 }
340
341 /// Evaluates the boundary conditions at the given time.
343
344 /// Identify if operator is negated in DoSolve
346
347protected:
348 /// Communicator
351 /// The session reader
353 /// Map of known SessionFunctions
354 std::map<std::string, SolverUtils::SessionFunctionSharedPtr>
356 /// Field input/output
358 /// Array holding all dependent variables.
360 /// Pointer to boundary conditions object.
362 /// Pointer to graph defining mesh.
364 /// Name of the session.
365 std::string m_sessionName;
366 /// Current time of simulation.
368 /// Number of the step where the simulation should begin
370 /// Finish time of the simulation.
372 /// Time step size
374
375 /// Lambda constant in real system if one required.
377 /// Time between checkpoints.
380
382
383 /// Number of checkpoints written so far
385 /// Number of steps to take.
387 /// Number of steps between checkpoints.
389 /// Number of time steps between outputting status information.
391 /// Number of parallel-in-time time iteration.
392 int m_iterPIT = 0;
393 /// Index of windows for parallel-in-time time iteration.
394 int m_windowPIT = 0;
395 /// Spatial dimension (>= expansion dim).
397 /// Expansion dimension.
399 /// Flag to determine if single homogeneous mode is used.
401 /// Flag to determine if half homogeneous mode is used.
403 /// Flag to determine if use multiple homogenenous modes are used.
405 /// Flag to determine if FFT is used for homogeneous transform.
407 /**
408 * \brief Flag to determine if dealiasing is used for
409 * homogeneous simulations.
410 */
412 /**
413 * \brief Flag to determine if dealisising is usde for the
414 * Spectral/hp element discretisation.
415 */
417 /// Type of projection; e.g continuous or discontinuous.
419 /// Array holding trace normals for DG simulations in the forwards
420 /// direction.
422 /// Flag to indicate if the fields should be checked for singularity.
424 /// Map to identify relevant solver info to dump in output fields
426
427 /// Moving reference frame status in the inertial frame
428 /// X, Y, Z, Theta_x, Theta_y, Theta_z,
429 /// U, V, W, Omega_x, Omega_y, Omega_z,
430 /// A_x, A_y, A_z, DOmega_x, DOmega_y, DOmega_z,
431 /// pivot_x, pivot_y, pivot_z
433 /// variable name in m_movingFrameData
434 std::vector<std::string> m_strFrameData;
435
436 /// Number of Quadrature points used to work out the error
438
439 /// Parameter for homogeneous expansions
441 {
446 };
447
449
450 NekDouble m_LhomX; ///< physical length in X direction (if homogeneous)
451 NekDouble m_LhomY; ///< physical length in Y direction (if homogeneous)
452 NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
453
454 int m_npointsX; ///< number of points in X direction (if homogeneous)
455 int m_npointsY; ///< number of points in Y direction (if homogeneous)
456 int m_npointsZ; ///< number of points in Z direction (if homogeneous)
457
458 int m_HomoDirec; ///< number of homogenous directions
459
460 /// Initialises EquationSystem class members.
464
465 SOLVER_UTILS_EXPORT virtual void v_InitObject(bool DeclareFeld = true);
466
467 /// Virtual function for initialisation implementation.
469 bool dumpInitialConditions = true);
470
471 /// Virtual function for solve implementation.
472 SOLVER_UTILS_EXPORT virtual void v_DoSolve();
473
474 /// Virtual function for the L_inf error computation between fields and a
475 /// given exact solution.
477 unsigned int field,
479
480 /// Virtual function for the L_2 error computation between fields and a
481 /// given exact solution.
483 unsigned int field,
485 bool Normalised = false);
486
487 /// Virtual function for transformation to physical space.
489
490 /// Virtual function for transformation to coefficient space.
492
493 /// Virtual function for generating summary information.
495
497 NekDouble initialtime = 0.0, bool dumpInitialConditions = true,
498 const int domain = 0);
499
501 unsigned int field, Array<OneD, NekDouble> &outfield,
502 const NekDouble time);
503
504 // Ouptut field information
505 SOLVER_UTILS_EXPORT virtual void v_Output(void);
506
507 // Get pressure field if available
509 void);
510
511 /// Virtual function to identify if operator is negated in DoSolve
512 SOLVER_UTILS_EXPORT virtual bool v_NegatedOp(void);
513
515 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
516 std::vector<std::string> &variables);
517
518 static std::string equationSystemTypeLookupIds[];
519 static std::string projectionTypeLookupIds[];
520
521private:
523
524 SOLVER_UTILS_EXPORT void PrintProgressbar(const int position,
525 const int goal) const
526 {
527 LibUtilities::PrintProgressbar(position, goal, "Interpolating");
528 }
529};
530
531/**
532 * This is the second part of the two-phase initialisation process.
533 * Calls to virtual functions will correctly resolve to the derived class
534 * during this phase of the construction.
535 */
536inline void EquationSystem::InitObject(bool DeclareField)
537{
538 v_InitObject(DeclareField);
539}
540
541/**
542 * This allows initialisation of the solver which cannot be completed
543 * during object construction (such as setting of initial conditions).
544 *
545 * Public interface routine to virtual function implementation.
546 */
547inline void EquationSystem::DoInitialise(bool dumpInitialConditions)
548{
549 v_DoInitialise(dumpInitialConditions);
550}
551
552/**
553 * Performs the transformation from coefficient to physical space.
554 *
555 * Public interface routine to virtual function implementation.
556 */
558{
560}
561
562/**
563 * Performs the transformation from physical to coefficient space.
564 *
565 * Public interface routine to virtual function implementation.
566 */
568{
570}
571
572/**
573 * Performs the actual solve.
574 *
575 * Public interface routine to virtual function implementation.
576 */
577inline void EquationSystem::DoSolve(void)
578{
579 v_DoSolve();
580}
581
582/**
583 * Perform output operations after solve.
584 */
585inline void EquationSystem::Output(void)
586{
587 v_Output();
588}
589
590/**
591 * L_inf Error computation
592 * Public interface routine to virtual function implementation.
593 */
595 unsigned int field, const Array<OneD, NekDouble> &exactsoln)
596{
597 return v_LinfError(field, exactsoln);
598}
599
600/**
601 * L_2 Error computation
602 * Public interface routine to virtual function implementation.
603 */
605 unsigned int field, const Array<OneD, NekDouble> &exactsoln,
606 bool Normalised)
607{
608 return v_L2Error(field, exactsoln, Normalised);
609}
610
611/**
612 * Get Pressure field if available
613 */
615{
616 return v_GetPressure();
617}
618
619/**
620 * Append the coefficients and name of variables with solver specific
621 * extra variables
622 *
623 * @param fieldcoeffs Vector with coefficients
624 * @param variables Vector with name of variables
625 */
627 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
628 std::vector<std::string> &variables)
629{
630 v_ExtraFldOutput(fieldcoeffs, variables);
631}
632
633/**
634 * Prints a summary of variables and problem parameters.
635 *
636 * Public interface routine to virtual function implementation.
637 *
638 * @param out The ostream object to write to.
639 */
640inline void EquationSystem::PrintSummary(std::ostream &out)
641{
642 if (m_session->GetComm()->GetRank() == 0)
643 {
644 std::vector<std::pair<std::string, std::string>> vSummary;
645 v_GenerateSummary(vSummary);
646
647 out << "==============================================================="
648 "========"
649 << std::endl
650 << std::flush;
651 for (auto &x : vSummary)
652 {
653 out << "\t";
654 out.width(20);
655 out << x.first << ": " << x.second << std::endl << std::flush;
656 }
657 out << "==============================================================="
658 "========"
659 << std::endl
660 << std::flush;
661 }
662}
663
665{
666 m_lambda = lambda;
667}
668
670 bool dumpInitialConditions,
671 const int domain)
672{
673 v_SetInitialConditions(initialtime, dumpInitialConditions, domain);
674}
675
676/// Evaluates an exact solution
678 int field, Array<OneD, NekDouble> &outfield, const NekDouble time)
679{
680 v_EvaluateExactSolution(field, outfield, time);
681}
682
683/// Identify if operator is negated in DoSolve
685{
686 return v_NegatedOp();
687}
688
690 UpdateFields(void)
691{
692 return m_fields;
693}
694
695/// Return time
697{
698 return m_time;
699}
700
702{
703 return m_fields[0]->GetNcoeffs();
704}
705
706inline int EquationSystem::GetNcoeffs(const int eid)
707{
708 return m_fields[0]->GetNcoeffs(eid);
709}
710
712{
713 return m_graph->GetExpansionInfo()
714 .begin()
715 ->second->m_basisKeyVector[0]
716 .GetNumModes();
717}
718
720{
721 return m_fields[0]->EvalBasisNumModesMaxPerExp();
722}
723
725{
726 return m_session->GetVariables().size();
727}
728
729inline const std::string EquationSystem::GetVariable(unsigned int i)
730{
731 return m_session->GetVariable(i);
732}
733
735{
736 return GetTraceNpoints();
737}
738
740{
741 return m_fields[0]->GetTrace()->GetNpoints();
742}
743
745{
746 return m_fields[0]->GetExpSize();
747}
748
750{
751 return m_fields[0]->GetPhys_Offset(n);
752}
753
755{
756 return m_fields[0]->GetCoeff_Offset(n);
757}
758
760{
761 return m_fields[0]->GetNpoints();
762}
763
765{
766 return m_fields[0]->GetTotPoints(n);
767}
768
770{
771 return m_fields[0]->GetNpoints();
772}
773
775{
776 return m_steps;
777}
778
780{
781 return m_timestep;
782}
783
784inline void EquationSystem::SetSteps(const int steps)
785{
786 m_steps = steps;
787}
788
789inline void EquationSystem::CopyFromPhysField(const int i,
791{
792 Vmath::Vcopy(output.size(), m_fields[i]->GetPhys(), 1, output, 1);
793}
794
796 const int i, const Array<OneD, const NekDouble> &input)
797{
798 Vmath::Vcopy(input.size(), input, 1, m_fields[i]->UpdatePhys(), 1);
799}
800
802{
803 return m_fields[i]->UpdatePhys();
804}
805
806} // namespace SolverUtils
807} // namespace Nektar
808
809#endif
#define SOLVER_UTILS_EXPORT
Provides a generic Factory class.
A base class for describing how to solve specific equations.
SOLVER_UTILS_EXPORT void ResetSessionName(std::string newname)
Reset Session name.
SOLVER_UTILS_EXPORT Array< OneD, MultiRegions::ExpListSharedPtr > & UpdateFields()
SOLVER_UTILS_EXPORT int GetSteps()
int m_spacedim
Spatial dimension (>= expansion dim).
SOLVER_UTILS_EXPORT void SetInitialStep(const int step)
SOLVER_UTILS_EXPORT int GetTraceNpoints()
SOLVER_UTILS_EXPORT void ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
bool m_useFFT
Flag to determine if FFT is used for homogeneous transform.
SOLVER_UTILS_EXPORT int GetNvariables()
SOLVER_UTILS_EXPORT int GetCheckpointSteps()
int m_expdim
Expansion dimension.
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
SOLVER_UTILS_EXPORT void SessionSummary(SummaryList &vSummary)
Write out a session summary.
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
virtual SOLVER_UTILS_EXPORT ~EquationSystem()
Destructor.
SOLVER_UTILS_EXPORT void SetSteps(const int steps)
SOLVER_UTILS_EXPORT void TransCoeffToPhys()
Transform from coefficient to physical space.
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
int m_npointsX
number of points in X direction (if homogeneous)
LibUtilities::CommSharedPtr m_comm
Communicator.
NekDouble m_timestep
Time step size.
int m_infosteps
Number of time steps between outputting status information.
SOLVER_UTILS_EXPORT void ImportFld(const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Input field data from the given file.
NekDouble m_time
Current time of simulation.
SOLVER_UTILS_EXPORT bool NegatedOp()
Identify if operator is negated in DoSolve.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
SOLVER_UTILS_EXPORT void SetWindowNumberPIT(int num)
int m_iterPIT
Number of parallel-in-time time iteration.
bool m_multipleModes
Flag to determine if use multiple homogenenous modes are used.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
int m_windowPIT
Index of windows for parallel-in-time time iteration.
SOLVER_UTILS_EXPORT NekDouble LinfError(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
Linf error computation.
SOLVER_UTILS_EXPORT const std::string GetVariable(unsigned int i)
NekDouble m_LhomX
physical length in X direction (if homogeneous)
SOLVER_UTILS_EXPORT void DoSolve()
Solve the problem.
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff()
Virtual function for transformation to coefficient space.
std::vector< std::string > m_strFrameData
variable name in m_movingFrameData
SOLVER_UTILS_EXPORT NekDouble L2Error(unsigned int field, bool Normalised=false)
Compute the L2 error of the fields.
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp(void)
Virtual function to identify if operator is negated in DoSolve.
SOLVER_UTILS_EXPORT void EvaluateExactSolution(int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
Evaluates an exact solution.
NekDouble m_fintime
Finish time of the simulation.
virtual SOLVER_UTILS_EXPORT NekDouble v_L2Error(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
Virtual function for the L_2 error computation between fields and a given exact solution.
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure(void)
NekDouble m_lambda
Lambda constant in real system if one required.
static std::string projectionTypeLookupIds[]
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > & UpdatePhysField(const int i)
SOLVER_UTILS_EXPORT void SetCheckpointNumber(int num)
int m_npointsZ
number of points in Z direction (if homogeneous)
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
std::map< std::string, SolverUtils::SessionFunctionSharedPtr > m_sessionFunctions
Map of known SessionFunctions.
NekDouble m_checktime
Time between checkpoints.
SOLVER_UTILS_EXPORT NekDouble GetTimeStep()
SOLVER_UTILS_EXPORT void TransPhysToCoeff()
Transform from physical to coefficient space.
virtual SOLVER_UTILS_EXPORT void v_InitObject(bool DeclareFeld=true)
Initialisation object for EquationSystem.
virtual SOLVER_UTILS_EXPORT NekDouble v_LinfError(unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
Virtual function for the L_inf error computation between fields and a given exact solution.
SOLVER_UTILS_EXPORT int GetCoeff_Offset(int n)
SOLVER_UTILS_EXPORT void Output()
Perform output operations after solve.
SOLVER_UTILS_EXPORT const Array< OneD, int > GetNumExpModesPerExp()
static std::string equationSystemTypeLookupIds[]
SOLVER_UTILS_EXPORT int GetInfoSteps()
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution(unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
virtual SOLVER_UTILS_EXPORT void v_DoInitialise(bool dumpInitialConditions=true)
Virtual function for initialisation implementation.
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname)
Write field data to the given filename.
SOLVER_UTILS_EXPORT NekDouble L2Error(unsigned int field, const Array< OneD, NekDouble > &exactsoln, bool Normalised=false)
Compute the L2 error between fields and a given exact solution.
SOLVER_UTILS_EXPORT int GetExpSize()
SOLVER_UTILS_EXPORT void ImportFldToMultiDomains(const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const int ndomains)
Input field data from the given file to multiple domains.
SOLVER_UTILS_EXPORT LibUtilities::FieldMetaDataMap & UpdateFieldMetaDataMap()
Get hold of FieldInfoMap so it can be updated.
NekDouble m_LhomY
physical length in Y direction (if homogeneous)
int m_npointsY
number of points in Y direction (if homogeneous)
SOLVER_UTILS_EXPORT void SetModifiedBasis(const bool modbasis)
std::string m_sessionName
Name of the session.
SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow(const int n)
Write base flow file of m_fields.
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT Array< OneD, const Array< OneD, NekDouble > > GetTraceNormals()
bool m_singleMode
Flag to determine if single homogeneous mode is used.
SOLVER_UTILS_EXPORT void SetIterationNumberPIT(int num)
HomogeneousType
Parameter for homogeneous expansions.
SOLVER_UTILS_EXPORT void ZeroPhysFields()
int m_HomoDirec
number of homogenous directions
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
SOLVER_UTILS_EXPORT void SetCheckpointSteps(int num)
int m_initialStep
Number of the step where the simulation should begin.
SOLVER_UTILS_EXPORT void DoInitialise(bool dumpInitialConditions=true)
Perform any initialisation necessary before solving the problem.
enum HomogeneousType m_HomogeneousType
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > ErrorExtraPoints(unsigned int field)
Compute error (L2 and L_inf) over an larger set of quadrature points return [L2 Linf].
SOLVER_UTILS_EXPORT std::string GetSessionName()
Get Session name.
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, bool > m_checkIfSystemSingular
Flag to indicate if the fields should be checked for singularity.
bool m_homogen_dealiasing
Flag to determine if dealiasing is used for homogeneous simulations.
SOLVER_UTILS_EXPORT void SetTimeStep(const NekDouble timestep)
SOLVER_UTILS_EXPORT int GetNcoeffs()
int m_nchk
Number of checkpoints written so far.
SOLVER_UTILS_EXPORT LibUtilities::SessionReaderSharedPtr GetSession()
Get Session name.
SOLVER_UTILS_EXPORT void SetInfoSteps(int num)
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
SOLVER_UTILS_EXPORT void CopyFromPhysField(const int i, Array< OneD, NekDouble > &output)
virtual SOLVER_UTILS_EXPORT void v_DoSolve()
Virtual function for solve implementation.
SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr GetPressure()
Get pressure field if available.
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
virtual SOLVER_UTILS_EXPORT Array< OneD, bool > v_GetSystemSingularChecks()
SOLVER_UTILS_EXPORT void SetLambda(NekDouble lambda)
Set parameter m_lambda.
int m_steps
Number of steps to take.
int m_NumQuadPointsError
Number of Quadrature points used to work out the error.
SOLVER_UTILS_EXPORT void PrintProgressbar(const int position, const int goal) const
SOLVER_UTILS_EXPORT EquationSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises EquationSystem class members.
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
SOLVER_UTILS_EXPORT int GetNumExpModes()
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
Pointer to boundary conditions object.
Array< OneD, NekDouble > m_movingFrameData
Moving reference frame status in the inertial frame X, Y, Z, Theta_x, Theta_y, Theta_z,...
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.
NekDouble m_LhomZ
physical length in Z direction (if homogeneous)
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &l)
Virtual function for generating summary information.
bool m_halfMode
Flag to determine if half homogeneous mode is used.
SOLVER_UTILS_EXPORT void FwdTransFields()
int m_checksteps
Number of steps between checkpoints.
SOLVER_UTILS_EXPORT void SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
Initialise the data in the dependent fields.
SOLVER_UTILS_EXPORT void InitObject(bool DeclareField=true)
Initialises the members of this object.
SOLVER_UTILS_EXPORT void CopyToPhysField(const int i, const Array< OneD, const NekDouble > &input)
SOLVER_UTILS_EXPORT int GetCheckpointNumber()
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction(std::string name, const MultiRegions::ExpListSharedPtr &field=MultiRegions::NullExpListSharedPtr, bool cache=false)
Get a SessionFunction by name.
SOLVER_UTILS_EXPORT int GetTotPoints()
virtual SOLVER_UTILS_EXPORT void v_Output(void)
SOLVER_UTILS_EXPORT void SetTime(const NekDouble time)
SOLVER_UTILS_EXPORT NekDouble GetTime()
Return final time.
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys()
Virtual function for transformation to physical space.
SOLVER_UTILS_EXPORT void PrintSummary(std::ostream &out)
Print a summary of parameters and solver characteristics.
std::shared_ptr< FieldIO > FieldIOSharedPtr
Definition: FieldIO.h:322
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:50
int PrintProgressbar(const int position, const int goal, const std::string message, int lastprogress=-1)
Prints a progressbar.
Definition: Progressbar.hpp:65
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55
ProjectionType
Type of Galerkin projection.
static ExpListSharedPtr NullExpListSharedPtr
Definition: ExpList.h:1499
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
LibUtilities::NekFactory< std::string, EquationSystem, const LibUtilities::SessionReaderSharedPtr &, const SpatialDomains::MeshGraphSharedPtr & > EquationSystemFactory
Datatype of the NekFactory used to instantiate classes derived from the EquationSystem class.
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
EquationSystemFactory & GetEquationSystemFactory()
std::shared_ptr< SessionFunction > SessionFunctionSharedPtr
std::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
Definition: Conditions.h:289
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
static Array< OneD, NekDouble > NullNekDouble1DArray
double NekDouble
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825