Black-Scholes Equation

I have difficulty writing the weak formulation of the Black-Scholes Equation or boundaries into Fenics.

I have plottet my solution, in both 2D and 3D hoping to figure out, what is wrong. It does solve something, just not the equation I intend to solve. I have no Idea, what I have typed wrong or is missing.

What I intend:
u0:
u0 = u(S,0) = max(S(0)-K,0)

Boundary conditions:
u(0,\tau)=0
u(S,\tau)=S-Ke^{-r\cdot \tau}

Weak formulation:
\int_\Omega \frac{\partial u}{\partial \tau} v dx + \int_\Omega \frac{1}{2} \sigma^2 S^2 \frac{\partial u}{\partial S}\frac{\partial v}{\partial S} dx + \int_\Omega (\frac{\sigma^2}{2}-r) \frac{\partial u}{\partial S} v dx + \int r u v dx = 0


This is what i have attempted in Fenics (only included the relevant part of my code below):

This is some chosen parameters:
t = 0.0 # initial time
T = 1.0 # end time
dt = 0.1 # time step
tau = T-t
K = 1
sigma = 0.25
r = 0.05
S0 = Expression(‘near(x[0], 0.0)’, degree=2)
S = Expression(‘x[0]’, degree=2)

u0:
def Max(a, b): return (a+b+abs(a-b))/Constant(2)
u0 = project(Max(S0-K, 0), V)

Boundary conditions:
uL = Constant(0.0)
uT = Expression('S-K*exp(-r*tau)', S=S, K=K, r=r, tau=tau, degree=2)

u\_ = interpolate(u0, V)
a = ((0.5*pow(sigma,2)*(pow(S,2))*inner(grad(u),grad(v)))*dx) + (((0.5*pow(sigma,2)-r)*S*inner(grad(u)[0],v))*dx) + ((r*u*v)*dx)
l = u\_*v*dx

Any help would be appreciated. Thank you in advance.