Hello Professor,

Thank you for your reply and your time.

The initialization of the cell_matrix and cell_rhs and cell_rhs_1 are being 
done in the beginning.

>        for(const auto &cell: dof_handler.active_cell_iterators())
>        {
>            fe_values.reinit(cell);
>            cell_matrix   = 0;
>            cell_rhs = 0;
>            cell_rhs_1 = 0;

For the assembly of cell_rhs_1, I agree it should generally be only over i 
and not over j but as mentioned in the tutorial in the space discretization 
section
( https://dealii.org/8.5.0/doxygen/deal.II/step_23.html#Spacediscretization 
) the right hand side has
M and A matrices which can only be accessed within the j loop.

Also thank you for the debugging tip. I will try printing out matrix and 
vectors for one cell.

Regards.


On Monday, February 5, 2018 at 10:56:36 PM UTC+1, Wolfgang Bangerth wrote:
>
> 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] 
> <javascript:> 
>                             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