81 m_session->MatchSolverInfo(
"DIFFUSIONADVANCEMENT",
"Explicit",
83 m_session->MatchSolverInfo(
"ADVECTIONADVANCEMENT",
"Explicit",
85 m_session->MatchSolverInfo(
"REACTIONADVANCEMENT",
"Explicit",
89 if (
m_session->DefinesSolverInfo(
"TIMEINTEGRATIONMETHOD"))
93 "TIMEINTEGRATIONMETHOD"));
101 boost::lexical_cast<std::string>(
m_time);
108 LibUtilities::FilterMap::const_iterator x;
110 for (x = f.begin(); x != f.end(); ++x)
137 TimeStability = 2.784;
156 "No CFL control implementation for this time"
157 "integration scheme");
160 return TimeStability;
173 int nfields =
m_fields.num_elements();
177 for (i = 0; i < nfields; ++i)
181 nvariables = nfields;
191 for(i = 0; i < nfields; ++i)
205 for(i = 0; i < nvariables; ++i)
227 "Final condition not unique: "
228 "fintime > 0.0 and Nsteps > 0");
232 "Timestep not unique: timestep > 0.0 & CFL > 0.0");
239 "Only one of IO_CheckTime and IO_CheckSteps "
243 bool doCheckTime =
false;
289 if (
m_session->GetComm()->GetRank() == 0 &&
292 cout <<
"Steps: " << setw(8) << left << step+1 <<
" "
293 <<
"Time: " << setw(12) << left <<
m_time;
297 cout <<
" Time-step: " << setw(12)
302 ss << cpuTime <<
"s";
303 cout <<
" CPU Time: " << setw(8) << left
309 for (i = 0; i < nvariables; ++i)
337 vector<bool> transformed(nfields,
false);
338 for(i = 0; i < nfields; i++)
346 transformed[i] =
true;
350 for(i = 0; i < nfields; i++)
374 if (
m_session->GetComm()->GetRank() == 0)
382 if (
m_session->GetSolverInfo(
"Driver") !=
"SteadyState")
384 cout <<
"Time-integration : " << intTime <<
"s" << endl;
391 for(i = 0; i < nfields; i++)
404 for(i = 0; i < nvariables; ++i)
447 ==
"SteadyAdvectionDiffusionReaction")
476 outfile.open(
"solution1D.txt");
479 outfile << scientific << setw (17) << setprecision(16) << x[i]
480 <<
" " << solution1D[0][i] << endl;
482 outfile << endl << endl;
491 "This function is not implemented for this equation.");
500 "This function is not implemented for this equation.");
509 int nvariables =
m_fields.num_elements();
510 int nqvar = uflux.num_elements();
521 for (j = 0; j < nqvar; ++j)
523 for (i = 0; i < nvariables ; ++i)
526 m_fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd);
548 if(
m_fields[0]->GetBndCondExpansions().num_elements())
579 int nvariables =
m_fields.num_elements();
580 int nqvar = qfield.num_elements();
595 for (
int i = 0; i < nvariables; ++i)
598 for (
int j = 0; j < nqvar; ++j)
601 m_fields[i]->GetFwdBwdTracePhys(qfield[j][i],qFwd,qBwd);
625 m_fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd);
632 -1.0 * C11, uterm, 1,
642 if (
m_fields[0]->GetBndCondExpansions().num_elements())
663 if (
m_session->DefinesFunction(
"InitialConditions"))
665 for (
int i = 0; i <
m_fields.num_elements(); ++i)
670 "InitialConditions",
m_session->GetVariable(i));
676 "InitialConditions",
m_session->GetVariable(i));
678 fs::path pfilename(filename);
681 if(fs::is_directory(pfilename))
683 fs::path metafile(
"Info.xml");
684 fs::path fullpath = pfilename / metafile;
715 int i, e, npoints, id1, id2;
718 int nbnd =
m_fields[var]->GetBndCondExpansions().num_elements();
725 m_fields[var]->ExtractTracePhys(physfield, uplus);
726 for (i = 0; i < nbnd; ++i)
730 GetBndCondExpansions()[i]->GetExpSize();
734 m_session->GetFunction(
"InitialConditions", 0);
737 GetBndCondExpansions()[i]->GetNpoints();
744 m_fields[var]->GetBndCondExpansions()[i]->GetCoords(x0,x1,x2);
745 ifunc->Evaluate(x0,x1,x2,time,BDphysics);
748 for (e = 0; e < numBDEdge ; ++e)
752 GetBndCondExpansions()[i]->GetExp(e)->GetNumPoints(0);
755 GetBndCondExpansions()[i]->GetPhys_Offset(e);
759 GetBndCondTraceToGlobalTraceMap(cnt++));
762 if (
m_fields[var]->GetBndConditions()[i]->
767 &penaltyflux[id2], 1);
770 else if ((
m_fields[var]->GetBndConditions()[i])->
775 &penaltyflux[id2], 1);
794 int i, e, npoints, id1, id2;
795 int nbnd =
m_fields[var]->GetBndCondExpansions().num_elements();
802 m_fields[var]->ExtractTracePhys(physfield,qtemp);
804 for (i = 0; i < nbnd; ++i)
807 GetBndCondExpansions()[i]->GetExpSize();
811 m_session->GetFunction(
"InitialConditions", 0);
814 GetBndCondExpansions()[i]->GetNpoints();
821 m_fields[var]->GetBndCondExpansions()[i]->GetCoords(x0,x1,x2);
822 ifunc->Evaluate(x0,x1,x2,time,BDphysics);
825 for (e = 0; e < numBDEdge ; ++e)
828 GetBndCondExpansions()[i]->GetExp(e)->GetNumPoints(0);
831 GetBndCondExpansions()[i]->GetPhys_Offset(e);
835 GetBndCondTraceToGlobalTraceMap(cnt++));
839 if(
m_fields[var]->GetBndConditions()[i]->
845 &penaltyflux[id2], 1);
848 else if((
m_fields[var]->GetBndConditions()[i])->
854 &penaltyflux[id2], 1);
883 ASSERTL0(
false,
"Not defined for this class");
virtual SOLVER_UTILS_EXPORT bool v_SteadyStateCheck(int step)
virtual SOLVER_UTILS_EXPORT void v_DoSolve()
Solves an unsteady problem.
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &l)
Virtual function for generating summary information.
#define ASSERTL0(condition, msg)
bool m_explicitReaction
Indicates if explicit or implicit treatment of reaction is used.
virtual SOLVER_UTILS_EXPORT void v_NumFluxforVector(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
SOLVER_UTILS_EXPORT void CheckForRestartTime(NekDouble &time)
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate(int step)
A base class for describing how to solve specific equations.
bool m_homoInitialFwd
Flag to determine if simulation should start in homogeneous forward transformed state.
Adams-Bashforth Forward multi-step scheme of order 2.
NekDouble m_time
Current time of simulation.
bool m_explicitDiffusion
Indicates if explicit or implicit treatment of diffusion is used.
Runge-Kutta multi-stage scheme 4th order explicit.
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
NekDouble m_timestep
Time step size.
std::vector< std::pair< std::string, std::string > > SummaryList
void WeakPenaltyforVector(const int var, const int dir, const Array< OneD, const NekDouble > &physfield, Array< OneD, NekDouble > &penaltyflux, NekDouble C11, NekDouble time=0.0)
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
virtual SOLVER_UTILS_EXPORT void v_AppendOutput1D(Array< OneD, Array< OneD, NekDouble > > &solution1D)
Print the solution at each solution point in a txt file.
virtual SOLVER_UTILS_EXPORT NekDouble v_GetTimeStep(const Array< OneD, const Array< OneD, NekDouble > > &inarray)
Return the timestep to be used for the next step in the time-marching loop.
NekDouble m_checktime
Time between checkpoints.
const char *const TimeIntegrationMethodMap[]
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator()
Get the maximum timestep estimator for cfl control.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
int m_checksteps
Number of steps between checkpoints.
NekDouble m_fintime
Finish time of the simulation.
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Initialisation object for EquationSystem.
int m_steps
Number of steps to take.
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &s)
Print a summary of time stepping parameters.
static const NekDouble kNekZeroTol
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
bool m_explicitAdvection
Indicates if explicit or implicit treatment of advection is used.
virtual SOLVER_UTILS_EXPORT ~UnsteadySystem()
Destructor.
virtual SOLVER_UTILS_EXPORT bool v_PostIntegrate(int step)
Adams-Bashforth Forward multi-step scheme of order 1.
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
std::vector< std::pair< std::string, FilterParams > > FilterMap
Runge-Kutta multi-stage scheme 2nd order explicit.
int m_spacedim
Spatial dimension (>= expansion dim).
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
std::string PortablePath(const boost::filesystem::path &path)
create portable path on different platforms for boost::filesystem path
TimeIntegrationWrapperFactory & GetTimeIntegrationWrapperFactory()
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Init object for UnsteadySystem class.
SOLVER_UTILS_EXPORT NekDouble GetTimeStep()
NekDouble m_cflSafetyFactor
CFL safety factor (comprise between 0 to 1).
virtual SOLVER_UTILS_EXPORT void v_NumFluxforScalar(const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
boost::shared_ptr< Equation > EquationSharedPtr
SOLVER_UTILS_EXPORT UnsteadySystem(const LibUtilities::SessionReaderSharedPtr &pSession)
Initialises UnsteadySystem class members.
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.
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.
virtual SOLVER_UTILS_EXPORT void v_NumericalFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
Runge-Kutta multi-stage scheme 2nd order explicit.
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT int GetTraceNpoints()
LibUtilities::TimeIntegrationWrapperSharedPtr m_intScheme
Wrapper to the time integration scheme.
LibUtilities::FieldIOSharedPtr m_fld
Field input/output.
FilterFactory & GetFilterFactory()
std::vector< FilterSharedPtr > m_filters
int m_infosteps
Number of time steps between outputting status information.
SOLVER_UTILS_EXPORT void SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
Initialise the data in the dependent fields.
void WeakPenaltyforScalar(const int var, const Array< OneD, const NekDouble > &physfield, Array< OneD, NekDouble > &penaltyflux, NekDouble time=0.0)
NekDouble TimePerTest(unsigned int n)
Returns amount of seconds per iteration in a test with n iterations.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
static FieldMetaDataMap NullFieldMetaDataMap
LibUtilities::TimeIntegrationSolutionSharedPtr m_intSoln
virtual SOLVER_UTILS_EXPORT void v_DoInitialise()
Sets up initial conditions.
enum HomogeneousType m_HomogeneousType
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
std::vector< int > m_intVariables