How to use tetrahedrons ?

Asked by Nicolas Verdon

Hi and sorry if this question seems simple..
In fact, I'm working with the python interface of Fenics and I'm defining my mesh using the command :

mesh = Box(-NlimMesh, -NlimMesh/10., -NlimMesh/10., NlimMesh, NlimMesh/10., NlimMesh/10., 10*Nmesh, Nmesh, Nmesh)
V = VectorFunctionSpace(mesh, "Lagrange", 2)

then, following the examples founded in the tutorials, I define my vectors as follows:

du = TrialFunction(V)
v = TestFunction(V)
u = Function(V)

That produces an mesh which is composed of prisms. My question is then :

How can I modify the elements I used for my FE formulation ?

In the example for the hyperelasticity equation, I found that it is possible using ufl & c++

# Function spaces
element = VectorElement("Lagrange", tetrahedron, 1)

# Trial and test functions
du = TrialFunction(element) # Incremental displacement
v = TestFunction(element) # Test function

I would really like to be able to do the same directly in my python file.
I thank you in advance for helping me,

Nicolas

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Garth Wells
Solved:
Last query:
Last reply:
Revision history for this message
Best Garth Wells (garth-wells) said :
#1

On 2 November 2011 11:10, Nicolas Verdon
<email address hidden> wrote:
> New question #177249 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/177249
>
> Hi and sorry if this question seems simple..
> In fact, I'm working with the python interface of Fenics  and I'm defining my mesh using the command :
>
> mesh = Box(-NlimMesh, -NlimMesh/10., -NlimMesh/10., NlimMesh, NlimMesh/10., NlimMesh/10., 10*Nmesh, Nmesh, Nmesh)

The above will create a mesh of tetrahedra.

> V = VectorFunctionSpace(mesh, "Lagrange", 2)
>

This will automatically select the cell shape based on the mesh.

> then, following the examples founded in the tutorials, I define my vectors as follows:
>
> du = TrialFunction(V)
> v  = TestFunction(V)
> u  = Function(V)
>
> That produces an mesh which is composed of prisms. My question is then :
>

The mesh will be made up of tetrahedra.

Garth

> How can I modify the elements I used for my FE formulation ?
>
>
> In the example for the hyperelasticity equation, I found that it is possible using ufl & c++
>
> # Function spaces
> element = VectorElement("Lagrange", tetrahedron, 1)
>
> # Trial and test functions
> du = TrialFunction(element)     # Incremental displacement
> v  = TestFunction(element)      # Test function
>
> I would really like to be able to do the same directly in my python file.
> I thank you in advance for helping me,
>
>
> Nicolas
>
>
> --
> 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
Nicolas Verdon (verdon-nicolas) said :
#2

Thanks Garth Wells, that solved my question.