> 1. 1st dimension is the number of the tetrahedra element. 5235 is the total
> number of the volume element. By what is 3898? Is it a number of the
> tetrahedra which are contains in boundary or is it a number of triangles on
> the surface?
It is the number of the entities of the region. If you integrate over a
whole volume domain, it's the number of elements. If you integrate over
a surface region, it's the number of faces.
Then, to save it for visualization, one usually wants to extend the data
over the whole mesh...
Yes, it is possible, Check the nodal_stress() function in
examples/linear_elasticity/its2D_3.py - it evaluates the stress in
quadrature points and then averages them into the mesh vertices. The key
function is FieldVariable.data_from_qp(). After that, the dofs can be
obtained by calling the variable instance.
To extend element-averaged data to all elements, use extend_cell_data().
# Integrals
integral_1 = {
'name' : 'i1',
'kind' : 's',
'order' : 2
}
def post_process(out, pb, state, extend = False):
flux = pb.evaluate('d_surface_flux.i1.Gamma(m.K, u)', mode = 'qp')
flux = extend_cell_data(flux, pb.domain, 'Gamma', is_surface = True)
flux_field = Field('flux', np.float64, (1,), pb.domain.regions['Omega'])
flux_var = FieldVariable('flux', 'parameter', flux_field, 1, primary_var_name='(set-to-None)')
flux_var.data_from_qp(flux, pb.integrals['i1'])
It seems that the flux shape should be (5235, 4, 1, 1) (4 quadrature
points). So you should use a volume integral in data_from_qp(), that you
use in solving the problem, as extend_cell_data() returns the flux in
the volume elements (averaged from the surface).
This is probably not
optimal for surface terms (a better way would be to directly average the
face data to face vertices), but it is how things are now.