46 using namespace MultiRegions;
48 string SmoothedProfileMethod::className =
50 "SmoothedProfileMethod",
51 SmoothedProfileMethod::create);
59 SmoothedProfileMethod::SmoothedProfileMethod(
94 SetUpExpansions<ContField>(nvel);
98 SetUpExpansions<DisContField>(nvel);
105 SetUpExpansions<ContField>(nvel);
109 SetUpExpansions<DisContField>(nvel);
118 SetUpExpansions<ContField>(nvel);
123 SetUpExpansions<ContField3DHomogeneous1D>(nvel);
130 SetUpExpansions<ContField3DHomogeneous2D>(nvel);
137 SetUpExpansions<DisContField>(nvel);
142 SetUpExpansions<DisContField3DHomogeneous1D>(nvel);
149 SetUpExpansions<DisContField3DHomogeneous2D>(nvel);
157 "ShapeFunction must be defined in the session file.")
161 int physTot =
m_phi->GetTotPoints();
173 for (
int i = 0; i < nvel; ++i)
199 "The TimeIntegrationMethod scheme must be IMEX with order '1' to '4'.")
201 switch (timeInt.
order)
222 for (
int i = 0; i <
m_session->GetFilters().size(); ++i)
224 if (boost::iequals(
m_session->GetFilters()[i].first,
242 "Smoothed Profile Method (SPM)");
280 static_pointer_cast<FilterAeroForcesSPM>(
315 int physTot =
m_fs[0]->GetNpoints();
325 for (
int i = 1; i < nvel; ++i)
373 int physTot =
m_phi->GetNpoints();
392 for (
int i = 0; i < nvel; ++i)
396 if (
m_session->DefinesSolverInfo(
"ForceBoundary") &&
397 boost::iequals(
m_session->GetSolverInfo(
"ForceBoundary"),
432 for (
int b = 0; b < BndExp.size(); ++b)
435 if (BndCond[b]->GetBoundaryConditionType() ==
437 BndCond[b]->GetBoundaryConditionType() ==
442 for (
int i = 0; i < nvel; ++i)
444 f_s[i] =
m_fs[0]->GetBndCondExpansions()[b]->GetPhys();
448 BndExp[b]->NormVectorIProductWRTBase(f_s,
449 BndExp[b]->UpdatePhys());
508 int nq =
m_phi->GetNpoints();
510 for (
int i = 0; i < nvel; ++i)
519 m_fields[ind]->HomogeneousBwdTrans(fields[i], tmpField);
520 m_fs[i]->HomogeneousBwdTrans(
m_fs[i]->GetPhys(),
521 m_fs[i]->UpdatePhys());
525 tmpField = fields[i];
530 m_fs[i]->UpdatePhys(), 1);
532 m_fs[i]->UpdatePhys(), 1);
538 m_fs[i]->HomogeneousFwdTrans(
m_fs[i]->GetPhys(),
539 m_fs[i]->UpdatePhys());
559 TiXmlElement *functionDef =
function->FirstChildElement();
560 ASSERTL0(functionDef,
"At least one element must be defined in " +
564 string varName = functionDef->Attribute(
"VAR");
565 while(functionDef && !boost::iequals(varName, elemName))
567 functionDef = functionDef->NextSiblingElement();
568 varName = functionDef->Attribute(
"VAR");
571 ASSERTL0(functionDef,
"Variable " + elemName +
" must be defined in " +
576 int err = functionDef->QueryStringAttribute(
"USERDEFINEDTYPE", &attr);
577 bool output = boost::iequals(attr,
"TimeDependent");
579 ASSERTL0((err == TIXML_NO_ATTRIBUTE) ||
580 (err == TIXML_SUCCESS && output),
"USERDEFINEDTYPE in " +
581 elemName +
" must be TimeDependent if defined");
596 TiXmlElement *conds =
m_session->GetElement(
"Nektar/Conditions");
597 TiXmlElement *
function = conds->FirstChildElement(
"FUNCTION");
600 string functionType =
function->Attribute(
"NAME");
601 while (
function && !boost::iequals(functionType, functionName))
603 function =
function->NextSiblingElement(
"FUNCTION");
604 functionType =
function->Attribute(
"NAME");
616 TiXmlElement *child =
function->FirstChildElement();
620 if (boost::iequals(child->ValueStr(),
"F"))
624 int status = child->QueryStringAttribute(
"FILE", &fileName);
625 ASSERTL0(status == TIXML_SUCCESS,
"An FLD file with the values "
626 "of the phi function has to be supplied.")
627 ASSERTL0(boost::iequals(fileName.substr(fileName.length()-4),
628 ".fld"),
"A valid FLD file must be supplied in the "
629 "'ShapeFunction' field.")
633 std::vector<LibUtilities::FieldDefinitionsSharedPtr> fieldDef;
634 std::vector<std::vector<NekDouble> > fieldData;
638 phiFile->Import(fileName, fieldDef, fieldData, fieldMetaData);
641 ASSERTL0(fieldData.size() == 1,
"Only one field (phi) must be "
642 "defined in the FLD file.")
646 m_phi->ExtractDataToCoeffs(fieldDef[0], fieldData[0],
647 tmp,
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 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:
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()
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.
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.
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:
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.
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
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, MultiRegions::ExpListSharedPtr > m_fs
Forcing function 'f_s'.
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 :
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 :
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_InitObject()
Init object for UnsteadySystem class.
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
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.