# Problem with NonlinearVariationalSolver

**URL:** <https://fenicsproject.discourse.group/t/problem-with-nonlinearvariationalsolver/1778>\
**Category:** Uncategorized\
**Created:** [October 24, 2019, 9:08am UTC](https://fenicsproject.discourse.group/t/problem-with-nonlinearvariationalsolver/1778 "2019-10-24T09:08:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CoE2845](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/coe2845/32/1210_2.png) [@CoE2845](https://fenicsproject.discourse.group/u/CoE2845)\
**Post date:** [October 24, 2019, 9:08am UTC](https://fenicsproject.discourse.group/t/problem-with-nonlinearvariationalsolver/1778/1 "2019-10-24T09:08:42Z")

</div>

Hi there,

I am currently trying to implement a Non-linear PDE solver in order to find the solution for:

```auto
F = T*v*dx + dt*dot(grad(T), grad(v))*dx + (1/kappa)*Q*v*dt*ds(3) + (1/kappa)*sum(integrals_R)-T_n*v*dx

```

Where sum(integral\_R) is defined as:

```auto
boundary_conditions = {0: {'Robin': (es, T_a4)},
                       1: {'Robin': (es, T_a4)},
                       2: {'Robin': (es, T_a4)},
                       3: {'Robin': (es, T_a4)}}

ds = Measure('ds', domain=mesh, subdomain_data = boundary_markers)
integrals_R = []
T = TrialFunction(V)
v = TestFunction(V)
T_ = Function(V)
T_n = interpolate(T_am, V)

#Account for Radiation
for i in boundary_conditions:
    if 'Robin' in boundary_conditions[i]:
        integrals_R.append(es*(T**4 - T_a4)*v*dt*ds(i))

```

Currently I have implemented a time dependent PDE solver:

```auto
F = T*v*dx + dt*dot(grad(T), grad(v))*dx + (1/kappa)*Q*v*dt*ds(3) + (1/kappa)*sum(integrals_R)-T_n*v*dx
T_= Function(V)
F = action(F,T_)
J = derivative(F, T_,T)
t = dt

while t <= time:
    print ('time =', t)
    Q.t = t
    problem = NonlinearVariationalProblem(F, T_, J)
    solver = NonlinearVariationalSolver(problem)
    solver.solve()
    t += dt
    T_n.assign(T_)

```

However, I get an error of the form:

```auto
File "test2D.py", line 117, in <module>
    problem = NonlinearVariationalProblem(F, T_, J)
  File "/usr/local/lib/python3.6/dist-packages/dolfin/fem/problem.py", line 95, in __init__
    cpp.fem.NonlinearVariationalProblem. __init__ (self, F, u._cpp_object, bcs, J)
TypeError: __init__ (): incompatible constructor arguments. The following argument types are supported:
    1. dolfin.cpp.fem.NonlinearVariationalProblem(arg0: dolfin.cpp.fem.Form, arg1: dolfin.cpp.function.Function, arg2: List[dolfin.cpp.fem.DirichletBC], arg3: dolfin.cpp.fem.Form)

```

I am very new to Fenics and I could be trying to solve this in the completely wrong way, so any help would be greatly appreciated.
