Re: [firedrake] Problem with Jacobian
On Mon, 9 Nov 2015 at 08:31 Buesing, Henrik <HBuesing@eonerc.rwth-aachen.de> wrote:
If you change the definition of derivative in firedrake/ufl_expr.py to
take an optional coefficient_derivatives argument:
def derivative(F, u, du=None, coefficient_derivatives=None):
...
And just pass that value through to the ufl.derivative call:
ufl.derivative(..., coefficient_derivatives=coefficient_derivatives)
If you do this in the firedrake source directly, you will be able to
commit your change in the local git repository. You can send us these
changes by forking firedrake on github and proposing a pull-request that
way.
Hmm... Okay I did this. Then I did a "make" in the firedrake directory. But then I'm still getting a
*TypeError: derivative() takes at most 3 arguments (4 given)*
So how can I test this? Thank you!
It depends a little on how you originally installed firedrake. If you installed firedrake by running firedrake-install (i.e. not with --developer) then you change to the firedrake/src directory and (with the virtualenv active) type:
pip install --upgrade firedrake/
If you have installed firedrake some other way, please say how and we can tell you how to build.
*[Buesing, Henrik] I followed the „Installing from individual components” manual. I cloned the firedrake repository*
git clone https://github.com/firedrakeproject/firedrake.git
*Then I did make in the firedrake directory.*
cd firedrake
export PYTHONPATH=$PWD:$PYTHONPATH
make
In this setup you shouldn't have even needed to type "make". My initial suspicion is that this is an actual issue with the new code. Can you please push your changes to a fork on github so we can see what you've got there? Regards, David
*Henrik*
In this setup you shouldn't have even needed to type "make". My initial suspicion is that this is an >actual issue with the new code. Can you please push your changes to a fork on github so we can see what >you've got there?
Ok. I think I have done this (see https://github.com/hbuesing/firedrake). But how can I have du=None and still pass the coefficient_derivatives? How do I pass a Jacobian du correctly for my attached test.py? I also have updated firedrake and all its dependencies. Changing ufl_expr.py now has an immediate effect. Thank you! Henrik
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/11/15 15:18, Buesing, Henrik wrote:
In this setup you shouldn't have even needed to type "make". My initial suspicion is that this is an >actual issue with the new code. Can you please push your changes to a fork on github so we can see what >you've got there?
Ok. I think I have done this (see https://github.com/hbuesing/firedrake).
Thanks, do you want to open a pull request from your modified branch into the upstream firedrake?
But how can I have du=None and still pass the coefficient_derivatives?
How do I pass a Jacobian du correctly for my attached test.py?
Ah, I think you are misunderstanding what the du argument to derivative is for. derivative(F, u) computes the derivative of F in the direction u symbolically. If F is a residual (linear in a test function) it linearises F around u. The linear algebra representation of this linearisation is a matrix. So the resulting symbolic object contains both a test and a trial function (an "Argument"). By default, the new Argument is constructed automatically inside the derivative call, however, you can also provide it. This is what the optional du is for. So if you don't want to provide this, but still pass in coefficient_derivatives you can do: J = derivative(F, u, coefficient_derivatives=...) Does this make sense? Cheers, Lawrence -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJWQxJtAAoJECOc1kQ8PEYvAAYH/j4ppPKTYDhQVvaOo0M7CoBG qidmCxYE00J97Z66Fee9dSW4KzlqeBJeKSZ8QxufKbcXdmHrzkK7j9AO1iB0rAOO 4GmvkdVtTiHb8Ugd0hZi1fHtlbHWnHPmxd4lYrhgqiJxvQk/mTE7dCzMtxYCobrO 7KdeOcxxoIh4c6/lPlZbebmM/KB/+59B+HDYQjlhPWQrPxUOOoOXgwOtM9jn+7R8 Ttn/dVJayH4ycZ8BjRJWXV6KY+LTJwN7rQiTd3Mrt3A03VuEuMVIgHsZb35AMr1S bX1kD4zlMyXaEAn9h1htWXTmNbyWaQTf/w0v8Of+Sq8k+6pAWEjzNLk5kXjEkUM= =EgNZ -----END PGP SIGNATURE-----
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 11 November 2015 11:03 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Problem with Jacobian
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 10/11/15 15:18, Buesing, Henrik wrote:
In this setup you shouldn't have even needed to type "make". My initial suspicion is that this is an >actual issue with the new code. Can you please push your changes to a fork on github so we can see what >you've got there?
Ok. I think I have done this (see https://github.com/hbuesing/firedrake).
Thanks, do you want to open a pull request from your modified branch into the upstream firedrake?
@Lawrence: Yes, that would be nice. I guess I opened a pull request... Do I have to do sth. else? Thank you! Henrik
participants (3)
- 
                
                Buesing, Henrik
- 
                
                David Ham
- 
                
                Lawrence Mitchell