54 const std::map<std::string, std::string> &pParams) :
57 if (pParams.find(
"OutputFile") == pParams.end())
63 ASSERTL0(!(pParams.find(
"OutputFile")->second.empty()),
64 "Missing parameter 'OutputFile'.");
73 if (pParams.find(
"OutputFrequency") == pParams.end())
80 atoi(pParams.find(
"OutputFrequency")->second.c_str());
84 m_session->MatchSolverInfo(
"Homogeneous",
"1D",
89 if (pParams.find(
"OutputPlane") == pParams.end())
96 atoi(pParams.find(
"OutputPlane")->second.c_str());
101 if (pParams.find(
"Boundary") == pParams.end())
103 ASSERTL0(
false,
"Missing parameter 'Boundary'.");
107 ASSERTL0(!(pParams.find(
"Boundary")->second.empty()),
108 "Missing parameter 'Boundary'.");
127 const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
131 std::string::size_type FirstInd =
133 std::string::size_type LastInd =
137 (std::string(
"Error reading boundary region definition:") +
140 std::string IndString =
145 (std::string(
"Unable to read boundary regions index "
146 "range for FilterAeroForces: ") + IndString).c_str());
150 unsigned int numBoundaryRegions =
151 pFields[0]->GetBndConditions().num_elements();
153 numBoundaryRegions, 0);
156 pFields[0]->GetGraph());
159 SpatialDomains::BoundaryRegionCollection::const_iterator it;
161 for (cnt = 0, it = bregions.begin(); it != bregions.end();
174 if (vComm->GetRank() == 0)
210 const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
219 int n, cnt, elmtid, nq, offset, nt, boundary;
220 nt = pFields[0]->GetNpoints();
221 int dim = pFields.num_elements()-1;
224 Array<OneD, int> BoundarytoElmtID;
225 Array<OneD, int> BoundarytoTraceID;
226 Array<OneD, MultiRegions::ExpListSharedPtr> BndExp;
228 Array<OneD, const NekDouble> P(nt);
229 Array<OneD, const NekDouble> U(nt);
230 Array<OneD, const NekDouble> V(nt);
231 Array<OneD, const NekDouble> W(nt);
233 Array<OneD, Array<OneD, NekDouble> > gradU(dim);
234 Array<OneD, Array<OneD, NekDouble> > gradV(dim);
235 Array<OneD, Array<OneD, NekDouble> > gradW(dim);
237 Array<OneD, Array<OneD, NekDouble> > fgradU(dim);
238 Array<OneD, Array<OneD, NekDouble> > fgradV(dim);
239 Array<OneD, Array<OneD, NekDouble> > fgradW(dim);
241 Array<OneD, NekDouble> values;
244 NekDouble Fx,Fy,Fz,Fxp,Fxv,Fyp,Fyv,Fzp,Fzv;
263 for(
int i = 0; i < pFields.num_elements(); ++i)
265 pFields[i]->SetWaveSpace(
false);
266 pFields[i]->BwdTrans(pFields[i]->GetCoeffs(),
267 pFields[i]->UpdatePhys());
268 pFields[i]->SetPhysState(
true);
275 if(vComm->GetColumnComm()->GetRank() == 0)
277 pFields[0]->GetPlane(0)->GetBoundaryToElmtMap(
278 BoundarytoElmtID,BoundarytoTraceID);
279 BndExp = pFields[0]->GetPlane(0)->GetBndCondExpansions();
283 for(cnt = n = 0; n < BndExp.num_elements(); ++n)
287 for(
int i = 0; i < BndExp[n]->GetExpSize();
291 elmtid = BoundarytoElmtID[cnt];
292 elmt = pFields[0]->GetPlane(0)->GetExp(elmtid);
293 nq = elmt->GetTotPoints();
294 offset = pFields[0]->GetPlane(0)->GetPhys_Offset(elmtid);
299 for(
int j = 0; j < dim; ++j)
301 gradU[j] = Array<OneD, NekDouble>(nq,0.0);
302 gradV[j] = Array<OneD, NekDouble>(nq,0.0);
303 gradW[j] = Array<OneD, NekDouble>(nq,0.0);
307 boundary = BoundarytoTraceID[cnt];
310 U = pFields[0]->GetPlane(0)->GetPhys() + offset;
311 V = pFields[1]->GetPlane(0)->GetPhys() + offset;
312 P = pFields[3]->GetPlane(0)->GetPhys() + offset;
315 elmt->PhysDeriv(U,gradU[0],gradU[1]);
316 elmt->PhysDeriv(V,gradV[0],gradV[1]);
319 bc = BndExp[n]->GetExp(i)
326 Array<OneD, NekDouble> Pb(nbc,0.0);
328 for(
int j = 0; j < dim; ++j)
330 fgradU[j] = Array<OneD, NekDouble>(nbc,0.0);
331 fgradV[j] = Array<OneD, NekDouble>(nbc,0.0);
334 Array<OneD, NekDouble> drag_t(nbc,0.0);
335 Array<OneD, NekDouble> lift_t(nbc,0.0);
336 Array<OneD, NekDouble> drag_p(nbc,0.0);
337 Array<OneD, NekDouble> lift_p(nbc,0.0);
338 Array<OneD, NekDouble> temp(nbc,0.0);
339 Array<OneD, NekDouble> temp2(nbc,0.0);
342 boundary = BoundarytoTraceID[cnt];
346 elmt->GetEdgePhysVals(boundary,bc,P,Pb);
348 for(
int j = 0; j < dim; ++j)
350 elmt->GetEdgePhysVals(boundary,bc,gradU[j],
352 elmt->GetEdgePhysVals(boundary,bc,gradV[j],
357 const Array<OneD, Array<OneD, NekDouble> > &normals
358 = elmt->GetEdgeNormal(boundary);
415 Fxv += bc->Integral(drag_t);
416 Fyv += bc->Integral(lift_t);
418 Fxp += bc->Integral(drag_p);
419 Fyp += bc->Integral(lift_p);
424 cnt += BndExp[n]->GetExpSize();
429 for(
int i = 0; i < pFields.num_elements(); ++i)
431 pFields[i]->SetWaveSpace(
true);
432 pFields[i]->BwdTrans(pFields[i]->GetCoeffs(),
433 pFields[i]->UpdatePhys());
434 pFields[i]->SetPhysState(
false);
440 pFields[0]->GetBoundaryToElmtMap(BoundarytoElmtID,
442 BndExp = pFields[0]->GetBndCondExpansions();
446 for(cnt = n = 0; n < BndExp.num_elements(); ++n)
450 for(
int i = 0; i < BndExp[n]->GetExpSize(); ++i, cnt++)
453 elmtid = BoundarytoElmtID[cnt];
454 elmt = pFields[0]->GetExp(elmtid);
455 nq = elmt->GetTotPoints();
456 offset = pFields[0]->GetPhys_Offset(elmtid);
461 for(
int j = 0; j < dim; ++j)
463 gradU[j] = Array<OneD, NekDouble>(nq,0.0);
464 gradV[j] = Array<OneD, NekDouble>(nq,0.0);
465 gradW[j] = Array<OneD, NekDouble>(nq,0.0);
469 boundary = BoundarytoTraceID[cnt];
472 U = pFields[0]->GetPhys() + offset;
473 V = pFields[1]->GetPhys() + offset;
474 W = pFields[2]->GetPhys() + offset;
475 P = pFields[3]->GetPhys() + offset;
478 elmt->PhysDeriv(U,gradU[0],gradU[1],gradU[2]);
479 elmt->PhysDeriv(V,gradV[0],gradV[1],gradV[2]);
480 elmt->PhysDeriv(W,gradW[0],gradW[1],gradW[2]);
483 bc = BndExp[n]->GetExp(i)
490 Array<OneD, NekDouble> Pb(nbc,0.0);
492 for(
int j = 0; j < dim; ++j)
494 fgradU[j] = Array<OneD, NekDouble>(nbc,0.0);
495 fgradV[j] = Array<OneD, NekDouble>(nbc,0.0);
496 fgradW[j] = Array<OneD, NekDouble>(nbc,0.0);
500 Array<OneD, NekDouble> drag_t(nbc,0.0);
501 Array<OneD, NekDouble> lift_t(nbc,0.0);
502 Array<OneD, NekDouble> side_t(nbc,0.0);
503 Array<OneD, NekDouble> drag_p(nbc,0.0);
504 Array<OneD, NekDouble> lift_p(nbc,0.0);
505 Array<OneD, NekDouble> side_p(nbc,0.0);
506 Array<OneD, NekDouble> temp(nbc,0.0);
507 Array<OneD, NekDouble> temp2(nbc,0.0);
510 boundary = BoundarytoTraceID[cnt];
514 elmt->GetFacePhysVals(boundary,bc,P,Pb);
516 for(
int j = 0; j < dim; ++j)
518 elmt->GetFacePhysVals(boundary,bc,gradU[j],
520 elmt->GetFacePhysVals(boundary,bc,gradV[j],
522 elmt->GetFacePhysVals(boundary,bc,gradW[j],
527 const Array<OneD, Array<OneD, NekDouble> > &normals
528 = elmt->GetFaceNormal(boundary);
621 Fxv += bc->Expansion::Integral(drag_t);
622 Fyv += bc->Expansion::Integral(lift_t);
623 Fzv += bc->Expansion::Integral(side_t);
625 Fxp += bc->Expansion::Integral(drag_p);
626 Fyp += bc->Expansion::Integral(lift_p);
627 Fzp += bc->Expansion::Integral(side_p);
632 cnt += BndExp[n]->GetExpSize();
639 pFields[0]->GetBoundaryToElmtMap(BoundarytoElmtID,
641 BndExp = pFields[0]->GetBndCondExpansions();
645 for(cnt = n = 0; n < BndExp.num_elements(); ++n)
649 for(
int i = 0; i < BndExp[n]->GetExpSize(); ++i, cnt++)
652 elmtid = BoundarytoElmtID[cnt];
653 elmt = pFields[0]->GetExp(elmtid);
654 nq = elmt->GetTotPoints();
655 offset = pFields[0]->GetPhys_Offset(elmtid);
657 for(
int j = 0; j < dim; ++j)
659 gradU[j] = Array<OneD, NekDouble>(nq,0.0);
660 gradV[j] = Array<OneD, NekDouble>(nq,0.0);
663 boundary = BoundarytoTraceID[cnt];
665 U = pFields[0]->GetPhys() + offset;
666 V = pFields[1]->GetPhys() + offset;
667 P = pFields[2]->GetPhys() + offset;
669 elmt->PhysDeriv(U,gradU[0],gradU[1]);
670 elmt->PhysDeriv(V,gradV[0],gradV[1]);
672 bc = BndExp[n]->GetExp(i)
676 Array<OneD, NekDouble> Pb(nbc,0.0);
678 Array<OneD, NekDouble> drag_t(nbc,0.0);
679 Array<OneD, NekDouble> lift_t(nbc,0.0);
680 Array<OneD, NekDouble> drag_p(nbc,0.0);
681 Array<OneD, NekDouble> lift_p(nbc,0.0);
682 Array<OneD, NekDouble> temp(nbc,0.0);
684 boundary = BoundarytoTraceID[cnt];
686 elmt->GetEdgePhysVals(boundary,bc,P,Pb);
688 for(
int j = 0; j < dim; ++j)
690 fgradU[j] = Array<OneD, NekDouble>(nbc,0.0);
691 fgradV[j] = Array<OneD, NekDouble>(nbc,0.0);
695 for(
int j = 0; j < dim; ++j)
697 elmt->GetEdgePhysVals(boundary,bc,gradU[j],
699 elmt->GetEdgePhysVals(boundary,bc,gradV[j],
703 const Array<OneD, Array<OneD, NekDouble> > &normals
704 = elmt->GetEdgeNormal(boundary);
728 Fxp += bc->Integral(drag_p);
729 Fyp += bc->Integral(lift_p);
731 Fxv += bc->Integral(drag_t);
732 Fyv += bc->Integral(lift_t);
737 cnt += BndExp[n]->GetExpSize();
757 if (vComm->GetRank() == 0)
792 const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
795 if (pFields[0]->GetComm()->GetRank() == 0)