Commit 0e9b34f1 authored by Michael Turner's avatar Michael Turner
Browse files

Merge branch 'feature/angled_BL' into 'master'

Adjusted BL thickness in corners.

Only applies to 2D mesher.

See merge request !739
parents 335f8548 f1aad831
Changelog
=========
v4.5.0
------
**NekMesh**:
- Adjust boundary layer thickness in corners in 2D (!739)
v4.4.0
------
**Library**:
......
......@@ -33,6 +33,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <math.h>
#include <NekMeshUtils/2DGenerator/2DGenerator.h>
......@@ -55,6 +56,10 @@ Generator2D::Generator2D(MeshSharedPtr m) : ProcessModule(m)
ConfigOption(false, "", "Generate parallelograms on these curves");
m_config["blthick"] =
ConfigOption(false, "0.0", "Parallelogram layer thickness");
m_config["bltadjust"] =
ConfigOption(false, "2.0", "Boundary layer thickness adjustment");
m_config["adjustblteverywhere"] =
ConfigOption(true, "0", "Adjust thickness everywhere");
}
Generator2D::~Generator2D()
......@@ -130,9 +135,8 @@ void Generator2D::Process()
"Face progress");
}
m_facemeshes[i] =
MemoryManager<FaceMesh>::AllocateSharedPtr(i,m_mesh,
m_curvemeshes, 99+i);
m_facemeshes[i] = MemoryManager<FaceMesh>::AllocateSharedPtr(
i, m_mesh, m_curvemeshes, 99 + i);
m_facemeshes[i]->Mesh();
}
......@@ -242,6 +246,16 @@ void Generator2D::MakeBL(int faceid)
}
}
bool adjust = m_config["bltadjust"].beenSet;
NekDouble divider = m_config["bltadjust"].as<NekDouble>();
bool adjustEverywhere = m_config["adjustblteverywhere"].beenSet;
if (divider < 2.0)
{
WARNINGL1(false, "BndLayerAdjustment too low, corrected to 2.0");
divider = 2.0;
}
map<NodeSharedPtr, NodeSharedPtr> nodeNormals;
map<NodeSharedPtr, vector<EdgeSharedPtr> >::iterator it;
for (it = m_nodesToEdge.begin(); it != m_nodesToEdge.end(); it++)
......@@ -261,6 +275,17 @@ void Generator2D::MakeBL(int faceid)
NekDouble t = m_thickness.Evaluate(m_thickness_ID, it->first->m_x,
it->first->m_y, 0.0, 0.0);
// Adjust thickness according to angle between normals
if (adjust)
{
if (adjustEverywhere || it->first->GetNumCadCurve() > 1)
{
NekDouble angle = acos(n1[0] * n2[0] + n1[1] * n2[1]);
angle = (angle > M_PI) ? 2 * M_PI - angle : angle;
t /= cos(angle / divider);
}
}
n[0] = n[0] * t + it->first->m_x;
n[1] = n[1] * t + it->first->m_y;
n[2] = 0.0;
......
......@@ -206,6 +206,17 @@ void InputMCF::ParseFile(string nm)
it = parameters.find("BndLayerProgression");
m_blprog = it != parameters.end() ? it->second : "2.0";
}
it = parameters.find("BndLayerAdjustment");
if (it != parameters.end())
{
m_adjust = true;
m_adjustment = it->second;
}
else
{
m_adjust = false;
}
}
m_naca = false;
......@@ -234,12 +245,14 @@ void InputMCF::ParseFile(string nm)
}
set<string>::iterator sit;
sit = boolparameters.find("SurfaceOptimiser");
m_surfopti = sit != boolparameters.end();
sit = boolparameters.find("WriteOctree");
m_woct = sit != boolparameters.end();
sit = boolparameters.find("VariationalOptimiser");
m_varopti = sit != boolparameters.end();
sit = boolparameters.find("SurfaceOptimiser");
m_surfopti = sit != boolparameters.end();
sit = boolparameters.find("WriteOctree");
m_woct = sit != boolparameters.end();
sit = boolparameters.find("VariationalOptimiser");
m_varopti = sit != boolparameters.end();
sit = boolparameters.find("BndLayerAdjustEverywhere");
m_adjustall = sit != boolparameters.end();
m_refine = refinement.size() > 0;
if(m_refine)
......@@ -304,6 +317,16 @@ void InputMCF::Process()
{
mods.back()->RegisterConfig("blcurves", m_blsurfs);
mods.back()->RegisterConfig("blthick", m_blthick);
if (m_adjust)
{
mods.back()->RegisterConfig("bltadjust", m_adjustment);
if (m_adjustall)
{
mods.back()->RegisterConfig("adjustblteverywhere", "");
}
}
}
}
else
......
......@@ -63,9 +63,9 @@ public:
private:
std::string m_minDelta, m_maxDelta, m_eps, m_cadfile, m_order,
m_blsurfs, m_blthick, m_blprog, m_bllayers, m_refinement,
m_nacadomain;
m_nacadomain, m_adjustment;
bool m_makeBL, m_surfopti, m_varopti, m_refine, m_woct, m_2D, m_splitBL,
m_naca;
m_naca, m_adjust, m_adjustall;
};
}
......
......@@ -16,6 +16,8 @@
<P PARAM="BndLayerSurfaces" VALUE="5-6" />
<P PARAM="BndLayerThickness" VALUE="0.05" />
<P PARAM="BndLayerAdjustment" VALUE="2.0" />
<P PARAM="Xmin" VALUE="-1.0" />
<P PARAM="Ymin" VALUE="-2.0" />
<P PARAM="Xmax" VALUE="3.0" />
......@@ -24,6 +26,7 @@
</PARAMETERS>
<BOOLPARAMETERS>
<P VALUE="BndLayerAdjustEverywhere" />
</BOOLPARAMETERS>
</MESHING>
......
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