Hello,
I think what I'm trying to do is referred to as a "group finite element formulation" - suppose I want to evaluate some function of my solution u--let's call it myfunc(u)--using an FE expansion. For example, to evaluate the function at quadrature points in a cell, I don't want to evaluate the solution at quadrature points and then pass those values to the function:
FEValues<dim> fe_values_u(fe_u, quadrature, update_values);
cell = dof_handler_u.begin_active();
fe_values_u.reinit(cell);
u_q = fe_values_u.get_function_values(u_dofs);
myfunc_q = myfunc(u_q);
Instead, I want to evaluate the function directly on the degrees of freedom of u--call them u_dofs--and then use these function degree of freedom values myfunc_dofs in an FE expansion:
myfunc_dofs = myfunc(u_dofs); // need to considering dof ordering here
somehow_associate_myfunc_dofs_with_a_dof_handler_and_fe_object();
FEValues<dim> fe_values_myfunc(fe_myfunc, quadrature, update_values);
cell = dof_handler_myfunc.begin_active();
fe_values_myfunc.reinit(cell);
myfunc_q = fe_values_myfunc.get_function_values(myfunc_dofs)
How might I go about doing this? Additional details:
- My solution has multiple components
- I want to use the same FE space (same type of FE object and degree) for myfunc as for each component of u.
For a scalar problem, I might guess that the answer of my question would be:
FE_Q<dim> fe_u(fe_degree);
DoFHandler<dim> dof_handler_u(triangulation);
dof_handler_u.distribute_dofs(fe_u);
FE_Q<dim> fe_myfunc(fe_degree);
DoFHandler<dim> dof_handler_myfunc(triangulation);
dof_handler_myfunc.distribute_dofs(fe_myfunc);
myfunc_dofs = myfunc(u_dofs);
// then just compute myfunc_q as given above
This would assume that the ordering in dof_handler_u and dof_handler_myfunc were the same, but I don't know if this is a safe assumption. For vector-valued problems though, I have no idea how to do this since I don't think the ability to extract dofs directly exists:
var1_dofs = u_dofs[var1_extractor];
var2_dofs = u_dofs[var2_extractor];
myfunc_dofs = myfunc(var1_dofs, var2_dofs);
Thanks!
P.S. I couldn't find an appropriate category tag - I think a tag "finite_elements" would be good.