How we define a mesh in 1 D

how we define mesh of an interval [a,b] with FreeFem++?

Thank’s in advance

Please read the documentation, section “mesh generation”.

Just some additional remarks:

load "msh3"

int n = 50;

real a = 5;
real b = 15;

meshL Th = Sline(n, [a + (1+1.0/(n-1)) * (b-a) * x, 0, 0]);

for (int i = 0; i < Th.nt; i++)
	cout << i << " " << Th[i][0].x << endl;

Sline seems to leave out the last point, so b is not included. Probably so that several 'Slines ’ can be linked together by simple addition. Sline does not provide a unit interval.

Thus I found that some scaling is required.

Also make sure that you use version 4.7.-1.

Kind regards

1 Like

Thank you so much.

Kind regards