46 using namespace MultiRegions;
48 string SmoothedProfileMethod::className =
50 "SmoothedProfileMethod", SmoothedProfileMethod::create);
58 SmoothedProfileMethod::SmoothedProfileMethod(
91 SetUpExpansions<ContField>(nvel);
95 SetUpExpansions<DisContField>(nvel);
102 SetUpExpansions<ContField>(nvel);
106 SetUpExpansions<DisContField>(nvel);
115 SetUpExpansions<ContField>(nvel);
119 SetUpExpansions<ContField3DHomogeneous1D>(nvel);
124 SetUpExpansions<ContField3DHomogeneous2D>(nvel);
131 SetUpExpansions<DisContField>(nvel);
135 SetUpExpansions<DisContField3DHomogeneous1D>(nvel);
140 SetUpExpansions<DisContField3DHomogeneous2D>(nvel);
148 "ShapeFunction must be defined in the session file.")
152 int physTot =
m_phi->GetTotPoints();
164 for (
int i = 0; i < nvel; ++i)
189 boost::iequals(timeInt.
method,
"IMEX") && 1 <= timeInt.
order &&
191 "The TimeIntegrationMethod scheme must be IMEX with order '1' to '4'.")
193 switch (timeInt.
order)
214 for (
int i = 0; i <
m_session->GetFilters().size(); ++i)
216 if (boost::iequals(
m_session->GetFilters()[i].first,
"AeroForcesSPM"))
233 "Smoothed Profile Method (SPM)");
268 static_pointer_cast<FilterAeroForcesSPM>(
301 int physTot =
m_fs[0]->GetNpoints();
311 for (
int i = 1; i < nvel; ++i)
357 int physTot =
m_phi->GetNpoints();
372 for (
int i = 0; i < nvel; ++i)
376 if (
m_session->DefinesSolverInfo(
"ForceBoundary") &&
377 boost::iequals(
m_session->GetSolverInfo(
"ForceBoundary"),
"True"))
411 for (
int b = 0; b < BndExp.size(); ++b)
414 if (BndCond[b]->GetBoundaryConditionType() ==
420 for (
int i = 0; i < nvel; ++i)
422 f_s[i] =
m_fs[0]->GetBndCondExpansions()[b]->GetPhys();
426 BndExp[b]->NormVectorIProductWRTBase(f_s, BndExp[b]->UpdatePhys());
484 int nq =
m_phi->GetNpoints();
486 for (
int i = 0; i < nvel; ++i)
495 m_fields[ind]->HomogeneousBwdTrans(fields[i], tmpField);
496 m_fs[i]->HomogeneousBwdTrans(
m_fs[i]->GetPhys(),
497 m_fs[i]->UpdatePhys());
501 tmpField = fields[i];
506 m_fs[i]->UpdatePhys(), 1);
508 m_fs[i]->UpdatePhys(), 1);
514 m_fs[i]->HomogeneousFwdTrans(
m_fs[i]->GetPhys(),
515 m_fs[i]->UpdatePhys());
535 TiXmlElement *functionDef =
function->FirstChildElement();
536 ASSERTL0(functionDef,
"At least one element must be defined in " + funcName)
539 string varName = functionDef->Attribute(
"VAR");
540 while (functionDef && !boost::iequals(varName, elemName))
542 functionDef = functionDef->NextSiblingElement();
543 varName = functionDef->Attribute(
"VAR");
547 "Variable " + elemName +
" must be defined in " + funcName +
".");
551 int err = functionDef->QueryStringAttribute(
"USERDEFINEDTYPE", &attr);
552 bool output = boost::iequals(attr,
"TimeDependent");
554 ASSERTL0((err == TIXML_NO_ATTRIBUTE) || (err == TIXML_SUCCESS && output),
555 "USERDEFINEDTYPE in " + elemName +
556 " must be TimeDependent if defined");
571 TiXmlElement *conds =
m_session->GetElement(
"Nektar/Conditions");
572 TiXmlElement *
function = conds->FirstChildElement(
"FUNCTION");
575 string functionType =
function->Attribute(
"NAME");
576 while (
function && !boost::iequals(functionType, functionName))
578 function =
function->NextSiblingElement(
"FUNCTION");
579 functionType =
function->Attribute(
"NAME");
591 TiXmlElement *child =
function->FirstChildElement();
595 if (boost::iequals(child->ValueStr(),
"F"))
599 int status = child->QueryStringAttribute(
"FILE", &fileName);
601 "An FLD file with the values "
602 "of the phi function has to be supplied.")
603 ASSERTL0(boost::iequals(fileName.substr(fileName.length() - 4),
".fld"),
604 "A valid FLD file must be supplied in the "
605 "'ShapeFunction' field.")
609 std::vector<LibUtilities::FieldDefinitionsSharedPtr> fieldDef;
610 std::vector<std::vector<NekDouble>> fieldData;
614 phiFile->Import(fileName, fieldDef, fieldData, fieldMetaData);
617 ASSERTL0(fieldData.size() == 1,
"Only one field (phi) must be "
618 "defined in the FLD file.")
622 m_phi->ExtractDataToCoeffs(fieldDef[0], fieldData[0], tmp,
623 m_phi->UpdateCoeffs());
#define ASSERTL0(condition, msg)
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
NekDouble m_kinvis
Kinematic viscosity.
ExtrapolateSharedPtr m_extrapolation
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
static std::shared_ptr< FieldIO > CreateForFile(const LibUtilities::SessionReaderSharedPtr session, const std::string &filename)
Construct a FieldIO object for a given input filename.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
void DefineImplicitSolve(FuncPointerT func, ObjectPointerT obj)
void SetUpCorrectionPressure(const Array< OneD, const Array< OneD, NekDouble >> &fields, Array< OneD, Array< OneD, NekDouble >> &Forcing)
Sets the forcing term of the equation for the correction pressure :
bool m_filePhi
Flag indicating that phi was defined in a file.
void SetCorrectionPressureBCs()
Updates the BCs for boundaries with Neumann or periodic BCs in the pressure:
Array< OneD, Array< OneD, NekDouble > > m_up
Velocity of the immersed body(ies)
virtual void v_InitObject(bool DeclareField=true)
Init object for UnsteadySystem class.
std::vector< std::string > m_velName
Vector storing the names of the components of \u_p.
NekDouble m_gamma0
Stiffly-stable scheme coefficient.
int m_forcesFilter
Position of "AeroForcesSPM" filter in 'm_session->GetFilters()'.
virtual ~SmoothedProfileMethod()
Destroy the Smoothed Profile Method object.
void SolveUnsteadyStokesSystem(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time, const NekDouble a_iixDt)
bool m_timeDependentPhi
Flag that is true when phi depends on time.
void UpdatePhiUp(NekDouble time)
Calculates the values of the shape function.
SolverUtils::SessionFunctionSharedPtr m_phiEvaluator
Function that evaluates the values of \Phi.
TiXmlElement * GetFunctionHdl(std::string functionName)
Returns a handle to the requested function. Returns NULL if it does not exist.
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Generates the summary of the current simulation.
void SolveCorrectedVelocity(Array< OneD, Array< OneD, NekDouble >> &Forcing, Array< OneD, Array< OneD, NekDouble >> &fields, NekDouble dt)
Corrects the velocity field so that the IBs are taken into account. Solves the explicit equation:
virtual void v_SolveUnsteadyStokesSystem(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, NekDouble time, NekDouble a_iixDt)
Linear terms due to pressure and visosity are calculated here. After solving the velocity filed witho...
bool m_timeDependentUp
Flag signaling if depends on time.
MultiRegions::ExpListSharedPtr m_pressureP
Correction pressure field for SPM.
bool GetVarTimeDependence(std::string funcName, std::string attrName)
True if the function is timedependent, false otherwise.
Array< OneD, Array< OneD, NekDouble > > m_upPrev
Array< OneD, MultiRegions::ExpListSharedPtr > m_fs
Forcing function 'f_s'.
void UpdateForcing(const Array< OneD, const Array< OneD, NekDouble >> &fields, NekDouble dt)
For a body with a velocity , the force applied to the fluid ensures that the IBC are met:
MultiRegions::ExpListSharedPtr m_phi
Shape function 'phi' as expansion list.
void SolveCorrectionPressure(const Array< OneD, NekDouble > &Forcing)
Solves the Poisson equation for the correction pressure :
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
enum HomogeneousType m_HomogeneousType
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction(std::string name, const MultiRegions::ExpListSharedPtr &field=MultiRegions::NullExpListSharedPtr, bool cache=false)
Get a SessionFunction by name.
Defines a forcing term to be explicitly applied.
Base class for unsteady solvers.
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
std::vector< std::pair< std::string, FilterSharedPtr > > m_filters
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
void SolveUnsteadyStokesSystem(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time, const NekDouble a_iixDt)
Array< OneD, Array< OneD, NekDouble > > m_F
virtual void v_InitObject(bool DeclareField=true)
Init object for UnsteadySystem class.
static void Daxpy(const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: y = alpha x plus y.
std::shared_ptr< FieldIO > FieldIOSharedPtr
std::map< std::string, std::string > FieldMetaDataMap
std::shared_ptr< SessionReader > SessionReaderSharedPtr
MultiRegions::Direction const DirCartesianMap[]
std::vector< std::pair< std::string, std::string > > SummaryList
EquationSystemFactory & GetEquationSystemFactory()
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::map< ConstFactorType, NekDouble > ConstFactorMap
The above copyright notice and this permission notice shall be included.
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.
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 Vvtvm(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)
vvtvm (vector times vector plus vector): z = w*x - y
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
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.