 # Compute Bochner space norm

#1

Dear community,

Given the solutions from the following elastodynamics problem https://comet-fenics.readthedocs.io/en/latest/demo/elastodynamics/demo_elastodynamics.py.html and assuming that a exact solution u exist. How we compute the following Bochner space norm?

\Vert u(x,t) - u_h(x,t)\Vert_{L^2(0,T;L^2(\Omega))}^2:=\int_0^T \Vert u(x,t) - u_h(x,t)\Vert_{L^2(\Omega)}^2ds

It is known that the usual L^2(\Omega) norm can be computed by errornorm(u, u_h, 'L2').

Thanks for your attention!

#2

As far as I know there isn’t a built in solution for that. What I’ve done in order to compute this is to use a quadrature in time and then used standard fenics commands (i.e. assemble) to compute the norm in space.

The discretization in time comes quite naturally as this has to be done anyway. For example, for a piecewise linear discretization in time one could use the (summed) end-point or trapezoidal rules.

As a MWE I assume that the values of the function u are stored in a numpy array, where

u[i, :] = u.vector()[:]


for iteration i of your solution. Afterwards, you can compute the L2(L2) norm of u by

result = 0
v = Function(V)
for i in range(steps):
v.vector()[:] = u[i, :]
result += dt * assemble(v*v*dx)


where V is your FunctionSpace and dt is your time step. It should be straightforward to adapt this to other norms. Also note that you might want to have a different integration rule or you might have to shift / leave out one of the ends in order to get the correct result (i.e. such that the integral over 1 from 0 to T equals T)

1 Like
#3

Dear plugged,

Thanks for your response. What is the role of v inside the for loop?. Maybe the last line is result += dt * assemble(v*v*dx) instead of result += dt * assemble(u*u*dx) ?

#4

Yes, that is what I meant, I’m going to edit my original post.

1 Like