# Time depended Neumann boundary

**URL:** <https://fenicsproject.discourse.group/t/time-depended-neumann-boundary/5111>\
**Category:** Uncategorized\
**Created:** [February 17, 2021, 4:00pm UTC](https://fenicsproject.discourse.group/t/time-depended-neumann-boundary/5111 "2021-02-17T16:00:16Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Miraboreasu](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@Miraboreasu](https://fenicsproject.discourse.group/u/Miraboreasu)\
**Post date:** [February 17, 2021, 7:03pm UTC](https://fenicsproject.discourse.group/t/time-depended-neumann-boundary/5111/7 "2021-02-17T19:03:37Z")

</div>

I am follow the [How to apply time varying boundary conditions coming from a function?](https://fenicsproject.discourse.group/t/how-to-apply-time-varying-boundary-conditions-coming-from-a-function/2386)

I test this with two def, one is exp(t), another one is a long equation, but except t, all other letters are defined, which are numbers.

```auto
blast=Constant((Po*(1-t/t1)*exp(-b*((t-t2)/t1)))/E)
def blast_func(t):
    return (Po*(1-t/t1)*exp(-b*((t-t2)/t1)))/E

pexp=Constant(exp(t))
def complicate_func(t):
    return exp(t)

a = u*v*dx + dt*dt*c*c*inner(grad(u), grad(v))*dx
L = 2*u1*v*dx - u0*v*dx + pexp*v*ds

bc = DirichletBC(V, 0, rightbound)
#A, b = assemble_system(a, L, bc)

u=Function(V)
vtkfile1=File('wave/u.pvd')
vtkfile2=File('wave/v.pvd')

while t <= T:
    A, b = assemble_system(a, L, bc)
    solve(A, u.vector(), b)
    velocity = (u - u0) / dt
    u0.assign(u1)
    u1.assign(u)
    t += dt
    pexp.assign(complicate_func(t))
    blast.assign(blast_func(t))
    vtkfile1<<(u,t)
    vtkfile2 << (project(velocity, V), t)

```

 ![image](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/d/d77a20fcde2367e7423dde0615e97375d21e545c.png)

---

_[View the full topic](https://fenicsproject.discourse.group/t/time-depended-neumann-boundary/5111)._
