Linearity of solution dependent property

Hi, I am working on a problem with solution dependent property, for instance k(u)\frac{du}{dt}=\frac{d^2u}{dx^2}. I am wondering how to implement it. I saw some posts giving almost the same solution: define u=Function(V), and then define k as an expression such as k=Expression('u+1',u=u,degree=2). I am confused by this implementation, since it is treating each time step as a non-linear problem (linear problem defines TrialFunction first). It looks to me that Expression freezes k(u) at each time step based on the solution of u in the previous step, thus we are solving a linear problem at each time step. Why in all examples (e.g. Material property depending on solution) we do not define u=TrialFunction(V)?

I tried u=TrialFunction(V) and k=Expression('u+1',u=u,degree=2). It reports error, so it seems Expression does not input TrialFunction. Is it designed on purpose?

Perhaps look at the nonlinear Poisson demo as a guide.

Thanks for your reply. I have read the demo. The demo expresses k(u)=u**2 directly without an Expression. I can understand that the demo is a non-linear case since u**2 is computed in Jacobian. I will need a conditional expression (e.g.,u>1?u+1:u+2) so I do not think I can use a simple form.

Why not? Your conditional is piecewise gateaux differentiable.

If you don’t want to use Newton’s method you could look into Picard iteration. E.g. the Navier Stokes demo.

Thanks again for your reply. How to express the conditional expression in the variational form?

Check the documentation.

E.g.

from dolfin import *

mesh = UnitSquareMesh(32, 32)
V = FunctionSpace(mesh,"DG",0)
x = SpatialCoordinate(mesh)
f0 = conditional(lt(x[0], 0.5), 1.0, 0.0)

image