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
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to