[firedrake] Solve multiple variational problems at once
Anna Kalogirou
a.kalogirou at leeds.ac.uk
Wed Nov 26 14:19:13 GMT 2014
That is what is am doing and it still complains about Mismatching
Function Spaces.. So what I have now is, let's say
u1_ = Function(V)
u2_ = Function(V)
w = Function(W), where W = V*V
v = TestFunction(W)
u1, u2 = split(w)
v1, v2 = split(v) *Here I also tried defining instead v1, v2 =
TestFunctions(W).*
F = fn(u1, u2, u1_, u2_; v1)
G = fn(u1, u2, u1_, u2_; v2)
u1, u2 = w.split() *OR does this need to be after the variational
problem is solved?*
*I tried both with the same outcome.*
solve(F == 0, w)
u1_.assign(u1)
u2_.assign(u2).
On 26/11/14 12:45, Lawrence Mitchell wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 26/11/14 12:24, Anna Kalogirou wrote:
>> Do I still need to define u1, u2, u3 = Functions(V), where V is in
>> original space? After the variational problem is solved I split w
>> as
>>
>> u1, u2, u3 = split(w)
>>
>> and try to print u1, u2, u3 in files, but I get
>>
>> AttributeError: 'Indexed' object has no attribute
>> 'function_space'.
> Aha, you run into the split(w) vs. w.split() problem.
>
> When you're defining your variational form, you need to use the
> former. For output purposes (and assignment in a timestepping loop)
> you need to use the latter.
>
> e.g.
>
> u1, u2 = split(w)
>
> F = fn(u1, u2; v)
>
> u1, u2 = w.split()
>
> solve(F == 0, w)
>
> u1_.assign(u1)
> u2_.assign(u2)
>
> etc...
>
>> Also, I can't interpolate or assign. In the end, I want to pass u1,
>> u2, u3 to some other functions u1_, u2_, u3_, which also appear in
>> the residual expressions. But this produces a 'Mismatching function
>> spaces' error.
> I hope the above should also clear up this problem.
>
> Cheers,
>
> Lawrence
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with undefined - http://www.enigmail.net/
>
> iQEcBAEBAgAGBQJUdcteAAoJECOc1kQ8PEYv9FMIANxK3tJWLEHrK/mrd3zqWKFK
> C1pb9+IFoEENBX1kwlTjor8sOZjpK4i/jyMVyVLl+zML47rnTYLsY0uMBf8reuT0
> 72JjLo5C5+TEgXA3mHq0YE6Ohw/7ls38moJaE0LYKiTqZQ2xfsjH7VCTe4a4vXlo
> Kw0JIeiWPvq5SAhPRpv3xl4MYfFtpNtg9Qat+B8S9HJNzQeY1bEmSP9U8xzkcouT
> hOpg2FKseroIWK9CefCJgqF4Pa9vL8S5Hz3FWkt1QAJHS68+q8qSqxsMxLamrFZS
> E5uwqAqZMU02CTBSGtEKXqljEDoqd+XKGEEX6uq6qzFlrpmxEM6zXBVZC7+ofWU=
> =oHan
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> firedrake mailing list
> firedrake at imperial.ac.uk
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
--
Dr Anna Kalogirou
Research Fellow
School of Mathematics
University of Leeds
-------------- next part --------------
HTML attachment scrubbed and removed
More information about the firedrake
mailing list