How to access solution values at DoFs of a cell?

36 views
Skip to first unread message

Junchao Zhang

unread,
Jul 22, 2016, 6:10:51 PM7/22/16
to dea...@googlegroups.com
 Hi,
 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]);
    }
  }


--Junchao Zhang

Wolfgang Bangerth

unread,
Jul 22, 2016, 7:52:32 PM7/22/16
to dea...@googlegroups.com
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: bang...@math.tamu.edu
www: http://www.math.tamu.edu/~bangerth/

Junchao Zhang

unread,
Jul 22, 2016, 10:53:01 PM7/22/16
to dea...@googlegroups.com
You are right. I only need values or grad values at the quadrature points.  Thanks a lot.


--Junchao Zhang

--
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 a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/Adn9T1mrT2M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages