← Back to team overview

dolfin team mailing list archive

Re: Dirichlet bc functions

 

2008/11/3 Garth N. Wells <gnw20@xxxxxxxxx>:
>
>
> Anders Logg wrote:
>> On Mon, Nov 03, 2008 at 02:38:36PM +0000, Garth N. Wells wrote:
>>>
>>> Anders Logg wrote:
>>>> On Mon, Nov 03, 2008 at 11:22:26AM +0000, Garth N. Wells wrote:
>>>>> Anders Logg wrote:
>>>>>> On Sun, Nov 02, 2008 at 06:29:25PM +0000, Garth N. Wells wrote:
>>>>>>> Anders Logg wrote:
>>>>>>>> On Sun, Nov 02, 2008 at 05:52:21PM +0000, Garth N. Wells wrote:
>>>>>>>>> Do we want to insist that Dirichlet bc functions that do not appear
>>>>>>>>> inside a form are constructed with a FunctionSpace? DirichletBC is
>>>>>>>>> supplied with a FunctionSpace, so if the bc Function does not have a
>>>>>>>>> FunctionSpace, we could attach one automatically.
>>>>>>>>>
>>>>>>>>> Garth
>>>>>>>>> _______________________________________________
>>>>>>>>> DOLFIN-dev mailing list
>>>>>>>>> DOLFIN-dev@xxxxxxxxxx
>>>>>>>>> http://www.fenics.org/mailman/listinfo/dolfin-dev
>>>>>>>> I think this is already handled. Look in the Poisson demo. It uses a
>>>>>>>> Constant to set the BC and it does not have a FunctionSpace attached
>>>>>>>> to it. The DirichletBC class now uses its own FunctionSpace rather
>>>>>>>> than the one that the Function has (if any). There is a check (in
>>>>>>>> DirichletBC::check()) that checks that the FunctionSpace for the
>>>>>>>> Function is the same as the one in the DirichletBC.
>>>>>>>>
>>>>>>> It works for Constant, but not for Functions. I was getting an error
>>>>>>> when Function::interpolate is called. Function::interpolate leads to
>>>>>>> eval being called, in which case there is a test for the FunctionSpace
>>>>>>> which fails. Constant provides its own eval and therefore doesn't have a
>>>>>>> problem.
>>>>>>>
>>>>>>> For now, I've added a test in DirichletBC for the FunctionSpace. What we
>>>>>>> can add is an attach function if there is no FunctionSpace associated.
>>>>>>>
>>>>>>> Garth
>>>>>> In which demo does this show up? Is there a simple way I can comment
>>>>>> something out to reproduce the error so I understand what goes wrong?
>>>>>>
>>>>> Look at /demo/nls/nonlinearpoisson/cpp.
>>>>>
>>>>> If you change
>>>>>
>>>>>    DirichletBoundaryCondition g(V, t);
>>>>>
>>>>> to
>>>>>
>>>>>    DirichletBoundaryCondition g(t);
>>>>>
>>>>> it will break down.
>>>>>
>>>>> Garth
>>>> ok I see the problem now.
>>>>
>>>> The problem is a user may choose to either overload a scalar eval
>>>> function or a tensor eval function and we need to decide which one
>>>> after the callback from ufc::function::evaluate(). If the
>>>> FunctionSpace is not known, we can't decide which one to pick.
>>>>
>>>> If we insist that one should be able to pass a Function without a
>>>> FunctionSpace to a DirichletBC, then we must remove the scalar eval
>>>> function.
>>>>
>>> Fine with me. I think that it makes things simpler because the eval
>>> interface remains the same for all user-defined functions.
>>>
>>> Garth
>>
>> ok. It will also look the same as in Python.
>>
>
> We discussed recently passing an object to eval() which contains some
> data. It would be useful the object also carried information on the rank
> and dimension of the function to allow checks and switching between
> 1D/2D/3D problems.

But a Function is supposed to implement rank() and dim(i)...
It can't do that if it doesn't know this itself.

--
Martin


References