Inverse of .dat.data
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? Thank you! Henrik -- Dipl.-Math. Henrik Büsing Institute for Applied Geophysics and Geothermal Energy E.ON Energy Research Center RWTH Aachen University ------------------------------------------------------ Mathieustr. 10 | Tel +49 (0)241 80 49907 52074 Aachen, Germany | Fax +49 (0)241 80 49889 ------------------------------------------------------ http://www.eonerc.rwth-aachen.de/GGE hbuesing@eonerc.rwth-aachen.de ------------------------------------------------------
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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. Cheers, Lawrence -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJWMNGVAAoJECOc1kQ8PEYv1GkH/iM1vrp3HNtkQe/0p+hRGrLG FrugYKQaxyoSGVM+rIqcMKWMSB+emnL5MThOhFazi9b3GhwmgvrVvRIwG7zaOPzf UuwE7URITzfRibBnraWDo42QFD1fnnWRhks9Rg61YhuukR0o24LVqxkSALimBW6e VQ5l61/71t/1rLYS20zsCwaOFL4s7w8RcRofULyDMGWkgL4SYMkERONCjUZ6WKuR iOYmApMB22Gw3wV6xt624VLwXcU+xSb+F82wRx0GWL/DAAiKGAPNAaH4Sdw++qcy 96PVyert8vNXVdu9jGZ7XsAg+6FSv9sMVT98Cd2FehD28Y2bn1PrYp7XXk/dekI= =+m7j -----END PGP SIGNATURE-----
-----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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
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 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... Henrik
Cheers,
Lawrence
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux)
iQEcBAEBAgAGBQJWMNGVAAoJECOc1kQ8PEYv1GkH/iM1vrp3HNtkQe/0p+hRGrLG FrugYKQaxyoSGVM+rIqcMKWMSB+emnL5MThOhFazi9b3GhwmgvrVvRIwG7zaOPzf UuwE7URITzfRibBnraWDo42QFD1fnnWRhks9Rg61YhuukR0o24LVqxkSALimBW6e VQ5l61/71t/1rLYS20zsCwaOFL4s7w8RcRofULyDMGWkgL4SYMkERONCjUZ6WKuR iOYmApMB22Gw3wV6xt624VLwXcU+xSb+F82wRx0GWL/DAAiKGAPNAaH4Sdw++qcy 96PVyert8vNXVdu9jGZ7XsAg+6FSv9sMVT98Cd2FehD28Y2bn1PrYp7XXk/dekI= =+m7j -----END PGP SIGNATURE-----
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-----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-----
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 28 October 2015 15:06 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Inverse of .dat.data
-----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?
[Buesing, Henrik] Not sure that we are on the same page here. I attached the code of calc_temp(p,h). DATA_temp is an array with 146,888 (602*244) entries. Of course, when doing gradtemp = (temp('+') - temp('-'))/Delta_h_facet I get TypeError: 'numpy.ndarray' object is not callable. Henrik
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]
[Buesing, Henrik] I think, that should work. Still the question remains how to get the int(). Henrik
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 28/10/15 14:21, Buesing, Henrik wrote:
[Buesing, Henrik] Not sure that we are on the same page here. I attached the code of calc_temp(p,h). DATA_temp is an array with 146,888 (602*244) entries.
Of course, when doing
gradtemp = (temp('+') - temp('-'))/Delta_h_facet
Ah, I think I see. What space does this resulting temp field live in, is it just DG0. In which case, you could do: temp_coeff = Function(DG0) temp_coeff.dat.data[:] = calc_temp(p, h) then use temp_coeff later in gradtemp. Does that make sense? Lawrence -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJWMNtFAAoJECOc1kQ8PEYvFJAH/RYtWVeEj3/awCoVDRwWJoh0 QE1VLdqo9vlYcEkvvDGa018BmF+EUGs8sIRqPBtGDKEWeVP5u9L+h1Zw/dfvspdv dd6EkJ2KI/xm2gIioO4422qBQTgTVonKqke3s1l7fRaOR67FeWQJPxlbllqyQJFP Zejqb7Y8HbOyWzCbhKJLJrSJVFyV308kyQJ783jB5Q7nxJ56c6y0Jxr9196jdbao mm1YkXoqvCq4azkdKr00zOGvA2nj7RAcbixltmfx/Kk/kfiDE2HByPIrzVv2czlU azKfTq4qsHp4mlqxnTMapO0v89+L8BxGBaDnE9KWP7y69xoGyxqqDgBFz130TVY= =RcxF -----END PGP SIGNATURE-----
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 28 October 2015 15:27 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Inverse of .dat.data
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 28/10/15 14:21, Buesing, Henrik wrote:
[Buesing, Henrik] Not sure that we are on the same page here. I attached the code of calc_temp(p,h). DATA_temp is an array with 146,888 (602*244) entries.
Of course, when doing
gradtemp = (temp('+') - temp('-'))/Delta_h_facet
Ah, I think I see. What space does this resulting temp field live in, is it just DG0.
[Buesing, Henrik] Yes, it's DG0. In which case, you could do:
temp_coeff = Function(DG0)
temp_coeff.dat.data[:] = calc_temp(p, h)
then use temp_coeff later in gradtemp.
Does that make sense?
[Buesing, Henrik] Yes! That works. Since, all my coefficient routines are like this, I should be fine! Thanks a lot! Henrik
Lawrence -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux)
iQEcBAEBAgAGBQJWMNtFAAoJECOc1kQ8PEYvFJAH/RYtWVeEj3/awCoVDRwWJoh0 QE1VLdqo9vlYcEkvvDGa018BmF+EUGs8sIRqPBtGDKEWeVP5u9L+h1Zw/dfvspdv dd6EkJ2KI/xm2gIioO4422qBQTgTVonKqke3s1l7fRaOR67FeWQJPxlbllqyQJFP Zejqb7Y8HbOyWzCbhKJLJrSJVFyV308kyQJ783jB5Q7nxJ56c6y0Jxr9196jdbao mm1YkXoqvCq4azkdKr00zOGvA2nj7RAcbixltmfx/Kk/kfiDE2HByPIrzVv2czlU azKfTq4qsHp4mlqxnTMapO0v89+L8BxGBaDnE9KWP7y69xoGyxqqDgBFz130TVY= =RcxF -----END PGP SIGNATURE-----
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 28 October 2015 15:27 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Inverse of .dat.data
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 28/10/15 14:21, Buesing, Henrik wrote:
[Buesing, Henrik] Not sure that we are on the same page here. I attached the code of calc_temp(p,h). DATA_temp is an array with 146,888 (602*244) entries.
Of course, when doing
gradtemp = (temp('+') - temp('-'))/Delta_h_facet
Ah, I think I see. What space does this resulting temp field live in, is it just DG0. In which case, you could do:
temp_coeff = Function(DG0)
temp_coeff.dat.data[:] = calc_temp(p, h)
then use temp_coeff later in gradtemp.
[Buesing, Henrik] Function(DG0) worked fine, but now I get an ufl.log.UFLException: Discontinuous type Coefficient must be restricted. error when assembling my form. I'm actually solving a multiphysics problem here. Do I have to use Function(W) (W being the mixed space) then and index [0] or [1]? Does it matter whether I take 0 or 1? Henrik
ufl.log.UFLException: Discontinuous type Coefficient must be restricted.
This error usually happens when you try to use facet integrals on a discontinuous field, and of course, it's not obvious from which side of the facet shall the values be taken from. f('+') and f('-') are restrictions of the field f onto the positive or negative sides of the facets. I don't think it's related to having a mixed space. Miklos ________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Buesing, Henrik [HBuesing@eonerc.rwth-aachen.de] Sent: 30 October 2015 14:56 To: firedrake Subject: Re: [firedrake] Inverse of .dat.data
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 28 October 2015 15:27 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Inverse of .dat.data
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 28/10/15 14:21, Buesing, Henrik wrote:
[Buesing, Henrik] Not sure that we are on the same page here. I attached the code of calc_temp(p,h). DATA_temp is an array with 146,888 (602*244) entries.
Of course, when doing
gradtemp = (temp('+') - temp('-'))/Delta_h_facet
Ah, I think I see. What space does this resulting temp field live in, is it just DG0. In which case, you could do:
temp_coeff = Function(DG0)
temp_coeff.dat.data[:] = calc_temp(p, h)
then use temp_coeff later in gradtemp.
[Buesing, Henrik] Function(DG0) worked fine, but now I get an ufl.log.UFLException: Discontinuous type Coefficient must be restricted. error when assembling my form. I'm actually solving a multiphysics problem here. Do I have to use Function(W) (W being the mixed space) then and index [0] or [1]? Does it matter whether I take 0 or 1? Henrik _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Homolya, Miklós Gesendet: 30 October 2015 16:02 An: firedrake Betreff: Re: [firedrake] Inverse of .dat.data
ufl.log.UFLException: Discontinuous type Coefficient must be restricted.
This error usually happens when you try to use facet integrals on a discontinuous field, and of course, it's not obvious from which side of the facet shall the values be taken from. f('+') and f('-') are restrictions of the field f onto the positive or negative sides of the facets.
[Buesing, Henrik] But I could also just use the avg(f), right?
I don't think it's related to having a mixed space.
Miklos ________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake- bounces@imperial.ac.uk] on behalf of Buesing, Henrik [HBuesing@eonerc.rwth-aachen.de] Sent: 30 October 2015 14:56 To: firedrake Subject: Re: [firedrake] Inverse of .dat.data
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 28 October 2015 15:27 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Inverse of .dat.data
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 28/10/15 14:21, Buesing, Henrik wrote:
[Buesing, Henrik] Not sure that we are on the same page here. I attached the code of calc_temp(p,h). DATA_temp is an array with 146,888 (602*244) entries.
Of course, when doing
gradtemp = (temp('+') - temp('-'))/Delta_h_facet
Ah, I think I see. What space does this resulting temp field live in, is it just DG0. In which case, you could do:
temp_coeff = Function(DG0)
temp_coeff.dat.data[:] = calc_temp(p, h)
then use temp_coeff later in gradtemp.
[Buesing, Henrik]
Function(DG0) worked fine, but now I get an
ufl.log.UFLException: Discontinuous type Coefficient must be restricted.
error when assembling my form. I'm actually solving a multiphysics problem here. Do I have to use
Function(W)
(W being the mixed space) then and index [0] or [1]? Does it matter whether I take 0 or 1?
Henrik
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
I think so, yes. In general it depends on the numerical scheme you want to use, it could be the average, the jump, the minimum/maximum... ________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Buesing, Henrik [HBuesing@eonerc.rwth-aachen.de] Sent: 30 October 2015 15:18 To: firedrake Subject: Re: [firedrake] Inverse of .dat.data
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Homolya, Miklós Gesendet: 30 October 2015 16:02 An: firedrake Betreff: Re: [firedrake] Inverse of .dat.data
ufl.log.UFLException: Discontinuous type Coefficient must be restricted.
This error usually happens when you try to use facet integrals on a discontinuous field, and of course, it's not obvious from which side of the facet shall the values be taken from. f('+') and f('-') are restrictions of the field f onto the positive or negative sides of the facets.
[Buesing, Henrik] But I could also just use the avg(f), right?
I don't think it's related to having a mixed space.
Miklos ________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake- bounces@imperial.ac.uk] on behalf of Buesing, Henrik [HBuesing@eonerc.rwth-aachen.de] Sent: 30 October 2015 14:56 To: firedrake Subject: Re: [firedrake] Inverse of .dat.data
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 28 October 2015 15:27 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Inverse of .dat.data
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 28/10/15 14:21, Buesing, Henrik wrote:
[Buesing, Henrik] Not sure that we are on the same page here. I attached the code of calc_temp(p,h). DATA_temp is an array with 146,888 (602*244) entries.
Of course, when doing
gradtemp = (temp('+') - temp('-'))/Delta_h_facet
Ah, I think I see. What space does this resulting temp field live in, is it just DG0. In which case, you could do:
temp_coeff = Function(DG0)
temp_coeff.dat.data[:] = calc_temp(p, h)
then use temp_coeff later in gradtemp.
[Buesing, Henrik]
Function(DG0) worked fine, but now I get an
ufl.log.UFLException: Discontinuous type Coefficient must be restricted.
error when assembling my form. I'm actually solving a multiphysics problem here. Do I have to use
Function(W)
(W being the mixed space) then and index [0] or [1]? Does it matter whether I take 0 or 1?
Henrik
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Homolya, Miklós Gesendet: 30 October 2015 16:20 An: firedrake Betreff: Re: [firedrake] Inverse of .dat.data
I think so, yes.
In general it depends on the numerical scheme you want to use, it could be the average, the jump, the minimum/maximum...
[Buesing, Henrik] Yes, I will use the upstream value at the appropriate places. Henrik
________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake- bounces@imperial.ac.uk] on behalf of Buesing, Henrik [HBuesing@eonerc.rwth-aachen.de] Sent: 30 October 2015 15:18 To: firedrake Subject: Re: [firedrake] Inverse of .dat.data
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Homolya, Miklós Gesendet: 30 October 2015 16:02 An: firedrake Betreff: Re: [firedrake] Inverse of .dat.data
ufl.log.UFLException: Discontinuous type Coefficient must be restricted.
This error usually happens when you try to use facet integrals on a discontinuous field, and of course, it's not obvious from which side of the facet shall the values be taken from. f('+') and f('-') are restrictions of the field f onto the positive or negative sides of the facets.
[Buesing, Henrik] But I could also just use the avg(f), right?
I don't think it's related to having a mixed space.
Miklos ________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake- bounces@imperial.ac.uk] on behalf of Buesing, Henrik [HBuesing@eonerc.rwth-aachen.de] Sent: 30 October 2015 14:56 To: firedrake Subject: Re: [firedrake] Inverse of .dat.data
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 28 October 2015 15:27 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Inverse of .dat.data
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 28/10/15 14:21, Buesing, Henrik wrote:
[Buesing, Henrik] Not sure that we are on the same page here. I attached the code of calc_temp(p,h). DATA_temp is an array with 146,888 (602*244) entries.
Of course, when doing
gradtemp = (temp('+') - temp('-'))/Delta_h_facet
Ah, I think I see. What space does this resulting temp field live in, is it just DG0. In which case, you could do:
temp_coeff = Function(DG0)
temp_coeff.dat.data[:] = calc_temp(p, h)
then use temp_coeff later in gradtemp.
[Buesing, Henrik]
Function(DG0) worked fine, but now I get an
ufl.log.UFLException: Discontinuous type Coefficient must be
restricted.
error when assembling my form. I'm actually solving a multiphysics problem here. Do I have to use
Function(W)
(W being the mixed space) then and index [0] or [1]? Does it matter whether I take 0 or 1?
Henrik
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Buesing, Henrik Gesendet: 30 October 2015 16:18 An: 'firedrake@imperial.ac.uk' Betreff: Re: [firedrake] Inverse of .dat.data
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Homolya, Miklós Gesendet: 30 October 2015 16:02 An: firedrake Betreff: Re: [firedrake] Inverse of .dat.data
ufl.log.UFLException: Discontinuous type Coefficient must be restricted.
This error usually happens when you try to use facet integrals on a discontinuous field, and of course, it's not obvious from which side of the facet shall the values be taken from. f('+') and f('-') are restrictions of the field f onto the positive or negative sides of the facets.
[Buesing, Henrik] But I could also just use the avg(f), right?
This works! Thank you! Henrik
I don't think it's related to having a mixed space.
Miklos ________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake- bounces@imperial.ac.uk] on behalf of Buesing, Henrik [HBuesing@eonerc.rwth-aachen.de] Sent: 30 October 2015 14:56 To: firedrake Subject: Re: [firedrake] Inverse of .dat.data
-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 28 October 2015 15:27 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Inverse of .dat.data
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 28/10/15 14:21, Buesing, Henrik wrote:
[Buesing, Henrik] Not sure that we are on the same page here. I attached the code of calc_temp(p,h). DATA_temp is an array with 146,888 (602*244) entries.
Of course, when doing
gradtemp = (temp('+') - temp('-'))/Delta_h_facet
Ah, I think I see. What space does this resulting temp field live in, is it just DG0. In which case, you could do:
temp_coeff = Function(DG0)
temp_coeff.dat.data[:] = calc_temp(p, h)
then use temp_coeff later in gradtemp.
[Buesing, Henrik]
Function(DG0) worked fine, but now I get an
ufl.log.UFLException: Discontinuous type Coefficient must be
restricted.
error when assembling my form. I'm actually solving a multiphysics problem here. Do I have to use
Function(W)
(W being the mixed space) then and index [0] or [1]? Does it matter whether I take 0 or 1?
Henrik
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
participants (3)
- 
                
                Buesing, Henrik
- 
                
                Homolya, Miklós
- 
                
                Lawrence Mitchell