59 ParamMap::const_iterator it;
62 it = pParams.find(
"OutputFile");
63 if (it == pParams.end())
69 ASSERTL0(it->second.length() > 0,
"Missing parameter 'OutputFile'.");
79 it = pParams.find(
"OutputFrequency");
80 if (it == pParams.end())
91 m_session->MatchSolverInfo(
"Homogeneous",
"1D",
95 it = pParams.find(
"OutputPlane");
96 if (it == pParams.end())
108 it = pParams.find(
"Boundary");
109 ASSERTL0(it != pParams.end(),
"Missing parameter 'Boundary");
110 ASSERTL0(it->second.length() > 0,
"Empty parameter 'Boundary'.");
132 std::string::size_type FirstInd =
134 std::string::size_type LastInd =
138 (std::string(
"Error reading boundary region definition:") +
141 std::string IndString =
146 (std::string(
"Unable to read boundary regions index "
147 "range for FilterAeroForces: ") + IndString).c_str());
151 unsigned int numBoundaryRegions =
152 pFields[0]->GetBndConditions().num_elements();
154 numBoundaryRegions, 0);
157 pFields[0]->GetGraph());
160 SpatialDomains::BoundaryRegionCollection::const_iterator it;
162 for (cnt = 0, it = bregions.begin(); it != bregions.end();
175 if (vComm->GetRank() == 0)
220 int n, cnt, elmtid, nq, offset, nt, boundary;
221 nt = pFields[0]->GetNpoints();
222 int dim = pFields.num_elements()-1;
245 NekDouble Fx,Fy,Fz,Fxp,Fxv,Fyp,Fyv,Fzp,Fzv;
264 for(
int i = 0; i < pFields.num_elements(); ++i)
266 pFields[i]->SetWaveSpace(
false);
267 pFields[i]->BwdTrans(pFields[i]->GetCoeffs(),
268 pFields[i]->UpdatePhys());
269 pFields[i]->SetPhysState(
true);
276 if(vComm->GetColumnComm()->GetRank() == 0)
278 pFields[0]->GetPlane(0)->GetBoundaryToElmtMap(
279 BoundarytoElmtID,BoundarytoTraceID);
280 BndExp = pFields[0]->GetPlane(0)->GetBndCondExpansions();
284 for(cnt = n = 0; n < BndExp.num_elements(); ++n)
288 for(
int i = 0; i < BndExp[n]->GetExpSize();
292 elmtid = BoundarytoElmtID[cnt];
293 elmt = pFields[0]->GetPlane(0)->GetExp(elmtid);
294 nq = elmt->GetTotPoints();
295 offset = pFields[0]->GetPlane(0)->GetPhys_Offset(elmtid);
300 for(
int j = 0; j < dim; ++j)
308 boundary = BoundarytoTraceID[cnt];
311 U = pFields[0]->GetPlane(0)->GetPhys() + offset;
312 V = pFields[1]->GetPlane(0)->GetPhys() + offset;
313 P = pFields[3]->GetPlane(0)->GetPhys() + offset;
316 elmt->PhysDeriv(U,gradU[0],gradU[1]);
317 elmt->PhysDeriv(V,gradV[0],gradV[1]);
320 bc = BndExp[n]->GetExp(i)
329 for(
int j = 0; j < dim; ++j)
343 boundary = BoundarytoTraceID[cnt];
347 elmt->GetEdgePhysVals(boundary,bc,P,Pb);
349 for(
int j = 0; j < dim; ++j)
351 elmt->GetEdgePhysVals(boundary,bc,gradU[j],
353 elmt->GetEdgePhysVals(boundary,bc,gradV[j],
359 = elmt->GetEdgeNormal(boundary);
416 Fxv += bc->Integral(drag_t);
417 Fyv += bc->Integral(lift_t);
419 Fxp += bc->Integral(drag_p);
420 Fyp += bc->Integral(lift_p);
425 cnt += BndExp[n]->GetExpSize();
430 for(
int i = 0; i < pFields.num_elements(); ++i)
432 pFields[i]->SetWaveSpace(
true);
433 pFields[i]->BwdTrans(pFields[i]->GetCoeffs(),
434 pFields[i]->UpdatePhys());
435 pFields[i]->SetPhysState(
false);
441 pFields[0]->GetBoundaryToElmtMap(BoundarytoElmtID,
443 BndExp = pFields[0]->GetBndCondExpansions();
447 for(cnt = n = 0; n < BndExp.num_elements(); ++n)
451 for(
int i = 0; i < BndExp[n]->GetExpSize(); ++i, cnt++)
454 elmtid = BoundarytoElmtID[cnt];
455 elmt = pFields[0]->GetExp(elmtid);
456 nq = elmt->GetTotPoints();
457 offset = pFields[0]->GetPhys_Offset(elmtid);
462 for(
int j = 0; j < dim; ++j)
470 boundary = BoundarytoTraceID[cnt];
473 U = pFields[0]->GetPhys() + offset;
474 V = pFields[1]->GetPhys() + offset;
475 W = pFields[2]->GetPhys() + offset;
476 P = pFields[3]->GetPhys() + offset;
479 elmt->PhysDeriv(U,gradU[0],gradU[1],gradU[2]);
480 elmt->PhysDeriv(V,gradV[0],gradV[1],gradV[2]);
481 elmt->PhysDeriv(W,gradW[0],gradW[1],gradW[2]);
484 bc = BndExp[n]->GetExp(i)
493 for(
int j = 0; j < dim; ++j)
511 boundary = BoundarytoTraceID[cnt];
515 elmt->GetFacePhysVals(boundary,bc,P,Pb);
517 for(
int j = 0; j < dim; ++j)
519 elmt->GetFacePhysVals(boundary,bc,gradU[j],
521 elmt->GetFacePhysVals(boundary,bc,gradV[j],
523 elmt->GetFacePhysVals(boundary,bc,gradW[j],
529 = elmt->GetFaceNormal(boundary);
622 Fxv += bc->Expansion::Integral(drag_t);
623 Fyv += bc->Expansion::Integral(lift_t);
624 Fzv += bc->Expansion::Integral(side_t);
626 Fxp += bc->Expansion::Integral(drag_p);
627 Fyp += bc->Expansion::Integral(lift_p);
628 Fzp += bc->Expansion::Integral(side_p);
633 cnt += BndExp[n]->GetExpSize();
640 pFields[0]->GetBoundaryToElmtMap(BoundarytoElmtID,
642 BndExp = pFields[0]->GetBndCondExpansions();
646 for(cnt = n = 0; n < BndExp.num_elements(); ++n)
650 for(
int i = 0; i < BndExp[n]->GetExpSize(); ++i, cnt++)
653 elmtid = BoundarytoElmtID[cnt];
654 elmt = pFields[0]->GetExp(elmtid);
655 nq = elmt->GetTotPoints();
656 offset = pFields[0]->GetPhys_Offset(elmtid);
658 for(
int j = 0; j < dim; ++j)
664 boundary = BoundarytoTraceID[cnt];
666 U = pFields[0]->GetPhys() + offset;
667 V = pFields[1]->GetPhys() + offset;
668 P = pFields[2]->GetPhys() + offset;
670 elmt->PhysDeriv(U,gradU[0],gradU[1]);
671 elmt->PhysDeriv(V,gradV[0],gradV[1]);
673 bc = BndExp[n]->GetExp(i)
685 boundary = BoundarytoTraceID[cnt];
687 elmt->GetEdgePhysVals(boundary,bc,P,Pb);
689 for(
int j = 0; j < dim; ++j)
696 for(
int j = 0; j < dim; ++j)
698 elmt->GetEdgePhysVals(boundary,bc,gradU[j],
700 elmt->GetEdgePhysVals(boundary,bc,gradV[j],
705 = elmt->GetEdgeNormal(boundary);
729 Fxp += bc->Integral(drag_p);
730 Fyp += bc->Integral(lift_p);
732 Fxv += bc->Integral(drag_t);
733 Fyv += bc->Integral(lift_t);
738 cnt += BndExp[n]->GetExpSize();
758 if (vComm->GetRank() == 0)
796 if (pFields[0]->GetComm()->GetRank() == 0)
std::ofstream m_outputStream
#define ASSERTL0(condition, msg)
virtual bool v_IsTimeDependent()
SOLVER_UTILS_EXPORT FilterAeroForces(const LibUtilities::SessionReaderSharedPtr &pSession, const ParamMap &pParams)
virtual SOLVER_UTILS_EXPORT ~FilterAeroForces()
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
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
vector< bool > m_boundaryRegionIsInList
Determines if a given Boundary Region is in m_boundaryRegionsIdList.
vector< unsigned int > m_boundaryRegionsIdList
ID's of boundary regions where we want the forces.
unsigned int m_outputPlane
plane to take history point from if using a homogeneous1D expansion
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
static bool GenerateSeqVector(const char *const str, std::vector< unsigned int > &vec)
static std::string className
Name of the class.
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
std::string m_BoundaryString
NekDouble Evaluate() const
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
boost::shared_ptr< StdExpansion1D > StdExpansion1DSharedPtr
void Neg(int n, T *x, const int incx)
Negate x = -x.
std::map< std::string, std::string > ParamMap
LibUtilities::SessionReaderSharedPtr m_session
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
unsigned int m_outputFrequency
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
FilterFactory & GetFilterFactory()
const BoundaryRegionCollection & GetBoundaryRegions(void) const
void Zero(int n, T *x, const int incx)
Zero vector.
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
Creates an instance of this class.
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.
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.