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,
139 const MultiRegions::ExpListSharedPtr &field =
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
159 SOLVER_UTILS_EXPORT inline NekDouble L2Error(unsigned int field,
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.
180 const int n, MultiRegions::ExpListSharedPtr &field,
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 frame of reference velocities
428 /// (u, v, w, omega_x, omega_y, omega_z, a_x, a_y, a_z, domega_x, domega_y,
429 /// domega_z)
431
432 /// Moving frame of reference angles with respect to the
433 // stationary inertial frame
434 // (x, y, z, angle_x, angle_y, angle_y, pivot_x, pivot_y, pivot_z)
436
437 /// Projection matrix for transformation between inertial and moving
438 // frame of reference
439 boost::numeric::ublas::matrix<NekDouble> m_movingFrameProjMat;
440
441 /// Number of Quadrature points used to work out the error
443
444 /// Parameter for homogeneous expansions
446 {
451 };
452
454
455 NekDouble m_LhomX; ///< physical length in X direction (if homogeneous)
456 NekDouble m_LhomY; ///< physical length in Y direction (if homogeneous)
457 NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
458
459 int m_npointsX; ///< number of points in X direction (if homogeneous)
460 int m_npointsY; ///< number of points in Y direction (if homogeneous)
461 int m_npointsZ; ///< number of points in Z direction (if homogeneous)
462
463 int m_HomoDirec; ///< number of homogenous directions
464
465 /// Initialises EquationSystem class members.
469
470 SOLVER_UTILS_EXPORT virtual void v_InitObject(bool DeclareFeld = true);
471
472 /// Virtual function for initialisation implementation.
474 bool dumpInitialConditions = true);
475
476 /// Virtual function for solve implementation.
477 SOLVER_UTILS_EXPORT virtual void v_DoSolve();
478
479 /// Virtual function for the L_inf error computation between fields and a
480 /// given exact solution.
482 unsigned int field,
484
485 /// Virtual function for the L_2 error computation between fields and a
486 /// given exact solution.
488 unsigned int field,
490 bool Normalised = false);
491
492 /// Virtual function for transformation to physical space.
494
495 /// Virtual function for transformation to coefficient space.
497
498 /// Virtual function for generating summary information.
500
502 NekDouble initialtime = 0.0, bool dumpInitialConditions = true,
503 const int domain = 0);
504
506 unsigned int field, Array<OneD, NekDouble> &outfield,
507 const NekDouble time);
508
509 // Ouptut field information
510 SOLVER_UTILS_EXPORT virtual void v_Output(void);
511
512 // Get pressure field if available
514 void);
515
516 /// Virtual function to identify if operator is negated in DoSolve
517 SOLVER_UTILS_EXPORT virtual bool v_NegatedOp(void);
518
520 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
521 std::vector<std::string> &variables);
522
523 static std::string equationSystemTypeLookupIds[];
524 static std::string projectionTypeLookupIds[];
525
526private:
528
529 SOLVER_UTILS_EXPORT void PrintProgressbar(const int position,
530 const int goal) const
531 {
532 LibUtilities::PrintProgressbar(position, goal, "Interpolating");
533 }
534};
535
536/**
537 * This is the second part of the two-phase initialisation process.
538 * Calls to virtual functions will correctly resolve to the derived class
539 * during this phase of the construction.
540 */
541inline void EquationSystem::InitObject(bool DeclareField)
542{
543 v_InitObject(DeclareField);
544}
545
546/**
547 * This allows initialisation of the solver which cannot be completed
548 * during object construction (such as setting of initial conditions).
549 *
550 * Public interface routine to virtual function implementation.
551 */
552inline void EquationSystem::DoInitialise(bool dumpInitialConditions)
553{
554 v_DoInitialise(dumpInitialConditions);
555}
556
557/**
558 * Performs the transformation from coefficient to physical space.
559 *
560 * Public interface routine to virtual function implementation.
561 */
563{
565}
566
567/**
568 * Performs the transformation from physical to coefficient space.
569 *
570 * Public interface routine to virtual function implementation.
571 */
573{
575}
576
577/**
578 * Performs the actual solve.
579 *
580 * Public interface routine to virtual function implementation.
581 */
582inline void EquationSystem::DoSolve(void)
583{
584 v_DoSolve();
585}
586
587/**
588 * Perform output operations after solve.
589 */
590inline void EquationSystem::Output(void)
591{
592 v_Output();
593}
594
595/**
596 * L_inf Error computation
597 * Public interface routine to virtual function implementation.
598 */
600 unsigned int field, const Array<OneD, NekDouble> &exactsoln)
601{
602 return v_LinfError(field, exactsoln);
603}
604
605/**
606 * L_2 Error computation
607 * Public interface routine to virtual function implementation.
608 */
610 unsigned int field, const Array<OneD, NekDouble> &exactsoln,
611 bool Normalised)
612{
613 return v_L2Error(field, exactsoln, Normalised);
614}
615
616/**
617 * Get Pressure field if available
618 */
620{
621 return v_GetPressure();
622}
623
624/**
625 * Append the coefficients and name of variables with solver specific
626 * extra variables
627 *
628 * @param fieldcoeffs Vector with coefficients
629 * @param variables Vector with name of variables
630 */
632 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
633 std::vector<std::string> &variables)
634{
635 v_ExtraFldOutput(fieldcoeffs, variables);
636}
637
638/**
639 * Prints a summary of variables and problem parameters.
640 *
641 * Public interface routine to virtual function implementation.
642 *
643 * @param out The ostream object to write to.
644 */
645inline void EquationSystem::PrintSummary(std::ostream &out)
646{
647 if (m_session->GetComm()->GetRank() == 0)
648 {
649 std::vector<std::pair<std::string, std::string>> vSummary;
650 v_GenerateSummary(vSummary);
651
652 out << "==============================================================="
653 "========"
654 << std::endl
655 << std::flush;
656 for (auto &x : vSummary)
657 {
658 out << "\t";
659 out.width(20);
660 out << x.first << ": " << x.second << std::endl << std::flush;
661 }
662 out << "==============================================================="
663 "========"
664 << std::endl
665 << std::flush;
666 }
667}
668
670{
671 m_lambda = lambda;
672}
673
675 bool dumpInitialConditions,
676 const int domain)
677{
678 v_SetInitialConditions(initialtime, dumpInitialConditions, domain);
679}
680
681/// Evaluates an exact solution
683 int field, Array<OneD, NekDouble> &outfield, const NekDouble time)
684{
685 v_EvaluateExactSolution(field, outfield, time);
686}
687
688/// Identify if operator is negated in DoSolve
690{
691 return v_NegatedOp();
692}
693
696{
697 return m_fields;
698}
699
700/// Return time
702{
703 return m_time;
704}
705
707{
708 return m_fields[0]->GetNcoeffs();
709}
710
711inline int EquationSystem::GetNcoeffs(const int eid)
712{
713 return m_fields[0]->GetNcoeffs(eid);
714}
715
717{
718 return m_graph->GetExpansionInfo()
719 .begin()
720 ->second->m_basisKeyVector[0]
721 .GetNumModes();
722}
723
725{
726 return m_fields[0]->EvalBasisNumModesMaxPerExp();
727}
728
730{
731 return m_session->GetVariables().size();
732}
733
734inline const std::string EquationSystem::GetVariable(unsigned int i)
735{
736 return m_session->GetVariable(i);
737}
738
740{
741 return GetTraceNpoints();
742}
743
745{
746 return m_fields[0]->GetTrace()->GetNpoints();
747}
748
750{
751 return m_fields[0]->GetExpSize();
752}
753
755{
756 return m_fields[0]->GetPhys_Offset(n);
757}
758
760{
761 return m_fields[0]->GetCoeff_Offset(n);
762}
763
765{
766 return m_fields[0]->GetNpoints();
767}
768
770{
771 return m_fields[0]->GetTotPoints(n);
772}
773
775{
776 return m_fields[0]->GetNpoints();
777}
778
780{
781 return m_steps;
782}
783
785{
786 return m_timestep;
787}
788
789inline void EquationSystem::SetSteps(const int steps)
790{
791 m_steps = steps;
792}
793
794inline void EquationSystem::CopyFromPhysField(const int i,
796{
797 Vmath::Vcopy(output.size(), m_fields[i]->GetPhys(), 1, output, 1);
798}
799
801 const int i, const Array<OneD, const NekDouble> &input)
802{
803 Vmath::Vcopy(input.size(), input, 1, m_fields[i]->UpdatePhys(), 1);
804}
805
807{
808 return m_fields[i]->UpdatePhys();
809}
810
811} // namespace SolverUtils
812} // namespace Nektar
813
814#endif
#define SOLVER_UTILS_EXPORT
Provides a generic Factory class.
Definition: NekFactory.hpp:104
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()
boost::numeric::ublas::matrix< NekDouble > m_movingFrameProjMat
Projection matrix for transformation between inertial and moving.
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.
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.
Array< OneD, NekDouble > m_movingFrameVelsxyz
Moving frame of reference velocities (u, v, w, omega_x, omega_y, omega_z, a_x, a_y,...
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 frame of reference angles with respect to the.
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