Applying a force on a face

Hello, Ihave tried to visualize delta in the code below, could you please try to see it? I am getting an error (output message) in paraview when I open PRO.pvd there and wondering if you will too. Thanks in advance.

class Delta(UserExpression):
        def __init__(self, eps, x0, **kwargs):
            print("init function")
            self.eps = eps
            self.x0 = x0
            UserExpression.__init__(self, **kwargs) 
        def eval(self, values, x):
           
            eps = self.eps
            values[0] =-0
            #eps/pi/(np.linalg.norm(x-self.x0)**2 + eps**2)
            values[1] = 0
            values[2] = -1 

        def value_shape(self): 
            print("ah")
            return (3, ) 
             

    delta = Delta(eps=1E-4, x0=[-0,-0,10], degree=3)
    PRO = project(delta, V)
    plot(PRO)

    vtkfile_ = File('PRO.pvd')
    vtkfile_ << PRO

You still do not supply a full code.
This works for me in paraview 5.7.0:

from dolfin import *
import numpy as np
mesh = UnitSquareMesh(10,10)
V = VectorFunctionSpace(mesh, "CG", 1)
class Delta(UserExpression):
   def __init__(self, eps, x0, **kwargs):
      print("init function")
      self.eps = eps
      self.x0 = x0
      UserExpression.__init__(self, **kwargs)
   def eval(self, values, x):

            eps = self.eps
            values[0] = eps/pi/(np.linalg.norm(x-self.x0)**2 + eps**2)
            values[1] = 0
            #values[2] = -1

   def value_shape(self):
            print("ah")
            return (2, )


delta = Delta(eps=1E-4, x0=[0.2,0.3], degree=3)
PRO = project(delta, V)
plot(PRO)

vtkfile_ = File('PRO.pvd')
vtkfile_ << PRO

Thanks a lot, is it possible to convert this example to 3d like this? I am getting this error when I tried I was able to see 3D axis earlier.I don’t know why it did not work now.
NotImplementedError: It is not currently possible to manually set the aspect on 3D axes

from dolfin import *
import numpy as np
mesh = UnitCubeMesh(10,10,10)
V = VectorFunctionSpace(mesh, "CG", 1)
plot(mesh)
class Delta(UserExpression):
   def __init__(self, eps, x0, **kwargs):
      print("init function")
      self.eps = eps
      self.x0 = x0
      UserExpression.__init__(self, **kwargs)
   def eval(self, values, x):

            eps = self.eps
            values[0] = eps/pi/(np.linalg.norm(x-self.x0)**2 + eps**2)
            values[1] = 0
            values[2] = -1

   def value_shape(self):
            print("ah")
            return (3, )


delta = Delta(eps=1E-4, x0=[0.1,0.5,0.2], degree=3)
PRO = project(delta, V)
plot(PRO)

vtkfile_ = File('PRO.pvd')
vtkfile_ << PRO

I will not run your code as you have not formated it properly with ```.
The 3D plotting issue is Fixed in dolfin master, and is because matplotlib changed behavior after the 2019.1.0 release. You can find a working image for plotting with matplotlib on quay.io.
However, in 3D, save it to file and visualize it in Paraview.

Ok thank you. I am running the code you provided in jupyter notebook and I can see this plot
image
However, pvd file 1 KB and I am getting error still. What should I do?

Which paraview version are you using? What is the error message? 3D plotting in a notebook is something you should avoid or use dedicated software such as vtkplotter for.