-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 28/10/15 14:02, Buesing, Henrik wrote:
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 28 October 2015 14:46 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Inverse of .dat.data
On 28/10/15 13:20, Buesing, Henrik wrote:
Dear all,
Ok. Maybe this is the way to go:
As before, I have a function temp(p,h), which shall return temperature dependent on pressure and enthalpy. I insert UFL representations of p and h into temp(,).
Then I'm doing a
p = assemble(p).dat.data[0] h = assemble(h).dat.data[1]
Now, I execute some operations on the arrays. In the end I want to have the UFL representation of temp (the same as what I inserted as p and h).
So how do I get the UFL representation back from the array?
I'm not sure I understand what you mean by get the UFL representation back. Can you explain what you're trying to achieve? I am guessing here, but I suppose you have a term in your equation which is either an unknown or has some known value, depending on an equation of state. I think you should be able to write this using "conditional" to select one or the other depending on the value of the equation of state (if you can represent it using UFL.
[Buesing, Henrik] At the moment I have a numpy array in the end. However I want a function back to be able to use UFL again, e.g. doing
So if you just do: p_coeff = assemble(p) then you can use p_coeff in your forms, is that what you want?
gradtemp = (temp('+') - temp('-'))/Delta_h_facet
Yes, you can think of the routine as an EOS. I tried to use UFL, but in my EOS code I have int(). I do not know how to represent this in UFL (see my previous mail "UFL statement for python int()"). Also I have an array of values DATA_temp[getD-1], which I then want to access with a UFL function getD, which probably makes no sense...
Well, if it's not spatially varying, then you could use a constant: c = Constant(data_array) and then index that constant in your expression: c[0] == data_array[0] Lawrence -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJWMNZOAAoJECOc1kQ8PEYvjyYH/R6U3LJ8gZNA5Sfk4wtS1Aqg oTSS554HNFo9df03e6aWqobvxca3QjCDkjpARoPi3oTHeEQS2NpCP6xej5GD0l0s iIYzpQr+x4NT1v+5boB7FBvyu9/Td4v3UZ3SDdC7dsvQBNzmS+m5Ut6B8RsBBU+a 6o94IGygzxdvWtD0FMv64Slyavv3v6RVmyFAjRATaHOsTCPwIQFbJPGmyaxkGysd xz3F5XWReZ4aNdsUcmPpdI7BAcKxyN7jbysiwn6JrTuQqAaVZZ+2pefRBW2kKmrU 7pkB9TZPs/HwJL+arvW3VoFpSIw3zbn9sj/lX/JJ3XaFyPnAAt9xbD5UNP8Ggss= =/prq -----END PGP SIGNATURE-----