dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22513
Re: [Question #152076]: Initial Concition for vector valued function
On Fri, Apr 08, 2011 at 08:45:07AM -0000, Melanie Jahny wrote:
> New question #152076 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/152076
>
> I've got a Trial Function in VectorFunctionSpace and I'd like to
> define an initial value for this function.
> My function is defined as follows:
>
> class InitialConditions(Expression):
> def __init__(self):
> values[0] = 0.02
> values[1] = 0.02
This part looks strange. Why do you set the values in the constructor.
> def eval(self, values, x):
> values[0] = 0.02
> values[1] = 0.02
> def value_shape(self):
> return (2,)
This part looks good.
> V = VectorFunctionSpace(mesh, "CG", 2)
> u = TrialFunction(V)
> u_init = InitialConditions()
> u.interpolate(u_init)
>
> I adopted this from the Cahn-Hilliard example, but I don't understand how I can
> adapt it for vector valued functions.
> Please can you help me?! Thanks!
I don't understand the question. The above example code you have given
is for a vector-valued function.
--
Anders
Follow ups
References