# Initial conditions for a mixed element

**URL:** <https://fenicsproject.discourse.group/t/initial-conditions-for-a-mixed-element/3119>\
**Category:** Uncategorized\
**Created:** [May 5, 2020, 11:17pm UTC](https://fenicsproject.discourse.group/t/initial-conditions-for-a-mixed-element/3119 "2020-05-05T23:17:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kausalyam](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/kausalyam/32/861_2.png) [@kausalyam](https://fenicsproject.discourse.group/u/kausalyam)\
**Post date:** [May 5, 2020, 11:17pm UTC](https://fenicsproject.discourse.group/t/initial-conditions-for-a-mixed-element/3119/1 "2020-05-05T23:17:53Z")

</div>

I am trying to set initial conditions (initial displacement) for a mixed element (from the von-karman demo). The following gives me a warning " \*\*\* FFC warning: evaluate\_dof(s) for enriched element not implemented." but the rest of my script still runs.  
Although there are no errors, the initial conditions are not actually applied when I print or visualize my results. Any help would be appreciated.  
Thanks

```python
P1 = FiniteElement("Lagrange", triangle, degree = 1)
P2 = FiniteElement("Lagrange", triangle, degree = 2)
bubble = FiniteElement("B", triangle, degree = 3)
enriched = P1 + bubble

element = MixedElement([VectorElement(P2, dim=2), P2, VectorElement(enriched, dim=2)])

e_v0 = Expression(("0.36*x[0]", "0.36*x[1]") ,degree=1)
e_w0 = Expression(("0*x[0]") ,degree=1)
e_theta0 = Expression(("0*x[0]", "0*x[1]") ,degree=1)
v0 = interpolate(e_v0,Q.sub(0).collapse())
w0 = interpolate(e_w0,Q.sub(1).collapse())
theta0 = interpolate(e_theta0,Q.sub(2).collapse())
q_, q, q_t = Function(Q), TrialFunction(Q), TestFunction(Q)
assign(q_,[v0,w0,theta0])
v_, w_, theta_ = split(q_)
q_old = Function(Q)
assign(q_old,[v0,w0,theta0])
v_old, w_old, theta_old = split(q_old)

```

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [May 5, 2020, 11:24pm UTC](https://fenicsproject.discourse.group/t/initial-conditions-for-a-mixed-element/3119/2 "2020-05-05T23:24:50Z")

</div>

Try projecting your initial condition instead of interpolating it.

---

<div class="post-metadata">

**Author:** ![kausalyam](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/kausalyam/32/861_2.png) [@kausalyam](https://fenicsproject.discourse.group/u/kausalyam)\
**Post date:** [May 6, 2020, 9:03am UTC](https://fenicsproject.discourse.group/t/initial-conditions-for-a-mixed-element/3119/3 "2020-05-06T09:03:55Z")

</div>

Thanks, this solved the warning but the initial conditions are still not actually applied when I see the results. Could this be an issue somewhere else in my script?

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [May 6, 2020, 9:16am UTC](https://fenicsproject.discourse.group/t/initial-conditions-for-a-mixed-element/3119/4 "2020-05-06T09:16:04Z")

</div>

As you have not supplied a minimal working example, i cant really tell you if you are doing anything wrong.
