<ahref="demo/reissner_mindlin/reissner_mindlin.py.html"title="Reissner-Mindlin plate with Quadrilaterals"
accesskey="N">next</a> |
<ahref="genindex.html"title="General Index"
accesskey="I">index</a>
</div>
</div>
</div>
<divclass="content-wrapper">
<divclass="content">
<divclass="document">
<divclass="documentwrapper">
<divclass="bodywrapper">
<divclass="body"role="main">
<divclass="section"id="d-linear-elasticity">
<h1>2D linear elasticity<aclass="headerlink"href="#d-linear-elasticity"title="Permalink to this headline">¶</a></h1>
<p>In this first numerical tour, we will show how to compute a static solution for a 2D isotropic linear elastic medium, either in plane stress or in plane strain, using FEniCS in a tradtional displacement-based finite element formulation.</p>
<p>We will illustrate this on the case of a cantilever beam modeled as a 2D medium of dimensions L x H. We first define the geometrical parameters and mesh density which will be used. The mesh is generated using the RectangleMesh function and we choose a crossed configuration for the mesh structure.</p>
<p>We now define the material parameters which are here given in terms of a Young’s modulus and a Poisson coefficient. In the following, we will need to define the constitutive relation relating sigma as a function of varepsilon. Let us recall that the general expression for a 3D medium of the linear elastic isotropic constitutive relation is given by :</p>
<p>here we will consider a 2D model either in plane strain or in plane stress. Irrespective of this choice, we will work only with a 2D displacement vector u and will subsequently define the strain operator epsilon as follows</p>
<p>which computes the 2x2 plane components of the symmetrized gradient tensor of any 2D vectorial field.
In the plane strain case, the full 3D strain tensor is defined as follows, so that the 2x2 plane part of the stress tensor is defined in the same way as for the 3D case.</p>
<p>In the plane stress case, an out-of-plane epsilon_{zz}</p>
<p>Hence, the 2D constitutive relation can be defined as follows, by changing only the value of the Lamé coefficient lambda.</p>
<liclass="toctree-l1 current"><aclass="current reference internal"href="#">2D linear elasticity</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="demo/reissner_mindlin/reissner_mindlin.py.html">Reissner-Mindlin plate with Quadrilaterals</a></li>
In this first numerical tour, we will show how to compute a static solution for a 2D isotropic linear elastic medium, either in plane stress or in plane strain, using FEniCS in a tradtional displacement-based finite element formulation.
We will illustrate this on the case of a cantilever beam modeled as a 2D medium of dimensions L x H. We first define the geometrical parameters and mesh density which will be used. The mesh is generated using the RectangleMesh function and we choose a crossed configuration for the mesh structure.
We now define the material parameters which are here given in terms of a Young's modulus and a Poisson coefficient. In the following, we will need to define the constitutive relation relating \sigma as a function of \varepsilon. Let us recall that the general expression for a 3D medium of the linear elastic isotropic constitutive relation is given by :
here we will consider a 2D model either in plane strain or in plane stress. Irrespective of this choice, we will work only with a 2D displacement vector u and will subsequently define the strain operator \epsilon as follows
.. code-block:: python
def eps(v):
return sym(grad(v))
which computes the 2x2 plane components of the symmetrized gradient tensor of any 2D vectorial field.
In the plane strain case, the full 3D strain tensor is defined as follows, so that the 2x2 plane part of the stress tensor is defined in the same way as for the 3D case.
In the plane stress case, an out-of-plane \epsilon_{zz}
Hence, the 2D constitutive relation can be defined as follows, by changing only the value of the Lamé coefficient \lambda.
In this first numerical tour, we will show how to compute a static solution for a 2D isotropic linear elastic medium, either in plane stress or in plane strain, using FEniCS in a tradtional displacement-based finite element formulation.
We will illustrate this on the case of a cantilever beam modeled as 2D medium of dimensions L x H. We first define the geometrical parameters and mesh density which will be used. The mesh is generated using the RectangleMesh function and we choose a crossed configuration for the mesh structure.
We now define the material parameters which are here given in terms of a Young's modulus and a Poisson coefficient. In the following, we will need to define the constitutive relation relating \sigma as a function of \varepsilon. Let us recall that the general expression for a 3D medium of the linear elastic isotropic constitutive relation is given by :
here we will consider a 2D model either in plane strain or in plane stress. Irrespective of this choice, we will work only with a 2D displacement vector u and will subsequently define the strain operator \epsilon as follows
.. code-block:: python
def eps(v):
return sym(grad(v))
which computes the 2x2 plane components of the symmetrized gradient tensor of any 2D vectorial field.
In the plane strain case, the full 3D strain tensor is defined as follows, so that the 2x2 plane part of the stress tensor is defined in the same way as for the 3D case.
In the plane stress case, an out-of-plane \epsilon_{zz}
Hence, the 2D constitutive relation can be defined as follows, by changing only the value of the Lamé coefficient \lambda.
These numerical tours will introduce you to a wide variety of topics in Computational Continuum Mechanics using the finite element software FEniCS.
You can find instructions on how to install FEniCS on the FEniCS project website http://fenicsproject.org. In the following numerical tours, we will use the Python interface for the different FEniCS scripts.
FEniCS is also distributed along with an important number of documented or undocumented examples, some of them will be revisited in these tours but do not hesitate to look for other interesting examples.
In particular, we advise you to go through the documentation and tutorials to get started with FEniCS.
--------------------
A few words about FEniCS
--------------------
Contrary to most finite element softwares in the computational mechanics community, FEniCS is a multi-purpose software that allows for the discretization and numerical resolution of a wide range of problems governed by partial differential equations.
The formulation of a problem in FEniCS relies on the definition of discrete functional spaces depending on a mesh. For instance, we can define :
.. code-block:: python
# A continuous Galerkin ("CG") scalar function space interpolated with polynomials of degree 2
Vh = FunctionSpace(mesh,"CG",2)
# A discontinous Galerkin ("DG") vectorial function space (the dimension is fixed by the mesh) interpolated with polynomials of degree 1
Wh = VectorFunctionSpace(mesh,"DG",1)
The next step is to define test and trial functions which will then be used to define forms (linear, bilinear or non-linear) representing the weak variational formulation of the problem which we aim at solving.
These numerical tours will introduce you to a wide variety of topics in Computational Continuum Mechanics using the finite element software FEniCS.
You can find instructions on how to install FEniCS on the FEniCS project website http://fenicsproject.org. In the following numerical tours, we will use the Python interface for the different FEniCS scripts.
FEniCS is also distributed along with an important number of documented or undocumented examples, some of them will be revisited in these tours but do not hesitate to look for other interesting examples.
In particular, we advise you to go through the documentation and tutorials to get started with FEniCS.
--------------------
A few words about FEniCS
--------------------
Contrary to most finite element softwares in the computational mechanics community, FEniCS is a multi-purpose software that allows for the discretization and numerical resolution of a wide range of problems governed by partial differential equations.
The formulation of a problem in FEniCS relies on the definition of discrete functional spaces depending on a mesh. For instance, we can define :
.. code-block:: python
# A continuous Galerkin ("CG") scalar function space interpolated with polynomials of degree 2
Vh = FunctionSpace(mesh,"CG",2)
# A discontinous Galerkin ("DG") vectorial function space (the dimension is fixed by the mesh) interpolated with polynomials of degree 1
Wh = VectorFunctionSpace(mesh,"DG",1)
The next step is to define test and trial functions which will then be used to define forms (linear, bilinear or non-linear) representing the weak variational formulation of the problem which we aim at solving.
Suppose that you have a vector-valued (dimension 2) function ``v`` defined on space ``VV`` and two scalar valued functions ``u0`` and ``u1`` defined on space ``V`` that you want to assign as the components of ``v``.
Projection of ``as_vector([u0,u1])`` onto ``VV`` or interpolation of Expression is too slow for big meshes. An efficient way to perform this is to use the ``FunctionAssigner`` between space ``VV`` and spaces ``[V,V]`` as follows :
assigner = FunctionAssigner(VV, [V, V])
assigner.assign(vv, [u0, u1])
Efficient projection on DG or Quadrature spaces
------------------------------------------------
For projecting a Function on a DG or Quadrature space, that is a space with no coupling between elements, the projection can be performed element-wise. For this purpose, using the LocalSolver is much more faster than performing a global projection :
def local_project(v,V):
dv = TrialFunction(V)
v_ = TestFunction(V)
a_proj = inner(dv,v_)*dx(metadata=metadata)
b_proj = inner(v,v_)*dx(metadata=metadata)
solver = LocalSolver(a_proj,b_proj)
solver.factorize()
u = Function(V)
solver.solve_local_rhs(u)
return u
Local factorizations can be cached if projection is performed many times.