Meshing with acute-angled triangles

Hi,
Is there a command in FreeFem++ to build a meshing with “only acute angles” for all elements?. Let us say the constructed triangles are equilateral as an example. I did not find that in the documentation. Can someone helps me with this please?
Thanks a lot.

Hi community again,
Any comment on this kind of meshing?
I have tried to use the command “adapt” with the subroutine “thetamax= minimum corner angle in degrees”. But I have not obtained the desired result.
Your comments are appreciated.

Have you tried adaptmesh with anisomax = 1.0?

Thank you Chris for your fast reply.
I put it as you suggested as follows :

mesh Th=square(2, 2, [x0+(x1-x0)*x, y0+(y1-y0)*y]);
Th = adaptmesh(Th, 1./8., IsMetric=1, anisomax = 1.0, thetamax=60);

However, the mesh is still the same without any change. Is there something else here to be replaced or added?

Hi,
As I am engrossed with this problem, I am just asking if there is any further replies in this regards. I appreciate that.

I would encourage you to check out a dedicated free open-source meshing software like GMSH if you are in need of greater control over the mesh. While FreeFEM is very powerful for adaptive meshing, it does not have as many mesh controls as are available in other, more specialized, meshing softwares.

You can easily interface FreeFEM meshes with GMSH using load "gmsh"

Many thanks for your help

Hi again
I studied Gmsh a bit and successfully exported the Gmsh mesh into freefem++ with mesh format 2. Now, when I run freefem++ I have another problem with the boundary labels of the domain. A message reads " Your set of boundary condition is incompatible with the mesh label" shown to me. How to make them compatible in order to make it run correctly.

Here is the rectangle1 Gmsh commands:
h1 = 0.0625; // Characteristic length of a mesh element
Point(1) = {0, 0, 0, h1}; // Points construction
Point(2) = {0.6, 0, 0, h1};
Point(3) = {0.6, 1, 0, h1};
Point(4) = {0, 1, 0, h1};
Line(1) = {1, 2}; // Lines construction between points
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Curve Loop(1) = {1, 2, 3, 4}; // A Boundary
Plane Surface(1) = {1}; // A Surface consisting of all lines
Physical Surface(1) = {1}; // Setting a label to the Surface
Physical Curve(1) = {1}; // Set a physical tag 1 to Curve (=line) 1
Physical Curve(2) = {2}; // Set a physical tag 2 to Curve (=line) 2
Physical Curve(3) = {3}; // Set a physical tag 3 to Curve (=line) 3
Physical Curve(4) = {4}; // Set a physical tag 4 to Curve (=line) 4

Also, a sketch of the freefem code is given:

func g= 12./(x+y+1.0)^2; //DIRICHELET boundary condition
func c=24; //The function c(x), coefficient of u

// importing two overlapping rectangles
load “gmsh”
mesh Th1 = gmshload(“rectangle1.msh”);
mesh Th2 = gmshload(“rectangle2.msh”);

// plot to see the 2 meshes.
plot(Th1, Th2, cmm=“Th mesh read from GMSH”, wait=true);

//Finite element spaces
fespace Vh1(Th1, P1);
Vh1 uh1, vh1, f1, uold1;

fespace Vh2(Th2, P1);
Vh2 uh2, vh2, f2, uold2;

uold1=0; uold2=0;
for (int n=0; n<=30; n++){
//solve both problems

f1=uold1^2;
solve Schw1(uh1, vh1)
      =int2d(Th1)(dx(uh1)*dx(vh1)+dy(uh1)*dy(vh1))+int2d(Th1)(c*uh1*vh1) 
	   +int2d(Th1)(f1*vh1)-int2d(Th1)(c*uold1*vh1)	  					 
	   +on(1,3,4, uh1=g)+on(2, uh1=max(uold1,uold2));	         					 			  

f2=uold2^2;
solve Schw2(uh2, vh2)
      =int2d(Th2)(dx(uh2)*dx(vh2)+dy(uh2)*dy(vh2))+int2d(Th2)(c*uh2*vh2) 
	   +int2d(Th2)(f2*vh2)-int2d(Th2)(c*uold2*vh2)	   					 
	   +on(1,2,3, uh2=g)+on(4, uh2=max(uold1,uold2));	              				 
uold1=uh1;
uold2=uh2;

};
I appreciate your help.

I am not exactly sure what that message means, but in my experience you can ignore it. You can suppress it with setting verbosity=0.

As mentioned by @aszaboa, you can ignore this as long as your script is behaving normally. See this thread for more info.

I solved the problem as long as i updated the gmsh mesh file. Thank you so much for your support.

One more question if possible.
After exporting the gmsh meshing into freefem environment, is there any command available in freefem allowing me to refine that mesh once again while keeping the same characteristics of meshing.
Thanks.

Are you referring to this?

Thanks Chris. I am trying to implement it in my case. The following is my attempt.

load “gmsh”
mesh Th1 = gmshload(“rectangle1_case3.msh”);
mesh Th2 = gmshload(“rectangle2_case3.msh”);

for (int n=1; n<=nmsh; n++){
// The updated mesh sizes
h1[n]=1./(2.*n+1);
h2[n]=1./(4.*n+1);

Th1 = splitmesh(Th1,h1[n]);
Th2 = splitmesh(Th2,h2[n]);

};

However, I have got the following error!

– Splitmesh 0x10eef5c0 split min: 0 max: 0
mshptg bug in number of points 0 > 0 == max nb points
Error mesh generation in mshptg : err = 1 nb triangles = 0
current line = 73
Assertion fail : (err==0 && nbt !=0)
line :2085, in file …/femlib/fem.cpp
Assertion fail : (err==0 && nbt !=0)
line :2085, in file …/femlib/fem.cpp
err code 6 , mpirank 0

I think the problem is with the mesh size functions. Any help to solve it.

I believe the second argument should be a single integer.

Sorry for the late reply. Do you mean the mesh sizes arguments h1[n] & h2[n]? If they are so, how can I write down them as integers?

Another question, Can I also use the command adaptmesh here to refine the meshs and is there any preventative measurements to apply it?

Sorry, I was thinking of the split argument in trunc. You can find more info about splitmesh and adaptmesh here.