You can do something like: from dolfin import *
mesh = UnitCube(10,10,10) V = FunctionSpace(mesh,"Lagrange",1) W = MixedFunctionSpace([V,V]) U = Function(W) u0 = Function(V) v0 = Function(V) # Fill u0, v0 u0.vector()[:] = 1.0 v0.vector()[:] = 2.0 offset = V.dim() U.vector()[:offset] = u0.vector() U.vector()[offset:] = v0.vector() This will only work on this particular MixedFunctionSpace, and it will not work in parallel. Johan On Wednesday May 25 2011 14:16:06 Douglas Brinkerhoff 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. _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : [email protected] Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp

