← Back to team overview

dolfin team mailing list archive

Re: new Function design

 

ok. Is there anyway to have a 'null' form (or a default form)? In the case of user defined functions, the form is not really necessary. Or, could we not just tell the user that he always has to specify a form whenever he has a function? If the form is irrelevant, he could just use whatever form was convenient. Maybe this is what is already being done...

It feels like the basis functions are too intertwined with the bilinear forms. I agree that forms should require a basis, but not the other way around.

- Shawn

On Tue, 21 Oct 2008, Garth N. Wells wrote:



Shawn Walker wrote:
The thing that has been confusing me about this, is the need for a form. By form you mean a weak/variational form of a PDE, right?

Yes.

But what does
this have to do with defining a discrete function? A discrete function only depends on a set of basis functions. Of course, you need a DoFmap, but that still doesn't require a bilinear form.

Correct, a form doesn't have anything to with defining a function from a particular space, but a form requires functions that do come from a known function space. We can't just pass around a pointer to a function that returns exp(x^2 + y^2), we need to attach a basis to the function. This last point is what we're grappling with in the case of user-defined functions.

Garth

Even a (finite element)
function space does not depend on a particular form (e.g. H^1 could be used for many different variational problems).

I'm probably missing something. I still don't know the whole dolfin/ffc setup yet. I appreciate any help you can give.

- Shawn

On Tue, 21 Oct 2008, Garth N. Wells wrote:

Shawn Walker wrote:
I may be missing part of the argument here, but for the case when a user defined function is something like exp(x^2 + y^2), could we just pass a function pointer (for this particular function) to the interpolation routine? In MATLAB, this type of thing is easy because of function handles. I know we don't have that luxury, but a function pointer kind of does this.

Sorry, if I am not understanding the issue.


The difficulty is that all the functions in a form come from a finite element space, and the space determines where we need to evaluate the functions. Before, DOLFIN figured out the appropriate space, and user-defined function were interpolated in this space, but it made the design complex when handling different function types. What we aim for now is to have all Functions fully-defined (but we'd like to keep it simple for users too).

Garth

- Shawn

On Tue, 21 Oct 2008, Garth N. Wells wrote:



Anders Logg wrote:
On Tue, Oct 21, 2008 at 04:45:01PM +0100, Garth N. Wells wrote:
I have a few questions and thoughts regarding the new Function design

* It's not clear to me what the intention is with user-defined
functions. The functions Function::interpolate(...) never call eval(..), so they can't pick up user-defined values. Should Function::interpolate
test for the presence of a GenericVector to decide whether or not the
Function is discrete or user-defined?

Yes, sorry. I've missed this. I'll fix it.

* It would be useful to declare user-defined functions without
associating a FunctionSpace. If we want to interpolate the function, a
FunctionSpace must then be provided. Anyone see any problems with this?

The reasoning here is that all Functions must always be associated
with a FunctionSpace so that they may be correctly interpreted in
forms and correctly plotted. When a Function is created in PyDOLFIN,
it must always be associated with a certain FiniteElement (and in a
while FunctionSpace). It would simplify the handling of Functions if
they are always associated with a FunctionSpace.


I agree that is makes life simple if every function has a space, but it
is a bit clunky for declaring user-defined functions. The forms must be
declared first to extract the finite element to create the function
space. Could look nasty when a lot of functions are involved.

We have a function Function::interpolate which takes a function space V
as an argument and it interpolates the function u in V. What if we
permit undefined function spaces (which perhaps only have a domain)? We
would then interpolate the user defined function u in the provided space V.

Garth




------------------------------------------------------------------------
_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev


_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev








Follow ups

References