RuntimeError: Invalid parameter: form_compiler

See Announcement: ufl_legacy and legacy dolfin

To start, the line

from ufl import nabla_div        #to import library for the calculation of nabla divergence

is wrong. You must use ufl_legacy.