← Back to team overview

ufl team mailing list archive

Re: Dirichlet boundary conditions

 

tor, 19.06.2008 kl. 12.17 +0200, skrev Martin Sandve Alnæs:
> 2008/6/19 Kent-Andre Mardal <kent-and@xxxxxxxxx>:
> >
> > tor, 19.06.2008 kl. 11.38 +0200, skrev Martin Sandve Alnæs:
> >> 2008/6/19 Kent-Andre Mardal <kent-and@xxxxxxxxx>:
> >> >
> >> > Should we include Dirichlet conditions in UFL ?
> >> >
> >> > It could be done with the notion of traces:
> >> >
> >> > g = Function(...)
> >> > u = TrialFunction(...)
> >> > T = FacetTrace(...)
> >>
> >> From a programming point of view, this line makes no sense to me:
> >>
> >> > T*u = g
> >>
> >> What it means mathematically is clear, but this can never be valid
> Python.
> >
> > You're right. Maybe
> > T*u == g.
> > Is this possible in Python ? It is in C++...
> 
> The assignment operator doesn't exist in Python.
> 
> Even if it did work, say in C++ or using ==, "T*u" would a a temporary
> object,
> and "(T*u) == g" would be a call to (T*u).operator==(g) returning
> another
> temporary object, which would then dissapear on the next line.
> 
> 
> >> Do you mean something like:
> >>
> >> a = u*v*dx + dot(u,n)*v*ds(0) + g*T(1)
> >>
> >> where T(i) and ds(i) would refer to the same boundary?
> >>
> >
> > Could be but I think this is less mathematically clear
> > (for one thing a would not be bilinear)
> >
> > c = T*u == g.
> > a = u*v*dx + dot(u,n)*v*ds(0)
> 
> So you don't want the BC to be part of the form.

It is a form, just not a bilinear one. 

> Where should it be used? Why should it be part of UFL
> and not just a dolfin component?
> 

Could be that we should leave Dirichlet bc as it is. It's just
that T is in some respect very similar to ds. 

> If we are to include this in UFL, it should support arbitrary UFL expressions
> in place of g, and we would also have to support component-wise conditions:
> 
> just_some_expression = (dot(g, n) + inner(grad(g), grad(g)))
> c = T*(u[0]) == just_some_expression

This makes sense, eg in elasticity you have Neumann in one component and
Dirichlet in another on the same sub-domain. 

> 
> This means we must generate code for it, and need to extend UFC to include it.
>
> If we only support the basic "u = g" condition, I don't see the point
> with adding it to UFL.
> 

I am not sure how much this affect UFC, but it could for instance be
nice to write

T*u*normal = g 

where g is a Function and normal is the outward normal. 


But anyway, this is just a thought that has not been thought properly
through yet... 

Kent




Follow ups

References