Never mind! I found the problem. It was my fault.
As the force is timedependent, I need to do "close()" to finalize assembly
properly every time step.
Maybe this issue can be added somewhere in the document.
Mengda
2009/6/7 Mengda Wu <phdggg@...>
> Hi all,
>
> I have a code which runs OK in serial version but when I tried to go to
> parallel. The result is wrong.
> I checked the matrix and rhs. The matrix is assembled correctly but the rhs
> is wrong. After a long time of debugging.
> I finally found it is because PetscVector::add_vector fails to add force
> contribution from neighboring elements on other processors to nodes (each
> node has 3 dofs) on the subdomain boundary. That is, the force only has the
> contribution from the
> elements on the same processor. However, for any node and all its
> neighboring elements on the same processors, the
> force is correct.
>
> The relevant code snippet looks like:
>
> NumericVector<Real>& force = t_system.get_vector("force");
> MeshBase::const_element_iterator el =
> mesh.local_elements_begin();
> const MeshBase::const_element_iterator end_el = mesh.local_elements_end();
> for( ; el != end_el; ++el)
> {
> const Elem* elem = *el;
> dof_map.dof_indices(elem, dof_indices);
> const unsigned int n_dofs = dof_indices.size();
> Fe.resize(n_dofs);
>
> for(unsigned int i=0; i<3; i++)
> for(unsigned int j=0; j<3; j++)
> Fe(3*i+j) = pressure * area * normal(j) / 3.0;
>
> force.add_vector(Fe, dof_indices);
> }
>
> I am looking forward to your help.
>
> Thanks,
> Mengda
>
>
