On 01/30/2018 07:53 AM, Dulcimer0909 wrote:

             for(unsigned int i = 0; i < dofs_per_cell; i++)
             {
                 for (unsigned int j = 0; j < dofs_per_cell; j++)
                 {
                     matrix_v.add (local_dof_indices[i],
                                    local_dof_indices[j],
                                    cell_matrix(i,j));
                 }
                 system_rhs(local_dof_indices[i]) += cell_rhs(i);

This is the place I pointed out in the other mail: you add to matrix_v and system_rhs on each cell, but you never set them to zero.

>                  for(unsigned int i = 0; i < dofs_per_cell; ++i)
>                  {
>                      for(unsigned int j = 0; j < dofs_per_cell; ++j)
>                      {
> [...]
>                          cell_rhs_1(i) +=
>                             /*(MV^(n-1) - k(theta*A*U^(n) +
> (1-theta)*A*U^(n-1))*/
>                            (
>                                 fe_values.shape_value(i, q_index) *
>                                 fe_values.shape_value(j, q_index)
>                                 *
>                                 old_v

This cannot be correct. The assembly of cell_rhs_1(i) cannot include the shape function shape_value(j,q_index). Assembly of the rhs must be in a loop only over i, not in the loop over j.

As for debugging these problems, you should also try to run these sorts of things on only one cell, for example. If you only change the system assembly for the second equation, then output the rhs and matrix for the v-system just before solving for both of the old code and for your modification. They need to be the same. If they're not, you know where your problem lies.

Best
 W.

--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 [email protected]
                           www: http://www.math.colostate.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