<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'> Hello, <br><br> 1. I am trying to save the solution of a PDE for a 3-D geometry domain. I used DM to manage the matrix and vector.<br> The solution vector was converted to local 3D arrays on each process successfully. But there was errors when the functions DMLocalToGlobalBegin() and DMLocalToGlobalEnd() were called.<br> <br> I built the code by following the example in /petsc-3.3-p6/src/dm/examples/tutorials/ex3.c. The codes for this are as followings :<br><br> /*Get the solution vec */<br> ierr = KSPSolve(ksp,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);<br> ierr = KSPGetSolution(ksp,&x);CHKERRQ(ierr);<br> <br> /* local 3d arrays */ <br> ierr = DMDAVecGetArray(da, x, &localArray3d ); CHKERRQ(ierr);<br><br> /* global 3d array */ <br> ierr = DMCreateGlobalVector(da,&gsol3d);CHKERRQ(ierr);<br> ierr = DMLocalToGlobalBegin(da,x,INSERT_VALUES,gsol3d);CHKERRQ(ierr);<br> ierr = DMLocalToGlobalEnd(da,x,INSERT_VALUES,gsol3d);CHKERRQ(ierr);<br> <br> <br> 2. I am trying to visualize the solution in a 3-D domain by using some software such as Tecplot. To my understand, I need to output the solution in the format of 3-D array. The vectors of KSP solution in PETSc are local vectors on each process. So they have to be assembled to a global vector and then converted to a 3-D global array. I am not sure if my approach is a good way and if there is some functions in PETSc to output the global solutions directly?<br> <br>Part of the error information when DMLocalToGlobalBegin() and DMLocalToGlobalEnd() were called <br> <br>[0]PETSC ERROR: [1]PETSC ERROR: [2]PETSC ERROR: --------------------- Error Message ------------------------------------<br>[3]PETSC ERROR: --------------------- Error Message ------------------------------------<br>[2]PETSC ERROR: [3]PETSC ERROR: --------------------- Error Message ------------------------------------<br>Nonconforming object sizes!<br>Nonconforming object sizes!<br>[2]PETSC ERROR: [3]PETSC ERROR: Vector wrong size 30 for scatter 60 (scatter forward and vector from != ctx from size)!<br>Vector wrong size 20 for scatter 45 (scatter forward and vector from != ctx from size)!<br> </div></body>
</html>