UFL

Using Hexahedron Element

Asked by Liang Jin Lim

I am trying to use a hexahedron element, but thing goes wrong when I compile using FFC. No problem arises when I use a tetrahedron element. This is the my ufl code:

------------------------------------------------------------------------------------------------
element = VectorElement("CG", "hexahedron", 1)

u = TrialFunction(element)
v = TestFunction(element)
f = Coefficient(element)
#g = Coefficient(element)

mu = Constant("hexahedron")
lmbda = Constant("hexahedron")

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

def sigma(v):
    return 2.0*mu*epsilon(v) + lmbda*tr(epsilon(v))*Identity(v.cell().d)

a = inner(sigma(u), epsilon(v))*dx
L = inner(f, v)*dx
------------------------------------------------------------------------------------------------------

And this is the error I got while compiling

//...
Compiler stage 4: Generating code
---------------------------------
  Generating code for 3 elements

*** FFC: 'hexahedron'
*** FFC: To get more information about this error, rerun FFC with --verbose.

Question information

Language:
English Edit question
Status:
Solved
For:
UFL Edit question
Assignee:
No assignee Edit question
Solved by:
Anders Logg
Solved:
Last query:
Last reply:
Revision history for this message
Anders Logg (logg) said :
#1

FFC can't handle hexahedra, only intervals, triangles and tetrahedra.

--
Anders

On Thu, Aug 25, 2011 at 12:50:47PM -0000, Liang Jin Lim wrote:
> New question #169147 on UFL:
> https://answers.launchpad.net/ufl/+question/169147
>
> I am trying to use a hexahedron element, but thing goes wrong when I compile using FFC. No problem arises when I use a tetrahedron element. This is the my ufl code:
>
> ------------------------------------------------------------------------------------------------
> element = VectorElement("CG", "hexahedron", 1)
>
> u = TrialFunction(element)
> v = TestFunction(element)
> f = Coefficient(element)
> #g = Coefficient(element)
>
> mu = Constant("hexahedron")
> lmbda = Constant("hexahedron")
>
> def epsilon(v):
> return 0.5*(grad(v) + grad(v).T)
>
> def sigma(v):
> return 2.0*mu*epsilon(v) + lmbda*tr(epsilon(v))*Identity(v.cell().d)
>
> a = inner(sigma(u), epsilon(v))*dx
> L = inner(f, v)*dx
> ------------------------------------------------------------------------------------------------------
>
> And this is the error I got while compiling
>
> //...
> Compiler stage 4: Generating code
> ---------------------------------
> Generating code for 3 elements
>
> *** FFC: 'hexahedron'
> *** FFC: To get more information about this error, rerun FFC with --verbose.
>

Revision history for this message
Liang Jin Lim (limliangjin) said :
#2

So, there is no work around to use Hexahedron element?

Revision history for this message
Best Anders Logg (logg) said :
#3

On Thu, Aug 25, 2011 at 01:10:59PM -0000, Liang Jin Lim wrote:
> Question #169147 on UFL changed:
> https://answers.launchpad.net/ufl/+question/169147
>
> Status: Answered => Open
>
> Liang Jin Lim is still having a problem:
> So, there is no work around to use Hexahedron element?

The workaround would be either:

1. split your hexahedra into tetrahedra

or

2. add the missing functionality in FFC, FIAT and DOLFIN

--
Anders

Revision history for this message
Liang Jin Lim (limliangjin) said :
#4

Thanks Anders Logg, that solved my question.