Hello,
I seem to be unable to raise exponential functions to non-integer values in FEniCS: they just return an array of nans.
I cannot seem to find any previous questions or documentation concerning this, so have come here.
For context, I have been attempting to implement a solution of non-linear diffusion-like equation, following https://fenicsproject.org/docs/dolfin/1.6.0/python/demo/documented/nonlinear-poisson/python/documentation.html.
I hope I haven’t made a silly mathematical error, but I am not sure what else to try.
from dolfin import * # from fenics import * replaced by dolfin
# Setup:
DEG = 5
mesh = IntervalMesh(100, 0.0001, 20)
V = FunctionSpace(mesh, 'CG', DEG)
# First function, exponential, doesn't work
u_0 = Expression('exp(-pow(x[0], 2))', degree=DEG)
u_n = project(u_0, V)
powered= pow(u_n, 2/3)
print(project(powered, V).vector().get_local()) # A full array of NaNs
# Same function, exponential, integer power, works
u_0 = Expression('exp(-pow(x[0], 2))', degree=DEG)
u_n = project(u_0, V)
powered= pow(u_n, 2)
print(project(powered, V).vector().get_local()) # Working
# Linear, non-integer power, works
u_0 = Expression('x[0]', degree=DEG)
u_n = project(u_0, V)
powered= pow(u_n, 2/3)
print(project(powered, V).vector().get_local()) # Working
Many thanks.
$ dolfin-version
2019.1.0
Python running in a Jupyter notebook on Ubuntu 18.04.4
Python 3.6.9
[GCC 8.4.0] on linux