FFC

Comment 21 for bug 897372

Revision history for this message
Kristian B. Ølgaard (k.b.oelgaard) wrote : Re: [Bug 897372] Re: FFC is extremely slow compared to SFC for this Fung-type material law

On 30 November 2011 19:05, Anders E. Johansen <email address hidden> wrote:
> Ok, I understand. I can confirm that the option
>
> ffc_options = {"quadrature_degree": 2}
>
> made the program run in approx. the times you mentioned.

Excellent.

I'm sorry, I
> was not aware of the high number of integration points.

Only Garth spotted the problem immediately, so you're excused.

> But I agree that a warning would be a good idea.

I added a warning, need to test if it is caught in PyDOLFIN though.

>
> Anders
>
> --
> You received this bug notification because you are a member of FFC Core
> Team, which is subscribed to FFC.
> https://bugs.launchpad.net/bugs/897372
>
> Title:
>  FFC is extremely slow compared to SFC for this Fung-type material law
>
> Status in FEniCS Form Compiler:
>  New
>
> Bug description:
>  FFC uses a considerable amount of time (> 1h) compiling the following
>  program. The generated .h-file exceeds 90MB. Running, it uses hours
>  assembling a matrix. Using the SFC compiler, compiling is done in no
>  more than ten minutes, and then the program finishes in about ten
>  seconds.
>
>  I have similar problems with FFC and this Fung-type material law in
>  other cases, eg computing the second Piola-Kirchhoff stress tensor.
>  Then, the SFC compiled code is about 22000 times faster than FFC.
>
>  Anders
>
>
>  from dolfin import *
>
>  mesh = UnitCube(2, 2, 2)
>  V = VectorFunctionSpace(mesh, "CG", 1)
>  bcl = DirichletBC(V, (0.0, 0.0, 0.0), "near(x[0], 0.0) && on_boundary")
>  bcr = DirichletBC(V, (0.1, 0.0, 0.0), "near(x[0], 1.0) && on_boundary")
>  bcs = [bcl, bcr]
>
>  v  = TestFunction(V)
>  u  = Function(V)
>  du = TrialFunction(V)
>
>  K   = Constant(0.876)
>  C   = Constant(10.0)
>  bff = Constant(18.48)
>  bxx = Constant(3.58)
>  bfx = Constant(2.8)
>
>  I = Identity(3)
>  F = I + grad(u)
>
>  a = Expression(("x[0]*DOLFIN_PI/8"))
>  R = as_matrix([[cos(a), 0, -sin(a)], [0, 1, 0], [sin(a), 0, cos(a)]])
>
>  F = variable(R.T*F*R)
>  E = 0.5*(F.T*F - I)
>  J = det(F)
>
>  f=0; s=1; n=2
>  W = (bff*E[f,f]**2
>       + bxx*(E[n,n]**2 + E[s,s]**2 + E[n,s]**2)
>       + bfx*(E[f,n]**2 + E[n,f]**2 + E[f,s]**2 + E[s,f]**2))
>  psi = 0.5*K*(exp(W) - 1) + C*(J*ln(J) - J + 1)
>
>  P = diff(psi, F)
>  P = R*P*R.T
>
>  L = inner(P, grad(v))*dx
>  a = derivative(L, u, du)
>  solve(L==0, u, bcs, J=a)
>  plot(u, mode="displacement", interactive=True)
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ffc/+bug/897372/+subscriptions