Commit b4bf156e authored by Michael Turner's avatar Michael Turner
Browse files

variable bl thickness

parent a8fbc4da
......@@ -128,7 +128,7 @@ void Generator2D::Process()
}
}
//m_mesh->m_element[1].clear();
// m_mesh->m_element[1].clear();
if (m_mesh->m_verbose)
{
......@@ -169,7 +169,8 @@ void Generator2D::MakeBLPrep()
// identify the nodes which will become the boundary layer.
ParseUtils::GenerateSeqVector(m_config["blcurves"].as<string>().c_str(),
m_blCurves);
m_thickness = m_config["blthick"].as<NekDouble>();
m_thickness_ID =
m_thickness.DefineFunction("x y z", m_config["blthick"].as<string>());
for (vector<unsigned>::iterator it = m_blCurves.begin();
it != m_blCurves.end(); ++it)
......@@ -199,7 +200,7 @@ void Generator2D::MakeBL(int faceid, vector<EdgeLoop> e)
int eid = 0;
for (vector<unsigned>::iterator it = m_blCurves.begin();
it != m_blCurves.end(); ++it)
it != m_blCurves.end(); ++it)
{
int edgeo = edgeToOrient[*it];
......@@ -207,17 +208,17 @@ void Generator2D::MakeBL(int faceid, vector<EdgeLoop> e)
// on each !!!EDGE!!! calculate a normal
// always to the left unless edgeo is 1
for(int j = 0; j < es.size(); j++)
for (int j = 0; j < es.size(); j++)
{
es[j]->m_id = eid++;
Array<OneD, NekDouble> p1 = (edgeo == 0) ? es[j]->m_n1->GetLoc()
: es[j]->m_n2->GetLoc();
Array<OneD, NekDouble> p2 = (edgeo == 0) ? es[j]->m_n2->GetLoc()
: es[j]->m_n1->GetLoc();
Array<OneD, NekDouble> p1 =
(edgeo == 0) ? es[j]->m_n1->GetLoc() : es[j]->m_n2->GetLoc();
Array<OneD, NekDouble> p2 =
(edgeo == 0) ? es[j]->m_n2->GetLoc() : es[j]->m_n1->GetLoc();
Array<OneD, NekDouble> n(2);
n[0] = p1[1] - p2[1];
n[1] = p2[0] - p1[0];
NekDouble mag = sqrt(n[0]*n[0]+n[1]*n[1]);
n[0] = p1[1] - p2[1];
n[1] = p2[0] - p1[0];
NekDouble mag = sqrt(n[0] * n[0] + n[1] * n[1]);
n[0] /= mag;
n[1] /= mag;
edgeNormals[es[j]->m_id] = n;
......@@ -226,7 +227,7 @@ void Generator2D::MakeBL(int faceid, vector<EdgeLoop> e)
map<NodeSharedPtr, NodeSharedPtr> nodeNormals;
map<NodeSharedPtr, vector<EdgeSharedPtr> >::iterator it;
for(it = m_nodesToEdge.begin(); it != m_nodesToEdge.end(); it++)
for (it = m_nodesToEdge.begin(); it != m_nodesToEdge.end(); it++)
{
Array<OneD, NekDouble> n(3);
ASSERTL0(it->second.size() == 2,
......@@ -234,39 +235,42 @@ void Generator2D::MakeBL(int faceid, vector<EdgeLoop> e)
Array<OneD, NekDouble> n1 = edgeNormals[it->second[0]->m_id];
Array<OneD, NekDouble> n2 = edgeNormals[it->second[1]->m_id];
n[0] = (n1[0] + n2[0]) / 2.0;
n[1] = (n1[1] + n2[1]) / 2.0;
NekDouble mag = sqrt(n[0]*n[0]+n[1]*n[1]);
n[0] = (n1[0] + n2[0]) / 2.0;
n[1] = (n1[1] + n2[1]) / 2.0;
NekDouble mag = sqrt(n[0] * n[0] + n[1] * n[1]);
n[0] /= mag;
n[1] /= mag;
n[0] = n[0] * m_thickness + it->first->m_x;
n[1] = n[1] * m_thickness + it->first->m_y;
NekDouble t = m_thickness.Evaluate(m_thickness_ID, it->first->m_x,
it->first->m_y, 0.0, 0.0);
n[0] = n[0] * t + it->first->m_x;
n[1] = n[1] * t + it->first->m_y;
n[2] = 0.0;
NodeSharedPtr nn = boost::shared_ptr<Node>(
new Node(m_mesh->m_numNodes++, n[0], n[1], 0.0));
CADSurfSharedPtr s = m_mesh->m_cad->GetSurf(faceid);
Array<OneD, NekDouble> uv = s->locuv(n);
nn->SetCADSurf(faceid,s,uv);
nn->SetCADSurf(faceid, s, uv);
nodeNormals[it->first] = nn;
}
for (vector<unsigned>::iterator it = m_blCurves.begin();
it != m_blCurves.end(); ++it)
it != m_blCurves.end(); ++it)
{
int edgeo = edgeToOrient[*it];
vector<NodeSharedPtr> ns = m_curvemeshes[*it]->GetMeshPoints();
vector<NodeSharedPtr> newNs;
for(int i = 0; i < ns.size(); i++)
for (int i = 0; i < ns.size(); i++)
{
newNs.push_back(nodeNormals[ns[i]]);
}
m_curvemeshes[*it] = MemoryManager<CurveMesh>::AllocateSharedPtr(
*it, m_mesh, newNs);
m_curvemeshes[*it] =
MemoryManager<CurveMesh>::AllocateSharedPtr(*it, m_mesh, newNs);
if(edgeo == 1)
if (edgeo == 1)
{
reverse(ns.begin(), ns.end());
}
......@@ -275,8 +279,8 @@ void Generator2D::MakeBL(int faceid, vector<EdgeLoop> e)
vector<NodeSharedPtr> qns;
qns.push_back(ns[i]);
qns.push_back(ns[i+1]);
qns.push_back(nodeNormals[ns[i+1]]);
qns.push_back(ns[i + 1]);
qns.push_back(nodeNormals[ns[i + 1]]);
qns.push_back(nodeNormals[ns[i]]);
ElmtConfig conf(LibUtilities::eQuadrilateral, 1, false, false);
......@@ -291,7 +295,7 @@ void Generator2D::MakeBL(int faceid, vector<EdgeLoop> e)
for (int j = 0; j < E->GetEdgeCount(); ++j)
{
pair<EdgeSet::iterator,bool> testIns;
pair<EdgeSet::iterator, bool> testIns;
EdgeSharedPtr ed = E->GetEdge(j);
// look for edge in m_mesh edgeset from curves
EdgeSet::iterator s = m_mesh->m_edgeSet.find(ed);
......
......@@ -40,6 +40,8 @@
#include <NekMeshUtils/SurfaceMeshing/CurveMesh.h>
#include <NekMeshUtils/SurfaceMeshing/FaceMesh.h>
#include <LibUtilities/Interpreter/AnalyticExpressionEvaluator.hpp>
namespace Nektar
{
namespace NekMeshUtils
......@@ -76,7 +78,8 @@ private:
std::map<int, CurveMeshSharedPtr> m_curvemeshes;
std::vector<unsigned int> m_blCurves;
NekDouble m_thickness;
LibUtilities::AnalyticExpressionEvaluator m_thickness;
int m_thickness_ID;
std::map<NodeSharedPtr, std::vector<EdgeSharedPtr> > m_nodesToEdge;
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment