[Gmsh] Fields and Volume
Jeremy Theler
jeremy at seamplex.com
Thu Jun 15 17:00:05 CEST 2017
It is in appendix B.3:
http://gmsh.info/doc/texinfo/gmsh.html#Mesh-options-list
On Thu, 2017-06-15 at 15:49 +0200, Vincent HUBER wrote:
> Hello Guillaume,
>
>
> Thank you for your answer.
> I'm a bit confused : I do not find this option in the doc
> http://gmsh.info/doc/texinfo/gmsh.html
>
> Moreover, Gmsh complains when loading the geo file.
>
>
> Where have you seen this option ?
>
>
> All the best,
>
>
> VH.
>
> 2017-06-15 15:34 GMT+02:00 DILASSER Guillaume
> <Guillaume.DILASSER at cea.fr>:
> Hi Vincent,
>
>
>
> I think you can simply add the statement
> “Mesh.CharacteristicLengthFromBoundary = 0 ;” somewhere in the
> script of your first model to solve the issue. This will force
> Gmsh not to use the characteristic length of the surface mesh
> when computing the volume mesh, but instead only rely on the
> fields you provide. Let me know if it worked,
>
>
>
> Sincerely Yours,
>
>
>
> Guillaume DILASSER
>
> Doctorant SACM / LEAS
>
> CEA - Centre de Saclay - Bât.123 - PC 319c
>
> 91191 Gif sur Yvette Cedex - France -
>
>
>
> guillaume.dilasser at cea.fr
>
>
>
>
>
> De : gmsh [mailto:gmsh-bounces at ace20.montefiore.ulg.ac.be] De
> la part de Vincent HUBER
> Envoyé : mercredi 14 juin 2017 15:26
> À : gmsh at onelab.info
> Objet : [Gmsh] Fields and Volume
>
>
>
> Hello everyone,
>
> I work with Gmsh 3.0.2
>
> I have a cylinder inside a cube.
> I want to refine the boundary of the cylinder.
>
> To do so, I use a combination of MathEval fields.
> If I declare the cylinder as a volume, it is meshed with very
> small elements.
> If I do not declare the cylinder as a volume, only the region
> near the interface is correctly meshed.
>
> How can I have both :
>
> · the cylinder as a volume
>
> · the reffinement near the interface ?
>
> With the cylinder as a volume
>
> h=0.1;
> x=1;
> y=1;
> z=1;
> ratio = 3.;
> radius=Sqrt(2.*(x/ratio)^2);
> distance=h;
> p0 = newp; Point(p0) = {0,0,0,50*h};
> pc = newp; Point(pc) = {0,0,-z,h};
> p1 = newp; Point(p1) = {-x,-y,-z,h};
> p2 = newp; Point(p2) = {-x, y,-z,h};
> p3 = newp; Point(p3) = { x, y,-z,h};
> p4 = newp; Point(p4) = { x,-y,-z,h};
>
> r1 = newp; Point(r1) = { 0, radius, -z, h};
> r2 = newp; Point(r2) = { radius, 0, -z, h};
> r3 = newp; Point(r3) = { 0, -radius, -z, h};
> r4 = newp; Point(r4) = {-radius, 0, -z, h};
>
> l1 = newl; Line(l1) = {p1,p2};
> l2 = newl; Line(l2) = {p2,p3};
> l3 = newl; Line(l3) = {p3,p4};
> l4 = newl; Line(l4) = {p4,p1};
>
> c1 = newl; Circle(c1) = {r1,pc,r2};
> c2 = newl; Circle(c2) = {r2,pc,r3};
> c3 = newl; Circle(c3) = {r3,pc,r4};
> c4 = newl; Circle(c4) = {r4,pc,r1};
>
> outer = newll; Line Loop(outer) = {l1,l2,l3,l4};
> inner = newll; Line Loop(inner) = {c1,c2,c3,c4};
> s1 = news; Plane Surface(s1) = {outer,-inner};
> s2 = news; Plane Surface(s2) = {inner};
>
> extruded[] = Extrude{0,0,2.*z} {
> Surface{s1,s2};
> };
>
> Physical Point("center") = {p0};
>
> Physical Volume("Omega1") = {extruded[1]};
> Physical Volume("Omega2") = {extruded[11]};
>
> Field[1] = MathEval;
> Field[1].F = Sprintf("(Fabs(%g-Sqrt(x*x+y*y)))+%g/5",radius,h);
> Field[2] = MathEval;
> Field[2].F = "0.1";
> Field[3] = Min;
> Field[3].FieldsList = {1,2};
> Background Field = 3;
>
> With the reffinement I target
>
> h=0.1;
> x=1;
> y=1;
> z=1;
> ratio = 3.;
> radius=Sqrt(2.*(x/ratio)^2);
> distance=h;
> p0 = newp; Point(p0) = {0,0,0,50*h};
> pc = newp; Point(pc) = {0,0,-z,h};
> p1 = newp; Point(p1) = {-x,-y,-z,h};
> p2 = newp; Point(p2) = {-x, y,-z,h};
> p3 = newp; Point(p3) = { x, y,-z,h};
> p4 = newp; Point(p4) = { x,-y,-z,h};
>
> r1 = newp; Point(r1) = { 0, radius, -z, h};
> r2 = newp; Point(r2) = { radius, 0, -z, h};
> r3 = newp; Point(r3) = { 0, -radius, -z, h};
> r4 = newp; Point(r4) = {-radius, 0, -z, h};
>
> l1 = newl; Line(l1) = {p1,p2};
> l2 = newl; Line(l2) = {p2,p3};
> l3 = newl; Line(l3) = {p3,p4};
> l4 = newl; Line(l4) = {p4,p1};
>
> c1 = newl; Circle(c1) = {r1,pc,r2};
> c2 = newl; Circle(c2) = {r2,pc,r3};
> c3 = newl; Circle(c3) = {r3,pc,r4};
> c4 = newl; Circle(c4) = {r4,pc,r1};
>
> outer = newll; Line Loop(outer) = {l1,l2,l3,l4};
> inner = newll; Line Loop(inner) = {c1,c2,c3,c4};
> s1 = news; Plane Surface(s1) = {outer};
> //s2 = news; Plane Surface(s2) = {inner};
>
> extruded[] = Extrude{0,0,2.*z} {
> Surface{s1};
> };
>
> Physical Point("center") = {p0};
>
> Physical Volume("Omega1") = {extruded[1]};
> //Physical Volume("Omega2") = {extruded[11]};
>
> Field[1] = MathEval;
> Field[1].F = Sprintf("(Fabs(%g-Sqrt(x*x+y*y)))+%g/5",radius,h);
> Field[2] = MathEval;
> Field[2].F = "0.1";
> Field[3] = Min;
> Field[3].FieldsList = {1,2};
> Background Field = 3;
>
> All the best,
>
>
>
>
> --
>
> Vincent HUBER
>
>
>
>
>
>
> --
> Vincent HUBER
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh
More information about the gmsh
mailing list