Tensor properties by domain (ex : Cijkl) on a single varf

Hi everybody,

I work on a thermoelastic problem but with general elasticity Cijkl. I have 3 domains, but also we could have more. And I wrote

fespace Ph(Th3,P0);

Ph[int] c(37);
for (i=1;i<=6;i++) {
for (j=1;j<=6;j++)
c[(i-1)6+j]=c1(i,j)(region==1)+c2(i,j)(region==2)+c3(i,j)(region==3);
}
where cI(i,j) have been given before as real[int,int].

after I use macro
macro C [[ c[1], c[2], c[3], c[4], c[5], c[6] ],
[ c[7], c[8], c[9], c[10], c[11], c[12] ],
[ c[13], c[14], c[15], c[16], c[17], c[18] ],
[ c[19], c[20], c[21], c[22], c[23], c[24] ],
[ c[25], c[26], c[27], c[28], c[29], c[30] ],
[ c[31], c[32], c[33], c[34], c[35], c[36] ]] // EOM

and then a varf as
varf vK(u,v)=int3d(Th3)( (C*epsilon(u))’ *epsilon(v)) etc ; where epsilon(u) describes strain usual parts.

But my model doesn’t work. And if I replace Ph by real it gives results but I imagine that my domains are not taken into account. Because how a real declaration can take into account a boolean part (region==k)?

So I know I am not very familiar with syntax and I aim to write elegant macro for simplicity but I didn’t achieve it for this general elastic, and then thermoelastic coupled problem.

Could you help me to find the right method to attribute physical properties to many domains (but tensor properties, not only nu or kappa or…) ?

Because I know that I could presumably use 3 varf with a mesh trunc for each domain but I hope a better solution.

Best regards.