On 25 May 2011 23:16, Douglas Brinkerhoff
<[email protected]> wrote:
> New question #159021 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/159021
>
> I would like to assign an initial guess to two solution variables in the 
> following way, given two functions u0 and v0:
>
>
> V = FunctionSpace(mesh,"Lagrange",1)
> W = MixedFunctionSpace([V,V])
>
> phi,psi = TestFunctions(W)
> dU = TrialFunctions(W)
> U = Function(W)
>
> du,dv = split(dU)
> u,v = split(U)
>
> #Here is where I would like to assign initial values u0 and v0 for my 
> non-linear problem
> u.assign(u0)
> v.assign(v0)
>
> u0 and v0 are already defined as functions on the appropriate function space.
>
> When I use this particular syntax, I receive an error message stating that 
> indexed objects don't have an assign method.  Fair enough, but how do I 
> bypass this so that I can assign an initial guess.  This problem cannot 
> converge from a zero starting solution.
>

You could also project u0,v0 into u,v:

a = (du*phi + dv*psi)*dx
L = (u0*phi + v0*psi)*dx
problem = VariationalProblem(a, L)
problem.solve(U)

Not tested!

But it would be nice with a more direct way to assign to a subfunction.

Martin

_______________________________________________
Mailing list: https://launchpad.net/~dolfin
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dolfin
More help   : https://help.launchpad.net/ListHelp

Reply via email to