← Back to team overview

dolfin team mailing list archive

Re: [Question #133595]: how to evaluate the angle from the x-axis of a gradient

 

Question #133595 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/133595

    Status: Open => Answered

Kristian B. Ølgaard proposed the following answer:
I'm not sure atan2 would help if the second argument is zero.

You need to use Conditional from UFL to define the if/else statement:

cond = conditional( eq(c0.dx(0), 0.0), 1.0, c0.dx(0) )
def anisotropic_tension(c0):
   return cos(atan(c0.dx(1) / cond))

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