ffc team mailing list archive
-
ffc team
-
Mailing list archive
-
Message #00474
Re: mean() for vectors
I used it componentwise: mean(uc[i1])
Is that ok?
/Johan
> Yes, it should be supported for vector-valued Functions, but it's not
> supported for general expressions:
>
> mean(f) # ok
> mean(f + g) # not ok
> mean(grad(f)) # not ok
>
> How have you used it in the form? If it's just mean(f) where f is a
> vector-valued function, then it should work.
>
> /Anders
>
>
> On Wed, Dec 21, 2005 at 01:28:46PM +0100, Johan Hoffman wrote:
>> Anders,
>>
>> Is the mean() function in FFC not supported for vector functions? Or am
>> I
>> missing something?
>>
>> /Johan
>>
>>
>>
>>
>> na41>ffc Poisson.form
>> This is FFC, the FEniCS Form Compiler, version 0.2.4.
>> For further information, go to http://www/fenics.org/ffc/.
>> Parsing Poisson.form
>> Output written to Poisson.py
>>
>> Compiling form: (dXa0/dx0)(dXa1/dx0) | ((d/dXa0)vi0)*((d/dXa1)vi1)*dX +
>> (dXa0/dx 1)(dXa1/dx1) | ((d/dXa0)vi0)*((d/dXa1)vi1)*dX
>> Finite element of test space: Lagrange finite element of degree 1 on a
>> Triangle with 1 components
>> Finite element of trial space: Lagrange finite element of degree 1 on a
>> Triangle with 1 components
>> Compiling tensor representation for interior
>> Hard signatures match for terms 0 and 1, factorizing
>> Computing reference tensor, this may take some time...
>> ................................................................................
>> Reference tensor computed in 0.00739 seconds.
>> Compiling tensor representation for boundary
>> Hard signatures match for terms 0 and 1, factorizing
>>
>> Compiling form: w0_a0 | vi0*va0*dX
>> Finite element of test space: Lagrange finite element of degree 1 on a
>> Triangle with 1 components
>> Finite elements for functions: [Lagrange finite element of degree 1 on a
>> Triangl e with 1 components]
>> Compiling tensor representation for interior
>> Computing reference tensor, this may take some time...
>> ................................................................................
>> Reference tensor computed in 0.012 seconds.
>> Compiling tensor representation for boundary
>>
>> Generating output for DOLFIN
>> Output written to Poisson.h
>> na41>cd
>> na41>cd local/dolfin/src/modules/navierstokes/dolfin/
>> na41>ffc NSEContinuity.form
>> This is FFC, the FEniCS Form Compiler, version 0.2.4.
>> For further information, go to http://www/fenics.org/ffc/.
>> Parsing NSEContinuity.form
>> Output written to NSEContinuity.py
>>
>> *** Error at w0_a69 | va69[a7]
>> *** Mean values are only supported for Functions.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> # Copyright (c) 2005 Johan Hoffman (hoffman@xxxxxxxxxxxx)
>> # Licensed under the GNU GPL Version 2
>> #
>> # The contiuity equation for the incompressible
>> # Navier-Stokes equations using cG(1)cG(1)
>> #
>> # Compile this form with FFC: ffc NSEContinuity.form.
>>
>> name = "NSEContinuity"
>> #scalar = FiniteElement("Lagrange", "triangle", 1)
>> #vector = FiniteElement("Vector Lagrange", "triangle", 1)
>> #constant_scalar = FiniteElement("Discontinuous Lagrange", "triangle",
>> 0)
>> #constant_vector = FiniteElement("Discontinuous vector Lagrange",
>> "triangle", 0)
>> scalar = FiniteElement("Lagrange", "tetrahedron", 1)
>> vector = FiniteElement("Vector Lagrange", "tetrahedron", 1)
>> #constant_vector = FiniteElement("Discontinuous vector Lagrange",
>> "tetrahedron", 0)
>> constant_scalar = FiniteElement("Discontinuous Lagrange", "tetrahedron",
>> 0)
>>
>> q = BasisFunction(scalar)
>> p = BasisFunction(scalar)
>> #um = Function(constant_vector)
>> uc = Function(vector)
>> f = Function(vector)
>>
>> delta1 = Function(constant_scalar) # stabilization
>>
>> i0 = Index()
>> i1 = Index()
>> i2 = Index()
>>
>> a = delta1*dot(grad(q), grad(p))*dx;
>> L = delta1*dot(grad(q), f)*dx - q*uc[i0].dx(i0)*dx -
>> delta1*q.dx(i0)*mean(uc[i1])*uc[i0].dx(i1)*dx
>> #L = delta1*dot(grad(q), f)*dx - q*uc[i0].dx(i0)*dx -
>> delta1*q.dx(i0)*um[i1]*uc[i0].dx(i1)*dx
>>
>> #a = delta1*q.dx(i0)*p.dx(i0)*dx
>> #L = delta1*q.dx(i0)*f[i0]*dx - delta1*q.dx(i0)*uc[i1]*uc[i0].dx(i1)*dx
>> -
>> q*uc[i0].dx(i0)*dx
>>
>>
>>
>>
>>
>> _______________________________________________
>> FFC-dev mailing list
>> FFC-dev@xxxxxxxxxx
>> http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev
>>
>
> --
> Anders Logg
> Research Assistant Professor
> Toyota Technological Institute at Chicago
> http://www.tti-c.org/logg/
>
--
Johan Hoffman, PhD
Assistant Professor
School of Computer Science and Communication
Royal Institute of Technology KTH
SE-100 44 Stockholm
Sweden
Email: jhoffman@xxxxxxxxxxx
URL: www.nada.kth.se/~jhoffman
Follow ups
References