dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #08193
Re: unit vectors in FFC?
On Thu, Jun 12, 2008 at 02:42:12PM -0500, Matthew Knepley wrote:
> On Thu, Jun 12, 2008 at 2:37 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> > On Wed, Jun 11, 2008 at 08:11:56AM -0400, mspieg wrote:
> >> Hi all,
> >> is there a simple way to implement a known constant vector (e.g. the unit
> >> vector jhat = [ 0 1]') into a FFC form?
> >>
> >> my specific issue is that the right hand side of my PDE looks like
> >>
> >> -\Div f\jhat = - df/dy
> >>
> >> where f(x,y) is a user defined scalar function (and df/dy is not easily
> >> evaluated)
> >>
> >> Given a test function v, the weak form (in pseudo-latex) is
> >>
> >> \int dv/dy f dx - \int v f \jhat\dot ds
> >>
> >> The question is how to evaluate the 2nd term in the FFC form language (the
> >> volume integral works fine as v.dx(1)*f*dx)
> >>
> >> ideally something like
> >>
> >> jhat=??
> >> L = v.dx(1)*f*dx) - v*f*jhat*ds
> >>
> >> (or more generally for a known unit vector k L=dot(grad(v),k)*f*dx - v*f*k*ds
> >> )
> >>
> >> would be nice (in the same way as simple known constants can be built in
> >> directly)
> >>
> >> But I'm flexible...all help greatly appreciated
> >> marc
> >
> > It looks like you expect ds to be a vector. It's not. It's a scalar.
>
> But you can get the surface normal as a vector, right? I think that
> is what Marc wants.
>
> Matt
Yes, just do
n = FacetNormal(shape)
So I guess what you want to do is
v*f*dot([0, 1], n)*ds
?
--
Anders
Attachment:
signature.asc
Description: Digital signature
Follow ups
References