interactive solution analysis
Hi again,
Further to my previous post on d_surface_flux, I thought I should be able to evaluate the surface heat flux myself, by solving the problem interactively and calculating the surface gradient myself. I use:
pb, state = solve_pde('flndrs2d.py')
t = state.get_parts()['t']
which returns temperatures. Now all I need are the corresponding coordinates. So I try:
xy = pb.get_mesh_coors()
But of course the coordinates vector is longer than the temperature one, I presume because the ebcs have resulted in removal of the corresponding DOFs. Is there anyway I can either (a) restore the full temperature vector, so I have temperatures at all the nodes, even the ones with ebcs applied, or (b) get the coordinates for only those nodes which do not have ebcs applied, i.e. coordinates that correspond to the temperatures returned by state.get_parts()? I tried pb.remove_bcs(), but was unsure if that affects anything other than the stiffness matrix. Again, any suggestions?
Many thanks,
 Phil
On 04/07/2014 09:40 AM, seismo_phil wrote:
Hi again,
Further to my previous post on d_surface_flux, I thought I should be able to evaluate the surface heat flux myself, by solving the problem interactively and calculating the surface gradient myself. I use:
pb, state = solve_pde('flndrs2d.py')
t = state.get_parts()['t']
which returns temperatures. Now all I need are the corresponding coordinates. So I try:
xy = pb.get_mesh_coors()
But of course the coordinates vector is longer than the temperature one, I presume because the ebcs have resulted in removal of the corresponding DOFs. Is there anyway I can either (a) restore the full temperature vector, so I have temperatures at all the nodes, even the ones with ebcs applied, or (b) get the coordinates for only those nodes which do not have ebcs applied, i.e. coordinates that correspond to the temperatures returned by state.get_parts()? I tried pb.remove_bcs(), but was unsure if that affects anything other than the stiffness matrix. Again, any suggestions?
Many thanks,
Hi Phil,
the state already holds all the degrees of freedom (including ebcs). The difference in size you see is caused by the fact that the following 69 vertices in the mesh are not in any element: [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77] Those vertices are ignored in the solution (note that 375 + 69 = 444, the xy size).
To get the coordinates of the vertices used, try:
In [36]: state.variables['t'].field.get_coor() Out[36]: array([[ 0. , 0. ], [ 250000. , 0. ], [ 0. , 63490. ], ..., [ 31599.14345693, 3500.9966557 ], [ 12347.75422142, 5070.41417628], [ 21548.42305604, 4505.78858353]])
In [37]: state.variables['t'].field.get_coor().shape Out[37]: (375, 2)
That would work also for a higher order of approximation than 1 (for nodal basis).
How are you going to get the gradient?
r.
Hi Robert,
That works perfectly, many thanks! For the moment I only need to calculate the vertical heat flow at the upper left and right corners, and since the sides are vertical I am planning to just take the first difference of the temperature at the surface with the node below it. Eventually I think it will be useful to know the heat flow at every point along the surface, and I am not sure how I will do that. Any suggestions will be much appreciated.
Also, I should apologise because I think I put us on the wrong track with d_surface_flux. When I said I need to know the heat flow out the top, I should have said that I want to know the heat flow at every point along the top boundary. I think d_surface_flux is integrating over the surface to give me the total heat flow out the top  isn't it?  which is actually not what I'm interested in. Sorry about that.
Regards,
 Phil
On Monday, April 7, 2014 5:40:23 PM UTC+10, seismo_phil wrote:
Hi again,
Further to my previous post on d_surface_flux, I thought I should be able to evaluate the surface heat flux myself, by solving the problem interactively and calculating the surface gradient myself. I use:
pb, state = solve_pde('flndrs2d.py')
t = state.get_parts()['t']
which returns temperatures. Now all I need are the corresponding coordinates. So I try:
xy = pb.get_mesh_coors()
But of course the coordinates vector is longer than the temperature one, I presume because the ebcs have resulted in removal of the corresponding DOFs. Is there anyway I can either (a) restore the full temperature vector, so I have temperatures at all the nodes, even the ones with ebcs applied, or (b) get the coordinates for only those nodes which do not have ebcs applied, i.e. coordinates that correspond to the temperatures returned by state.get_parts()? I tried pb.remove_bcs(), but was unsure if that affects anything other than the stiffness matrix. Again, any suggestions?
Many thanks,
 Phil
On 04/08/2014 03:17 PM, seismo_phil wrote:
Hi Robert,
That works perfectly, many thanks! For the moment I only need to calculate the vertical heat flow at the upper left and right corners, and since the sides are vertical I am planning to just take the first difference of the temperature at the surface with the node below it. Eventually I think it will be useful to know the heat flow at every point along the surface, and I am not sure how I will do that. Any suggestions will be much appreciated.
Also, I should apologise because I think I put us on the wrong track with d_surface_flux. When I said I need to know the heat flow out the top, I should have said that I want to know the heat flow at every point along the top boundary. I think d_surface_flux is integrating over the surface to give me the total heat flow out the top  isn't it?  which is actually not what I'm interested in. Sorry about that.
Note that d_surface_flux when evaluated with mode='el' returns a vector of flows through individual facets (edges in 2D) of the region. So given that, you can IMHO average those values into the mesh vertices by using the edge lengths. There might a way how to get that using FieldVariable.set_data_from_qp() function (but support for mode='qp' would have to be added), let me know if you need that.
r.
Regards,
 Phil
On Monday, April 7, 2014 5:40:23 PM UTC+10, seismo_phil wrote:
Hi again,
Further to my previous post on d_surface_flux, I thought I should be able to evaluate the surface heat flux myself, by solving the problem interactively and calculating the surface gradient myself. I use:
pb, state = solve_pde('flndrs2d.py')
t = state.get_parts()['t']
which returns temperatures. Now all I need are the corresponding coordinates. So I try:
xy = pb.get_mesh_coors()
But of course the coordinates vector is longer than the temperature one, I presume because the ebcs have resulted in removal of the corresponding DOFs. Is there anyway I can either (a) restore the full temperature vector, so I have temperatures at all the nodes, even the ones with ebcs applied, or (b) get the coordinates for only those nodes which do not have ebcs applied, i.e. coordinates that correspond to the temperatures returned by state.get_parts()? I tried pb.remove_bcs(), but was unsure if that affects anything other than the stiffness matrix. Again, any suggestions?
Many thanks,
 Phil
participants (2)

Robert Cimrman

seismo_phil