# how to compute W_{1,\infty} semi-norm

I do not know how to compute the W_{1,\infty} semi-norm a finite solution with FEniCS.
For example I solve a standard elliptic equation as below, and I get
the solution u, now I want to compute L-inf norm of du/dx and du/dy.

I cannot make sure I am correct, any help is great apprieciated.

#-----------------------------
from dolfin import *

mesh = UnitSquareMesh(100, 100)
V = FunctionSpace(mesh, "CG", 1)

def boundary(x):
return x < DOLFIN_EPS or x > 1.0 - DOLFIN_EPS

u0 = Constant(0.0)
bc = DirichletBC(V, u0, boundary)

u = TrialFunction(V)
v = TestFunction(V)
f = Expression("10*exp(-(pow(x - 0.5, 2) + pow(x - 0.5, 2)) / 0.02)")
g = Expression("sin(5*x)")
L = f*v*dx + g*v*ds

u = Function(V)
solve(a == L, u, bc)

#-----------------------------------
# compute the W_{1,\infty} semi-norm
#-----------------------------------
ux , uy = A.split(deepcopy=True)
tempx = norm(ux.vector(),'linf',mesh)
tempy = norm(uy.vector(),'linf',mesh)
linf = max(tempx,tempy)
print linf
#-----------------------------------

## Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Blechta
Solved:
2013-03-18
Last query:
2013-03-18
2013-03-18 Jan Blechta (blechta) said on 2013-03-18: #1

Gradient of CG1 function is DG0 vector function. Also you don't need to deepcopy components.

u = Function(FunctionSpace(mesh, "CG", 1))
A = project(grad(u), VectorFunctionSpace(mesh, "DG", 0))
linf = norm(A.vector(), 'linf')

 Huadong GAO (mathsgao) said on 2013-03-18: #2

Thanks Jan Blechta, that solved my question.