Adding tensors in the frame of elasticity problem

Asked by Ben Sklenard

Hello

I have a very naive question concerning the elasticity problem (in demo). I'm wondering how it can be modified to add a spatially constant tensor (over a subdomain) to the strain tensor.

Typically in:

def epsilon(v):
  return 0.5 * (grad(v) + grav(v).T) + A

where A is a spatially constant tensor. My question, is how to define "A"?

Regards

Ben

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
minak (piotrekminak) said :
#1

try A = as_tensor([[A11,A12],[A21,A22]])

Revision history for this message
Johan Hake (johan-hake) said :
#2

The tricky part is the subdomain part of your question. You could define four Functions over the whole domain, as suggested by minak, and then assign the correct values to the dofs. Something like:

  V = FunctionSpace(mesh, "CG", 1)
  dm = V.dof_map()
  A11 = Function(V)
  A11.vector()[:] = 0
  ...
  for cell in SubsetIterator(domains, marker):
      A11.vector()[dm.cell_dofs(cell.index())] = value11
     ...

Revision history for this message
Ben Sklenard (b-sklenard) said :
#3

Thank you for your answer.

Actually, when doing that, I get an error from ffc that is complaining about the rank of the tensor ("*** FFC: All terms in forms must have same rank"). For example:

FE = FiniteElement("DG", triangle, 0)
A11 = Coefficient(FE)
A12 = Coefficient(FE)
A21 = Coefficient(FE)
A22 = Coefficient(FE)
A = as_tensor([[A11,A12],[A21,A22]]

def epsilon(v):
  return 0.5 * (grad(v) + grad(v).T) + A

NB: Johan, I forgot to precise that I'm using the C++ interface

Revision history for this message
Kent-Andre Mardal (kent-and) said :
#4

Is v a TrialFunction or a (Tensor)Function?

Kent

On 4 April 2012 10:55, Ben Sklenard <email address hidden>wrote:

> New question #192604 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/192604
>
> Hello
>
> I have a very naive question concerning the elasticity problem (in demo).
> I'm wondering how it can be modified to add a spatially constant tensor
> (over a subdomain) to the strain tensor.
>
> Typically in:
>
> def epsilon(v):
> return 0.5 * (grad(v) + grav(v).T) + A
>
> where A is a spatially constant tensor. My question, is how to define "A"?
>
> Regards
>
> Ben
>
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>

Revision history for this message
Ben Sklenard (b-sklenard) said :
#5

It is a trial function (the displacement).
The code I am using is the one given in the "elasticity" demo.

Ben

Revision history for this message
Kent-Andre Mardal (kent-and) said :
#6

You can't add together TrialFunctions and other Functions in this way. The
A term should instead appear on the right hand side.

Kent

On 4 April 2012 16:41, Ben Sklenard <email address hidden>wrote:

> Question #192604 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/192604
>
> Ben Sklenard posted a new comment:
> It is a trial function (the displacement).
> The code I am using is the one given in the "elasticity" demo.
>
> Ben
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>

Revision history for this message
Ben Sklenard (b-sklenard) said :
#7

Thank you for your answer, however I haven't really understand what you are suggesting. Can you provide an example?

Can you help with this problem?

Provide an answer of your own, or ask Ben Sklenard for more information if necessary.

To post a message you must log in.