Hi,

we defin the interval [0,1] by

//Mesh

real a=0., b=1.;

mesh Th=square(Nx,1,[a+x*(b-a),y*b/Nx]);

fespace Vh(Th,P2);

My question is how we can define the interval [0,2]?

Regards

Hi,

we defin the interval [0,1] by

//Mesh

real a=0., b=1.;

mesh Th=square(Nx,1,[a+x*(b-a),y*b/Nx]);

fespace Vh(Th,P2);

My question is how we can define the interval [0,2]?

Regards

I think I have contributed to your confusion by giving some incorrect advice in a previous reply:

In 1d the unit interval can be created via the segment function. This segment can be scaled during creation in the standard way. There is also the function BuildMeshL that can be used in combination with the border command.

And as you seem to have fallen back to quasi 1d on a 2d rectangular mesh you can scale the x interval during square creation.

What I have learned from this topic:

I still find it difficult to check node coordinates on the mesh object directly.

A better way seems to be to set up an fespace and project the coordinates on it.

```
load "msh3"
int n = 10;
int b = 2;
// using segment
meshL ThSegment = segment(n, [b*x, 0, 0]);
fespace WhSegment(ThSegment,P1);
WhSegment S = x;
cout << endl << "segment" << endl;
cout << "NELEM\t" << ThSegment.nt << endl;
cout << "NBELEM\t" << ThSegment.nbe << endl;
cout << "NNODE\t" << ThSegment.nv << endl;
cout << "Length\t" << ThSegment.measure << endl;
cout << "x" << endl << S[] << endl;
// using buildmeshL
border interval(t=0., b){x=t;y=0;z=0;};
meshL ThbuildmeshL = buildmeshL(interval(n));
fespace WhbuildmeshL(ThbuildmeshL,P1);
WhSegment B = x;
cout << endl << "buildmeshL" << endl;
cout << "x" << endl << B[] << endl;
// quasiInterval
mesh Thsquare=square(n,1,[x*b,y]);
fespace Whsquare(Thsquare,P1);
Whsquare u=x, v=y;
cout << endl << "square" << endl;
cout << "NELEM\t" << Thsquare.nt << endl;
cout << "NBELEM\t" << Thsquare.nbe << endl;
cout << "NNODE\t" << Thsquare.nv << endl;
cout << "Area\t" << Thsquare.measure << endl;
cout << "x" << endl << u[] << endl;
cout << "y" << endl << v[] << endl;
```

I try with

int Nx=200;

int b=2.;

meshL ThSegment = segment(Nx, [b*x, 0, 0]);

fespace WhSegment(ThSegment,P2);

WhSegment S = x;

But i have this error: meshl does not exist.

What’s the solution? Please

Have a look at the first line:

load “mesh3”