<div dir="ltr"><div>Barry,</div><div><br></div><div>Thanks.</div><div><br></div><div>It is my fault. I should not mix the VecScatter and MatSetValues.</div><div><br></div><div>1. Matrix assemble</div><div>There are only two options matrix for case with rotation boundary.</div><div>The first is using "MatSetoption(A,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_FALSE)".</div><div>The second is to create matrix by hand.</div><div>Is it correct?</div><div><br></div><div>2. VecScatter</div><div>It will be used to get the values on ghosted cell.</div><div>My case is neutron diffusion equation which is like below:</div><div>\( -\nabla \cdot D_g \nabla \phi_g + \Sigma_{r,g}\phi_g - \sum_{g' \neq g} \Sigma_{s,g'\to g} \phi_{g'} = \frac{1}{Keff} \chi_g \sum_{g' = 1, G} \nu\Sigma_{f,g'}\phi_{g'}  \)</div><div>where g denotes energy group, G is the number of energy groups, \(D_g\) is the diffusion coefficient of group g, \(\Sigma_{r,g}\) is the removal cross section of group g,</div><div>\(\Sigma_{s,g'\to g}\) is the scatter cross section from group g' to group g, \(chi_g\) is the fission spectral of group g, \(\nu\Sigma_{f,g'}\) is the fission production cross section,</div><div>\(\phi_g\) is neutron flux and eigenvector, Keff is the eigenvalue.</div><div>The diffusion coefficients and other cross sections varied in the region and are distributed on procs. </div><div>If I use mesh-centerd seven point finite difference method for 3D, the degree of freedom is G and \(D_g\) need comunication.</div><div><br></div><div>I get the \(D_g\) of the ghost cell through VecScatter and insert values to matrix.</div><div>Is it correct?</div><div><br></div><div>BEST,</div><div><br></div><div>Wenbo</div></div>