← Back to team overview

dolfin team mailing list archive

Re: [Question #95954]: Absent Coefficient in Linear Form

 

Question #95954 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/95954

    Status: Open => Answered

Garth Wells proposed the following answer:

as Maximoff wrote:
> New question #95954 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/95954
> 
> Hello
> 
> I have a ufl file like so (for the Heat Equation with time-stepping via the theta-method):
> 
> element = FiniteElement("Lagrange", "triangle", 2)
> 
> v         = TestFunction(element)
> u         = TrialFunction(element)
> kappa = Coefficient(element)
> u_old  = Coefficient(element)
> f          = Coefficient(element)
> 
> dt = ....
> 
> a = u*v*dx + theta*dt*kappa*inner(grad(u), grad(v))*dx
> L = ((u_old + dt*f)*v - (1-theta)*dt*kappa*inner(grad(u), grad(v)))*dx
> 
> The problem is that I can't assign kappa to L.kappa in the linear form, i.e.,
> 
> L.kappa = kappa
> 
> This is fine though for the Bilinear form.
> 
> On examining the generated header file, it turns out that the LinearForm class has no member kappa which is exactly the error message given. 
> 
> What am I doing wrong?
>

Are you setting theta=0? In this case, UFL will discard the entire
product involving theta.

Also, your form is not correct. You cannot have the trial function u
appearing in L.

Garth

> Best wishes 
> 
> Pietro
> 
>

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.