← Back to team overview

dolfin team mailing list archive

Re: MixedElement in ffc

 

Hi again.

I ran into something strange in ffc which I have no answer for that. 
referring to the following the following piece of code, I am defining a 
Function named "Tau0" , however when in the main program I define 
"L.Tau0" it gives me a strange error saying that "  ‘class 
SWELinearForm’ has no member named ‘Tau0’ "  . Is it related to the use 
of MixedElement??? 

_________________________________________________________

P2 = VectorElement("Lagrange", "triangle", 1)
P1 = FiniteElement("Lagrange", "triangle", 1)
P0 = FiniteElement("Discontinuous Lagrange", "triangle", 0)
TH = MixedElement([P2 ,P1, P0])


(v,w,q) = TestFunctions(TH)
(U,P,Tau) = TrialFunctions(TH)


U0=Function(P2)
P0=Function(P1)
Tau0=Function(P0)

#Defining Normal components
n=FacetNormal("triangle")


a1 = (dot(U,v)+ dot(grad(P),v))*dx 
a2 = (P*w - dot(U,grad(w)))*dx  
a3 = Tau*q*dx

L1 = (dot(U0,v)- dot(grad(P0),v)-.5*k*Tau0*dot(U0,v))*dx    
L2 = (P0*w+dot(U0,grad(w)))*dx +w*H*k*dot(n,U0)*ds
L3 = Tau0*q*dx

a=a1+a2+a3
L=L1+L2+L3
_____________________________________________









Thanks, 
Hatef


Hatef Monajemi wrote:
> Thanks Andy. That worked!
> 
> Andy Ray Terrel wrote:
> > On Mon, Mar 16, 2009 at 7:32 PM, Andy Ray Terrel  wrote:
> > > 2009/3/16 Hatef Monajemi :
> > >> Hi,
> > >>
> > >> I would assume more than 2 elemnts should be O.K for ffc. 
However, 
> I am
> > >> getting some error while trying the following code:
> > >>
> > >> -----------------------------------
> > >>
> > >> P2 = VectorElement("Lagrange", "triangle", 1)
> > >> P1 = FiniteElement("Lagrange", "triangle", 1)
> > >> P3 = FiniteElement("Discontinuous Lagrange", "triangle", 0)
> > >> TH = (P2 + P1)+ P3
> > > ^^^^^^^^^^^^^^^^^^^^^
> > >
> > > To fix the trace back replace the above line with
> > > TH = MixedElement(P2,P1,P3)
> > 
> > opps copied the wrong line =D, use:
> > 
> > TH = MixedElement([P2,P1,P3])
> > 
> > 
> > >
> > > The above code creates a Mixed element like so ((v,w), q)
> > >
> > > -- Andy
> > >
> > >>
> > >> (v,w,q) = TestFunctions(TH)
> > >> (U,P,Tau) = TrialFunctions(TH)
> > >>
> > >>
> > >>
> > >> a1 =a1(U,P;v)
> > >> a2 = a2(U,P;w)
> > >> a3 = a3(Tau;q)
> > >>
> > >> a=a1+a2+a3
> > >> ----------------------------------------------
> > >>
> > >> does anyone know what is wrong here?
> > >>
> > >> This is the error I am geting:
> > >>
> > >>  ****need more than 2 values to unpack
> > >>
> > >> I want to basically add a constant number on every element 
besides 
> velocity
> > >> and pressure on nodal points , That's why I used the P3 type of
> > >> FiniteElement.
> > >>
> > >>
> > >>
> > >>
> > >> Thanks ,
> > >>
> > >> H! at! ! ef
> > >>
> > >> _______________________________________________
> > >> DOLFIN-dev mailing list
> > >> DOLFIN-dev@xxxxxxxxxx
> > >> http://www.fenics.org/mailman/listinfo/dolfin-dev
> > >>
> > >>
> > >
> 
> --------------------------------------
> Hatef Monajemi
> Graduate Student
> Dept of Civil and Environmental Eng
> 2032 MC Building, Carleton University 
> 1125 Colonel By Drive, Ottawa 
> Ontario, Canada, K1S 5B6
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev

--------------------------------------

Hatef Monajemi
Graduate Student
Dept of Civil and Environmental Eng
2032 MC Building, Carleton University 
1125 Colonel By Drive, Ottawa 
Ontario, Canada, K1S 5B6


Follow ups