Converting symbols to UFL type

Hi, I have a problem when I try to solve a Nonlinear Varational problem, specifically when trying to compute the varational part with a coefficient depending on x,y and u:

# Packages used
from __future__ import print_function
from fenics import *
import matplotlib.pyplot as plt
import numpy as np
################################################################
# Defining Relativity hydraulic conductivity
# Defining k_s(x), positive function.
def k_s(x,y):
    return 0.1+10*(sin(20*(x))*sin(20*y)+1)
# Haverkamp model
# Constants used
A=1
B=1
Gamma=1

def k(x,y,u):
    return k_s(x,y)*(A/(A+((abs(u)/B)**Gamma)))
    
# Use SymPy to compute f from the manufactured solution u

import sympy as sym
x, y = sym.symbols('x[0], x[1]')

u = 2*x**2+y*y+4*x
f = - sym.diff(k(x,y,u)*sym.diff(u, x), x) -sym.diff(k(x,y,u)*sym.diff(u, y), y)
f = sym.simplify(f)
u_code = sym.printing.ccode(u)
f_code = sym.printing.ccode(f)
print('u =', u_code)
print('f =', f_code)

u = sin(x*2*pi)
f = - sym.diff(k(x,y,u)*sym.diff(u, x), x) -sym.diff(k(x,y,u)*sym.diff(u, y), y)
f = sym.simplify(f)
u_code = sym.printing.ccode(u)
f_code = sym.printing.ccode(f)
print('u =', u_code)
print('f =', f_code)

I get the following compilation error:

    Traceback (most recent call last):
      File "muestra.py", line 25, in <module>
        f = - sym.diff(k(x,y,u)*sym.diff(u, x), x) -sym.diff(k(x,y,u)*sym.diff(u, y), y)
      File "muestra.py", line 19, in k
        return k_s(x,y)*(A/(A+((abs(u)/B)**Gamma)))
      File "muestra.py", line 10, in k_s
        return 0.1+10*(sin(20*(x))*sin(20*y)+1)
      File "/usr/lib/python3/dist-packages/ufl/operators.py", line 598, in sin
        return _mathfunction(f, Sin)
      File "/usr/lib/python3/dist-packages/ufl/operators.py", line 569, in _mathfunction
        f = as_ufl(f)
      File "/usr/lib/python3/dist-packages/ufl/constantvalue.py", line 413, in as_ufl
        " to any UFL type." % str(expression))
    ufl.log.UFLValueError: Invalid type conversion: 20*x[0] can not be converted to any UFL type.

Thank you in advance for helping me

You are mixing UFL with sympy objects, in particular, sin in your code is the one from UFL.