This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Interpolation and Nonlinearities

0 votes

Suppose I have a nonlinearity f(x) of some sort that appears in my PDE. One way of handling the nonlinearity, that works fine, is to project it into an appropriate function space using project:

f = project(u**3, V)

However, when I try to approximate the nonlinearity by interpolation, I get an error:

f = interpolate(u**3, V)

gives

TypeError: in method 'Function_interpolate', argument 2 of type 'dolfin::GenericFunction const &'

If this is not the way to handle interpolation, is there a way to do it?

asked Mar 5, 2016 by gideonsimpson FEniCS Novice (510 points)

1 Answer

0 votes

If u is a function in the space V, you may work with u.vector() to
get what you want. If u is not in V then it is not clear what interpolate in
general means (at least not to me). However project always has a clear meaning.

answered Mar 5, 2016 by Kent-Andre Mardal FEniCS Expert (14,380 points)
...