### Avoiding NaN on invariants of Cauchy Green deformation tensor

88

views

0

I would like to limit the values of invariants of Cauchy Green deformation tensor. In the code below Igama should not be lower than zero since there is a square root of Igama at the end. When I do this I get this message: "UFL conditions cannot be evaluated as bool in a Python context". If I donot limit I gama solution yields NaN. So, how can I limit the value of a solution variable (Igama)?

I = Identity(d) # Identity tensor

F = I + grad(u1) # Deformation gradient

C = F.T*F # Right Cauchy-Green tensor

Cinv=inv(C)

Finv=inv(F)

J = det(F)

I1 = tr(C)

I2 = 0.5*(tr(C)**2-tr(dot(C,C)))

I3 = J**2.0

Jinv=J**(-1.0)

I1bar=I1/(I3**(1.0/3.0))

I2bar=I2/(I3**(2.0/3.0))

Igama = (2.0*(I1bar**2)-6.0*I2bar)

tol=1E-14

if Igama < tol:

Igama = tol

Igama = (Igama**0.5)/6.0

I = Identity(d) # Identity tensor

F = I + grad(u1) # Deformation gradient

C = F.T*F # Right Cauchy-Green tensor

Cinv=inv(C)

Finv=inv(F)

J = det(F)

I1 = tr(C)

I2 = 0.5*(tr(C)**2-tr(dot(C,C)))

I3 = J**2.0

Jinv=J**(-1.0)

I1bar=I1/(I3**(1.0/3.0))

I2bar=I2/(I3**(2.0/3.0))

Igama = (2.0*(I1bar**2)-6.0*I2bar)

tol=1E-14

if Igama < tol:

Igama = tol

Igama = (Igama**0.5)/6.0

Community: FEniCS Project

### 2 Answers

Please login to add an answer/comment or follow this question.