[petsc-users] questions about dmdacreaterestriction
Xiangdong
epscodes at gmail.com
Mon May 7 15:25:52 CDT 2018
Hello everyone,
I have a 2D DMDA with Nx=6 and Ny=4. If I set refine_x=3 and refine_y=2, I
can get a coarse DMDA by DMCoarsen(). However, when I tried to call the
DMCreateRestriction between these two DMDAs, I got error about " No support
for this operation for this object type. DMCreateRestriction not
implemented for this type."
Can you help me get around this?
Another simple question, where can I find the explanation/meaning of
DMDA_Q0 and DMDA_Q1?
Below is my test example.
Thank you.
Best,
Xiangdong
#include <petsc.h>
int main(int argc, char **argv)
{
PetscErrorCode ierr;
PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
int Nx=6, Ny=4, Nz=1;
DM da;
ierr = DMDACreate2d(PETSC_COMM_WORLD,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,
DMDA_STENCIL_STAR,Nx,Ny,PETSC_DECIDE,
PETSC_DECIDE,1,1,NULL,NULL,&da);CHKERRQ(ierr);
int refine_x=3, refine_y=2, refine_z=1;
ierr = DMDASetRefinementFactor(da,refine_x,refine_y,refine_z);
ierr = DMDASetInterpolationType(da,DMDA_Q0);
ierr = DMSetFromOptions(da); CHKERRQ(ierr);
ierr = DMSetUp(da); CHKERRQ(ierr);
DM dac;
ierr = DMCoarsen(da,NULL,&dac);
Mat M;
Vec V;
ierr = DMCreateRestriction(dac,da,&M);
MatView(M,PETSC_VIEWER_STDOUT_WORLD);
ierr = PetscFinalize(); CHKERRQ(ierr);
PetscFunctionReturn(0);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180507/9abfe803/attachment.html>
More information about the petsc-users
mailing list