Fiber inclusion thermomechanical problem: two materials

Hi,

I have been playing with Fenics during the last week and played around with some of the tutorial problems. My goal is to solve a slightly (?) more complex problem that I have been stuck with during the last 3 days. First of all, I really got and still get confused by Google’s result, as most of them are not valid for Fenics’ current version (I am running DOLFIN2018.1.0 using python3). Partly because of that, I am still very confused when it comes to working with two different materials (Clases with UserExpression?Or should use a material_properties python list? )

The problem I am trying to solve using Fenics (I have results with a commercial FEM software but would love to learn more Fenics too) is the following one: A fiber is included within a matrix (2D), the matrix is initially at T0 = 60C and cools down until Tf = 20. The fiber and matrix have different elastic properties (E, nu) and different Coefficients of Thermal Expansion. The code I have been working with is heavily inspired from https://comet-fenics.readthedocs.io/en/latest/demo/thermoelasticity/thermoelasticity_transient.html

I have stored my current code here: https://gist.github.com/ilyasst/7fcafc757e1f045845ecc9e914a3f79e

I have two main issues that I was not able to solve yet:

  1. I do not know how to set different initial temperatures for each subdomain
  2. I am not able to define different properties for each subdomain (although you will see that I have tried implementing UserExpression Classes, my code keeps crashing there)

Thanks,
ilyass

Try the following changes:

First: For each of the three UserExpression subclasses you define, change the value_shape method to

return ()

This is the “shape” associated to a scalar.

Second: The variables lmbda, mu, and kappa do not need to be defined as UserExpressions. You can just define

lmbda = E*nu/((1+nu)*(1-2*nu))

and likewise for mu and kappa.