Re: [petsc-users] [petsc-maint] Issues linking petsc header files and lib from FORTRAN codes

2022-11-03 Thread Satish Balay via petsc-users
For ex83f.F90: > balay@p1 /home/balay/test $ ls ex83f.F90 balay@p1 /home/balay/test $ ls ex83f.F90 balay@p1 /home/balay/test $ export PETSC_DIR=$HOME/petsc balay@p1 /home/balay/test $ cp $PETSC_DIR/src/ksp/ksp/tests/makefile . balay@p1 /home/balay/test $ make ex83f mpif90 -fPIC -Wall

Re: [petsc-users] [petsc-maint] Issues linking petsc header files and lib from FORTRAN codes

2022-11-03 Thread Barry Smith
Please send your attempted makefile and we'll see if we can get it working. I am not sure if we can organize the include files as Fortran compiler include files easily. We've always used the preprocessor approach. The Intel compiler docs indicate the procedure for finding the Fortran

Re: [petsc-users] locate DMSwarm particles with respect to a background DMDA mesh

2022-11-03 Thread Matthew Knepley
On Thu, Nov 3, 2022 at 8:36 PM Matthew Knepley wrote: > On Thu, Oct 27, 2022 at 11:57 AM Semplice Matteo < > matteo.sempl...@uninsubria.it> wrote: > >> Dear Petsc developers, >> I am trying to use a DMSwarm to locate a cloud of points with respect >> to a background mesh. In the real

Re: [petsc-users] locate DMSwarm particles with respect to a background DMDA mesh

2022-11-03 Thread Matthew Knepley
On Thu, Oct 27, 2022 at 11:57 AM Semplice Matteo < matteo.sempl...@uninsubria.it> wrote: > Dear Petsc developers, > I am trying to use a DMSwarm to locate a cloud of points with respect > to a background mesh. In the real application the points will be loaded > from disk, but I have created a

Re: [petsc-users] Local columns of A10 do not equal local rows of A00

2022-11-03 Thread Matthew Knepley
On Thu, Nov 3, 2022 at 7:52 PM Alexander Lindsay wrote: > I have errors on quite a few (but not all) processes of the like > > [1]PETSC ERROR: - Error Message > -- > [1]PETSC ERROR: Nonconforming object sizes >

[petsc-users] Local columns of A10 do not equal local rows of A00

2022-11-03 Thread Alexander Lindsay
I have errors on quite a few (but not all) processes of the like [1]PETSC ERROR: - Error Message -- [1]PETSC ERROR: Nonconforming object sizes [1]PETSC ERROR: Local columns of A10 4137 do not equal local rows of A00

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Barry Smith
You should pass 1 and 1 not 3, because you are setting one block. Regarding all the integer values passed in to PETSc routines To be completely portable you need to declare them as PetscInt and pass the variables. But if you do not use --with-64-bit-indices in ./configure and you do not

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Edoardo alinovi
Barry, Can you please provide me with an example on how to use MatSetValuesBlocked? To play it easy, let's say that I want to insert a 3x3 block matrix b into the matrix A, rows 0-2, columns 0-2. Up to what I've understood (very few apparently XD ), I would do like this: b(3,3) = 11.0 call

Re: [petsc-users] Report Bug TaoALMM class

2022-11-03 Thread Barry Smith
Thanks for your response and the code. I understand the potential problem and how your code demonstrates a bug if the TaoALMMSubsolverObjective() is used in the manner you use in the example where you directly call TaoComputeObjective() multiple times line a line search code might. What I

Re: [petsc-users] Advice on coupling linear physics with Allen-Cahn

2022-11-03 Thread Barry Smith
> On Nov 3, 2022, at 2:33 PM, Mike Welland wrote: > > I am coupling a linear diffusion equation with Allen-Cahn in a time dependent > problem. I'd like to take advantage of the linear block to speed things up. > I'm trying two approaches: > > 1. Allen-Cahn with double well potential:

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Barry Smith
The error indicates not enough nonzero blocks are preallocated for. Try something really simple, preallocate for one block and put in one block then call MatAssemblyBegin/End(), MatView(), if that works then work up to your full problem. Barry > On Nov 3, 2022, at 3:11 PM, Edoardo

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Edoardo alinovi
Well, definitely using MatsetValuesBlocked in a bad way. Instead if seeing 11 in the first place 3 rows and 3 columns, I see all zeros and random numbers in row 9 10 and 11... [image: image.png]

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Edoardo alinovi
Just to give a bit more of context I am doing like this: call MatCreate(PETSC_COMM_WORLD, this%A, ierr) call MatSetSizes(this%A, lm, lm, M, M, ierr) ! lm is the local size of the matrix , M the global one call MatSetType(this%A, myType, ierr) ! myType is MATMPIBAIJ

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Edoardo alinovi
Yes I am doing: call MatMPIBAIJSetPreallocation(this%A, 4-bdim, flubioSolvers%d_nz, mesh%d_nnz, flubioSolvers%o_nz, mesh%o_nnz, ierr) with d_nnz the number of diagonal blocks and o_nnz the number of off-diagonal blocks. However I am getting this: [0]PETSC ERROR: - Error

[petsc-users] Advice on coupling linear physics with Allen-Cahn

2022-11-03 Thread Mike Welland
I am coupling a linear diffusion equation with Allen-Cahn in a time dependent problem. I'd like to take advantage of the linear block to speed things up. I'm trying two approaches: 1. Allen-Cahn with double well potential: phi^2*(1-phi^2), which makes it nonlinear. The best performance I have is

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Barry Smith
> On Nov 3, 2022, at 1:16 PM, Edoardo alinovi wrote: > > Ah, I was forgetting the most important thing... Are the size of idxm and > idxn equal to one if I insert 1 block or should I specify all the rows and > columns in the block? Yes, for a single block they are one. The block size is

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Edoardo alinovi
Ah, I was forgetting the most important thing... Are the size of idxm and idxn equal to one if I insert 1 block or should I specify all the rows and columns in the block? I am getting some memory issues with unallocated non zero values so I must have made some mistake here... :( Sorry for the

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Edoardo alinovi
Also, just to be 100% sure, is m and equal to 3 in 2 and 4 in 3D if my blocks are 3x3 and 4x4 respectively?

Re: [petsc-users] Report Bug TaoALMM class

2022-11-03 Thread Stephan Köhler
Barry, so far, I have not experimented with trust-region methods, but I can imagine that this "design feature" causes no problem for trust-region methods, if the old point is saved and after the trust-region check fails the old point is copied to the actual point.  But the implementation of

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Edoardo alinovi
Hi Barry, Thanks for popping in. This is my code: *blockValues = this%getDiagonalBlockValues(iElement=iElement)call MatSetValuesBlocked(this%A, 4-bdim, mesh%cellGlobalAddr(iElement)-1, 4-bdim, mesh%cellGlobalAddr(iElement)-1, blockValues, INSERT_VALUES, ierr)*

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Edoardo alinovi
Hello Matt, I see, so from an operation point of view, I should pass a 1D array... How should I unroll my nComp x nComp matrix? by row or by column? e.g. say that my block is: A=[ 1 2 3 4 5 6 7 8 9 ] than v = [1 2 3 4 5 6 7 8 9] or [1 4 7 2 5 8 3 6 9]?

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Barry Smith
You can find the current F90 interface definitions we support for MatSetValuesBlocked() in /src/mat/f90-mod/petscmat.h90 > On Nov 3, 2022, at 12:16 PM, Edoardo alinovi > wrote: > > Hello Jed/Barry/Petsc friends > > I am trying to assemble a block matrix with 3x3 in 2D and 4x4 blocks

Re: [petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Matthew Knepley
On Thu, Nov 3, 2022 at 12:16 PM Edoardo alinovi wrote: > Hello Jed/Barry/Petsc friends > > I am trying to assemble a block matrix with 3x3 in 2D and 4x4 blocks in 3D > coming from the fully coupled NS equation. > > I am not sure I am understanding the example provided here: >

[petsc-users] On the usage of MatSetValuesBlocked

2022-11-03 Thread Edoardo alinovi
Hello Jed/Barry/Petsc friends I am trying to assemble a block matrix with 3x3 in 2D and 4x4 blocks in 3D coming from the fully coupled NS equation. I am not sure I am understanding the example provided here: https://petsc.org/main/docs/manualpages/Mat/MatSetValuesBlocked/ The description says

Re: [petsc-users] Doubt about PCILU

2022-11-03 Thread Ahmed Mansur
Thanks a lot. El jue., 3 de noviembre de 2022 10:22 a. m., Zhang, Hong escribió: > PETSc does not support 'ilutp' . Sequential superlu supports it. You can > install petsc with superlu, then use runtime options to activate 'ilutp' , > e.g., > petsc/src/ksp/ksp/tutorials > ./ex2 -ksp_view

Re: [petsc-users] Redefining MPI functions as macros can break C++ code

2022-11-03 Thread Satish Balay via petsc-users
And I see the issue got fixed differently [with braces] https://github.com/AMReX-Codes/amrex/pull/3011/files Satish On Wed, 2 Nov 2022, Satish Balay via petsc-users wrote: > You can define 'PETSC_HAVE_BROKEN_RECURSIVE_MACRO' and then include > petsc.h in your sources to avoid these macros in

Re: [petsc-users] Doubt about PCILU

2022-11-03 Thread Zhang, Hong via petsc-users
PETSc does not support 'ilutp' . Sequential superlu supports it. You can install petsc with superlu, then use runtime options to activate 'ilutp' , e.g., petsc/src/ksp/ksp/tutorials ./ex2 -ksp_view -pc_type ilu -pc_factor_mat_solver_type superlu -help |grep superlu ...

[petsc-users] Doubt about PCILU

2022-11-03 Thread Ahmed Mansur
Hi, I'm trying to use ILU as GMRES preconditioner (using PCILU), my question is how use ILU as 'ilutp' type like MATLAB ( ILU factorization with threshold and pivoting. ) Thanks. Regards