Thank you very much Lawrence. This is exactly what I want!

Le lun. 1 juin 2020 20:11, Lawrence Mitchell <wence@gmx.li> a écrit :


On Mon, 1 Jun 2020 at 18:59, Karin&NiKo <niko.karin@gmail.com> wrote:
Dear Colin and David, 

I have been trying things and looking all over the place but I cannot get to do what I would like to. 
So please allow me to come back to you in order to make my question clearer. 
I have a Gmsh 2D mesh where I have defined Physical Surface corresponding to regions having different values of the Lamé's coefficients.  Then I would like to set the values of these coefficients with respect to the names or numbers of the regions in my bilinear form. Said that way, it seems obvious but I couldn't find similar tests or examples.

If you make a dg0 function

V = FunctionSpace(mesh, "DG", 0)
f = Function(V)

You can interpolate onto subsets defined by the physical surface ids:

f.interpolate(valA, subset=mesh.cell_subset(idA))

Etc...


This is rather badly documented sorry.

Lawrence


Thanks for your help.
Nicolas


Le mer. 27 mai 2020 à 09:37, Karin&NiKo <niko.karin@gmail.com> a écrit :
Dear Colin and David, 
Thank you very much. I am trying this.

Le mer. 27 mai 2020 à 09:26, Ham, David A <david.ham@imperial.ac.uk> a écrit :

Dear Nicolas,

 

You can simply use a DG0 Function for each Lame coefficient, and interpolate a spatially varying expression into it. For a case like this where you want a step function in the coefficient, you probably want to use a ufl.conditional (effectively an “if” expression) in the expression you interpolate.

 

Regards,

 

David

 

From: <firedrake-bounces@imperial.ac.uk> on behalf of Karin&NiKo <niko.karin@gmail.com>
Date: Wednesday, 27 May 2020 at 07:31
To: firedrake <firedrake@imperial.ac.uk>
Subject: [firedrake] Bi-material example

 

Dear Firedrakers,

 

I would like to model a bi-material medium. One can think of an elasticity problem where the domain is composed of 2 parts, one being made of steel and the other one of rubber. Then I would like to assign different Lamé coefficients to these parts.

I do not find such an example in Firedrake tests. 

 

Could you please give me some piece of advice?

 

Best regards,

Nicolas

_______________________________________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake