Dear all,

I would like to calculate some error indicators for a problem similar to step-21. If I wanted the divergence of the first components of BlockVector solution I could do something like (in pseudo code):

std::vector<double> div_u (n_quadrature_points);
const FEValuesExtractors::Vector velocities (0);
loop over cells
    fe_values.reinit (cell);
    fe_values[velocities].get_function_divergences (solution, div_u);
end loop

which gives the divergences at the quadrature points on cell, which is good.

However, what I would like is the divergence of D(u)\nabla c, where D(u) is a Tensor<2,dim> valued function of the first component u of solution and \nabla c is the gradient of the last component of solution, so D(u)\nabla c is of type Tensor<1,dim>.

I can find the gradient of c in a similar way to the code snippet above, using const FEValuesExtractors::Scalar concentration(dim+1) and fe_values[concentration].get_function_gradients (solution, grad_c) and the value of D by overloading TensorFunction::tensor_value for my particular code. With these I can make a vector of D(u)*grad_c values for the quadrature points on the cell. However I can't call fe_values[extractor].get_function_divergences now as the vector is the wrong size and gives values at quadrature points on this cell not degrees of freedom everywhere.

Is there a way to solve this problem with deal.ii without having to construct a dummy solution which contains D(u)*grad_c at every dof and feeding it into fe_values[extractor].get_function_divergences just to recover the values at the quadrature points? If this is the only way, what is the best way to construct the dummy solution, considering grad_c also isn't known at the dofs either.

Apologies if this is covered in one of the tutorial steps, but I could only find examples for functions where a deal.ii function already existed e.g. get_function_laplacians.

Thanks,

John





_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to