> On May 6, 2016, at 5:08 AM, praveen kumar <[email protected]> wrote:
>
> Hi,
>
> I am trying to implement Petsc for DD in a serial fortran FVM code. I want
> to use solver from serial code itself. Solver consists of gauss seidel +
> TDMA. BCs are given along with the solver at boundary virtual nodes. For Ex:
> CALL TDMA(0,nx+1), where BCs are given at 0 and nx+1 which are virtual nodes
> (which don't take part in computation). I partitioned the domain using
> DMDACreate and got the ghost nodes information using DMDAGetcorners. But how
> to create the virtual nodes at the processes boundary where BCs are to be
> given. Please suggest all the possibilities to fix this other than using
> PETSc for solver parallelization.
DMCreateGlobalVector(dm,gvector,ierr);
DMCreateLocalVector(dm,lvector,ierr);
/* full up gvector with initial guess or whatever */
DMGlobalToLocalBegin(dm,gvector,INSERT_VALUES,lvector,ierr)
DMGlobalToLocalEnd(dm,gvector,INSERT_VALUES,lvector,ierr)
Now the vector lvector has the ghost values you can use
DMDAVecGetArrayF90(dm,lvector,fortran_array_pointer_of_correct dimension
for your problem (1,2,3d))
Note that the indexing into the fortran_array_pointer uses the global
indexing, not the local indexing. You can use DMDAGetCorners() to get the start
and end indices for each process.
Barry
>
> Thanks,
> Praveen
>