38 #include <boost/algorithm/string.hpp>
57 UnsteadySystem(pSession),
58 AdvectionSystem(pSession),
59 m_subSteppingScheme(false),
60 m_SmoothAdvection(false),
67 AdvectionSystem::v_InitObject();
70 int numfields =
m_fields.num_elements();
71 std::string velids[] = {
"u",
"v",
"w"};
78 for(j = 0; j < numfields; ++j)
81 if(boost::iequals(velids[i], var))
87 ASSERTL0(j != numfields,
"Failed to find field: " + var);
124 for(
int n = 0; n <
m_fields[0]->GetBndConditions().num_elements(); ++n)
126 std::string type =
m_fields[0]->GetBndConditions()[n]->GetUserDefined();
130 ASSERTL0 (boost::iequals(type,
"Wall_Forces") ||
131 boost::iequals(type,
"TimeDependent") ||
132 boost::iequals(type,
"MovingBody") ||
133 boost::iequals(type,
"Radiation") ||
134 boost::iequals(type,
"I") ||
135 boost::iequals(type,
"HOutflow"),
136 "Unknown USERDEFINEDTYPE boundary condition");
142 ASSERTL0(
false,
"Unknown or undefined equation type");
148 std::string vConvectiveType;
153 vConvectiveType =
"NoAdvection";
157 vConvectiveType =
"Convective";
160 vConvectiveType =
"Linearised";
170 vConvectiveType =
m_session->GetTag(
"AdvectiveType");
187 for (i = 0; i <
m_fields.num_elements(); ++i)
195 BndConds =
m_fields[i]->GetBndConditions();
196 BndExp =
m_fields[i]->GetBndCondExpansions();
197 for(
int n = 0; n < BndConds.num_elements(); ++n)
199 if(boost::iequals(BndConds[n]->GetUserDefined(),
"Radiation"))
202 "Radiation boundary condition must be of type Robin <R>");
209 radpts += BndExp[n]->GetTotPoints();
217 for(
int n = 0; n < BndConds.num_elements(); ++n)
219 if(boost::iequals(BndConds[n]->GetUserDefined(),
"Radiation"))
222 int npoints = BndExp[n]->GetNpoints();
228 BndExp[n]->GetCoords(x0,x1,x2);
231 boost::static_pointer_cast<
233 >(BndConds[n])->m_robinPrimitiveCoeff;
236 tmpArray = m_fieldsRadiationFactor[i]+ radpts);
263 ASSERTL1(flux.num_elements() ==
m_velocity.num_elements(),
"Dimension of flux array and velocity array do not match");
265 for(
int j = 0; j < flux.num_elements(); ++j)
296 for(i = 0; i < nDimensions; ++i)
303 for(i = 0; i < numflux.num_elements(); ++i)
306 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd, Bwd);
309 m_fields[i]->GetTrace()->Upwind(Vn, Fwd, Bwd, numflux[i]);
313 Vmath::Vmul(nTracePts, numflux[i], 1, Vn, 1, numflux[i], 1);
325 int nqtot =
m_fields[0]->GetTotPoints();
330 for(i = 0; i < VelDim; ++i)
344 if(wk.num_elements())
346 ASSERTL0(wk.num_elements() >= nqtot*VelDim,
347 "Workspace is not sufficient");
356 velocity, inarray, outarray,
m_time);
366 int nvariables =
m_fields.num_elements();
368 for (i = 0; i < nvariables; ++i)
370 for(n = 0; n <
m_fields[i]->GetBndConditions().num_elements(); ++n)
372 if(
m_fields[i]->GetBndConditions()[n]->IsTimeDependent() ||
373 m_fields[i]->GetBndConditions()[n]->GetUserDefined() ==
377 m_fields[i]->EvaluateBoundaryConditions(time, varName);
397 BndConds =
m_fields[fieldid]->GetBndConditions();
398 BndExp =
m_fields[fieldid]->GetBndCondExpansions();
404 int elmtid,nq,offset, boundary;
408 for(cnt = n = 0; n < BndConds.num_elements(); ++n)
410 std::string type = BndConds[n]->GetUserDefined();
412 if((BndConds[n]->GetBoundaryConditionType() ==
SpatialDomains::eRobin)&&(boost::iequals(type,
"Radiation")))
414 for(i = 0; i < BndExp[n]->GetExpSize(); ++i,cnt++)
417 elmt =
m_fields[fieldid]->GetExp(elmtid);
418 offset =
m_fields[fieldid]->GetPhys_Offset(elmtid);
420 U =
m_fields[fieldid]->UpdatePhys() + offset;
421 Bc = BndExp[n]->GetExp(i);
426 nq = Bc->GetTotPoints();
428 elmt->GetTracePhysVals(boundary,Bc,U,ubc);
433 Bvals = BndExp[n]->UpdateCoeffs()+BndExp[n]->GetCoeff_Offset(i);
435 Bc->IProductWRTBase(ubc,Bvals);
437 cnt1 += BndExp[n]->GetTotPoints();
441 cnt += BndExp[n]->GetExpSize();
464 bool returnval =
false;
469 int ncoeffs =
m_fields[0]->GetNcoeffs();
471 for(
int i = 0; i <
m_fields.num_elements(); ++i)
492 int n_element =
m_fields[0]->GetExpSize();
507 for(
int i = 0; i < 2; ++i)
516 for(
int i = 0; i < n_vel; ++i)
524 for(
int el = 0; el < n_element; ++el)
526 cfl[el] =
m_timestep*(stdVelocity[el] * cLambda *
527 (ExpOrder[el]-1) * (ExpOrder[el]-1));
538 int n_element =
m_fields[0]->GetExpSize();
545 CFL = CFL_loc = cfl[elmtid];
549 elmtid =
m_fields[0]->GetExp(elmtid)->GetGeom()->GetGlobalID();
560 elmtid = elmtid%
m_fields[0]->GetPlane(0)->GetExpSize();
587 if(
m_comm->GetRank() == 0)
589 cout <<
"CFL (zero plane): "<< cfl <<
" (in elmt "
590 << elmtid <<
")" << endl;
598 cout <<
"Reached Steady State to tolerance "
EquationType m_equationType
equation type;
bool m_singleMode
Flag to determine if single homogeneous mode is used.
#define ASSERTL0(condition, msg)
void SetBoundaryConditions(NekDouble time)
time dependent boundary conditions updating
Array< OneD, Array< OneD, int > > m_fieldsBCToTraceID
Mapping from BCs to Elmt Edge IDs.
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
SolverUtils::AdvectionSharedPtr m_advObject
Advection term.
virtual bool v_PreIntegrate(int step)
NekDouble m_time
Current time of simulation.
void SetRadiationBoundaryForcing(int fieldid)
Set Radiation forcing term.
NekDouble m_kinvis
Kinematic viscosity.
bool CalcSteadyState(void)
evaluate steady state
NekDouble m_timestep
Time step size.
bool m_halfMode
Flag to determine if half homogeneous mode is used.
SOLVER_UTILS_EXPORT const Array< OneD, int > GetNumExpModesPerExp()
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
ExtrapolateSharedPtr m_extrapolation
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
SOLVER_UTILS_EXPORT typedef boost::shared_ptr< Forcing > ForcingSharedPtr
A shared pointer to an EquationSystem object.
static SOLVER_UTILS_EXPORT std::vector< ForcingSharedPtr > Load(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields=0)
virtual ~IncNavierStokes()
virtual bool v_PostIntegrate(int step)
int m_nConvectiveFields
Number of fields to be convected;.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
int Imax(int n, const T *x, const int incx)
Return the index of the maximum element in x.
LibUtilities::CommSharedPtr m_comm
Communicator.
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
Array< OneD, Array< OneD, NekDouble > > m_fieldsRadiationFactor
RHS Factor for Radiation Condition.
int m_cflsteps
dump cfl estimate
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
Forcing terms.
NekDouble Evaluate() const
int m_steadyStateSteps
Check for steady state at step interval.
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
Pointer to boundary conditions object.
int m_spacedim
Spatial dimension (>= expansion dim).
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
virtual void v_NumericalFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
T Dot(int n, const T *w, const T *x)
vvtvp (vector times vector times vector): z = w*x*y
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
SOLVER_UTILS_EXPORT int GetNpoints()
void EvaluateAdvectionTerms(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, Array< OneD, NekDouble > &wk=NullNekDouble1DArray)
void AddForcing(const SolverUtils::ForcingSharedPtr &pForce)
Array< OneD, Array< OneD, int > > m_fieldsBCToElmtID
Mapping from BCs to Elmt IDs.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT int GetTraceNpoints()
const std::string kEquationTypeStr[]
int m_infosteps
Number of time steps between outputting status information.
NekDouble m_steadyStateTol
Tolerance to which steady state should be evaluated at.
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
virtual void v_GetFluxVector(const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
LibUtilities::TimeIntegrationSolutionSharedPtr m_intSoln
virtual void v_InitObject()
Init object for UnsteadySystem class.
virtual int v_GetForceDimension()=0
enum HomogeneousType m_HomogeneousType
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.
NekDouble GetCFLEstimate(int &elmtid)
Array< OneD, NekDouble > GetElmtCFLVals(void)
IncNavierStokes(const LibUtilities::SessionReaderSharedPtr &pSession)
Constructor.