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 size_t physTot =
m_phi->GetTotPoints();
164 for (
size_t 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 (
size_t 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 boost::ignore_unused(fields);
303 size_t physTot =
m_fs[0]->GetNpoints();
313 for (
size_t i = 1; i < nvel; ++i)
359 size_t physTot =
m_phi->GetNpoints();
374 for (
size_t i = 0; i < nvel; ++i)
378 if (
m_session->DefinesSolverInfo(
"ForceBoundary") &&
379 boost::iequals(
m_session->GetSolverInfo(
"ForceBoundary"),
"True"))
413 for (
size_t b = 0; b < BndExp.size(); ++b)
416 if (BndCond[b]->GetBoundaryConditionType() ==
422 for (
size_t i = 0; i < nvel; ++i)
424 f_s[i] =
m_fs[0]->GetBndCondExpansions()[b]->GetPhys();
428 BndExp[b]->NormVectorIProductWRTBase(f_s, BndExp[b]->UpdatePhys());
486 size_t nq =
m_phi->GetNpoints();
488 for (
size_t i = 0; i < nvel; ++i)
497 m_fields[ind]->HomogeneousBwdTrans(nq, fields[i], tmpField);
498 m_fs[i]->HomogeneousBwdTrans(nq,
m_fs[i]->GetPhys(),
499 m_fs[i]->UpdatePhys());
503 tmpField = fields[i];
508 m_fs[i]->UpdatePhys(), 1);
510 m_fs[i]->UpdatePhys(), 1);
516 m_fs[i]->HomogeneousFwdTrans(nq,
m_fs[i]->GetPhys(),
517 m_fs[i]->UpdatePhys());
537 TiXmlElement *functionDef =
function->FirstChildElement();
538 ASSERTL0(functionDef,
"At least one element must be defined in " + funcName)
541 string varName = functionDef->Attribute(
"VAR");
542 while (functionDef && !boost::iequals(varName, elemName))
544 functionDef = functionDef->NextSiblingElement();
545 varName = functionDef->Attribute(
"VAR");
549 "Variable " + elemName +
" must be defined in " + funcName +
".");
553 int err = functionDef->QueryStringAttribute(
"USERDEFINEDTYPE", &attr);
554 bool output = boost::iequals(attr,
"TimeDependent");
556 ASSERTL0((err == TIXML_NO_ATTRIBUTE) || (err == TIXML_SUCCESS && output),
557 "USERDEFINEDTYPE in " + elemName +
558 " must be TimeDependent if defined");
573 TiXmlElement *conds =
m_session->GetElement(
"Nektar/Conditions");
574 TiXmlElement *
function = conds->FirstChildElement(
"FUNCTION");
577 string functionType =
function->Attribute(
"NAME");
578 while (
function && !boost::iequals(functionType, functionName))
580 function =
function->NextSiblingElement(
"FUNCTION");
581 functionType =
function->Attribute(
"NAME");
593 TiXmlElement *child =
function->FirstChildElement();
597 if (boost::iequals(child->ValueStr(),
"F"))
601 int status = child->QueryStringAttribute(
"FILE", &fileName);
603 "An FLD file with the values "
604 "of the phi function has to be supplied.")
605 ASSERTL0(boost::iequals(fileName.substr(fileName.length() - 4),
".fld"),
606 "A valid FLD file must be supplied in the "
607 "'ShapeFunction' field.")
611 std::vector<LibUtilities::FieldDefinitionsSharedPtr> fieldDef;
612 std::vector<std::vector<NekDouble>> fieldData;
616 phiFile->Import(fileName, fieldDef, fieldData, fieldMetaData);
619 ASSERTL0(fieldData.size() == 1,
"Only one field (phi) must be "
620 "defined in the FLD file.")
624 m_phi->ExtractDataToCoeffs(fieldDef[0], fieldData[0], tmp,
625 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.
virtual void v_GenerateSummary(SolverUtils::SummaryList &s) override
Generates the summary of the current simulation.
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)
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.
virtual void v_InitObject(bool DeclareField=true) override
Init object for UnsteadySystem class.
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.
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) override
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) override
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 minus 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.