Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-19 Thread Edoardo alinovi
Please ignore me, I was just making a mistake with the number of zeros,
with JEd's suggestion to use MatXAIJSetPreallocation I can do a very
bespoke code and everything looks good.

I'll test the field splitting a bit to see if I can find some performance!

Cheers


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-19 Thread Edoardo alinovi
Morning Guys,

The good news is that finally fieldsplit is working ok! I have just a
simple question about the interaction of
MatMPIAIJSetPreallocation with MatSetValuesBlocked.

In this simple example I have a 27x27 matrix (9 blocks, each composed by a
3x3 matrix). The only entry I have on each line of the matrix is 1.0 in the
diagonal.

I set the block size of the matrix to 3 with call MatSetBlockSize(A, 3,
ierr) as discussed, and I pass a dnnz(1:27)  = 1, since every line of the
matrix has just 1 diagonal entry.  Now, using MatSetValuesBlocked with this
preallocation leads to a wrong matrix, only the first line of the block is
assigned correctly. I get A(1,1) = 1, A(2,2) = 0, A(3,3) = 0, A(4,4) = 1,
A(5,5) = 0, A(6,6) = 0 and so on.  Instead, if I set dnnz = 3, i correctly
get I get A(1,1) = 1, A(2,2) = 1, A(3,3) = 1, A(4,4) = 1, A(5,5) = 1,
A(6,6) = 1 and so on.

Why should I say that dnnz = 3 instead of 1? Is MatSetValuesBlocked kind of
requesting this?

Thank you!


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-15 Thread Edoardo alinovi
Thanks, I'll do it then :)

Il Mar 15 Nov 2022, 19:25 Jed Brown  ha scritto:

> You do if preconditioners (like AMG) will use it or if using functions
> like MatSetValuesBlocked(). If you have uniform block structure, it doesn't
> hurt.
>
> Edoardo alinovi  writes:
>
> > Hi Guys,
> >
> > Very quick one. Do I need to set the block size with MPIAIJ?
>


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-15 Thread Jed Brown
You do if preconditioners (like AMG) will use it or if using functions like 
MatSetValuesBlocked(). If you have uniform block structure, it doesn't hurt.

Edoardo alinovi  writes:

> Hi Guys,
>
> Very quick one. Do I need to set the block size with MPIAIJ?


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-15 Thread Edoardo alinovi
Hi Guys,

Very quick one. Do I need to set the block size with MPIAIJ?


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-14 Thread Edoardo alinovi
Thanks Barry, Your help is always much appreciated! I'll try this out asap.
I have ended using baij because I have read the section "solving block
matrices" and I was thinking that baij was the only way to use fieldsplit!
Completely misunderstood then!



Il Lun 14 Nov 2022, 20:34 Barry Smith  ha scritto:

>
>   Can you clarify what you mean? For some classes of problems,
> PCFIELDSPLIT can be a very efficacious preconditioner; for example when
> certain fields have very different mathematical structure than others. In
> those cases it is worth using AIJ and PCFIELDSPLIT instead of keeping BAIJ.
>
>
> On Nov 14, 2022, at 2:21 PM, Edoardo alinovi 
> wrote:
>
> Hi Barry no worries!
>
> Thanks for letting me know! It is not a problem for me to use MPIAIJ, do
> you think field split will be a game changer?
>
>
>
> Il Lun 14 Nov 2022, 20:13 Barry Smith  ha scritto:
>
>>
>>Very sorry for wasting so much of your time. The PCFIELDSPLIT
>> generally will not work with BAIJ matrices because the MatCreateSubMatrix()
>> for BAIJ requires indexing by block in the matrix. Your code should work if
>> you use MPIAIJ matrices.  Note you can still use MatSetValuesBlocked() with
>> MPAIJ matrices.
>>
>>   Barry
>>
>>
>> > On Nov 10, 2022, at 5:24 PM, Edoardo alinovi 
>> wrote:
>> >
>> > True,
>> >
>> > Maybe somebody merged it already? I have  attached my silly example.
>> >
>> > To compile:
>> > mpifort -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc -fdefault-real-8 -o test
>> test.F90 -I$PETSC_DIR/include -I$PETSC_DIR/$PETSC_ARCH/include
>> >
>> > Do you need the petsc code MAtt did?
>> > 
>>
>>
>


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-14 Thread Barry Smith

  Can you clarify what you mean? For some classes of problems, PCFIELDSPLIT can 
be a very efficacious preconditioner; for example when certain fields have very 
different mathematical structure than others. In those cases it is worth using 
AIJ and PCFIELDSPLIT instead of keeping BAIJ.


> On Nov 14, 2022, at 2:21 PM, Edoardo alinovi  
> wrote:
> 
> Hi Barry no worries!
> 
> Thanks for letting me know! It is not a problem for me to use MPIAIJ, do you 
> think field split will be a game changer?
>  
> 
> 
> Il Lun 14 Nov 2022, 20:13 Barry Smith  > ha scritto:
>> 
>>Very sorry for wasting so much of your time. The PCFIELDSPLIT generally 
>> will not work with BAIJ matrices because the MatCreateSubMatrix() for BAIJ 
>> requires indexing by block in the matrix. Your code should work if you use 
>> MPIAIJ matrices.  Note you can still use MatSetValuesBlocked() with MPAIJ 
>> matrices.
>> 
>>   Barry
>> 
>> 
>> > On Nov 10, 2022, at 5:24 PM, Edoardo alinovi > > > wrote:
>> > 
>> > True, 
>> > 
>> > Maybe somebody merged it already? I have  attached my silly example. 
>> > 
>> > To compile:
>> > mpifort -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc -fdefault-real-8 -o test 
>> > test.F90 -I$PETSC_DIR/include -I$PETSC_DIR/$PETSC_ARCH/include
>> > 
>> > Do you need the petsc code MAtt did? 
>> > 
>> 



Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-14 Thread Barry Smith


   Very sorry for wasting so much of your time. The PCFIELDSPLIT generally will 
not work with BAIJ matrices because the MatCreateSubMatrix() for BAIJ requires 
indexing by block in the matrix. Your code should work if you use MPIAIJ 
matrices.  Note you can still use MatSetValuesBlocked() with MPAIJ matrices.

  Barry


> On Nov 10, 2022, at 5:24 PM, Edoardo alinovi  
> wrote:
> 
> True, 
> 
> Maybe somebody merged it already? I have  attached my silly example. 
> 
> To compile:
> mpifort -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc -fdefault-real-8 -o test 
> test.F90 -I$PETSC_DIR/include -I$PETSC_DIR/$PETSC_ARCH/include
> 
> Do you need the petsc code MAtt did? 
> 



Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-11 Thread Edoardo alinovi
Hi guys,

anyone with any suggestion to make this thing work? 梁

Il Ven 11 Nov 2022, 10:24 Edoardo alinovi  ha
scritto:

> Hi Barry,
>
> FYI, in test.F90 I noted that "ui" starts for 1 and not from 0. I fixed it
> but the situation does not change much. I attached the new file in this
> email.
>
> Thanks for the support, I am really walking in the dark!
>
> Il giorno gio 10 nov 2022 alle ore 23:28 Edoardo alinovi <
> edoardo.alin...@gmail.com> ha scritto:
>
>> Ah I see you have already added the missing interfaces for fortran
>> enthusiasts :) So you likely do not need Matt's hack!
>>
>> [image: image.png]
>>
>


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-10 Thread Edoardo alinovi
Ah I see you have already added the missing interfaces for fortran
enthusiasts :) So you likely do not need Matt's hack!

[image: image.png]


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-10 Thread Edoardo alinovi
True,

Maybe somebody merged it already? I have  attached my silly example.

To compile:
mpifort -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc -fdefault-real-8 -o test
test.F90 -I$PETSC_DIR/include -I$PETSC_DIR/$PETSC_ARCH/include

Do you need the petsc code MAtt did?


test.F90
Description: Binary data


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-10 Thread Barry Smith


  Can you share the code that produces the problem below?

> On Nov 10, 2022, at 3:52 PM, Edoardo alinovi  
> wrote:
> 
> The thing is, even I pass the following options: 
> 
> -UPeqn_pc_type fieldsplit -UPeqn_pc_fieldsplit_0_fields 0,1 
> -UPeqn_pc_fieldsplit_1_fields 2 -UPeqn_pc_fieldsplit_type SCHUR 
> -UPeqn_pc_fieldsplit_block_size 3
> 
> I am getting the same issue, so there must be something fundamental in the 
> way I am splitting :/
> 
> 



Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-10 Thread Barry Smith

  Hmm, that branch does not appear to exist.



> On Nov 10, 2022, at 3:48 PM, Edoardo alinovi  
> wrote:
> 
> I am sorry Barry,
> 
> I told you it works, but it is not. I changed to index to integer, but I am 
> still getting this: 
> 
> [0]PETSC ERROR: - Error Message 
> --
> [0]PETSC ERROR: Nonconforming object sizes
> [0]PETSC ERROR: Local column sizes 6 do not add up to total number of columns 
> 9
> 
> I am a bit tired and I was running linux's test instead of my program -.-
> 
> This is the branch Matt did if you whish to try... -> 
> https://gitlab.com/petsc/petsc/-/commits/knepley/fix-fieldsplit-fortran
> 
> Cheers



Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-10 Thread Edoardo alinovi
The thing is, even I pass the following options:

-UPeqn_pc_type fieldsplit -UPeqn_pc_fieldsplit_0_fields 0,1
-UPeqn_pc_fieldsplit_1_fields 2 -UPeqn_pc_fieldsplit_type SCHUR
-UPeqn_pc_fieldsplit_block_size 3

I am getting the same issue, so there must be something fundamental in the
way I am splitting :/


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-10 Thread Edoardo alinovi
I am sorry Barry,

I told you it works, but it is not. I changed to index to integer, but I am
still getting this:

[0]PETSC ERROR: - Error Message
--
[0]PETSC ERROR: Nonconforming object sizes
[0]PETSC ERROR: Local column sizes 6 do not add up to total number of
columns 9

I am a bit tired and I was running linux's test instead of my program -.-

This is the branch Matt did if you whish to try... ->
https://gitlab.com/petsc/petsc/-/commits/knepley/fix-fieldsplit-fortran

Cheers


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-10 Thread Edoardo alinovi
Hi Barry,

Thanks a lot for getting back to me, I am quite stuck at the moment!

Matt kindly added them in a dev branch I am using right now to test this pc.

You are right I am declaring them badly, I am an idiot! My small test works
now, but I'm still in trouble with the main code unfortunately. There the
indices are integers, but I am invoking the field splitting before
assembling the matrix (thus doing MatAssemblyBegin/End). Does the matrix
need to be fully assembled before calling PCFieldSplitSetFields?


Il Gio 10 Nov 2022, 20:14 Barry Smith  ha scritto:

>
>   These beasts should be PetscInt, not real
>
>  real :: ufields(2), pfields(1)
>
>
>Side note. We do not recommend using options like *-fdefault-real-8 
> *because
> the compiler may change values in surprising ways.  You can use PetscReal
> to declare real numbers and this will automatically match with single or
> double precision based on the PETSc configure options.
>
>What version of PETSc are you using? We don't have Fortran stubs for
> the calls to PCFieldSplitSetFields in the latest release. I should add them.
>
>
>
> On Nov 9, 2022, at 12:00 PM, Edoardo alinovi 
> wrote:
>
> Hi Matt,
>
> it took a bit more than 1s, but I can reproduce the error in the
> attached file.
>
> To compile:
> *mpifort -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc -fdefault-real-8 -o test
> test.F90 -I$PETSC_DIR/include -I$PETSC_DIR/$PETSC_ARCH/include*
>
> Please run it in serial as I have hardcoded some dimensions to code this
> up faster.
>
> Thank you!
> 
>
>
>


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-10 Thread Barry Smith

  These beasts should be PetscInt, not real

 real :: ufields(2), pfields(1)


   Side note. We do not recommend using options like -fdefault-real-8 because 
the compiler may change values in surprising ways.  You can use PetscReal to 
declare real numbers and this will automatically match with single or double 
precision based on the PETSc configure options.

   What version of PETSc are you using? We don't have Fortran stubs for the 
calls to PCFieldSplitSetFields in the latest release. I should add them.



> On Nov 9, 2022, at 12:00 PM, Edoardo alinovi  
> wrote:
> 
> Hi Matt,
> 
> it took a bit more than 1s, but I can reproduce the error in the attached 
> file.
> 
> To compile:
> mpifort -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc -fdefault-real-8 -o test 
> test.F90 -I$PETSC_DIR/include -I$PETSC_DIR/$PETSC_ARCH/include
> 
> Please run it in serial as I have hardcoded some dimensions to code this up 
> faster.
> 
> Thank you!
> 



Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-10 Thread Edoardo alinovi
Hello,

I have tried a different way to create the splitting:

ui(1) = 0
ui(2) = 1
pi(1) = 2


call ISCreateGeneral(PETSC_COMM_WORLD, 2, ui, PETSC_COPY_VALUES, isu,
ierr)
call ISCreateGeneral(PETSC_COMM_WORLD, 1, pi, PETSC_COPY_VALUES, isp,
ierr)


call PCFieldSplitSetIS(mypc, "0", isu, ierr)
call PCFieldSplitSetIS(mypc, "1", isp, ierr)

However I get even worst erros!

*[0]PETSC ERROR: - Error Message
--*
*[0]PETSC ERROR: Nonconforming object sizes*
*[0]PETSC ERROR: Local column sizes 0 do not add up to total number of
columns 1*
*[0]PETSC ERROR: See https://petsc.org/release/faq/
 for trouble shooting.*


ISes looks like:

IS Object: 1 MPI process *---> isu*
  type: general
Number of indices in set 2
0 0
1 1
IS Object: 1 MPI process  * ---> isp*
  type: general
Number of indices in set 1
0 2

I really have no idea on how to deal with this thing...  I guess I am not
setting ok the index of the splitting, but cannot really figure out what I
am doing wrong.

Any help is much appreciated :)


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Edoardo alinovi
Hi Matt,

it took a bit more than 1s, but I can reproduce the error in the
attached file.

To compile:
*mpifort -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc -fdefault-real-8 -o test
test.F90 -I$PETSC_DIR/include -I$PETSC_DIR/$PETSC_ARCH/include*

Please run it in serial as I have hardcoded some dimensions to code this up
faster.

Thank you!


test.F90
Description: Binary data


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Edoardo alinovi
The fact it is telling me 6 instead of 9, makes me think it is getting just
the first split for "u" and not the second one for "p" that would lead to 9.


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Matthew Knepley
That would be fine.

  Thanks,

Matt

On Wed, Nov 9, 2022 at 9:19 AM Edoardo alinovi 
wrote:

> I am copying this example:
>  https://petsc.org/release/src/ksp/ksp/tutorials/ex42.c.html
>  lines
> 2040'2042
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Matthew Knepley
On Wed, Nov 9, 2022 at 9:17 AM Edoardo alinovi 
wrote:

> Thanks,
>
> the stuff I am doing is within my code, so I am not sure you can reproduce
> it.
>

How about just making a small code that fills those nonzeros with 1s. We
just want to figure out why your
sparsity pattern is not working. We have lots of working PCFIELDSPLIT
examples, but I don't think it would
be useful to show you those.

  Thanks,

 Matt


> I am just doing this:
>
> call PCSetType(mypc, PCFIELDSPLIT, ierr)
>
> call PCFieldSplitSetBlockSize(mypc, 4-bdim, ierr)
>
> ufields(1) = 0
> ufields(2) = 1
> pfields(1) = 2
> call PCFieldSplitSetFields(mypc, "u", 2, ufields, ufields,
> ierr)
> call PCFieldSplitSetFields(mypc, "p", 1, pfields, pfields,
> ierr)
>
> On an MPIBAIJ matrix with bs = 3.
>
>
>
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Edoardo alinovi
I am copying this example:
 https://petsc.org/release/src/ksp/ksp/tutorials/ex42.c.html
 lines
2040'2042


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Edoardo alinovi
Thanks,

the stuff I am doing is within my code, so I am not sure you can reproduce
it.

I am just doing this:

call PCSetType(mypc, PCFIELDSPLIT, ierr)

call PCFieldSplitSetBlockSize(mypc, 4-bdim, ierr)

ufields(1) = 0
ufields(2) = 1
pfields(1) = 2
call PCFieldSplitSetFields(mypc, "u", 2, ufields, ufields,
ierr)
call PCFieldSplitSetFields(mypc, "p", 1, pfields, pfields,
ierr)

On an MPIBAIJ matrix with bs = 3.


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Matthew Knepley
On Wed, Nov 9, 2022 at 9:05 AM Edoardo alinovi 
wrote:

> So my cavity has 3x3=9 cells, each cells as a 3x3 block. I get the same
> error: [0]PETSC ERROR: Local column sizes 6 do not add up to total number
> of columns 9
>
> However I do not define any IS, I just pass an array
> to PCFieldSplitSetFields() and thus I do not know how to plot them...
>

Okay, just send in the small example and I will figure out why you are
getting this.

  Thanks,

 Matt

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Edoardo alinovi
So my cavity has 3x3=9 cells, each cells as a 3x3 block. I get the same
error: [0]PETSC ERROR: Local column sizes 6 do not add up to total number
of columns 9

However I do not define any IS, I just pass an array
to PCFieldSplitSetFields() and thus I do not know how to plot them...


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Matthew Knepley
On Wed, Nov 9, 2022 at 8:09 AM Edoardo alinovi 
wrote:

> Sure,
>
> I'll try on a 3x3 cavity. How can I print the ISs?
>

ISView() or PetscObjectViewFromOptions()

  Thanks,

 Matt


> Il Mer 9 Nov 2022, 14:07 Matthew Knepley  ha scritto:
>
>> On Wed, Nov 9, 2022 at 7:57 AM Edoardo alinovi 
>> wrote:
>>
>>> To be clear,
>>>
>>> You are suggesting to use ufields(0)=0, ufields(1)=1 and so on?
>>>
>>
>> I think you are right. Those should start from 1. However, your ISes do
>> not seem to cover
>> the whole matrix. Can you start with a very small problem so that you can
>> print them to
>> the screen?
>>
>>   Thanks,
>>
>>  Matt
>>
>>
>>> Il Mer 9 Nov 2022, 13:54 Edoardo alinovi  ha
>>> scritto:
>>>
 Even in the fortran interface?

 Il Mer 9 Nov 2022, 13:52 Matthew Knepley  ha
 scritto:

> Fields are numbered from 0.
>
>   Thanks,
>
>  Matt
>
> On Wed, Nov 9, 2022 at 2:20 AM Edoardo alinovi <
> edoardo.alin...@gmail.com> wrote:
>
>> Hello guys,
>>
>> I am getting this error while using fieldsplit:
>>
>> [3]PETSC ERROR: - Error Message
>> --
>>
>> *[3]PETSC ERROR: Nonconforming object sizes[3]PETSC ERROR: Local
>> column sizes 6132 do not add up to total number of columns 9200*
>> [3]PETSC ERROR: See https://petsc.org/release/faq/ for trouble
>> shooting.
>> [3]PETSC ERROR: Petsc Development GIT revision:
>> v3.18.1-191-g32ed6ae2ff2  GIT Date: 2022-11-08 12:22:17 -0500
>> [3]PETSC ERROR: flubio_coupled on a gnu named alienware by edo Wed
>> Nov  9 08:16:29 2022
>> [3]PETSC ERROR: Configure options PETSC_ARCH=gnu FOPTFLAGS=-O3
>> COPTFLAGS=-O3 CXXOPTFLAGS=-O3 -with-debugging=no -download-fblaslapack=1
>> -download-superlu_dist -download-mumps -download-hypre -download-metis
>> -download-parmetis -download-scalapack -download-ml -download-slepc
>> -download-hpddm -download-cmake
>> -with-mpi-dir=/home/edo/software/openmpi-4.1.1/build/
>> [3]PETSC ERROR: #1 MatCreateSubMatrix_MPIBAIJ_Private() at
>> /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1987
>> [3]PETSC ERROR: #2 MatCreateSubMatrix_MPIBAIJ() at
>> /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1911
>> [3]PETSC ERROR: #3 MatCreateSubMatrix() at
>> /home/edo/software/petsc/src/mat/interface/matrix.c:8340
>> [3]PETSC ERROR: #4 PCSetUp_FieldSplit() at
>> /home/edo/software/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c:657
>> [3]PETSC ERROR: #5 PCSetUp() at
>> /home/edo/software/petsc/src/ksp/pc/interface/precon.c:994
>> [3]PETSC ERROR: #6 KSPSetUp() at
>> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:406
>> [3]PETSC ERROR: #7 KSPSolve_Private() at
>> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:825
>> [3]PETSC ERROR: #8 KSPSolve() at
>> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:1071
>>
>> Do you have any ideas? Probably something missing in my brief
>> implementation here:
>>
>>
>>
>>
>> *call PCSetType(mypc, PCFIELDSPLIT, ierr)
>> call PCFieldSplitSetBlockSize(mypc, 4-bdim, ierr)   *
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *!2D, 3x3 blockif(bdim==1) then
>>   ufields(1) = 0ufields(2) = 1pfields(1) 
>> =
>> 2call PCFieldSplitSetFields(mypc, "u", 2, ufields, 
>> ufields,
>> ierr)call PCFieldSplitSetFields(mypc, "p", 1, pfields,
>> pfields, ierr) ! 3D 4x4 blockelse
>> ufields(1) = 0ufields(2) = 1ufields(3) = 
>> 2
>>   pfields(1) = 3call
>> PCFieldSplitSetFields(mypc, "u", 3, ufields, ufields, ierr)
>> call PCFieldSplitSetFields(mypc, "p", 1, pfields, pfields, ierr)
>> endif ! Field split type ADDITIVE, MULTIPLICATIVE
>> (default), SYMMETRIC_MULTIPLICATIVE, SPECIAL, SCHURcall
>> PCFieldSplitSetType(mypc, PC_COMPOSITE_SCHUR, ierr)*
>>
>> Thanks for the help!
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> 
>

>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/
>> 
>>
>

-- 

Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Edoardo alinovi
Sure,

I'll try on a 3x3 cavity. How can I print the ISs?

Il Mer 9 Nov 2022, 14:07 Matthew Knepley  ha scritto:

> On Wed, Nov 9, 2022 at 7:57 AM Edoardo alinovi 
> wrote:
>
>> To be clear,
>>
>> You are suggesting to use ufields(0)=0, ufields(1)=1 and so on?
>>
>
> I think you are right. Those should start from 1. However, your ISes do
> not seem to cover
> the whole matrix. Can you start with a very small problem so that you can
> print them to
> the screen?
>
>   Thanks,
>
>  Matt
>
>
>> Il Mer 9 Nov 2022, 13:54 Edoardo alinovi  ha
>> scritto:
>>
>>> Even in the fortran interface?
>>>
>>> Il Mer 9 Nov 2022, 13:52 Matthew Knepley  ha scritto:
>>>
 Fields are numbered from 0.

   Thanks,

  Matt

 On Wed, Nov 9, 2022 at 2:20 AM Edoardo alinovi <
 edoardo.alin...@gmail.com> wrote:

> Hello guys,
>
> I am getting this error while using fieldsplit:
>
> [3]PETSC ERROR: - Error Message
> --
>
> *[3]PETSC ERROR: Nonconforming object sizes[3]PETSC ERROR: Local
> column sizes 6132 do not add up to total number of columns 9200*
> [3]PETSC ERROR: See https://petsc.org/release/faq/ for trouble
> shooting.
> [3]PETSC ERROR: Petsc Development GIT revision:
> v3.18.1-191-g32ed6ae2ff2  GIT Date: 2022-11-08 12:22:17 -0500
> [3]PETSC ERROR: flubio_coupled on a gnu named alienware by edo Wed Nov
>  9 08:16:29 2022
> [3]PETSC ERROR: Configure options PETSC_ARCH=gnu FOPTFLAGS=-O3
> COPTFLAGS=-O3 CXXOPTFLAGS=-O3 -with-debugging=no -download-fblaslapack=1
> -download-superlu_dist -download-mumps -download-hypre -download-metis
> -download-parmetis -download-scalapack -download-ml -download-slepc
> -download-hpddm -download-cmake
> -with-mpi-dir=/home/edo/software/openmpi-4.1.1/build/
> [3]PETSC ERROR: #1 MatCreateSubMatrix_MPIBAIJ_Private() at
> /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1987
> [3]PETSC ERROR: #2 MatCreateSubMatrix_MPIBAIJ() at
> /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1911
> [3]PETSC ERROR: #3 MatCreateSubMatrix() at
> /home/edo/software/petsc/src/mat/interface/matrix.c:8340
> [3]PETSC ERROR: #4 PCSetUp_FieldSplit() at
> /home/edo/software/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c:657
> [3]PETSC ERROR: #5 PCSetUp() at
> /home/edo/software/petsc/src/ksp/pc/interface/precon.c:994
> [3]PETSC ERROR: #6 KSPSetUp() at
> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:406
> [3]PETSC ERROR: #7 KSPSolve_Private() at
> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:825
> [3]PETSC ERROR: #8 KSPSolve() at
> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:1071
>
> Do you have any ideas? Probably something missing in my brief
> implementation here:
>
>
>
>
> *call PCSetType(mypc, PCFIELDSPLIT, ierr)
> call PCFieldSplitSetBlockSize(mypc, 4-bdim, ierr)   *
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *!2D, 3x3 blockif(bdim==1) then
>   ufields(1) = 0ufields(2) = 1pfields(1) =
> 2call PCFieldSplitSetFields(mypc, "u", 2, ufields, 
> ufields,
> ierr)call PCFieldSplitSetFields(mypc, "p", 1, pfields,
> pfields, ierr) ! 3D 4x4 blockelse
> ufields(1) = 0ufields(2) = 1ufields(3) = 2
>   pfields(1) = 3call
> PCFieldSplitSetFields(mypc, "u", 3, ufields, ufields, ierr)
> call PCFieldSplitSetFields(mypc, "p", 1, pfields, pfields, ierr)
> endif ! Field split type ADDITIVE, MULTIPLICATIVE
> (default), SYMMETRIC_MULTIPLICATIVE, SPECIAL, SCHURcall
> PCFieldSplitSetType(mypc, PC_COMPOSITE_SCHUR, ierr)*
>
> Thanks for the help!
>


 --
 What most experimenters take for granted before they begin their
 experiments is infinitely more interesting than any results to which their
 experiments lead.
 -- Norbert Wiener

 https://www.cse.buffalo.edu/~knepley/
 

>>>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> 
>


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Matthew Knepley
On Wed, Nov 9, 2022 at 7:57 AM Edoardo alinovi 
wrote:

> To be clear,
>
> You are suggesting to use ufields(0)=0, ufields(1)=1 and so on?
>

I think you are right. Those should start from 1. However, your ISes do not
seem to cover
the whole matrix. Can you start with a very small problem so that you can
print them to
the screen?

  Thanks,

 Matt


> Il Mer 9 Nov 2022, 13:54 Edoardo alinovi  ha
> scritto:
>
>> Even in the fortran interface?
>>
>> Il Mer 9 Nov 2022, 13:52 Matthew Knepley  ha scritto:
>>
>>> Fields are numbered from 0.
>>>
>>>   Thanks,
>>>
>>>  Matt
>>>
>>> On Wed, Nov 9, 2022 at 2:20 AM Edoardo alinovi <
>>> edoardo.alin...@gmail.com> wrote:
>>>
 Hello guys,

 I am getting this error while using fieldsplit:

 [3]PETSC ERROR: - Error Message
 --

 *[3]PETSC ERROR: Nonconforming object sizes[3]PETSC ERROR: Local column
 sizes 6132 do not add up to total number of columns 9200*
 [3]PETSC ERROR: See https://petsc.org/release/faq/ for trouble
 shooting.
 [3]PETSC ERROR: Petsc Development GIT revision:
 v3.18.1-191-g32ed6ae2ff2  GIT Date: 2022-11-08 12:22:17 -0500
 [3]PETSC ERROR: flubio_coupled on a gnu named alienware by edo Wed Nov
  9 08:16:29 2022
 [3]PETSC ERROR: Configure options PETSC_ARCH=gnu FOPTFLAGS=-O3
 COPTFLAGS=-O3 CXXOPTFLAGS=-O3 -with-debugging=no -download-fblaslapack=1
 -download-superlu_dist -download-mumps -download-hypre -download-metis
 -download-parmetis -download-scalapack -download-ml -download-slepc
 -download-hpddm -download-cmake
 -with-mpi-dir=/home/edo/software/openmpi-4.1.1/build/
 [3]PETSC ERROR: #1 MatCreateSubMatrix_MPIBAIJ_Private() at
 /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1987
 [3]PETSC ERROR: #2 MatCreateSubMatrix_MPIBAIJ() at
 /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1911
 [3]PETSC ERROR: #3 MatCreateSubMatrix() at
 /home/edo/software/petsc/src/mat/interface/matrix.c:8340
 [3]PETSC ERROR: #4 PCSetUp_FieldSplit() at
 /home/edo/software/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c:657
 [3]PETSC ERROR: #5 PCSetUp() at
 /home/edo/software/petsc/src/ksp/pc/interface/precon.c:994
 [3]PETSC ERROR: #6 KSPSetUp() at
 /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:406
 [3]PETSC ERROR: #7 KSPSolve_Private() at
 /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:825
 [3]PETSC ERROR: #8 KSPSolve() at
 /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:1071

 Do you have any ideas? Probably something missing in my brief
 implementation here:




 *call PCSetType(mypc, PCFIELDSPLIT, ierr)  call
 PCFieldSplitSetBlockSize(mypc, 4-bdim, ierr)   *






















 *!2D, 3x3 blockif(bdim==1) then
 ufields(1) = 0ufields(2) = 1pfields(1) = 2
   call PCFieldSplitSetFields(mypc, "u", 2, ufields, ufields,
 ierr)call PCFieldSplitSetFields(mypc, "p", 1, pfields,
 pfields, ierr) ! 3D 4x4 blockelse
 ufields(1) = 0ufields(2) = 1ufields(3) = 2
   pfields(1) = 3call
 PCFieldSplitSetFields(mypc, "u", 3, ufields, ufields, ierr)
 call PCFieldSplitSetFields(mypc, "p", 1, pfields, pfields, ierr)
 endif ! Field split type ADDITIVE, MULTIPLICATIVE
 (default), SYMMETRIC_MULTIPLICATIVE, SPECIAL, SCHURcall
 PCFieldSplitSetType(mypc, PC_COMPOSITE_SCHUR, ierr)*

 Thanks for the help!

>>>
>>>
>>> --
>>> What most experimenters take for granted before they begin their
>>> experiments is infinitely more interesting than any results to which their
>>> experiments lead.
>>> -- Norbert Wiener
>>>
>>> https://www.cse.buffalo.edu/~knepley/
>>> 
>>>
>>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Edoardo alinovi
To be clear,

You are suggesting to use ufields(0)=0, ufields(1)=1 and so on?

Il Mer 9 Nov 2022, 13:54 Edoardo alinovi  ha
scritto:

> Even in the fortran interface?
>
> Il Mer 9 Nov 2022, 13:52 Matthew Knepley  ha scritto:
>
>> Fields are numbered from 0.
>>
>>   Thanks,
>>
>>  Matt
>>
>> On Wed, Nov 9, 2022 at 2:20 AM Edoardo alinovi 
>> wrote:
>>
>>> Hello guys,
>>>
>>> I am getting this error while using fieldsplit:
>>>
>>> [3]PETSC ERROR: - Error Message
>>> --
>>>
>>> *[3]PETSC ERROR: Nonconforming object sizes[3]PETSC ERROR: Local column
>>> sizes 6132 do not add up to total number of columns 9200*
>>> [3]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
>>> [3]PETSC ERROR: Petsc Development GIT revision: v3.18.1-191-g32ed6ae2ff2
>>>  GIT Date: 2022-11-08 12:22:17 -0500
>>> [3]PETSC ERROR: flubio_coupled on a gnu named alienware by edo Wed Nov
>>>  9 08:16:29 2022
>>> [3]PETSC ERROR: Configure options PETSC_ARCH=gnu FOPTFLAGS=-O3
>>> COPTFLAGS=-O3 CXXOPTFLAGS=-O3 -with-debugging=no -download-fblaslapack=1
>>> -download-superlu_dist -download-mumps -download-hypre -download-metis
>>> -download-parmetis -download-scalapack -download-ml -download-slepc
>>> -download-hpddm -download-cmake
>>> -with-mpi-dir=/home/edo/software/openmpi-4.1.1/build/
>>> [3]PETSC ERROR: #1 MatCreateSubMatrix_MPIBAIJ_Private() at
>>> /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1987
>>> [3]PETSC ERROR: #2 MatCreateSubMatrix_MPIBAIJ() at
>>> /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1911
>>> [3]PETSC ERROR: #3 MatCreateSubMatrix() at
>>> /home/edo/software/petsc/src/mat/interface/matrix.c:8340
>>> [3]PETSC ERROR: #4 PCSetUp_FieldSplit() at
>>> /home/edo/software/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c:657
>>> [3]PETSC ERROR: #5 PCSetUp() at
>>> /home/edo/software/petsc/src/ksp/pc/interface/precon.c:994
>>> [3]PETSC ERROR: #6 KSPSetUp() at
>>> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:406
>>> [3]PETSC ERROR: #7 KSPSolve_Private() at
>>> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:825
>>> [3]PETSC ERROR: #8 KSPSolve() at
>>> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:1071
>>>
>>> Do you have any ideas? Probably something missing in my brief
>>> implementation here:
>>>
>>>
>>>
>>>
>>> *call PCSetType(mypc, PCFIELDSPLIT, ierr)  call
>>> PCFieldSplitSetBlockSize(mypc, 4-bdim, ierr)   *
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *!2D, 3x3 blockif(bdim==1) then
>>> ufields(1) = 0ufields(2) = 1pfields(1) = 2
>>>   call PCFieldSplitSetFields(mypc, "u", 2, ufields, ufields,
>>> ierr)call PCFieldSplitSetFields(mypc, "p", 1, pfields,
>>> pfields, ierr) ! 3D 4x4 blockelse
>>> ufields(1) = 0ufields(2) = 1ufields(3) = 2
>>>   pfields(1) = 3call
>>> PCFieldSplitSetFields(mypc, "u", 3, ufields, ufields, ierr)
>>> call PCFieldSplitSetFields(mypc, "p", 1, pfields, pfields, ierr)
>>> endif ! Field split type ADDITIVE, MULTIPLICATIVE
>>> (default), SYMMETRIC_MULTIPLICATIVE, SPECIAL, SCHURcall
>>> PCFieldSplitSetType(mypc, PC_COMPOSITE_SCHUR, ierr)*
>>>
>>> Thanks for the help!
>>>
>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/
>> 
>>
>


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Edoardo alinovi
Even in the fortran interface?

Il Mer 9 Nov 2022, 13:52 Matthew Knepley  ha scritto:

> Fields are numbered from 0.
>
>   Thanks,
>
>  Matt
>
> On Wed, Nov 9, 2022 at 2:20 AM Edoardo alinovi 
> wrote:
>
>> Hello guys,
>>
>> I am getting this error while using fieldsplit:
>>
>> [3]PETSC ERROR: - Error Message
>> --
>>
>> *[3]PETSC ERROR: Nonconforming object sizes[3]PETSC ERROR: Local column
>> sizes 6132 do not add up to total number of columns 9200*
>> [3]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
>> [3]PETSC ERROR: Petsc Development GIT revision: v3.18.1-191-g32ed6ae2ff2
>>  GIT Date: 2022-11-08 12:22:17 -0500
>> [3]PETSC ERROR: flubio_coupled on a gnu named alienware by edo Wed Nov  9
>> 08:16:29 2022
>> [3]PETSC ERROR: Configure options PETSC_ARCH=gnu FOPTFLAGS=-O3
>> COPTFLAGS=-O3 CXXOPTFLAGS=-O3 -with-debugging=no -download-fblaslapack=1
>> -download-superlu_dist -download-mumps -download-hypre -download-metis
>> -download-parmetis -download-scalapack -download-ml -download-slepc
>> -download-hpddm -download-cmake
>> -with-mpi-dir=/home/edo/software/openmpi-4.1.1/build/
>> [3]PETSC ERROR: #1 MatCreateSubMatrix_MPIBAIJ_Private() at
>> /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1987
>> [3]PETSC ERROR: #2 MatCreateSubMatrix_MPIBAIJ() at
>> /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1911
>> [3]PETSC ERROR: #3 MatCreateSubMatrix() at
>> /home/edo/software/petsc/src/mat/interface/matrix.c:8340
>> [3]PETSC ERROR: #4 PCSetUp_FieldSplit() at
>> /home/edo/software/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c:657
>> [3]PETSC ERROR: #5 PCSetUp() at
>> /home/edo/software/petsc/src/ksp/pc/interface/precon.c:994
>> [3]PETSC ERROR: #6 KSPSetUp() at
>> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:406
>> [3]PETSC ERROR: #7 KSPSolve_Private() at
>> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:825
>> [3]PETSC ERROR: #8 KSPSolve() at
>> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:1071
>>
>> Do you have any ideas? Probably something missing in my brief
>> implementation here:
>>
>>
>>
>>
>> *call PCSetType(mypc, PCFIELDSPLIT, ierr)  call
>> PCFieldSplitSetBlockSize(mypc, 4-bdim, ierr)   *
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *!2D, 3x3 blockif(bdim==1) then
>> ufields(1) = 0ufields(2) = 1pfields(1) = 2
>>   call PCFieldSplitSetFields(mypc, "u", 2, ufields, ufields,
>> ierr)call PCFieldSplitSetFields(mypc, "p", 1, pfields,
>> pfields, ierr) ! 3D 4x4 blockelse
>> ufields(1) = 0ufields(2) = 1ufields(3) = 2
>>   pfields(1) = 3call
>> PCFieldSplitSetFields(mypc, "u", 3, ufields, ufields, ierr)
>> call PCFieldSplitSetFields(mypc, "p", 1, pfields, pfields, ierr)
>> endif ! Field split type ADDITIVE, MULTIPLICATIVE
>> (default), SYMMETRIC_MULTIPLICATIVE, SPECIAL, SCHURcall
>> PCFieldSplitSetType(mypc, PC_COMPOSITE_SCHUR, ierr)*
>>
>> Thanks for the help!
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> 
>


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-09 Thread Matthew Knepley
Fields are numbered from 0.

  Thanks,

 Matt

On Wed, Nov 9, 2022 at 2:20 AM Edoardo alinovi 
wrote:

> Hello guys,
>
> I am getting this error while using fieldsplit:
>
> [3]PETSC ERROR: - Error Message
> --
>
> *[3]PETSC ERROR: Nonconforming object sizes[3]PETSC ERROR: Local column
> sizes 6132 do not add up to total number of columns 9200*
> [3]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
> [3]PETSC ERROR: Petsc Development GIT revision: v3.18.1-191-g32ed6ae2ff2
>  GIT Date: 2022-11-08 12:22:17 -0500
> [3]PETSC ERROR: flubio_coupled on a gnu named alienware by edo Wed Nov  9
> 08:16:29 2022
> [3]PETSC ERROR: Configure options PETSC_ARCH=gnu FOPTFLAGS=-O3
> COPTFLAGS=-O3 CXXOPTFLAGS=-O3 -with-debugging=no -download-fblaslapack=1
> -download-superlu_dist -download-mumps -download-hypre -download-metis
> -download-parmetis -download-scalapack -download-ml -download-slepc
> -download-hpddm -download-cmake
> -with-mpi-dir=/home/edo/software/openmpi-4.1.1/build/
> [3]PETSC ERROR: #1 MatCreateSubMatrix_MPIBAIJ_Private() at
> /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1987
> [3]PETSC ERROR: #2 MatCreateSubMatrix_MPIBAIJ() at
> /home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1911
> [3]PETSC ERROR: #3 MatCreateSubMatrix() at
> /home/edo/software/petsc/src/mat/interface/matrix.c:8340
> [3]PETSC ERROR: #4 PCSetUp_FieldSplit() at
> /home/edo/software/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c:657
> [3]PETSC ERROR: #5 PCSetUp() at
> /home/edo/software/petsc/src/ksp/pc/interface/precon.c:994
> [3]PETSC ERROR: #6 KSPSetUp() at
> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:406
> [3]PETSC ERROR: #7 KSPSolve_Private() at
> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:825
> [3]PETSC ERROR: #8 KSPSolve() at
> /home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:1071
>
> Do you have any ideas? Probably something missing in my brief
> implementation here:
>
>
>
>
> *call PCSetType(mypc, PCFIELDSPLIT, ierr)  call
> PCFieldSplitSetBlockSize(mypc, 4-bdim, ierr)   *
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *!2D, 3x3 blockif(bdim==1) then
> ufields(1) = 0ufields(2) = 1pfields(1) = 2
>   call PCFieldSplitSetFields(mypc, "u", 2, ufields, ufields,
> ierr)call PCFieldSplitSetFields(mypc, "p", 1, pfields,
> pfields, ierr) ! 3D 4x4 blockelse
> ufields(1) = 0ufields(2) = 1ufields(3) = 2
>   pfields(1) = 3call
> PCFieldSplitSetFields(mypc, "u", 3, ufields, ufields, ierr)
> call PCFieldSplitSetFields(mypc, "p", 1, pfields, pfields, ierr)
> endif ! Field split type ADDITIVE, MULTIPLICATIVE
> (default), SYMMETRIC_MULTIPLICATIVE, SPECIAL, SCHURcall
> PCFieldSplitSetType(mypc, PC_COMPOSITE_SCHUR, ierr)*
>
> Thanks for the help!
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-08 Thread Edoardo alinovi
Hello guys,

I am getting this error while using fieldsplit:

[3]PETSC ERROR: - Error Message
--

*[3]PETSC ERROR: Nonconforming object sizes[3]PETSC ERROR: Local column
sizes 6132 do not add up to total number of columns 9200*
[3]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
[3]PETSC ERROR: Petsc Development GIT revision: v3.18.1-191-g32ed6ae2ff2
 GIT Date: 2022-11-08 12:22:17 -0500
[3]PETSC ERROR: flubio_coupled on a gnu named alienware by edo Wed Nov  9
08:16:29 2022
[3]PETSC ERROR: Configure options PETSC_ARCH=gnu FOPTFLAGS=-O3
COPTFLAGS=-O3 CXXOPTFLAGS=-O3 -with-debugging=no -download-fblaslapack=1
-download-superlu_dist -download-mumps -download-hypre -download-metis
-download-parmetis -download-scalapack -download-ml -download-slepc
-download-hpddm -download-cmake
-with-mpi-dir=/home/edo/software/openmpi-4.1.1/build/
[3]PETSC ERROR: #1 MatCreateSubMatrix_MPIBAIJ_Private() at
/home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1987
[3]PETSC ERROR: #2 MatCreateSubMatrix_MPIBAIJ() at
/home/edo/software/petsc/src/mat/impls/baij/mpi/mpibaij.c:1911
[3]PETSC ERROR: #3 MatCreateSubMatrix() at
/home/edo/software/petsc/src/mat/interface/matrix.c:8340
[3]PETSC ERROR: #4 PCSetUp_FieldSplit() at
/home/edo/software/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c:657
[3]PETSC ERROR: #5 PCSetUp() at
/home/edo/software/petsc/src/ksp/pc/interface/precon.c:994
[3]PETSC ERROR: #6 KSPSetUp() at
/home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:406
[3]PETSC ERROR: #7 KSPSolve_Private() at
/home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:825
[3]PETSC ERROR: #8 KSPSolve() at
/home/edo/software/petsc/src/ksp/ksp/interface/itfunc.c:1071

Do you have any ideas? Probably something missing in my brief
implementation here:




*call PCSetType(mypc, PCFIELDSPLIT, ierr)  call
PCFieldSplitSetBlockSize(mypc, 4-bdim, ierr)   *






















*!2D, 3x3 blockif(bdim==1) then
ufields(1) = 0ufields(2) = 1pfields(1) = 2
  call PCFieldSplitSetFields(mypc, "u", 2, ufields, ufields,
ierr)call PCFieldSplitSetFields(mypc, "p", 1, pfields,
pfields, ierr) ! 3D 4x4 blockelse
ufields(1) = 0ufields(2) = 1ufields(3) = 2
  pfields(1) = 3call
PCFieldSplitSetFields(mypc, "u", 3, ufields, ufields, ierr)
call PCFieldSplitSetFields(mypc, "p", 1, pfields, pfields, ierr)
endif ! Field split type ADDITIVE, MULTIPLICATIVE
(default), SYMMETRIC_MULTIPLICATIVE, SPECIAL, SCHURcall
PCFieldSplitSetType(mypc, PC_COMPOSITE_SCHUR, ierr)*

Thanks for the help!


Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-08 Thread Matthew Knepley
On Tue, Nov 8, 2022 at 12:05 PM Edoardo alinovi 
wrote:

> Hello Guys,
>
> Thanks to your suggestions on the block matrices, my fully coupled solver
> is proceeding very well!
>
> I am now about to take advantage of the block structure of the matrix
> using PCFIELDSPLIT. I have learned a bit from the user manual and followed
> with interest this discussion in the mailing list:
> https://lists.mcs.anl.gov/pipermail/petsc-users/2015-February/024154.html
> which is actually the exact same situation I am in, so I guess most of the
> command line options will be copy and paste.
>
> I would like however to code them in fortran, as I usually provide some
> default implementation alongside the command line options.
>
> While coding some of the options I got an error here
> in PCFieldSplitSetFields() which looks to be undefined. I am importing
> petscksp, do I need to import something else maybe?
>

Since it uses arrays, we will have to write the Fortran wrapper by hand. I
will see if I can do it soon.

  Thanks,

Matt


> Thank you!
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ 


[petsc-users] On PCFIELDSPLIT and its implementation

2022-11-08 Thread Edoardo alinovi
Hello Guys,

Thanks to your suggestions on the block matrices, my fully coupled solver
is proceeding very well!

I am now about to take advantage of the block structure of the matrix
using PCFIELDSPLIT. I have learned a bit from the user manual and followed
with interest this discussion in the mailing list:
https://lists.mcs.anl.gov/pipermail/petsc-users/2015-February/024154.html
which is actually the exact same situation I am in, so I guess most of the
command line options will be copy and paste.

I would like however to code them in fortran, as I usually provide some
default implementation alongside the command line options.

While coding some of the options I got an error here
in PCFieldSplitSetFields() which looks to be undefined. I am importing
petscksp, do I need to import something else maybe?

Thank you!