← Back to team overview

dolfin team mailing list archive

Re: [Question #127166]: computing funtionals and setting a flux condition

 

On Tue, Sep 28, 2010 at 08:50:53AM -0700, Johan Hake wrote:
> On Tuesday September 28 2010 05:34:06 Achim Schroll wrote:
> > New question #127166 on DOLFIN:
> > https://answers.launchpad.net/dolfin/+question/127166
> >
> > Hi!
> >
> > Thanks for the new tutorial (aug 2010)!
> >
> > Ultimately I need to specify a flux condition on a (small) part of the
> > boundary as explained in Section 6.3. But, is it true that "it is not
> > possible to perform integrals over different parts of the ... boundary
> > using ... the VariationalProblem instance"?
>
> This should be possible. Just pass a FacetFunction which marks the different
> Boundary domains, as the exterior_facet_domains.
>
> Can you point me to the tutorial. I think I do not have the latest copy.

It's available from http://www.fenics.org/doc/

> > Background: I am solving the nonlinear DEMOSTRAT model and want to model
> > sediment inflow through a river bed. Just recently, before the summer, I
> > updated my code to implement the fully nonlinear system and to use DOLFINs
> > features like automatic form building and nonlinearity. I don't want to go
> > back to manual linearization etc...
> >
> > Another detail:
> > Any idea what could be wrong when using the code on page 24 to evaluate the
> > total flux: n = FacetNormal(mesh)
> > flux = -dot(grad(u),n)*ds
> > total_flux = assemble(flux)
> > A runtime error appears: "Unable to extract mesh from form (no mesh found)"
> > when executing the last line.
>
> This because the dolfin::Form which is used to pass the ufc::form to the
> assembler only chech the FunctionSpaces of the Test and TrialSpaces for a
> mesh. So you need to pass this manually by:
>
>   total_flux = assemble(flux, mesh=mesh)
>
> I think it would be convinient to be able to assemble a scalar from a
> Function. The mesh is contained in the FunctionSpace so it should be possible.
> I then need to figure out if a GenericFunction is a Function or an Expression.
> Maybe we can add a has_function_space() method to the GenericFunction
> interface?

Sounds ok to me.

--
Anders



Follow ups

References