Regarding inability to define linear variational problem a(u, v) = L(v) for all v

Hello everyone,
I am using Fenics 2019.1.0 and trying to solve the following Poisson problem.

import matplotlib.pyplot as plt
from dolfin import *
from mshr import *
import logging
import time

refRuns        = 1

# Importing mesh
# !dolfin-convert annulus.msh annulus.xml
mesh = Mesh("../meshes/annulus_refined_8000.xml")

# Defining function space for fluid dynamics
V = VectorElement("Lagrange", mesh.ufl_cell(), 2)
Q = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
W = FunctionSpace(mesh,Q*Q)
WTilde = FunctionSpace(mesh,Q*Q)

################################
####### Case parameters ########
################################

def determineCase(cs,csV):
    if cs == "m":
        debye = Constant(csV)
        beta  = Constant(1/(csV**2))
    else:
        debye = Constant(csV**2)
        beta  = Constant(1/(csV))
    return debye, beta

Re             = Constant(0.001) # Reynolds number 
t              = 0.0
m              = 0
kappa          = 1.0 #D/aU
case           = "m"
caseValue      = Constant(10.0)
choiceOfSolver = "LU"
saveVTK        = False
stopSimulation = False
withVarTime    = True

debye, beta  = determineCase(case,caseValue)

#################################
##### Simulation parameters #####
#################################

t       = 0
dt      = 100
old_dt  = dt
res     = 1
old_res = 100
eps     = 1e-10
i       = 0
max_iter = 5000
# Boundaries
tol       = 0.04*(0.5)**refRuns
tolout      = 720*(0.5)**refRuns
domain_end  = 8000.0

def walls(x,on_boundary):
    return on_boundary and near(x[0]**2 + x[1]**2,1.0,tol)

def farfield(x,on_boundary):
    return on_boundary and near(sqrt(x[0]**2 + x[1]**2),domain_end,tolout)

##############################
#### Boundary conditions ####
#############################


bc_phi_walls = DirichletBC(W.sub(1),Constant(0.0),walls)
bc_phi_farfield = DirichletBC(W.sub(1),Expression("-beta*x[0]",beta=beta,degree=2),farfield) 
# bc_q_farfield = DirichletBC(W.sub(0),Constant(0.0),farfield)

bcs = [bc_phi_walls,bc_phi_farfield]

parameters["form_compiler"]["cpp_optimize"] = True
parameters["form_compiler"]["quadrature_degree"] = 3
  

var,dvar = TrialFunction(W),TestFunction(W)
q,phi = split(var)
dq,dphi = split(dvar)

Res = inner(grad(phi),grad(dphi))*dx - (q/(2*debye**2))*dphi*dx
aa = lhs(Res)
ll = rhs(Res)
varTilde = Function(WTilde)
solve(aa==ll,varTilde,bcs,solver_parameters={'linear_solver':'mumps'})

However when I solve it I get the following error.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-36-710a040acf80> in <module>
    211 varTilde = Function(WTilde)
    212 # varTilde.assign(old_var)
--> 213 solve(aa==ll,varTilde,bcs,solver_parameters={'linear_solver':'mumps'})
    214 
    215 

/usr/local/lib/python3.6/dist-packages/dolfin/fem/solving.py in solve(*args, **kwargs)
    218     # tolerance)
    219     elif isinstance(args[0], ufl.classes.Equation):
--> 220         _solve_varproblem(*args, **kwargs)
    221 
    222     # Default case, just call the wrapped C++ solve function

/usr/local/lib/python3.6/dist-packages/dolfin/fem/solving.py in _solve_varproblem(*args, **kwargs)
    240         # Create problem
    241         problem = LinearVariationalProblem(eq.lhs, eq.rhs, u, bcs,
--> 242                                            form_compiler_parameters=form_compiler_parameters)
    243 
    244         # Create solver and call solve

/usr/local/lib/python3.6/dist-packages/dolfin/fem/problem.py in __init__(self, a, L, u, bcs, form_compiler_parameters)
     57 
     58         # Initialize C++ base class
---> 59         cpp.fem.LinearVariationalProblem.__init__(self, a, L, u._cpp_object, bcs)
     60 
     61 

RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to define linear variational problem a(u, v) = L(v) for all v.
*** Reason:  Expecting the solution variable u to be a member of the trial space.
*** Where:   This error was encountered inside LinearVariationalProblem.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2019.1.0
*** Git changeset:  74d7efe1e84d65e9433fd96c50f1d278fa3e3f3f
*** -------------------------------------------------------------------------

I have already referred the following links (1) , (2) , (3) , but the hints provided there could not solve the error I am receiving.

If I am missing out on something please do let me know. Any insights would highly be appreciated.

Why is your solution defined in Wtilde

when your test and trial function is in W

Change varTilde to

varTilde = Function(W)

should resolve the issue

I am thankful to you for your prompt response.

If I change varTilde = Function(WTilde) to varTilde = Function(W) then I get the following error.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-38-300381208f1d> in <module>
    211 varTilde = Function(W)
    212 # varTilde.assign(old_var)
--> 213 solve(aa==ll,varTilde,bcs,solver_parameters={'linear_solver':'mumps'})
    214 
    215 

/usr/local/lib/python3.6/dist-packages/dolfin/fem/solving.py in solve(*args, **kwargs)
    218     # tolerance)
    219     elif isinstance(args[0], ufl.classes.Equation):
--> 220         _solve_varproblem(*args, **kwargs)
    221 
    222     # Default case, just call the wrapped C++ solve function

/usr/local/lib/python3.6/dist-packages/dolfin/fem/solving.py in _solve_varproblem(*args, **kwargs)
    245         solver = LinearVariationalSolver(problem)
    246         solver.parameters.update(solver_parameters)
--> 247         solver.solve()
    248 
    249     # Solve nonlinear variational problem

RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to solve linear system using PETSc Krylov solver.
*** Reason:  Solution failed to converge in 0 iterations (PETSc reason DIVERGED_PC_FAILED, residual norm ||r|| = 0.000000e+00).
*** Where:   This error was encountered inside PETScKrylovSolver.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2019.1.0
*** Git changeset:  74d7efe1e84d65e9433fd96c50f1d278fa3e3f3f
*** -------------------------------------------------------------------------

Do any tolerances of the PETScKrylovSolver need to be changed?

To me the variational form does not make sense, as you are not using test function from both of the mixed spaces (thus the matrix system is rectangular).

Please post the strong form of the PDE you are solving with Latex syntax and encapsulation, i.e.

$f(x)=x_2$

will render as
f(x) = x_2

The following is the PDE in the strong form
\nabla ^2 \phi = -\frac{q}{2 \lambda^2}

If I am not wrong should q be defined as an dolfin expression?

Is q known?
If not you have only one equation for two unknowns.