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

Cahn-Hilliard demo: Exception thrown when changing the free energy function f(c)

0 votes

In the python documentation ( http://fenicsproject.org/documentation/dolfin/1.6.0/python/demo/documented/cahn-hilliard/python/documentation.html )
of the Cahn-Hilliard demo the free energy function f is defined as
f = 100 * c2 * (1-c)2

Trying to replace it in the python code with the following function fails:
N = 1
k = 1
TT = 2
TTc = 3
w = 2 * k * TTc
f = NkTT * ( clog(c) + (1-c)log(1-c) ) + Nw * c(1 - c)

As a result the runtime throws the following error:
TypeError: nb_float should return float object

Any help is appreciated.

Kind regards.

asked Oct 28, 2015 by bsh FEniCS Novice (180 points)

1 Answer

0 votes

I think you need ln(c) for the natural logarithm of c (log is a utility function that prints debug messages to a log file).

answered Oct 28, 2015 by clason FEniCS Novice (880 points)
...