Dear all, I have a lot of coefficients in my form, e.g. 1) Calculate density rhow pointwise from temperature and pressure via interpolation of a table rhow = Function(DG1) rhow.dat.data[:]=calc_rhow(temp,Tsat,pw) 2) Averaging rhow_avg = (rhow('+') + rhow('-')) / 2.0 3) Use rhow_avg in my form. This works all right for calulcating F(u), but fails when computing the Jacobian. Since I calculate things pointwise and providing all the derivatives is not so easy I use -snes_fd_color. What I would want to happen is that the function calc_rhow is called every time rhow_avg is needed. This seems not to be the case. Rather the coefficient is assumed constant and thus the derivative is zero. How can I make sure that the function calc_rhow is called every time I need rhow_avg? 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 ------------------------------------------------------
Any ideas? Henrik Dear all, I have a lot of coefficients in my form, e.g. 1) Calculate density rhow pointwise from temperature and pressure via interpolation of a table rhow = Function(DG1) rhow.dat.data[:]=calc_rhow(temp,Tsat,pw) 2) Averaging rhow_avg = (rhow('+') + rhow('-')) / 2.0 3) Use rhow_avg in my form. This works all right for calulcating F(u), but fails when computing the Jacobian. Since I calculate things pointwise and providing all the derivatives is not so easy I use –snes_fd_color. What I would want to happen is that the function calc_rhow is called every time rhow_avg is needed. This seems not to be the case. Rather the coefficient is assumed constant and thus the derivative is zero. How can I make sure that the function calc_rhow is called every time I need rhow_avg? 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 ------------------------------------------------------
So, the only way to deal with this is the following? Use my functions to calculate the values pointwise. Then, provide the correct derivatives via the coefficient_derivatives keyword in the derivative() function. Henrik
Dear all,
I have a lot of coefficients in my form, e.g.
1) Calculate density rhow pointwise from temperature and pressure via interpolation of a table rhow = Function(DG1) rhow.dat.data[:]=calc_rhow(temp,Tsat,pw)
2) Averaging rhow_avg = (rhow('+') + rhow('-')) / 2.0
3) Use rhow_avg in my form.
This works all right for calulcating F(u), but fails when computing the Jacobian. Since I calculate things pointwise and providing all the derivatives is not so easy I use -snes_fd_color.
What I would want to happen is that the function calc_rhow is called every time rhow_avg is needed. This seems not to be the case. Rather the coefficient is assumed constant and thus the derivative is zero.
How can I make sure that the function calc_rhow is called every time I need rhow_avg?
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 ------------------------------------------------------
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
On 23/11/15 08:55, Buesing, Henrik wrote:
So, the only way to deal with this is the following?
Use my functions to calculate the values pointwise. Then, provide the correct derivatives via the coefficient_derivatives keyword in the derivative() function.
I think so. If you need to do this update once per nonlinear step, at the moment you will have to write your own nonlinear iteration (e.g. fixed point). Since we do not really have support for hooking arbitrary callbacks into the nonlinear solver pipeline. Lawrence
participants (2)
- 
                
                Buesing, Henrik
- 
                
                Lawrence Mitchell