Hi to all,

i have the following mesh and variational problem:

//Rectangle [0 2] x [-1 0]

border b(t=0,1) {x=t; y=-1; label=1;};

border c(t=1,2) {x=t; y=-1; label=2;};

border d(t=-1,0) {x=2; y=t; label=3;};

border e(t=0,1) {x=2-t; y=0; label=4;};

border f(t=0,1) {x=1-t; y=0; label=5;};

border a(t=0,1 ) {x=0 ; y=-t; label=6;};

border g(t=-1,0) {x=1; y=t; label=7;};

mesh Th = buildmesh(a(5)+b(5)+c(5)+d(5)+e(5)+f(5)+g(10));

//TIME-DEPENDENT PROBLEM

fespace Vhh(Th,P1);

fespace Nh(Th,P0);

Vhh u1,u2,v1,v2,uold1,uold2;

real Dt=0.5;

uold1=1e+2;

uold2=1e+2;

problem TIME(u1,u2,v1,v2,solver=sparsesolver,eps=1e-10)=

int2d(Th,qforder=2)(D1*(dx(u1)*dx(v1)+dy(u1) dy(v1)))*uold1

+int2d(Th,qforder=2)(D2(dx(u2)dx(v2)+dy(u2)dy(v2)))

+int2d(Th,qforder=2) (vinv1u1v1/Dt)

-int2d(Th,qforder=2) (vinv1

*v1/Dt)*

+int2d(Th,qforder=2) (vinv2u2

+int2d(Th,qforder=2) (vinv2

*v2/Dt)*

-int2d(Th,qforder=2) (vinv2uold2

-int2d(Th,qforder=2) (vinv2

*v2/Dt)*

+int2d(Th,qforder=2)((Sa1+Ss12)

+int2d(Th,qforder=2)((Sa2+Ss21)

-int2d(Th,qforder=2)(Ss21u2

+int2d(Th,qforder=2)((Sa1+Ss12)

*u1*v1)+int2d(Th,qforder=2)((Sa2+Ss21)

*u2*v2)-int2d(Th,qforder=2)(Ss21

*v1)*

-int2d(Th,qforder=2)(Ss12u1

-int2d(Th,qforder=2)(Ss12

*v2)*

-int2d(Th,qforder=2)(f0v1)

-int2d(Th,qforder=2)(f0

-int2d(Th,qforder=2)(Sf1

*u1*v1+Sf2

*u2*v1)

+on(4,u1=1e-10,u2=1e-10);

//definition of metric “h” wrt u1 or u2

(…)

Th = adaptmesh(Th,h, IsMetric=1, nbvx=800000,hmin=hmin,hmax=hmax);

My goal is refine ONLY the “first” square [0 1]x[-1 0] when i pass the “h” calculated wrt u1, refine ONLY the “second” square [1 2]x[-1 0] when i pass the “h” calculated wrt u2, and of course refine the ENTIRE domain if i calculate “h” as a linear combination of u1 and u2

How can i do this?

Initially i try to split my mesh in 2 mesh like :

Mesh Th1 = \first square;

Mesh Th2 = \second square;

Mesh Th = Th1+Th2;

but the second one [1 2]x[-1 0] gives an error.

Apart from this, i think that the “chi” function could help in this way:

u1=u1*chi(Th1);
u2=u2*chi(Th2);

…but does not work as i expect.

Anyone can give me some tips? Thanks!