I
n my FSI problem, the parallization code solved 2 sets of equations using the "workstream" class interfacing with PETSc. Equation 1 will get known values of variables in equation 2, and so does equation 2.
The solution for equation 2 is initiallized in this way.
hp_index_set = dof_handler.locally_owned_dofs();
hp_relevant_set = DoFTools::extract_locally_relevant_dofs(dof_handler);
solution.reinit(hp_index_set,
hp_relevant_set,
mpi_communicator);
In the "assemble_local" part, I used this line to get parts of the solution values.
fe_values[extractor_displacement].get_function_gradients(solution, grad_u);
In the "workstream" part, there are worker, copier, and workstream function.
PerTaskData cp;
auto worker =
[this](const typename DoFHandler<dim>::active_cell_iterator &cell,
ScratchData & scratch,
PerTaskData & copy_data) {
this->local_assemble_volume(cell, scratch, copy_data);
};
auto copier = [this](const PerTaskData ©_data) {
this->copy_local_to_global_volume(copy_data);
};
WorkStream::run(CellFilter(IteratorFilters::LocallyOwnedCell(),
volume_dof_handler.begin_active()),
CellFilter(IteratorFilters::LocallyOwnedCell(),
volume_dof_handler.end()),
worker,
copier,
sd,
cp);
volume_system_matrix.compress(VectorOperation::add);
volume_system_rhs.compress(VectorOperation::add);
Note that I used a cell filter to make the code run on locally owned cells, instead of ghosted cells.However, an error will occur in the "get function values" line. It failed to call back the function
get_dof_values(values, local_values.begin(), local_values.end());
in the source file. Refer to the picture below.
The reason is deal.ii somehow tries to get values on ghosted cells, ignoring the cell filter.
This puzzled me a lot for a long time. Any suggestion?
Regards,
Lex