69 if (
m_f->m_exp[0]->GetNumElmts() != 0)
71 for (
size_t i = 0; i <
m_f->m_exp.size(); ++i)
73 m_f->m_exp[i]->FillBndCondFromField(
m_f->m_exp[i]->GetCoeffs());
77 int nfields =
m_f->m_variables.size();
80 if (
m_f->m_exp[0]->GetNumElmts() == 0)
88 "Error: Force decomposition for a 1D problem cannot be computed");
92 int nBnds = 0, cnt = 0, Nphi = 0;
93 map<int, int> BndRegionMap;
95 m_f->m_exp[0]->GetGraph());
98 for (
auto &breg_it : bregions)
100 nBnds =
max(nBnds, breg_it.first);
101 BndRegionMap[breg_it.first] = cnt++;
110 std::map<int, std::string> Infophi;
112 Nphi = Infophi.size();
119 std::numeric_limits<NekDouble>::lowest());
121 std::numeric_limits<NekDouble>::lowest());
123 nBnds * Nphi, std::numeric_limits<NekDouble>::lowest());
126 for (
const auto &bit : bregions)
128 int b = BndRegionMap[bit.first];
130 for (
int i = 0; i < nfields; i++)
132 BndExp[i] =
m_f->m_exp[i]->UpdateBndCondExpansion(b);
134 for (
int i = 0; i < nfields; i++)
136 m_f->m_exp[i]->GetBndElmtExpansion(b, BndElmtExp[i]);
140 int nqb = BndExp[0]->GetTotPoints();
146 GetPhi(BndElmtExp, phi, Infophi);
154 norma(nqb, 0.), tmp(nqb, 0.);
157 for (
size_t i = 0; i < bndvalue.size(); ++i)
161 for (
size_t i = 0; i < bndphi.size(); ++i)
166 m_f->m_exp[0]->GetBoundaryNormals(b, normals);
172 for (
size_t i = 0; i < phi.size(); ++i)
174 m_f->m_exp[0]->ExtractElmtToBndPhys(b, phi[i], bndphi[i]);
177 for (
size_t i = 0; i < stress.size(); ++i)
179 m_f->m_exp[0]->ExtractElmtToBndPhys(b, stress[i], bndvalue[i]);
189 friction[i + bit.first *
m_spacedim] = BndExp[i]->Integral(tmp);
194 m_f->m_exp[0]->ExtractElmtToBndPhys(b, lapvel[i], bndvalue[i]);
195 Vmath::Vvtvp(nqb, normals[i], 1, bndvalue[i], 1, normLapVel, 1,
199 for (
int i = 0; i < Nphi; ++i)
201 Vmath::Vmul(nqb, bndphi[i], 1, normLapVel, 1, tmp, 1);
202 vispress[i + bit.first * Nphi] = BndExp[i]->Integral(tmp);
207 m_f->m_exp[0]->ExtractElmtToBndPhys(b, gradp[i], bndvalue[i]);
208 Vmath::Vvtvp(nqb, normals[i], 1, bndvalue[i], 1, normp, 1, normp,
211 Vmath::Vsub(nqb, normLapVel, 1, normp, 1, norma, 1);
212 for (
int i = 0; i < Nphi; ++i)
215 acceleration[i + bit.first * Nphi] = -BndExp[i]->Integral(tmp);
223 if (
m_f->m_comm->TreatAsRankZero())
225 cout <<
"Force decomposition results\n";
226 cout <<
"number of boundaries " << nBnds <<
"\n";
227 cout <<
"space dimension " <<
m_spacedim <<
"\n";
228 cout <<
"number of phi " << Nphi <<
"\n";
229 cout <<
"Friction force (x, y, ...)[" + std::to_string(
m_spacedim) +
230 "] on all boundaries \n FRIC ";
231 for (
const auto f : friction)
236 cout <<
"Visouce pressure force (phi0, phi1, ...)[" +
237 std::to_string(Nphi) +
239 "boundaries \n VISP ";
240 for (
const auto f : vispress)
245 cout <<
"Wall acceleratrion (phi0, phi1, ...)[" + std::to_string(Nphi) +
246 "] on all boundaries "
248 for (
const auto f : acceleration)
const BoundaryRegionCollection & GetBoundaryRegions(void) const
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
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