Time dependent problem in mixed elements

Hi, I have a simple time dependent equation set here:
image
and I’m trying to solve this equation set with reference to the mixed Poisson demo Bitbucket. Following is my MWE:

from dolfin import *

# timestep
dt = 1

# define mesh and FunctionSpace
mesh = UnitSquareMesh(32,32)
V1 = FiniteElement('CG',mesh.ufl_cell(),1)
V2 = FiniteElement('CG',mesh.ufl_cell(),1)
V = FunctionSpace(mesh,V1*V2)

# initial condition projection
w_n = Function(V)
u10,u20 = w_n.split()
u10 = project(Expression('1+x[1]+x[0]',degree=1),V.sub(0).collapse())

# Define TrialFunctions and TestFunctions
u1,u2 = TrialFunctions(V)
v1,v2 = TestFunctions(V)

# Define variational problem
a = u1*v1*dx+dt*inner(grad(u2),grad(v1))*dx+u1*v2*dx-(1+u2)**(-1.5)*v2*dx
L = u10*v1*dx

# Solve and time stepping
w=Function(V)
out1=File('mixed/u1.pvd')
out2=File('mixed/u2.pvd')
t=0
for t in range(0,40):
    A = assemble(a)
    b = assemble(L)
    solve(A,w.vector(),b)
    u1,u2 = w.split()
    out1 << u1
    out2 << u2
    w_n.assign(w)
    t += 1

When I run this MWE, an error occurs as:
ufl.algorithms.check_arities.ArityMismatch: Applying nonlinear operator Power to expression depending on form argument v_1.
So what should I do to eliminate this error?
And also, as I tried to dodge the error by simplly replacing the (1+u2)**(-1.5)*v2*dx with u2*v2*dx, the u1 and u2 seems can’t update. Is there something wrong in my initial condition projection or somewhere else? Thanks!

Your project call overwrites the u10 variable.

And your problem isn’t linear given the right hand side of the second equation \frac{1}{(1 + u_2)^{1.5}} so I’d recommend consulting the nonlinear Poisson demo.

Also I’m a bit rushed here and may have made a stupid mistake, but can’t you reformulate this as:

- \frac{3}{2} (1 + u)^{-\frac{5}{2}} \frac{\partial u}{\partial t} = \nabla^2 u
1 Like