Question #133595 on DOLFIN changed: https://answers.launchpad.net/dolfin/+question/133595
Status: Answered => Open Thomas Fraunholz is still having a problem: Ok. When I use L = L - dt*(inner(div(grad(w)), anisotropic_tension(c0)*div(grad(c)))*dx) and the simplified expression def anisotropic_tension(c0): return cos(c0.dx(1)) it works. But there is still a problem with the arctan I need. If I use the ufl version, e.g. def anisotropic_tension(c0): return cos(N*atan(c0.dx(1)/c0.dx(0))) I got a native problem when c0.dx(0) equals zero. Then the solver returns in every step 'not a number'. So I'm looking for a possibility like atan2 in the cmath library or the arctan2 numpy version. A first try with an if/else expression didn't helped either. But I'm not really sure if I am allowed to writefor example def anisotropic_tension(c0): if c0.dx(0) > 0.01: return cos(N*atan(c0.dx(1)/c0.dx(0))) else: return cos(N*atan(c0.dx(1)/0.01)) Thanks in advance for your help, Thomas -- You received this question notification because you are a member of DOLFIN Team, which is an answer contact for DOLFIN. _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp