mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-11 21:50:34 +05:00
Boundary layers with user-defined heights/materials
This commit is contained in:
parent
c8e51c4ebc
commit
7d3041e841
@ -155,6 +155,7 @@ namespace netgen
|
|||||||
int prismlayers = blp.prismlayers;
|
int prismlayers = blp.prismlayers;
|
||||||
double hfirst = blp.hfirst;
|
double hfirst = blp.hfirst;
|
||||||
double growthfactor = blp.growthfactor;
|
double growthfactor = blp.growthfactor;
|
||||||
|
Array<double> heights (blp.heights);
|
||||||
|
|
||||||
bool grow_edges = false; // grow layer at edges
|
bool grow_edges = false; // grow layer at edges
|
||||||
|
|
||||||
@ -179,13 +180,20 @@ namespace netgen
|
|||||||
|
|
||||||
double layerht = hfirst;
|
double layerht = hfirst;
|
||||||
|
|
||||||
if(growthfactor == 1)
|
if(heights.Size()>0)
|
||||||
{
|
{
|
||||||
layerht = layer * hfirst;
|
layerht = heights[layer-1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
layerht = hfirst*(pow(growthfactor,(layer+1)) - 1)/(growthfactor - 1);
|
if(growthfactor == 1)
|
||||||
|
{
|
||||||
|
layerht = layer * hfirst;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layerht = hfirst*(pow(growthfactor,(layer+1)) - 1)/(growthfactor - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "Layer Height = " << layerht << endl;
|
cout << "Layer Height = " << layerht << endl;
|
||||||
@ -510,7 +518,10 @@ namespace netgen
|
|||||||
Element el(types[classify]);
|
Element el(types[classify]);
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
el[i] = nums[vertices[classify][i]];
|
el[i] = nums[vertices[classify][i]];
|
||||||
el.SetIndex(blp.new_matnr);
|
if(blp.new_matnrs.Size() > 0)
|
||||||
|
el.SetIndex(blp.new_matnrs[layer-1]);
|
||||||
|
else
|
||||||
|
el.SetIndex(blp.new_matnr);
|
||||||
// cout << "el = " << el << endl;
|
// cout << "el = " << el << endl;
|
||||||
if (classify != 0)
|
if (classify != 0)
|
||||||
mesh.AddVolumeElement(el);
|
mesh.AddVolumeElement(el);
|
||||||
|
@ -13,6 +13,8 @@ class BoundaryLayerParameters
|
|||||||
public:
|
public:
|
||||||
// parameters by Philippose ..
|
// parameters by Philippose ..
|
||||||
Array<int> surfid;
|
Array<int> surfid;
|
||||||
|
Array<double> heights;
|
||||||
|
Array<double> new_matnrs;
|
||||||
int prismlayers = 1;
|
int prismlayers = 1;
|
||||||
int bulk_matnr = 1;
|
int bulk_matnr = 1;
|
||||||
int new_matnr = 1;
|
int new_matnr = 1;
|
||||||
|
@ -338,6 +338,37 @@ DLL_HEADER void ExportNetgenMeshing()
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
.def ("BoundaryLayer", FunctionPointer
|
.def ("BoundaryLayer", FunctionPointer
|
||||||
|
([](Mesh & self, int bc, bp::list thicknesses, int volnr, bp::list materials)
|
||||||
|
{
|
||||||
|
int n = bp::len(thicknesses);
|
||||||
|
BoundaryLayerParameters blp;
|
||||||
|
|
||||||
|
for (int i = 1; i <= self.GetNFD(); i++)
|
||||||
|
if (self.GetFaceDescriptor(i).BCProperty() == bc)
|
||||||
|
blp.surfid.Append (i);
|
||||||
|
|
||||||
|
cout << "add layer at surfaces: " << blp.surfid << endl;
|
||||||
|
|
||||||
|
blp.prismlayers = n;
|
||||||
|
blp.growthfactor = 1.0;
|
||||||
|
|
||||||
|
// find max domain nr
|
||||||
|
int maxind = 0;
|
||||||
|
for (ElementIndex ei = 0; ei < self.GetNE(); ei++)
|
||||||
|
maxind = max (maxind, self[ei].GetIndex());
|
||||||
|
cout << "maxind = " << maxind << endl;
|
||||||
|
for ( int i=0; i<n; i++ )
|
||||||
|
{
|
||||||
|
blp.heights.Append( bp::extract<double>(thicknesses[i])()) ;
|
||||||
|
blp.new_matnrs.Append( maxind+1+i );
|
||||||
|
self.SetMaterial (maxind+1+i, bp::extract<string>(materials[i])().c_str());
|
||||||
|
}
|
||||||
|
blp.bulk_matnr = volnr;
|
||||||
|
GenerateBoundaryLayer (self, blp);
|
||||||
|
}
|
||||||
|
))
|
||||||
|
|
||||||
|
.def ("BoundaryLayer", FunctionPointer
|
||||||
([](Mesh & self, int bc, double thickness, int volnr, string material)
|
([](Mesh & self, int bc, double thickness, int volnr, string material)
|
||||||
{
|
{
|
||||||
BoundaryLayerParameters blp;
|
BoundaryLayerParameters blp;
|
||||||
|
Loading…
Reference in New Issue
Block a user