950 for (
int i = 1; i <
m_layer; i++)
952 m_layerT[i] = m_layerT[i - 1] + a * pow(
m_prog, i) *
m_bl;
957 cout <<
"First layer height " << m_layerT[0] << endl;
962 NodeSet::iterator it;
969 for (it =
m_mesh->m_vertexSet.begin(); it !=
m_mesh->m_vertexSet.end();
972 vector<CADSurfSharedPtr> ss = (*it)->GetCADSurfs();
973 vector<unsigned int> surfs;
974 for (
int i = 0; i < ss.size(); i++)
976 surfs.push_back(ss[i]->GetId());
978 sort(surfs.begin(), surfs.end());
979 vector<unsigned int> inter, diff;
982 surfs.end(), back_inserter(inter));
983 set_symmetric_difference(inter.begin(), inter.end(), surfs.begin(),
984 surfs.end(), back_inserter(diff));
987 if (inter.size() > 0)
992 bln->stopped =
false;
1001 ASSERTL0(diff.size() <= 1,
"not setup for curve bl refinement");
1002 symSurfs.insert(diff[0]);
1003 bln->symsurf = diff[0];
1018 for (
int i = 0; i <
m_mesh->m_element[2].size(); i++)
1020 vector<unsigned int>::iterator f =
1022 m_mesh->m_element[2][i]->m_parentCAD->GetId());
1030 vector<NodeSharedPtr> ns =
m_mesh->m_element[2][i]->GetVertexList();
1031 for (
int j = 0; j < ns.size(); j++)
1035 m_mesh->m_element[2][i]->m_parentCAD->GetId());
1039 map<NodeSharedPtr, blInfoSharedPtr>::iterator bit;
1043 bit->second->N =
GetNormal(bit->second->els);
1045 if (
Visability(bit->second->els, bit->second->N) < 0.0)
1047 cerr <<
"failed " << bit->first->m_x <<
" " << bit->first->m_y
1048 <<
" " << bit->first->m_z <<
" " 1049 <<
Visability(bit->second->els, bit->second->N) << endl;
1053 Array<OneD, NekDouble>
loc = bit->first->GetLoc();
1054 for (
int k = 0; k < 3; k++)
1056 loc[k] += bit->second->N[k] * m_layerT[0];
1059 bit->second->pNode = std::shared_ptr<Node>(
1060 new Node(
m_mesh->m_numNodes++, loc[0], loc[1], loc[2]));
1061 bit->second->bl = 0;
1064 m_symSurfs = vector<unsigned int>(symSurfs.begin(), symSurfs.end());
1070 if (!bit->second->onSym)
1075 Array<OneD, NekDouble> loc = bit->second->pNode->GetLoc();
1076 Array<OneD, NekDouble> uv =
1077 m_mesh->m_cad->GetSurf(bit->second->symsurf)->locuv(loc);
1079 Array<OneD, NekDouble> nl =
1080 m_mesh->m_cad->GetSurf(bit->second->symsurf)->P(uv);
1082 Array<OneD, NekDouble> N(3);
1083 N[0] = nl[0] - bit->first->m_x;
1084 N[1] = nl[1] - bit->first->m_y;
1085 N[2] = nl[2] - bit->first->m_z;
1087 NekDouble mag = sqrt(N[0] * N[0] + N[1] * N[1] + N[2] * N[2]);
1093 bit->second->AlignNode(m_layerT[0]);
1101 added.insert(bit->first->m_id);
1102 for (
int i = 0; i < bit->second->els.size(); i++)
1104 vector<NodeSharedPtr> ns = bit->second->els[i]->GetVertexList();
1105 for (
int j = 0; j < ns.size(); j++)
1107 set<int>::iterator t = added.find(ns[j]->
m_id);
1108 if (t == added.end())
1116 for (
int l = 0; l < 10; l++)
1120 if (bit->first->GetNumCADSurf() > 1)
1125 Array<OneD, NekDouble> sumV(3, 0.0);
1126 vector<blInfoSharedPtr> data =
m_nToNInfo[bit->first];
1128 for (
int i = 0; i < data.size(); i++)
1130 NekDouble d = bit->first->Distance(data[i]->oNode);
1132 sumV[0] += data[i]->N[0] / d;
1133 sumV[1] += data[i]->N[1] / d;
1134 sumV[2] += data[i]->N[2] / d;
1140 sqrt(sumV[0] * sumV[0] + sumV[1] * sumV[1] + sumV[2] * sumV[2]);
1145 Array<OneD, NekDouble> N(3);
1147 N[0] = (1.0 - 0.8) * bit->second->N[0] + 0.8 * sumV[0];
1148 N[1] = (1.0 - 0.8) * bit->second->N[1] + 0.8 * sumV[1];
1149 N[2] = (1.0 - 0.8) * bit->second->N[2] + 0.8 * sumV[2];
1151 mag = sqrt(N[0] * N[0] + N[1] * N[1] + N[2] * N[2]);
1157 bit->second->AlignNode(m_layerT[0]);
1175 ASSERTL0(failed == 0,
"some normals failed to generate");
1179 Array<OneD, NekDouble> u1, v1, w1;
1182 LibUtilities::NodalUtilPrism nodalPrism(1, u1, v1, w1);
1184 NekMatrix<NekDouble> Vandermonde = *nodalPrism.GetVandermonde();
1185 NekMatrix<NekDouble> VandermondeI = Vandermonde;
1186 VandermondeI.Invert();
1188 m_deriv[0] = *nodalPrism.GetVandermondeForDeriv(0) * VandermondeI;
1189 m_deriv[1] = *nodalPrism.GetVandermondeForDeriv(1) * VandermondeI;
1190 m_deriv[2] = *nodalPrism.GetVandermondeForDeriv(2) * VandermondeI;
#define ASSERTL0(condition, msg)
Array< OneD, NekDouble > GetNormal(std::vector< ElementSharedPtr > tris)
std::vector< unsigned int > m_symSurfs
list of surfaces to be remeshed due to the boundary layer
MeshSharedPtr m_mesh
mesh object containing surface mesh
NekDouble Visability(std::vector< ElementSharedPtr > tris, Array< OneD, NekDouble > N)
Array< OneD, NekDouble > m_layerT
NekDouble m_bl
thickness of the boundary layer
std::map< NodeSharedPtr, blInfoSharedPtr > m_blData
data structure used to store and develop bl information
NekMatrix< NekDouble > m_deriv[3]
std::shared_ptr< blInfo > blInfoSharedPtr
PointsManagerT & PointsManager(void)
std::map< NodeSharedPtr, std::vector< blInfoSharedPtr > > m_nToNInfo
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
3D electrostatically spaced points on a Prism
std::vector< unsigned int > m_blsurfs
List of surfaces onto which boundary layers are placed.