[firedrake] Question on mixed solves: RHS is not defined in product function space

Eike Mueller e.mueller at bath.ac.uk
Thu Jan 22 15:38:41 GMT 2015


Hi Lawrence,

yes, I use the mixed function spaces only in the preconditioner, so I went for your alternative solution. However, now I get:

   L = ufl.replace(r_p, {TestFunction(self._W3), self._mptest}) \
  File "/Users/eikemueller/PostDocBath/EllipticSolvers/ufl/build/lib/ufl/algorithms/replace.py", line 61, in replace
    mapping2 = dict((k, as_ufl(v)) for (k, v) in iteritems(mapping))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/six.py", line 484, in iteritems
    return iter(getattr(d, _iteritems)(**kw))
AttributeError: 'set' object has no attribute ‘iteritems’

Thanks,

Eike

--

Dr Eike Hermann Mueller
Research Associate (PostDoc)

Department of Mathematical Sciences
University of Bath
Bath BA2 7AY, United Kingdom

+44 1225 38 5803
e.mueller at bath.ac.uk
http://people.bath.ac.uk/em459/

> On 22 Jan 2015, at 15:27, Lawrence Mitchell <lawrence.mitchell at imperial.ac.uk> wrote:
> 
> -----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/ <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-----
> 
> _______________________________________________
> firedrake mailing list
> firedrake at imperial.ac.uk <mailto:firedrake at imperial.ac.uk>
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake <https://mailman.ic.ac.uk/mailman/listinfo/firedrake>
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the firedrake mailing list