# [Gmsh] - Use of Matheval field

Alessandro Vicini alessandro.vicini at sitael.com
Wed Nov 16 14:07:58 CET 2016

```I defined a background field using matheval for a cylinder; in this case the field only depends on the distance from the cylinder axis:

Field[1].F = "0.025 + (y*y+z*z)*0.05";

The field can be seen in the attached picture.
The question is: why do I get such mesh size on the lateral surface? The radial size of the mesh looks ok, but the longitudinal size on the lateral surface is much bigger…

A.

Da: gmsh [mailto:gmsh-bounces at ace20.montefiore.ulg.ac.be] Per conto di Tanguy RAFFRAY
Inviato: venerdì 14 ottobre 2016 12.09
A: gmsh at onelab.info
Oggetto: Re: [Gmsh] GMSH - NACA Profile, Boundary Layers and Two level of refinements

Good morning,

Well I figured out by using the extrusion tool.
The problem is there is a superposition of my boundary layers and the rest of the mesh.
Is it possible to make beginning the unstructured grids at the end of the boundary layers ?

I simplified my .geo file to only work on the boundary layers generations.
I saw that on an other conversation :

// remove the volume
//Delete { Volume{1}; }

//extrude the boundary of the foil inwards by 0.05, with 5 layers of elements
Extrude { Surface{-232, -228}; Layers{5, 0.01}; Recombine; }
// NOTE : Create Boundaries outside the airfoil

// create the inner volume
//Surface Loop(159) = {232, 255, 242, 246, 250, 254};
//Volume(160) = {159};

I don’t understand the goal of removing the volume and adding and new one then. And how are chosen the surfaces which are in the Surface Loop?

Please note that I can’t create multiple box (one around the foil to create structured grids, one at the trailing edge and one outside) because I am then using other profiles which do not like that kind of meshing.

Thank you for you help and Thank you for this amazing tool which is GMSH.

Best regards,

——— My Geo File ———
//Define Foil Coordinates (160pts)
Point(1) = { 1.000000, 0.001260, 0.0000000, 0.002};
Point(2) = { 0.993720, 0.002140, 0.0000000, 0.002};
Point(3) = { 0.982780, 0.003650, 0.0000000, 0.002};
Point(4) = { 0.969990, 0.005390, 0.0000000, 0.002};
Point(5) = { 0.955670, 0.007320, 0.0000000, 0.002};
Point(6) = { 0.940260, 0.009340, 0.0000000, 0.002};
Point(7) = { 0.924220, 0.011420, 0.0000000, 0.002};
Point(8) = { 0.907840, 0.013500, 0.0000000, 0.002};
Point(9) = { 0.891280, 0.015560, 0.0000000, 0.002};
Point(10) = { 0.874620, 0.017590, 0.0000000, 0.002};
Point(11) = { 0.857930, 0.019590, 0.0000000, 0.002};
Point(12) = { 0.841200, 0.021550, 0.0000000, 0.002};
Point(13) = { 0.824460, 0.023480, 0.0000000, 0.002};
Point(14) = { 0.807710, 0.025370, 0.0000000, 0.002};
Point(15) = { 0.790950, 0.027230, 0.0000000, 0.002};
Point(16) = { 0.774190, 0.029050, 0.0000000, 0.002};
Point(17) = { 0.757420, 0.030830, 0.0000000, 0.002};
Point(18) = { 0.740660, 0.032570, 0.0000000, 0.002};
Point(19) = { 0.723890, 0.034280, 0.0000000, 0.002};
Point(20) = { 0.707120, 0.035940, 0.0000000, 0.002};
Point(21) = { 0.690350, 0.037570, 0.0000000, 0.002};
Point(22) = { 0.673590, 0.039160, 0.0000000, 0.002};
Point(23) = { 0.656830, 0.040710, 0.0000000, 0.002};
Point(24) = { 0.640080, 0.042210, 0.0000000, 0.002};
Point(25) = { 0.623330, 0.043670, 0.0000000, 0.002};
Point(26) = { 0.606590, 0.045090, 0.0000000, 0.002};
Point(27) = { 0.589870, 0.046460, 0.0000000, 0.002};
Point(28) = { 0.573150, 0.047780, 0.0000000, 0.002};
Point(29) = { 0.556450, 0.049050, 0.0000000, 0.002};
Point(30) = { 0.539760, 0.050270, 0.0000000, 0.002};
Point(31) = { 0.523090, 0.051430, 0.0000000, 0.002};
Point(32) = { 0.506440, 0.052530, 0.0000000, 0.002};
Point(33) = { 0.489800, 0.053570, 0.0000000, 0.002};
Point(34) = { 0.473190, 0.054550, 0.0000000, 0.002};
Point(35) = { 0.456610, 0.055460, 0.0000000, 0.002};
Point(36) = { 0.440040, 0.056310, 0.0000000, 0.002};
Point(37) = { 0.423510, 0.057070, 0.0000000, 0.002};
Point(38) = { 0.407010, 0.057760, 0.0000000, 0.002};
Point(39) = { 0.390550, 0.058370, 0.0000000, 0.002};
Point(40) = { 0.374120, 0.058890, 0.0000000, 0.002};
Point(41) = { 0.357740, 0.059320, 0.0000000, 0.002};
Point(42) = { 0.341400, 0.059650, 0.0000000, 0.002};
Point(43) = { 0.325110, 0.059880, 0.0000000, 0.002};
Point(44) = { 0.308880, 0.060000, 0.0000000, 0.002};
Point(45) = { 0.292720, 0.060010, 0.0000000, 0.002};
Point(46) = { 0.276620, 0.059890, 0.0000000, 0.002};
Point(47) = { 0.260600, 0.059650, 0.0000000, 0.002};
Point(48) = { 0.244670, 0.059270, 0.0000000, 0.002};
Point(49) = { 0.228840, 0.058750, 0.0000000, 0.002};
Point(50) = { 0.213130, 0.058070, 0.0000000, 0.002};
Point(51) = { 0.197550, 0.057230, 0.0000000, 0.002};
Point(52) = { 0.182140, 0.056220, 0.0000000, 0.002};
Point(53) = { 0.166930, 0.055030, 0.0000000, 0.002};
Point(54) = { 0.151960, 0.053650, 0.0000000, 0.002};
Point(55) = { 0.137300, 0.052070, 0.0000000, 0.002};
Point(56) = { 0.123030, 0.050290, 0.0000000, 0.002};
Point(57) = { 0.109290, 0.048320, 0.0000000, 0.002};
Point(58) = { 0.096220, 0.046180, 0.0000000, 0.002};
Point(59) = { 0.083990, 0.043890, 0.0000000, 0.002};
Point(60) = { 0.072780, 0.041500, 0.0000000, 0.002};
Point(61) = { 0.062710, 0.039080, 0.0000000, 0.002};
Point(62) = { 0.053800, 0.036670, 0.0000000, 0.002};
Point(63) = { 0.046030, 0.034310, 0.0000000, 0.002};
Point(64) = { 0.039290, 0.032030, 0.0000000, 0.002};
Point(65) = { 0.033460, 0.029830, 0.0000000, 0.002};
Point(66) = { 0.028400, 0.027710, 0.0000000, 0.002};
Point(67) = { 0.023990, 0.025660, 0.0000000, 0.002};
Point(68) = { 0.020130, 0.023670, 0.0000000, 0.002};
Point(69) = { 0.016740, 0.021730, 0.0000000, 0.002};
Point(70) = { 0.013760, 0.019820, 0.0000000, 0.002};
Point(71) = { 0.011140, 0.017930, 0.0000000, 0.002};
Point(72) = { 0.008830, 0.016060, 0.0000000, 0.002};
Point(73) = { 0.006820, 0.014190, 0.0000000, 0.002};
Point(74) = { 0.005080, 0.012310, 0.0000000, 0.002};
Point(75) = { 0.003600, 0.010410, 0.0000000, 0.002};
Point(76) = { 0.002380, 0.008510, 0.0000000, 0.002};
Point(77) = { 0.001410, 0.006590, 0.0000000, 0.002};
Point(78) = { 0.000700, 0.004670, 0.0000000, 0.002};
Point(79) = { 0.000250, 0.002770, 0.0000000, 0.002};
Point(80) = { 0.000030, 0.000910, 0.0000000, 0.002};
Point(81) = { 0.000030, -0.000910, 0.0000000, 0.002};
Point(82) = { 0.000250, -0.002770, 0.0000000, 0.002};
Point(83) = { 0.000700, -0.004670, 0.0000000, 0.002};
Point(84) = { 0.001410, -0.006590, 0.0000000, 0.002};
Point(85) = { 0.002380, -0.008510, 0.0000000, 0.002};
Point(86) = { 0.003600, -0.010410, 0.0000000, 0.002};
Point(87) = { 0.005080, -0.012310, 0.0000000, 0.002};
Point(88) = { 0.006820, -0.014190, 0.0000000, 0.002};
Point(89) = { 0.008830, -0.016060, 0.0000000, 0.002};
Point(90) = { 0.011140, -0.017930, 0.0000000, 0.002};
Point(91) = { 0.013760, -0.019820, 0.0000000, 0.002};
Point(92) = { 0.016740, -0.021730, 0.0000000, 0.002};
Point(93) = { 0.020130, -0.023670, 0.0000000, 0.002};
Point(94) = { 0.023990, -0.025660, 0.0000000, 0.002};
Point(95) = { 0.028400, -0.027710, 0.0000000, 0.002};
Point(96) = { 0.033460, -0.029830, 0.0000000, 0.002};
Point(97) = { 0.039300, -0.032030, 0.0000000, 0.002};
Point(98) = { 0.046030, -0.034310, 0.0000000, 0.002};
Point(99) = { 0.053800, -0.036670, 0.0000000, 0.002};
Point(100) = { 0.062710, -0.039080, 0.0000000, 0.002};
Point(101) = { 0.072780, -0.041500, 0.0000000, 0.002};
Point(102) = { 0.083990, -0.043890, 0.0000000, 0.002};
Point(103) = { 0.096220, -0.046180, 0.0000000, 0.002};
Point(104) = { 0.109290, -0.048320, 0.0000000, 0.002};
Point(105) = { 0.123030, -0.050290, 0.0000000, 0.002};
Point(106) = { 0.137300, -0.052070, 0.0000000, 0.002};
Point(107) = { 0.151960, -0.053650, 0.0000000, 0.002};
Point(108) = { 0.166930, -0.055030, 0.0000000, 0.002};
Point(109) = { 0.182140, -0.056220, 0.0000000, 0.002};
Point(110) = { 0.197550, -0.057230, 0.0000000, 0.002};
Point(111) = { 0.213130, -0.058070, 0.0000000, 0.002};
Point(112) = { 0.228840, -0.058750, 0.0000000, 0.002};
Point(113) = { 0.244670, -0.059270, 0.0000000, 0.002};
Point(114) = { 0.260600, -0.059650, 0.0000000, 0.002};
Point(115) = { 0.276620, -0.059890, 0.0000000, 0.002};
Point(116) = { 0.292720, -0.060010, 0.0000000, 0.002};
Point(117) = { 0.308880, -0.060000, 0.0000000, 0.002};
Point(118) = { 0.325110, -0.059880, 0.0000000, 0.002};
Point(119) = { 0.341400, -0.059650, 0.0000000, 0.002};
Point(120) = { 0.357740, -0.059320, 0.0000000, 0.002};
Point(121) = { 0.374120, -0.058890, 0.0000000, 0.002};
Point(122) = { 0.390550, -0.058370, 0.0000000, 0.002};
Point(123) = { 0.407010, -0.057760, 0.0000000, 0.002};
Point(124) = { 0.423510, -0.057070, 0.0000000, 0.002};
Point(125) = { 0.440040, -0.056310, 0.0000000, 0.002};
Point(126) = { 0.456610, -0.055460, 0.0000000, 0.002};
Point(127) = { 0.473190, -0.054550, 0.0000000, 0.002};
Point(128) = { 0.489800, -0.053570, 0.0000000, 0.002};
Point(129) = { 0.506440, -0.052530, 0.0000000, 0.002};
Point(130) = { 0.523090, -0.051430, 0.0000000, 0.002};
Point(131) = { 0.539760, -0.050270, 0.0000000, 0.002};
Point(132) = { 0.556450, -0.049050, 0.0000000, 0.002};
Point(133) = { 0.573150, -0.047780, 0.0000000, 0.002};
Point(134) = { 0.589870, -0.046460, 0.0000000, 0.002};
Point(135) = { 0.606590, -0.045090, 0.0000000, 0.002};
Point(136) = { 0.623330, -0.043670, 0.0000000, 0.002};
Point(137) = { 0.640080, -0.042210, 0.0000000, 0.002};
Point(138) = { 0.656830, -0.040710, 0.0000000, 0.002};
Point(139) = { 0.673590, -0.039160, 0.0000000, 0.002};
Point(140) = { 0.690350, -0.037570, 0.0000000, 0.002};
Point(141) = { 0.707120, -0.035940, 0.0000000, 0.002};
Point(142) = { 0.723890, -0.034280, 0.0000000, 0.002};
Point(143) = { 0.740660, -0.032570, 0.0000000, 0.002};
Point(144) = { 0.757420, -0.030830, 0.0000000, 0.002};
Point(145) = { 0.774190, -0.029050, 0.0000000, 0.002};
Point(146) = { 0.790950, -0.027230, 0.0000000, 0.002};
Point(147) = { 0.807710, -0.025370, 0.0000000, 0.002};
Point(148) = { 0.824460, -0.023480, 0.0000000, 0.002};
Point(149) = { 0.841200, -0.021550, 0.0000000, 0.002};
Point(150) = { 0.857930, -0.019590, 0.0000000, 0.002};
Point(151) = { 0.874620, -0.017590, 0.0000000, 0.002};
Point(152) = { 0.891280, -0.015560, 0.0000000, 0.002};
Point(153) = { 0.907840, -0.013500, 0.0000000, 0.002};
Point(154) = { 0.924220, -0.011420, 0.0000000, 0.002};
Point(155) = { 0.940260, -0.009340, 0.0000000, 0.002};
Point(156) = { 0.955670, -0.007320, 0.0000000, 0.002};
Point(157) = { 0.969990, -0.005390, 0.0000000, 0.002};
Point(158) = { 0.982780, -0.003650, 0.0000000, 0.002};
Point(159) = { 0.993720, -0.002140, 0.0000000, 0.002};
Point(160) = { 1.000000, -0.001260, 0.0000000, 0.002};

//Define bounding box corners
Point(1001) = { 6.000000, 3.000000, 0.0000000, 1.0};
Point(1002) = { 6.000000, -3.000000, 0.0000000, 1.0};
Point(1003) = { -3.000000, -3.000000, 0.0000000, 1.0};
Point(1004) = { -3.000000, 3.000000, 0.0000000, 1.0};

//Define bounding box edges
Line(1) = {1001, 1002};
Line(2) = {1002, 1003};
Line(3) = {1003, 1004};
Line(4) = {1004, 1001};

//Define bounding box outer boundary
Line Loop(101) = {1, 2, 3, 4};

//Define foil spline and trailing edge
Spline(5) = {1:160};
Line(6) = {160, 1};

//Define foil boundary
Line Loop(102) = {5, 6};

//Define unstructured far field mesh zone
Plane Surface(201) = {101, 102};

//Extrude unstructured far field mesh
Extrude {0, 0, 1} {
Surface {201};
Layers{1};
Recombine;
}

// remove the volume
//Delete { Volume{1}; }

//extrude the boundary of the foil inwards by 0.05, with 5 layers of elements
Extrude { Surface{-232, -228}; Layers{5, 0.01}; Recombine; }
// NOTE : Create Boundaries outside the airfoil

// create the inner volume
//Surface Loop(159) = {232, 255, 242, 246, 250, 254};
//Volume(160) = {159};

//Define physical surfaces - numeric designations from GUI
Physical Surface("back") = {201};
Physical Surface("front") = {233};
Physical Surface("top") = {224};
Physical Surface("bottom") = {216};
Physical Surface("inlet") = {220};
Physical Surface("outlet") = {212};
Physical Surface("foil") = {228, 232};

//Define physical volumes - numeric designations from GUI
Physical Volume("internal") = {1};

[cid:image001.png at 01D24011.72437190]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20161116/cd48be17/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 39416 bytes
Desc: image001.png
URL: <http://onelab.info/pipermail/gmsh/attachments/20161116/cd48be17/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: field.jpg
Type: image/jpeg
Size: 125789 bytes
Desc: field.jpg
URL: <http://onelab.info/pipermail/gmsh/attachments/20161116/cd48be17/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mesh.jpg
Type: image/jpeg
Size: 295148 bytes
Desc: mesh.jpg
URL: <http://onelab.info/pipermail/gmsh/attachments/20161116/cd48be17/attachment-0003.jpg>
```