# Piezoelectric PDEs

**URL:** <https://fenicsproject.discourse.group/t/piezoelectric-pdes/4457>\
**Category:** Linear Algebra\
**Created:** [October 31, 2020, 2:26pm UTC](https://fenicsproject.discourse.group/t/piezoelectric-pdes/4457 "2020-10-31T14:26:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefan](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/stefan/32/1841_2.png) [@stefan](https://fenicsproject.discourse.group/u/stefan)\
**Post date:** [October 31, 2020, 2:26pm UTC](https://fenicsproject.discourse.group/t/piezoelectric-pdes/4457/1 "2020-10-31T14:26:26Z")

</div>

hello everyone please I have a Problem I’m new to fenics programming and I’d like to solve the linear equation of a piezoelectric

 ![Cture](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/d/da50a9c85cca2260b7b56f4399cb3b96cf1325b3.jpeg)

---

<div class="post-metadata">

**Author:** ![bleyerj](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bleyerj/32/6020_2.png) [@bleyerj](https://fenicsproject.discourse.group/u/bleyerj)\
**Post date:** [November 1, 2020, 11:42am UTC](https://fenicsproject.discourse.group/t/piezoelectric-pdes/4457/2 "2020-11-01T11:42:07Z")

</div>

Hi,  
transform it into weak form and use a mixed function space for the displacement u and electric potential. You can start by the quasistatic version and then adapt any elastodynamic demo to this case quite easily…

---

<div class="post-metadata">

**Author:** ![stefan](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/stefan/32/1841_2.png) [@stefan](https://fenicsproject.discourse.group/u/stefan)\
**Post date:** [November 1, 2020, 12:29pm UTC](https://fenicsproject.discourse.group/t/piezoelectric-pdes/4457/3 "2020-11-01T12:29:40Z")

</div>

Hi Jeremi,  
thank you for your answer.My difficulty resides exactly in the quasistatic version case because for the elastodynamic case I already have an idea. Please can you give me if it’s possible a document or a type that illustrates the quasistatic version case?

---

<div class="post-metadata">

**Author:** ![bleyerj](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bleyerj/32/6020_2.png) [@bleyerj](https://fenicsproject.discourse.group/u/bleyerj)\
**Post date:** [November 1, 2020, 2:51pm UTC](https://fenicsproject.discourse.group/t/piezoelectric-pdes/4457/4 "2020-11-01T14:51:34Z")

</div>

well then if you are OK for the elastodynamic case, what is your problem ? If you don’t post your code with a specific issue, people will not be likely to help you

---

<div class="post-metadata">

**Author:** ![stefan](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/stefan/32/1841_2.png) [@stefan](https://fenicsproject.discourse.group/u/stefan)\
**Post date:** [November 11, 2020, 9:17pm UTC](https://fenicsproject.discourse.group/t/piezoelectric-pdes/4457/5 "2020-11-11T21:17:42Z")

</div>

> [@bleyerj](#):
>
> weak form

Hi,  
please, I still have a problem, I have changed my expression as you asked me. My difficulty lies in the fact that I don’t know where to start in order to implement this. I would like to know if there are any examples or tipps that you can give me

 ![weakform](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/0/0738c74e6bf91a8fb35196ae367818a72b817175.jpeg)

---

<div class="post-metadata">

**Author:** ![bleyerj](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bleyerj/32/6020_2.png) [@bleyerj](https://fenicsproject.discourse.group/u/bleyerj)\
**Post date:** [November 12, 2020, 1:14pm UTC](https://fenicsproject.discourse.group/t/piezoelectric-pdes/4457/6 "2020-11-12T13:14:23Z")

</div>

Hi,  
I assume that B is the symetrized gradient and Bbar the gradient operators. Here is some partial code for the quasistatic part of the bilinear weak form:

```auto
Ue = VectorElement("CG", mesh.ufl_cell(), 1)
Ve = FiniteElement("CG", mesh.ufl_cell(), 1)
W = FunctionSpace(mesh, MixedElement([Ue, Ve]))
u_, v_ = TestFunctions(W)
du, dv = TrialFunctions(W)
def sigma(u):
    eps = sym(grad(u))
    return lmbda*tr(eps)*Identity(u.geometric_dimension()) + 2*mu*esp
a = inner(sigma(du), eps(u_))*dx + inner(sigma(du), dot(e, grad(v_)))*dx \
    + inner(sigma(u_), dot(e, grad(dv)))*dx - dot(grad(dv), dot(eps_S, grad(v_)))*dx

```

I assumed isotropic elasticity for the mechanical part. You will also need to define the third-rank tensor `e` for coupling and the second-rank tensor `eps_S` for the electrical part.  
For the extension to dynamics, you just need to adapt elastodynamics demos e.g. [https://fenicsproject.org/docs/dolfin/latest/python/demos/elastodynamics/demo\_elastodynamics.py.html](https://fenicsproject.org/docs/dolfin/latest/python/demos/elastodynamics/demo_elastodynamics.py.html)
