← Back to team overview

ffc team mailing list archive

Re: Problems with Nonlinear Stokes flow

 

Quoting Jed Brown <fenics@xxxxxxxx>:

> On 20 Sep 2007, k.b.oelgaard@xxxxxxxxxx wrote:
> 
> > Quoting Jed Brown <fenics@xxxxxxxx>:
> >
> >> The issue with general powers ought to be pretty easy to rectify.  The
> >> inability to take roots or inverses of a sum might be deeper, but it is
> >> essential for me to use FFC.  Any tips about how to go about this?
> > 
> > Just substitute your sum with one function, and compute the sum elsewhere.
> 
> Can I do it within this form?  I can't take derivatives from within
> Dolfin, but I guess I could outsource that job to another form?  Clumsy
> but workable.

if you're thinking something like:
f0 = Function()
f1 = Function()
sum = f0 + f1
1/sum

it won't work, I've tried things like this many times but FFC spots it every
time and complains about it. Outsourcing is the keyword here also in terms of
FFC compile time and file size.
 
> >> To avoid the massive hit for computation, I should be able to use
> >> quadrature.  Presumably the tensor-based code is more efficient, I
> >> could use quadrature for development and only generate the tensor
> >> code for production.  Alternatively, I should be able to compile the
> >> form into its own object file and then just link to it.  This doesn't
> >> help for when I edit the form, but that shouldn't happen too often.
> >
> > This should be fixed now.
> 
> Quadrature works now (FFC still takes a few minutes) and generates code
> that is less than 1 MiB (instead of 16 MiB) for the Newton case.  The
> Newton case without quadrature generates 16 MiB of code and I killed the
> build job after 5 hours with my CPU pegged and 600 MiB memory usage.
> The code explosion is confusing to me because there is basically nothing
> to do.  There are no test/trial functions involved in defining D2 (or
> eta).
> 
No, but the order of the form is still going up quite fast just by multiplying
the functions -> increase of quadrature points.

Consider the following form:

constant = FiniteElement("Discontinuous Lagrange", "triangle", 0)
scalar   = FiniteElement("Lagrange", "triangle", 1)
vector   = VectorElement("Lagrange", "triangle", 1)

v     = TestFunction(scalar)
F     = Function(scalar)
rho_w = Function(scalar)
kro   = Function(scalar)
mu_o  = Function(scalar)
rho_o = Function(scalar)
k     = Function(constant)
G     = Function(constant)

def g(gravity):
  return [0.0, gravity]

source   = mult(k*(kro/mu_o)*F*(rho_o - rho_w), g(G) )
L = dot(grad(v),source)*dx

The source term in this case could be computed in a different form file and be
replaced by just one vector valued function.

Kristian


Follow ups

References