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.