dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #20366
Re: [Question #127978]: User-defined function in a nonlinear problem
Question #127978 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/127978
Johan Hake posted a new comment:
Sorry for the late replay...
In Python you can:
class MyExpr(Expression):
def __init__(self, func):
self.func = func
def eval(self, value, x):
value[0] = 0.0
feval = self.func(x)
if feval>0:
value[0] = feval
myexpr = MyExpr(func)
You can also make a compiled expression. See the docstring of
Expression, under bullet point 2, for this.
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.