[petsc-users] questions about dm/examples/tutorials/ex5.c
Barry Smith
bsmith at mcs.anl.gov
Wed Feb 19 10:58:17 CST 2014
On Feb 19, 2014, at 10:40 AM, Xiangdong <epscodes at gmail.com> wrote:
> Hello everyone,
>
> I am running the dm tutorial ex5. I have a few quick questions:
>
> 1) what do DMDA_ELEMENT_P1 and DMDA_ELEMENT_Q1 mean? I googled, but did not find the answer.
See DMCreateInterpolation_DA_1D/2D/3D_Q0/Q1 in dainterp.c It simple means the interpolation is piecewise constant (cell centered elements) or piecewise bilinear Q1 elements.
>
> 2) the m and n for DMDACreate2d are used as PETSC_DECIDE. when I print these values, it seems that m=-1 and n=-1. Can the number of processors per dimension be negative? Does -1 corresponds to some special meaning in PETSc?
Yes, when PETSC_DECIDE (which is -1) is used then the routine decides the value to use based on other values passed in.
>
> 3) When I run the program with np=1, I get ne=126 and nc=3 from DMDAGetElements(da,&ne,&nc,&e). It is not clear for me where 126 and 3 come from. Can you explain a little bit?
There are 126 elements, each with three nc=3 nodes (hence triangles). 126 triangles/2 = 63 rectangles which comes from an 63 = (10 - 1) * (8 - 1) elements from a 10 by 8 mesh which are the inputs in DMDACreate2d
Barry
>
> Thank you.
>
> Xiangdong
More information about the petsc-users
mailing list