[petsc-users] 2D vector in 3D dmda

2016-09-16 Thread Aurelien PONTE
Hi, I've started using petsc4py in order to solve a 3D problem (inversion of elliptic operator). I would like to store 2D metric terms describing the grid I am working on but don't know how to do that given my domain is tiled in 3D directions: self.da = PETSc.DMDA().create([self.grid.Nx, self

[petsc-users] How to create a local to global mapping and construct matrix correctly

2016-09-16 Thread Ji Zhang
Dear all, I have a number of small 'mpidense' matrices mij, and I want to construct them to a big 'mpidense' matrix M like this: [ m11 m12 m13 ] M = | m21 m22 m23 | , [ m31 m32 m33 ] And a short demo is below. I'm using python, but their grammar are similar. import nump

[petsc-users] Question about PETScSF usage in DMNetwork/DMPlex

2016-09-16 Thread Adrian Maldonado
Hi, I am trying to understand some of the data structures DMPlex/DMNetwork creates and the relationship among them. As an example, I have an small test circuit (/src/ksp/ksp/examples/tutorials/network/ex1.c). This is a graph that consists on 6 edges and 4 vertices, each one of those having one d

Re: [petsc-users] 2D vector in 3D dmda

2016-09-16 Thread Barry Smith
> On Sep 16, 2016, at 9:29 AM, Aurelien PONTE wrote: > > Hi, > > I've started using petsc4py in order to solve a 3D problem (inversion of > elliptic operator). > I would like to store 2D metric terms describing the grid What do you mean by 2D metric terms describing the grid? Do y

Re: [petsc-users] Question about memory usage in Multigrid preconditioner

2016-09-16 Thread Hengjie Wang
Hi Dave, I add both options and test it by solving the poisson eqn in a 1024 cube with 32^3 cores. This test used to give the OOM error. Now it runs well. I attach the ksp_view and log_view's output in case you want to know. I also test my original code with those petsc options by simulating

Re: [petsc-users] Question about PETScSF usage in DMNetwork/DMPlex

2016-09-16 Thread Adrian Maldonado
Just one addition about one thing I've noticed. The section: PetscSection Object: 2 MPI processes type not yet set Process 0: ( 0) dim 1 offset 0 ( 1) dim 1 offset 1 ( 2) dim 1 offset 2 ( 3) dim 1 offset 3 ( 4) dim -2 offset -8 ( 5) dim -2 offset -9 ( 6

Re: [petsc-users] How to create a local to global mapping and construct matrix correctly

2016-09-16 Thread Barry Smith
"Gives wrong answers" is not very informative. What answer do you expect and what answer do you get? Note that each process is looping over mSizes? for i in range(len(mSizes)): for j in range(len(mSizes)): Is this what you want? It doesn't seem likely that you want all processes to

Re: [petsc-users] fieldsplit preconditioner for indefinite matrix

2016-09-16 Thread Barry Smith
Why is your C matrix an MPIAIJ matrix on one process? In general we recommend creating a SeqAIJ matrix for one process and MPIAIJ for multiple. You can use MatCreateAIJ() and it will always create the correct one. We could change the code as you suggest but I want to make sure that is the

Re: [petsc-users] Question about memory usage in Multigrid preconditioner

2016-09-16 Thread Jed Brown
Barry Smith writes: >> On Sep 15, 2016, at 1:10 PM, Dave May wrote: >> >> >> >> On Thursday, 15 September 2016, Barry Smith wrote: >> >>Should we have some simple selection of default algorithms based on >> problem size/number of processes? For example if using more than 1000 >> proce

Re: [petsc-users] fieldsplit preconditioner for indefinite matrix

2016-09-16 Thread Barry Smith
> On Sep 16, 2016, at 6:09 PM, Hoang Giang Bui wrote: > > Hi Barry > > You are right, using MatCreateAIJ() eliminates the first issue. Previously I > ran the mpi code with one process so A,B,C,D is all MPIAIJ > > And how about the second issue, this error will always be thrown if A11 is > no

Re: [petsc-users] How to create a local to global mapping and construct matrix correctly

2016-09-16 Thread Ji Zhang
Sorry. What I mean is that, for example, I have a matrix [a1, a2, a3] mij = [b1, b2, b3] , [c1, c2, c3] and using 3 cups. Thus, mij in cpu 2 is mij_2 = [b1, b2, b3] . The local index of element b1 is (1, 1) and it's global index is (2, 1). How can I get the global i

Re: [petsc-users] How to create a local to global mapping and construct matrix correctly

2016-09-16 Thread Barry Smith
> On Sep 16, 2016, at 7:52 PM, Ji Zhang wrote: > > Sorry. What I mean is that, for example, I have a matrix > [a1, a2, a3] > mij = [b1, b2, b3] , > [c1, c2, c3] > and using 3 cups. Thus, mij in cpu 2 is > mij_2 = [b1, b2, b3] . > > The local index of element b

Re: [petsc-users] How to create a local to global mapping and construct matrix correctly

2016-09-16 Thread Ji Zhang
Thanks for your previous suggestion and the construction from little m to big M have accomplished. For a MPI program, a arbitrary matrix is been shorted in different cups (i.e. 3), and each cup only contain part of then. So I think the matrix have two kinds of indexes, a local one indicate the loc

Re: [petsc-users] How to create a local to global mapping and construct matrix correctly

2016-09-16 Thread Barry Smith
> On Sep 16, 2016, at 9:00 PM, Ji Zhang wrote: > > Thanks for your previous suggestion and the construction from little m to big > M have accomplished. > > For a MPI program, a arbitrary matrix is been shorted in different cups (i.e. > 3), and each cup only contain part of then. So I think t