Hi there,
I am currently trying to implement a Non-linear PDE solver in order to find the solution for:
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:
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:
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:
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.