56 "Refines a prismatic boundary layer.");
62 "Number of layers to refine.");
64 "Number of points in high order elements.");
66 "Tag identifying surface connected to prism.");
68 "Ratio to use in geometry progression.");
80 cout <<
"ProcessBL: Refining prismatic boundary layer..."
84 int nodeId =
m_mesh->m_vertexSet.size();
85 int nl =
m_config[
"layers"].as<
int>();
92 bool ratioIsString =
false;
94 if (
m_config[
"r"].isType<NekDouble>())
100 std::string rstr =
m_config[
"r"].as<
string>();
101 rExprId = rEval.DefineFunction(
"x y z", rstr);
102 ratioIsString =
true;
106 int prismFaceNodes[5][4] = {
107 {0,1,2,3},{0,1,4,-1},{1,2,5,4},{3,2,5,-1},{0,3,5,4}};
114 map<int, int> splitEls;
121 int splitMapEdge[6] = {0,2,4,5,6,7};
122 int splitMapOffset[6][2] = {
127 {nq+nq-1, nq*(nl+1)},
134 int splitEdge[3] = {3,1,8};
139 int edgeVertMap[3][2] = {{0,3}, {1,2}, {4,5}};
143 int edgeOffset[3] = {0, nq-1, nq*(nl+1)*(nq-1)};
149 boost::unordered_map<int, vector<NodeSharedPtr> > edgeMap;
150 boost::unordered_map<int, vector<NodeSharedPtr> >
::iterator eIt;
152 string surf =
m_config[
"surf"].as<
string>();
155 vector<unsigned int> surfs;
157 sort(surfs.begin(), surfs.end());
161 for (
int i = 0; i <
m_mesh->m_element[
m_mesh->m_expDim].size(); ++i)
164 int nSurf = el->GetFaceCount();
166 for (
int j = 0; j < nSurf; ++j)
168 int bl = el->GetBoundaryLink(j);
175 vector<int> tags = bEl->GetTagList();
178 sort(tags.begin(), tags.end());
179 set_intersection(surfs.begin(), surfs.end(),
180 tags .begin(), tags .end(),
181 back_inserter(inter));
183 "Intersection of surfaces wrong");
185 if (inter.size() == 1)
189 cerr <<
"WARNING: Found non-prismatic element "
190 <<
"to split in surface " << surf
191 <<
"; ignoring" << endl;
197 cerr <<
"WARNING: Found quadrilateral face "
198 << j <<
" on surface " << surf
199 <<
" connected to prism; ignoring."
204 if (splitEls.count(el->GetId()) > 0)
206 cerr <<
"WARNING: prism already found; "
207 <<
"ignoring" << endl;
210 splitEls[el->GetId()] = j;
219 for (
int i = 0; i <
m_mesh->m_element[
m_mesh->m_expDim].size(); ++i)
228 splitEls[el->GetId()] = 1;
232 if (splitEls.size() == 0)
234 cerr <<
"WARNING: No elements detected to split." << endl;
240 vector<ElementSharedPtr> el =
m_mesh->m_element[
m_mesh->m_expDim];
244 for (
int i = 0; i < el.size(); ++i)
246 if (splitEls.count(el[i]->GetId()) == 0)
253 std::map<int, int> bLink;
254 for (
int j = 0; j < 5; j += 2)
256 int bl = el[i]->GetBoundaryLink(j);
266 el[i]->GetGeom(
m_mesh->m_spaceDim));
277 int nverts = geom->GetNumVerts();
281 for(
int i = 0; i < nverts; ++i)
283 geom->GetVertex(i)->GetCoords(x1,y1,z1);
284 x += x1; y += y1; z += z1;
289 r = rEval.Evaluate(rExprId,x,y,z,0.0);
310 Array<OneD, NekDouble> x(nq*nq*(nl+1));
311 Array<OneD, NekDouble> y(nq*nq*(nl+1));
312 Array<OneD, NekDouble> z(nq*nq*(nl+1));
315 vector<vector<NodeSharedPtr> > edgeNodes(3);
318 for (
int j = 0; j < 3; ++j)
320 int locEdge = splitEdge[j];
321 int edgeId = el[i]->GetEdge(locEdge)->m_id;
325 eIt = edgeMap.find(edgeId);
327 if (eIt == edgeMap.end())
330 edgeNodes[j].resize(nl+1);
334 edgeNodes[j][0] = el[i]->GetVertex(edgeVertMap[j][0]);
335 edgeNodes[j][nl] = el[i]->GetVertex(edgeVertMap[j][1]);
345 x0 = x[edgeOffset[j]];
346 y0 = y[edgeOffset[j]];
347 z0 = z[edgeOffset[j]];
349 x1 = x[edgeOffset[j]+nl*nq];
350 y1 = y[edgeOffset[j]+nl*nq];
351 z1 = z[edgeOffset[j]+nl*nq];
359 rnew = rEval.Evaluate(rExprId,xm,ym,zm,0.0);
366 const Array<OneD, const NekDouble> z = newP->GetZ();
369 for (
int k = 1; k < nl; ++k)
371 xm = 0.5*(1+z[k])*(x1-x0) + x0;
372 ym = 0.5*(1+z[k])*(y1-y0) + y0;
373 zm = 0.5*(1+z[k])*(z1-z0) + z0;
375 new Node(nodeId++, xm,ym,zm));
381 for (
int k = 1; k < nl; ++k)
383 int pos = edgeOffset[j] + k*nq;
385 new Node(nodeId++, x[pos], y[pos], z[pos]));
390 edgeMap[edgeId] = edgeNodes[j];
394 edgeNodes[j] = eIt->second;
399 for (
int j = 0; j < nl; ++j)
406 vector<NodeSharedPtr> nodeList(6);
407 nodeList[0] = edgeNodes[0][j ];
408 nodeList[1] = edgeNodes[1][j ];
409 nodeList[2] = edgeNodes[1][j+1];
410 nodeList[3] = edgeNodes[0][j+1];
411 nodeList[4] = edgeNodes[2][j ];
412 nodeList[5] = edgeNodes[2][j+1];
421 for (
int l = 0; l < 6; ++l)
425 for (
int k = 1; k < nq-1; ++k)
427 int pos = offset + splitMapOffset[l][0] +
428 k*splitMapOffset[l][1];
429 HOedge->m_edgeNodes.push_back(
431 new Node(nodeId++,x[pos],y[pos],z[pos])));
433 HOedge->m_curveType = pt;
439 for (it = bLink.begin(); it != bLink.end(); ++it)
448 for (
int k = 0; k < 4; ++k)
451 k, nodeList[prismFaceNodes[fid][k]]);
457 vector<NodeSharedPtr> qNodeList(4);
458 for (
int k = 0; k < 4; ++k)
460 qNodeList[k] = nodeList[prismFaceNodes[fid][k]];
463 tagBE =
m_mesh->m_element[
m_mesh->m_expDim-1][bl]->GetTagList();
468 m_mesh->m_element[
m_mesh->m_expDim-1].push_back(boundaryElmt);