[firedrake] disentangling solver setup costs
Eike Mueller
E.Mueller at bath.ac.uk
Tue Apr 21 11:42:53 BST 2015
Hi Lawrence,
it looks like I’m setting up the same operator multiple times in my code, so this is very wasteful and explains why my setup costs are so high.
Basically I need four assembled operators which describe the 2x2 matrix of the velocity-pressure system in several parts of my code. What happens if I construct those centrally, but then use them in different parts of the code? For example, I might want to apply the UU,UP,PU and PP-operators when I apply the mixed system matrix in the outer loop of the iterative solver (and I would do this in my MixedOperator class). For this I would extract the handles with .M.handle as below. But somewhere else I need to solve for the velocity mass matrix (I would do this in the class Mutilde), so I would throw the same UU operator into a LinearSolver class. Would the operator be built multiple times in this case? Or can I call mat.M once, and this will then be the only time where the operator gets assembled? If that is the case, then I need some class which holds the UU,UP,PU and PP operators and then feed them to the other classes appropriately.
Thanks,
Eike
> On 21 Apr 2015, at 11:23, Lawrence Mitchell <lawrence.mitchell at imperial.ac.uk> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 21/04/15 11:20, Eike Mueller wrote:
>> Hi Lawrence,
>>
>> thanks! When I build a LinearSolver, can I solve the same problem
>> (but for different RHSs) to two different tolerances? Currently I
>> construct the LinearSolver twice, and that is very wasteful since I
>> assemble the matrix twice).
>
> Yes:
>
> foo = LinearSolver(..., solver_parameters={'ksp_rtol': 1e-10})
>
> foo.solve(...)
>
> foo.parameters = {'ksp_rtol': 1e-4}
>
> Note that setting this dict completely overwrites all the solver options.
>
> Lawrence
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
>
> iQEcBAEBAgAGBQJVNiULAAoJECOc1kQ8PEYvD0cH/jQTIJp1xRouxpWv02CydaLQ
> 7uKPkQ7RA2E2HfdSqEwJDz1cv7uVfi9mevlz8sY8sKfzb3QTodyzFY6/oFI+IFb6
> W7Ae/d2LmhFRLv0aeGVNh7KneNHepZNVXMvzjxKmBNy7OQpnuifMVCVlE+KLYw/u
> M/+um5X5RRintrbq1NGNx/Lle6FSfds9r7cO2rgB/nNpI0FUHvCwuvOx21R1kNHe
> ym+DcJdCP3O/V/Nc5IzyHrhCbf5W40MGyNSW0wgw0gKAninYiGQwkyd49AnKemuf
> pijIZB3xjO1AcIt8X0fS/C5glotdpISc2QxqDGouc38MgOib4ov4gR6KGi2h77k=
> =qd87
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> firedrake mailing list
> firedrake at imperial.ac.uk
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
More information about the firedrake
mailing list