[petsc-users] Question about DMDA BOUNDARY_CONDITION set
Barry Smith
bsmith at mcs.anl.gov
Mon Apr 3 15:33:51 CDT 2017
> On Apr 3, 2017, at 1:10 PM, Wenbo Zhao <zhaowenbo.npic at gmail.com> wrote:
>
> Barry,
> Hi. I am sorry for too late to reply you.
> I read the code you send to me which create a VecScatter for ghost points on rotation boundary.
> But I am still not clear to how to use it to assemble the matrix.
You did not ask specifically about assembling the matrix for the rotated boundary; what I provided was a way to update
the rotated ghost locations with the correct ghost values so you could write function evaluations that use the local representation including the rotated ghost locations.
The easiest way to avoid the error below is to turn off the flag not allowing additional matrix allocations when you set the values
MatSetOption(A,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE); This will make the assembly process slower. But if this is a one time thing you want to do (i.e. you are not devoting your career to this problem with the rotated boundary) then just wait for the slow assembly.
>
> I studied the example "$SLEPC_DIR/src/eps/examples/tutorials/ex19.c", which is a 3D eigenvalue problem.
>
>
> [0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint at mcs.anl.gov----------
> "
> I think the reason is Mat Prellocation. If so, I need to create matrix using MatCreate by myself according to the src code of DMCreateMatrix_DA? Is it correct?
Yes you can do this. It will be tedious, you can reuse some of the code I sent in the example to get the mappings correct.
>
> Could you give some explanation about how to use VecScatter?
I don't understand. The example shows exactly how to use the scatter (but it won't help you fill up matrices).
> In the $PETSC_DIR/src/ksp/ksp/examples/tutorials/ex2.c, I did not find the VecScatter.
> I found VecScatter is created in the src code of dm/impls/da/da1.c but i am not clear about it.
Barry
>
> BEST,
> Wenbo
>
> <step-2.c>
More information about the petsc-users
mailing list