← Back to team overview

dolfin team mailing list archive

[Question #105262]: Another question about piecewise defined function

 

New question #105262 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/105262

I have taken a look at Achim Schroll's question and the answers. But I still have trouble to make it run.

My problem is a little different,  I need to apply an expression instead of constants in the piecewise function.

e.g.

alpha = Expression("1 + x[0]*x[0] + 3*x[1]*x[1] + 1.2*t")

class Alpha(Expression):
    def eval(self, v, x):
        v[0] = 0
        if x[0] > 0.5: v[0] = alpha
u0 = Alpha()
u_prev = interpolate(u0, V)

When I interpolate u0 to apply initial condition, the system gave me error like:

 line 28, in interpolate
    Pv.interpolate(v)
Exception: Swig director method error. Error detected when calling 'Expression.eval_data'

I tried to use just constants, it ran well. but it failed for the expressions. Anyone knows why? Thank you.





-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.



Follow ups