[firedrake] Question on mixed solves: RHS is not defined in product function space
Lawrence Mitchell
lawrence.mitchell at imperial.ac.uk
Thu Jan 22 15:27:01 GMT 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 22/01/15 15:17, Eike Mueller wrote:
> Dear firedrakers,
>
> assume I want to do the following solve of a mixed system:
>
> V1 = FunctionSpace(mesh, 'RT', 1) V2 = FunctionSpace(mesh, 'DG',
> 0)
>
> W = V1 * V2 lmbda = 1 u, p = TrialFunctions(W) v, q =
> TestFunctions(W) f = Function(V1) g = Function(V2)
>
> a = (p*q - q*div(u) + lmbda*inner(v, u) + div(v)*p)*dx
>
> L = (dot(u,f)+p*g)*dx
>
> u = Function(W) solve(a == L, u, solver_parameters=...)
>
> But now I take out the line
>
> L = (dot(u,f)+p*g)*dx
>
> and assume that somewhere I calculate instead:
>
> L1 = dot(TestFunction(V1),f)*dx L2 = TestFunction(V2)*g*dx
Can you define these two forms using the test functions v and q
respectively (rather than building new test functions on the
subspaces)? Then everything should "just work".
Alternately, if you haven't already assembled L1 and L2, you could (to
get L), do:
v1 = TestFunction(V1)
v2 = TestFunction(V2)
L1 = dot(v1, f)*dx
L2 = v2*g*dx
import ufl
L1p = ufl.replace(L1, {v1, v})
L2p = ufl.replace(L2, {v2, v})
L = L1p + L2p
but that's effectively the same as just defining L1 and L2 using v and
q rather v1 and v2. I guess you're separately using L1 and L2
somewhere in a non-mixed solve?
Cheers,
Lawrence
Cheers,
Lawrence
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/
iQEcBAEBAgAGBQJUwRbFAAoJECOc1kQ8PEYvJHAH/17RtMO14gh60/jIOLFNPxJ0
AkYpR2T44g0oE0/5U2Kw3daLYl3cW1KKi9f5W2FpTy/qmCFL1pJu3qSf1hzIzktT
bAdZPm1fxJXychDrZMwT+zPWDJtVHQONvX7ESBnsUmXbFz493J3nktL70DW2ovnM
bdS1CDlWEBcqweQG6w7GGI/0bdrf3BYH8o9nt/PCq1Xcl6ItvUiktBwegFlRlaP/
HT0pMPKASdKgtCFqHgLolZW0oiUrnekqDePTz68rzn+FUp2llYwA+YnOFUTcJ0tB
x4fbsnh4ktJIg06R3jtqpZFFQuOxwvNVEqALE0FWSjPcpTWVls/VHa/w9PdIBqQ=
=tndm
-----END PGP SIGNATURE-----
More information about the firedrake
mailing list