[Gmsh] hyperbolic-tangent function in a for loop

Sebastian Tietjen Sebastian_Tietjen at web.de
Wed Sep 25 17:16:43 CEST 2019


Dear all,

I try to create a mesh based on a hyperbolic-tangent function. This .geo
file works perfectly in gmsh, however, implementing this in OpenFoam causes
problems. My guess is that OpenFoam does not like how the layer command is
used. I try already couple of stuff to fix it, but it is somehow not
possible.

I would be pleasd about any problem to fix my problem.

Regards

Sebastian Tietjen



SetFactory("OpenCASCADE");
//+
Mesh.RecombineAll=1;
g2=1.5;
g3=1.5;
A3=4;
A1=2;
L2=1/A3;
L3=A3*L2;
L1=A1*L2;
N1=10;//128;
N2=16;//156;
N3=20;//312

//vertical direction - x3 (y)
one[0] = 1;
layer[0] = 0;
For i In {2:N3+1}
one[i] = 1;
X3=g3*(2*(i-1)/N3-1);
layer[i]=(L3/2)*(1+Tanh (X3)/Tanh (g3));
EndFor
//Extrusion part in vertical direction
Point(1) = {0, 0, 0, 1.0};
Extrude {0,L3,0} {
Point{1};
Layers{one[], layer[]}; }
//horizontal direction - x2 (x)
oneX[0] = 1;
layerX[0] = 0;
For j In {2:N2+1}
oneX[j] = 1;
X2=g2*(2*(j-1)/N2-1);
layerX[j]=(L2*4/2)*(1+Tanh (X2)/Tanh (g2));
EndFor
//Extrusion part in 1. vertical direction
Extrude {L2,0,0} {
Line{1};
Layers{oneX[], layerX[]}; }
//+

//+Extrude surface
Extrude {0, 0, L1} {
  Surface{1}; Layers{N1}; Recombine;
}
//+
Transfinite Surface {1};
//+
Physical Surface("Back") = {7};
//+
Physical Surface("Front") = {1};
//+
Physical Surface("HotWall") = {5};
//+
Physical Surface("ColdWall") = {3};
//+
Physical Surface("Top") = {4};
//+
Physical Surface("Bottom") = {6};
//+
Physical Volume("Fluid") = {1};
//+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20190925/97028e6d/attachment.html>


More information about the gmsh mailing list