On 07/22/2016 05:10 PM, Junchao Zhang wrote:
  In matrix assembly, I need to access solution values of the previous
time-step at DoFs of the current cell. Is my following code correct? I could
not find an example. Thanks.

  std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
  ...
   for(; cell!=endc; ++cell) {
     if (cell->is_locally_owned()) {
       cell->get_dof_indices (local_dof_indices);
       fe_values.reinit (cell);
        ... += old_locally_relevant_solution(local_dof_indices[i]);
     }
   }

No. You typically need to access the old solution at *quadrature points*, not at the node points. You can find how this is typically done in many tutorial programs, e.g., in steps 21, 26, 15. To evaluate a solution at the quadrature points, you'll have to do something like
  fe_values.get_function_values (old_solution,
                                 old_solution_values);

Best
 W.

--
------------------------------------------------------------------------
Wolfgang Bangerth               email:            [email protected]
                                www: http://www.math.tamu.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to