ufl team mailing list archive
-
ufl team
-
Mailing list archive
-
Message #01246
Re: Upwinding function
On Fri, Apr 24, 2009 at 1:00 PM, Garth N. Wells <gnw20@xxxxxxxxx> wrote:
> To get upwinding in a DG formulation of the advection-diffusion eqn with
> the FFC .form language, we used
>
> vector = VectorElement("Lagrange", "triangle", 2)
> scalar = FiniteElement("Discontinuous Lagrange", "triangle", 1)
> constant = FiniteElement("Discontinuous Lagrange", "triangle", 0)
>
> u = TrialFunction(scalar)
> b = Function(vector)
> of = Function(constant)
>
> def upwind(u, b):
> return [b[i]('+')*(of('+')*u('+') + of('-')*u('-')) for i in range(2)]
>
> to return the product b*u, with u taken from the 'upwind' side. How
> should the function 'upwind' look using UFL?
Lets see...
def upwind(u, b):
s = of('+')*u('+') + of('-')*u('-')
return [b[i]('+')*s for i in range(2)]
This returns a list, so it's a vector-valued expression?
s is a scalar expression, and b is a vector-valued expression,
so I would simply do
def upwind(u, b):
s = of('+')*u('+') + of('-')*u('-')
return b('+')*s
Does that look right?
Martin
Follow ups
References