dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #17736
Re: [Question #102159]: user-defined vector valued function
Question #102159 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/102159
Status: Open => Answered
Garth Wells proposed the following answer:
On Thu, 2010-02-25 at 11:28 +0000, Richard Norton wrote:
> Question #102159 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/102159
>
> Status: Answered => Open
>
> Richard Norton is still having a problem:
> Sorry... in mathematical terms, sigma is a vector field from R^2 to R^2.
> It maps (a,b) to (a,2(b^2-1)b) for real numbers a and b. So yes,
> sigma_1 and sigma_2 are the two components of sigma. I want to define
> an expression or function (called "sigma") so that the following code
> makes sense...
>
Try this:
# Test and trial functions
v = TestFunction(V)
u = TrialFunction(V)
uold = Function(V)
def sigma(u):
return as_vector( [u.dx(0), 2*(u.dx(1)**2 -1)*u.dx(1)] )
# Variational problem
a = dot(grad(u), grad(v))*dx
L = dot(sigma(uold),grad(v))*dx
Garth
>
>
>
> # Test and trial functions
> v = TestFunction(V)
> u = TrialFunction(V)
> uold = Function(V)
>
> def sigma(gradu):
> ????
>
> # Variational problem
> a = dot(grad(u), grad(v))*dx
> L = dot(sigma(grad(uold)),grad(v))*dx
>
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.