[petsc-users] Question on local vec to global vec for dof > 1

Matthew Knepley knepley at gmail.com
Thu May 22 14:01:05 CDT 2014


On Thu, May 22, 2014 at 1:58 PM, Danyang Su <danyang.su at gmail.com> wrote:

>  Hi All,
>
> I have a 1D transient flow problem (1 dof) coupled with energy balance (1
> dof), so the total dof per node is 2.
>
> The whole domain has 10 nodes in z direction.
>
> The program runs well with 1 processor but failed in 2 processors. The
> matrix is the same for 1 processor and 2 processor but the rhs are
> different.
>
> The following is used to set the rhs value.
>
> call VecGetArrayF90(x_vec_loc, vecpointer, ierr)
> vecpointer = (calculate the rhs value here)
> call VecRestoreArrayF90(x_vec_loc,vecpointer,ierr)
> call DMLocalToGlobalBegin(da,x_vec_loc,INSERT_VALUES, x_vec_gbl,ierr)
> call DMLocalToGlobalEnd(da,x_vec_loc,INSERT_VALUES, x_vec_gbl,ierr)
>
>
> *Vecview  Correct *            *Vecview  Wrong*
> dof     local node           Process [0]                                  *Process
> [0]   *                  * Process [0] *
> 1            1              1.395982780116148E-021
> 1.39598e-021                 1.39598e-021
> 1            2              0.000000000000000E+000
> 0                                       0
> 1            3              0.000000000000000E+000
> 0                                       0
> 1            4              5.642372883946980E-037
> 5.64237e-037                 5.64237e-037
> 1            5              0.000000000000000E+000
> 0                                       0
> 1            6             -1.395982780116148E-021              -7.52316e-037
> -1.39598e-021                       Line A
> 2            1              0.000000000000000E+000
> 7.52316e-037                 0
> 2            2              0.000000000000000E+000                0
> 0
> 2            3              0.000000000000000E+000
> 1.68459e-016                  0
> 2            4              4.814824860968090E-035                0.1296
> 4.81482e-035
> 2            5              0.000000000000000E+000
>              *Process [1]*                             Line B
> 2            6             -1.371273884908092E-019               0
> 7.52316e-037                       Line C
>
>                    0                                        0
>                                        Process [1]
>           0                                       1.68459e-016
> 1            1              1.395982780116148E-021
> 4.81482e-035                 0.1296
> Line D
> 1            2             -7.523163845262640E-037                0
>             1.37127e-019                         Line E
> 1            3              7.523163845262640E-037
> -7.22224e-035                -7.22224e-035
> 1            4              0.000000000000000E+000
> 7.22224e-035                 7.22224e-035
> 1            5              1.684590875336239E-016
> 0                                       0
> 1            6              0.129600000000000
> 128623                            128623
> 2            1              1.371273884908092E-019
> 0
> 0                                                Line F
> 2            2             -7.222237291452134E-035
> 2            3              7.222237291452134E-035
> 2            4              0.000000000000000E+000
> 2            5               128623.169844761
> 2            6              0.000000000000000E+000
>
> The red line (Line A, C, D and F) is the ghost values for 2 subdomains,
> but when run with 2 processor, the program treates Line B, C, D, and E as
> ghost values.
> *How can I handle this kind of local vector to global vector assembly?*
>

Why are you not using DMDAVecGetArrayF90()? This is exactly what it is for.

   Matt


>
> *In fact, the codes can work if the dof and local node is as follows.*
> dof     local node
> 1            1
> 2            1
> 1            2
> 2            2
> 1            3
> 2            3
>
> Thanks and regards,
>
> Danyang
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140522/4fa6f86a/attachment.html>


More information about the petsc-users mailing list