Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-08-03 Thread Matthew Knepley
On Fri, Aug 3, 2018 at 9:42 AM Pierpaolo Minelli 
wrote:

> I tried to use these options with GAMG:
>
> -mg_levels_ksp_type richardson
>
> -mg_levels_pc_type sor
>
>
> but also in this case i don’t obtain a convergence.
>

Can you send the convergence and solver view so we can check?

Also, if you send the matrix we can try running it.


> I used also direct solvers (MUMPS ad SuperLU) and they works fine, but
> slower (solve time) then iterative method with ML and hypre.
>
> If i check with -ksp_monitor_true_residual, is it advisable to continue
> using the iterative method?
>

Yes.

   Matt


> Pierpaolo
>
>
> Il giorno 03 ago 2018, alle ore 15:16, Mark Adams  ha
> scritto:
>
> So this is a complex valued indefinite Helmholtz operator (very hard to
> solve scalably) with axisymmetric coordinates. ML, hypre and GAMG all
> performed about the same, with a big jump in residual initially and
> essentially not solving it. You scaled it and this fixed ML and hypre but
> not GAMG.
>
> From this output I can see that the eigenvalue estimates are strange. Your
> equations look fine so I have to assume that the complex values are the
> problem. If this is symmetric the CG is a much better solver and eigen
> estimator. But this is not a big deal, especially since you have two
> options that work. I would suggest not using cheby smoother, it uses these
> bad eigen estimates, and it is basically not smoothing on some levels. You
> can use this instead:
>
> -mg_levels_ksp_type richardson
> -mg_levels_pc_type sor
>
> Note, if you have a large shift these equations are very hard to solve
> iteratively and you should just use a direct solver. Direct solvers in 2D
> are not bad,
>
> Mark
>
>
> On Fri, Aug 3, 2018 at 3:02 AM Pierpaolo Minelli 
> wrote:
>
>> In this simulation I'm solving two equations in a two-dimensional domain
>> (z,r) at each time step. The first is an equation derived from the Maxwell
>> equation. Taking advantage of the fact that the domain is axialsymmetric
>> and applying a temporal harmonic approximation, the equation I am solving
>> is the following:
>>
>>
>> The second equation is a Poisson’s  equation in cylindrical coordinates
>> (z,r) in the field of real numbers.
>>
>> This is the output obtained using these options (Note that at this moment
>> of development I am only using a processor):
>>
>> *-pc_type gamg -pc_gamg_agg_nsmooths 1 -pc_gamg_reuse_interpolation true
>> -pc_gamg_square_graph 1 -pc_gamg_threshold 0. -ksp_rtol 1.e-7
>> -ksp_max_it 30 -ksp_monitor_true_residual -info | grep GAMG*
>>
>> [0] PCSetUp_GAMG(): level 0) N=321201, n data rows=1, n data cols=1,
>> nnz/row (ave)=5, np=1
>> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0.,
>> 4.97011 nnz ave. (N=321201)
>> [0] PCGAMGCoarsen_AGG(): Square Graph on level 1 of 1 to square
>> [0] PCGAMGProlongator_AGG(): New grid 45754 nodes
>> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=1.972526e+00
>> min=3.461411e-03 PC=jacobi
>> [0] PCSetUp_GAMG(): 1) N=45754, n data cols=1, nnz/row (ave)=10, 1 active
>> pes
>> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0.,
>> 10.7695 nnz ave. (N=45754)
>> [0] PCGAMGProlongator_AGG(): New grid 7893 nodes
>> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=5.686837e+00
>> min=5.062501e-01 PC=jacobi
>> [0] PCSetUp_GAMG(): 2) N=7893, n data cols=1, nnz/row (ave)=23, 1 active
>> pes
>> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0.,
>> 23.2179 nnz ave. (N=7893)
>> [0] PCGAMGProlongator_AGG(): New grid 752 nodes
>> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=1.504451e+01
>> min=2.124898e-02 PC=jacobi
>> [0] PCSetUp_GAMG(): 3) N=752, n data cols=1, nnz/row (ave)=30, 1 active
>> pes
>> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0.,
>> 30.7367 nnz ave. (N=752)
>> [0] PCGAMGProlongator_AGG(): New grid 56 nodes
>> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=7.781296e+00
>> min=2.212257e-02 PC=jacobi
>> [0] PCSetUp_GAMG(): 4) N=56, n data cols=1, nnz/row (ave)=22, 1 active pes
>> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0.,
>> 22.9643 nnz ave. (N=56)
>> [0] PCGAMGProlongator_AGG(): New grid 6 nodes
>> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=1.525086e+00
>> min=1.375043e-01 PC=jacobi
>> [0] PCSetUp_GAMG(): 5) N=6, n data cols=1, nnz/row (ave)=6, 1 active pes
>> [0] PCSetUp_GAMG(): 6 levels, grid complexity = 1.43876
>> [0] PCSetUp_GAMG(): level 0) N=321201, n data rows=1, n data cols=1,
>> nnz/row (ave)=5, np=1
>> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0.,
>> 4.97011 nnz ave. (N=321201)
>> [0] PCGAMGCoarsen_AGG(): Square Graph on level 1 of 1 to square
>> [0] PCGAMGProlongator_AGG(): New grid 45754 nodes
>> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=1.972526e+00
>> min=3.461411e-03 PC=jacobi
>> [0] PCSetUp_GAMG(): 1) N=45754, n data cols=1, nnz/row (ave)=10, 1 active
>> pes
>> [0] PCGAMGFilterGraph():   100.% 

Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-08-03 Thread Jed Brown
Mark Adams  writes:

> From this output I can see that the eigenvalue estimates are strange. Your
> equations look fine so I have to assume that the complex values are the
> problem. If this is symmetric the CG is a much better solver and eigen
> estimator. 

CG needs Hermitian positive definite.


Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-08-03 Thread Pierpaolo Minelli
I tried to use these options with GAMG:

> -mg_levels_ksp_type richardson
> -mg_levels_pc_type sor

but also in this case i don’t obtain a convergence.

I used also direct solvers (MUMPS ad SuperLU) and they works fine, but slower 
(solve time) then iterative method with ML and hypre.

If i check with -ksp_monitor_true_residual, is it advisable to continue using 
the iterative method?

Pierpaolo


> Il giorno 03 ago 2018, alle ore 15:16, Mark Adams  ha 
> scritto:
> 
> So this is a complex valued indefinite Helmholtz operator (very hard to solve 
> scalably) with axisymmetric coordinates. ML, hypre and GAMG all performed 
> about the same, with a big jump in residual initially and essentially not 
> solving it. You scaled it and this fixed ML and hypre but not GAMG.
> 
> From this output I can see that the eigenvalue estimates are strange. Your 
> equations look fine so I have to assume that the complex values are the 
> problem. If this is symmetric the CG is a much better solver and eigen 
> estimator. But this is not a big deal, especially since you have two options 
> that work. I would suggest not using cheby smoother, it uses these bad eigen 
> estimates, and it is basically not smoothing on some levels. You can use this 
> instead:
> 
> -mg_levels_ksp_type richardson
> -mg_levels_pc_type sor
> 
> Note, if you have a large shift these equations are very hard to solve 
> iteratively and you should just use a direct solver. Direct solvers in 2D are 
> not bad,
> 
> Mark
> 
> 
> On Fri, Aug 3, 2018 at 3:02 AM Pierpaolo Minelli  > wrote:
> In this simulation I'm solving two equations in a two-dimensional domain 
> (z,r) at each time step. The first is an equation derived from the Maxwell 
> equation. Taking advantage of the fact that the domain is axialsymmetric and 
> applying a temporal harmonic approximation, the equation I am solving is the 
> following:
> 
> 
> 
> 
> The second equation is a Poisson’s  equation in cylindrical coordinates (z,r) 
> in the field of real numbers.
> 
> This is the output obtained using these options (Note that at this moment of 
> development I am only using a processor):
> 
> -pc_type gamg -pc_gamg_agg_nsmooths 1 -pc_gamg_reuse_interpolation true 
> -pc_gamg_square_graph 1 -pc_gamg_threshold 0. -ksp_rtol 1.e-7 -ksp_max_it 30 
> -ksp_monitor_true_residual -info | grep GAMG
> 
> [0] PCSetUp_GAMG(): level 0) N=321201, n data rows=1, n data cols=1, nnz/row 
> (ave)=5, np=1
> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0., 
> 4.97011 nnz ave. (N=321201)
> [0] PCGAMGCoarsen_AGG(): Square Graph on level 1 of 1 to square
> [0] PCGAMGProlongator_AGG(): New grid 45754 nodes
> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=1.972526e+00 
> min=3.461411e-03 PC=jacobi
> [0] PCSetUp_GAMG(): 1) N=45754, n data cols=1, nnz/row (ave)=10, 1 active pes
> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0., 
> 10.7695 nnz ave. (N=45754)
> [0] PCGAMGProlongator_AGG(): New grid 7893 nodes
> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=5.686837e+00 
> min=5.062501e-01 PC=jacobi
> [0] PCSetUp_GAMG(): 2) N=7893, n data cols=1, nnz/row (ave)=23, 1 active pes
> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0., 
> 23.2179 nnz ave. (N=7893)
> [0] PCGAMGProlongator_AGG(): New grid 752 nodes
> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=1.504451e+01 
> min=2.124898e-02 PC=jacobi
> [0] PCSetUp_GAMG(): 3) N=752, n data cols=1, nnz/row (ave)=30, 1 active pes
> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0., 
> 30.7367 nnz ave. (N=752)
> [0] PCGAMGProlongator_AGG(): New grid 56 nodes
> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=7.781296e+00 
> min=2.212257e-02 PC=jacobi
> [0] PCSetUp_GAMG(): 4) N=56, n data cols=1, nnz/row (ave)=22, 1 active pes
> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0., 
> 22.9643 nnz ave. (N=56)
> [0] PCGAMGProlongator_AGG(): New grid 6 nodes
> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=1.525086e+00 
> min=1.375043e-01 PC=jacobi
> [0] PCSetUp_GAMG(): 5) N=6, n data cols=1, nnz/row (ave)=6, 1 active pes
> [0] PCSetUp_GAMG(): 6 levels, grid complexity = 1.43876
> [0] PCSetUp_GAMG(): level 0) N=321201, n data rows=1, n data cols=1, nnz/row 
> (ave)=5, np=1
> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0., 
> 4.97011 nnz ave. (N=321201)
> [0] PCGAMGCoarsen_AGG(): Square Graph on level 1 of 1 to square
> [0] PCGAMGProlongator_AGG(): New grid 45754 nodes
> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max eigen=1.972526e+00 
> min=3.461411e-03 PC=jacobi
> [0] PCSetUp_GAMG(): 1) N=45754, n data cols=1, nnz/row (ave)=10, 1 active pes
> [0] PCGAMGFilterGraph():   100.% nnz after filtering, with threshold 0., 
> 10.7695 nnz ave. (N=45754)
> [0] PCGAMGProlongator_AGG(): New grid 7893 nodes
> [0] PCGAMGOptProlongator_AGG(): Smooth P0: max 

Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-08-02 Thread Mark Adams
It looks like ML and hypre are working well now. If you want to debug GAMG
you can run with -info, which is very noisy, and grep on GAMG or send the
whole output.

BTW, what equations are you solving?

On Thu, Aug 2, 2018 at 5:12 AM Pierpaolo Minelli 
wrote:

> Thank you very much for the correction.
> By rebalancing the matrix coefficients, making them dimensionless, in my
> complex problem i managed to obtain a better result with both ML and HYPRE.
> GAMG instead seems to be unable to converge and in fact I get unexpected
> results. I report the outputs of the three simulations again (i tried to
> use also -pc_gamg_square_graph 20 without any improvement).
>
> Pierpaolo
>
> *-pc_type hypre -ksp_rtol 1.e-7 -ksp_monitor_true_residual*
>
>   0 KSP preconditioned resid norm 1.984853668904e-02 true resid norm
> 2.979865703850e-03 ||r(i)||/||b|| 1.e+00
>   1 KSP preconditioned resid norm 1.924446712661e-04 true resid norm
> 1.204260204811e-04 ||r(i)||/||b|| 4.041323752460e-02
>   2 KSP preconditioned resid norm 5.161509100765e-06 true resid norm
> 2.810809726926e-06 ||r(i)||/||b|| 9.432672496933e-04
>   3 KSP preconditioned resid norm 9.297326931238e-08 true resid norm
> 4.474617977876e-08 ||r(i)||/||b|| 1.501617328625e-05
>   4 KSP preconditioned resid norm 1.910271882670e-09 true resid norm
> 9.637470658283e-10 ||r(i)||/||b|| 3.234196308186e-07
>   0 KSP preconditioned resid norm 2.157687745805e+04 true resid norm
> 3.182001523188e+03 ||r(i)||/||b|| 1.e+00
>   1 KSP preconditioned resid norm 1.949268476386e+02 true resid norm
> 1.243419788627e+02 ||r(i)||/||b|| 3.907665598415e-02
>   2 KSP preconditioned resid norm 5.078054475792e+00 true resid norm
> 2.745355604400e+00 ||r(i)||/||b|| 8.627763325675e-04
>   3 KSP preconditioned resid norm 8.663802743529e-02 true resid norm
> 4.254290979292e-02 ||r(i)||/||b|| 1.336985839979e-05
>   4 KSP preconditioned resid norm 1.795605563039e-03 true resid norm
> 9.040507428245e-04 ||r(i)||/||b|| 2.841138623714e-07
>   0 KSP preconditioned resid norm 6.728304961395e+02 true resid norm
> 1.879478105170e+02 ||r(i)||/||b|| 1.e+00
>   1 KSP preconditioned resid norm 2.190497539532e+01 true resid norm
> 4.630095820203e+02 ||r(i)||/||b|| 2.463500802413e+00
>   2 KSP preconditioned resid norm 8.425561564252e-01 true resid norm
> 7.012565302251e+01 ||r(i)||/||b|| 3.731123700223e-01
>   3 KSP preconditioned resid norm 3.029848345705e-02 true resid norm
> 4.379018464663e+00 ||r(i)||/||b|| 2.329911932795e-02
>   4 KSP preconditioned resid norm 7.374025528575e-04 true resid norm
> 1.337183702137e-01 ||r(i)||/||b|| 7.114654320570e-04
>   5 KSP preconditioned resid norm 3.009400175162e-05 true resid norm
> 7.731135032616e-03 ||r(i)||/||b|| 4.113447776459e-05
>
> *-pc_type ml -ksp_rtol 1.e-7 -ksp_monitor_true_residual*
>
>   0 KSP preconditioned resid norm 1.825767020538e-02 true resid norm
> 2.979865703850e-03 ||r(i)||/||b|| 1.e+00
>   1 KSP preconditioned resid norm 6.495628259383e-04 true resid norm
> 3.739440526742e-04 ||r(i)||/||b|| 1.254902367550e-01
>   2 KSP preconditioned resid norm 4.971875712015e-05 true resid norm
> 2.118856024328e-05 ||r(i)||/||b|| 7.110575559127e-03
>   3 KSP preconditioned resid norm 3.726806462912e-06 true resid norm
> 1.370355844514e-06 ||r(i)||/||b|| 4.598716790303e-04
>   4 KSP preconditioned resid norm 2.496898447120e-07 true resid norm
> 9.494701893753e-08 ||r(i)||/||b|| 3.186285167645e-05
>   5 KSP preconditioned resid norm 1.541814409235e-08 true resid norm
> 6.216753346769e-09 ||r(i)||/||b|| 2.086252859898e-06
>   6 KSP preconditioned resid norm 1.153890845138e-09 true resid norm
> 5.290239857745e-10 ||r(i)||/||b|| 1.775328281039e-07
>   0 KSP preconditioned resid norm 1.961448048639e+04 true resid norm
> 3.182001523188e+03 ||r(i)||/||b|| 1.e+00
>   1 KSP preconditioned resid norm 7.940694187370e+02 true resid norm
> 4.331011797078e+02 ||r(i)||/||b|| 1.361096707691e-01
>   2 KSP preconditioned resid norm 6.141876183555e+01 true resid norm
> 2.734346095946e+01 ||r(i)||/||b|| 8.593164007057e-03
>   3 KSP preconditioned resid norm 4.872887149917e+00 true resid norm
> 1.774255242955e+00 ||r(i)||/||b|| 5.575909470898e-04
>   4 KSP preconditioned resid norm 3.088357668927e-01 true resid norm
> 1.183728642343e-01 ||r(i)||/||b|| 3.720075662179e-05
>   5 KSP preconditioned resid norm 2.030016543073e-02 true resid norm
> 7.924623904393e-03 ||r(i)||/||b|| 2.490452580442e-06
>   6 KSP preconditioned resid norm 1.458276941086e-03 true resid norm
> 6.781128809522e-04 ||r(i)||/||b|| 2.131089114856e-07
>   0 KSP preconditioned resid norm 6.230592591466e+02 true resid norm
> 1.879478105170e+02 ||r(i)||/||b|| 1.e+00
>   1 KSP preconditioned resid norm 3.825349376322e+01 true resid norm
> 7.755266613308e+02 ||r(i)||/||b|| 4.126287287931e+00
>   2 KSP preconditioned resid norm 4.321561767174e+00 true resid norm
> 2.170558998883e+02 ||r(i)||/||b|| 1.154873255992e+00
>   3 KSP preconditioned resid 

Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-08-02 Thread Pierpaolo Minelli
Thank you very much for the correction.
By rebalancing the matrix coefficients, making them dimensionless, in my 
complex problem i managed to obtain a better result with both ML and HYPRE. 
GAMG instead seems to be unable to converge and in fact I get unexpected 
results. I report the outputs of the three simulations again (i tried to use 
also -pc_gamg_square_graph 20 without any improvement).

Pierpaolo

-pc_type hypre -ksp_rtol 1.e-7 -ksp_monitor_true_residual

  0 KSP preconditioned resid norm 1.984853668904e-02 true resid norm 
2.979865703850e-03 ||r(i)||/||b|| 1.e+00
  1 KSP preconditioned resid norm 1.924446712661e-04 true resid norm 
1.204260204811e-04 ||r(i)||/||b|| 4.041323752460e-02
  2 KSP preconditioned resid norm 5.161509100765e-06 true resid norm 
2.810809726926e-06 ||r(i)||/||b|| 9.432672496933e-04
  3 KSP preconditioned resid norm 9.297326931238e-08 true resid norm 
4.474617977876e-08 ||r(i)||/||b|| 1.501617328625e-05
  4 KSP preconditioned resid norm 1.910271882670e-09 true resid norm 
9.637470658283e-10 ||r(i)||/||b|| 3.234196308186e-07
  0 KSP preconditioned resid norm 2.157687745805e+04 true resid norm 
3.182001523188e+03 ||r(i)||/||b|| 1.e+00
  1 KSP preconditioned resid norm 1.949268476386e+02 true resid norm 
1.243419788627e+02 ||r(i)||/||b|| 3.907665598415e-02
  2 KSP preconditioned resid norm 5.078054475792e+00 true resid norm 
2.745355604400e+00 ||r(i)||/||b|| 8.627763325675e-04
  3 KSP preconditioned resid norm 8.663802743529e-02 true resid norm 
4.254290979292e-02 ||r(i)||/||b|| 1.336985839979e-05
  4 KSP preconditioned resid norm 1.795605563039e-03 true resid norm 
9.040507428245e-04 ||r(i)||/||b|| 2.841138623714e-07
  0 KSP preconditioned resid norm 6.728304961395e+02 true resid norm 
1.879478105170e+02 ||r(i)||/||b|| 1.e+00
  1 KSP preconditioned resid norm 2.190497539532e+01 true resid norm 
4.630095820203e+02 ||r(i)||/||b|| 2.463500802413e+00
  2 KSP preconditioned resid norm 8.425561564252e-01 true resid norm 
7.012565302251e+01 ||r(i)||/||b|| 3.731123700223e-01
  3 KSP preconditioned resid norm 3.029848345705e-02 true resid norm 
4.379018464663e+00 ||r(i)||/||b|| 2.329911932795e-02
  4 KSP preconditioned resid norm 7.374025528575e-04 true resid norm 
1.337183702137e-01 ||r(i)||/||b|| 7.114654320570e-04
  5 KSP preconditioned resid norm 3.009400175162e-05 true resid norm 
7.731135032616e-03 ||r(i)||/||b|| 4.113447776459e-05

-pc_type ml -ksp_rtol 1.e-7 -ksp_monitor_true_residual

  0 KSP preconditioned resid norm 1.825767020538e-02 true resid norm 
2.979865703850e-03 ||r(i)||/||b|| 1.e+00
  1 KSP preconditioned resid norm 6.495628259383e-04 true resid norm 
3.739440526742e-04 ||r(i)||/||b|| 1.254902367550e-01
  2 KSP preconditioned resid norm 4.971875712015e-05 true resid norm 
2.118856024328e-05 ||r(i)||/||b|| 7.110575559127e-03
  3 KSP preconditioned resid norm 3.726806462912e-06 true resid norm 
1.370355844514e-06 ||r(i)||/||b|| 4.598716790303e-04
  4 KSP preconditioned resid norm 2.496898447120e-07 true resid norm 
9.494701893753e-08 ||r(i)||/||b|| 3.186285167645e-05
  5 KSP preconditioned resid norm 1.541814409235e-08 true resid norm 
6.216753346769e-09 ||r(i)||/||b|| 2.086252859898e-06
  6 KSP preconditioned resid norm 1.153890845138e-09 true resid norm 
5.290239857745e-10 ||r(i)||/||b|| 1.775328281039e-07
  0 KSP preconditioned resid norm 1.961448048639e+04 true resid norm 
3.182001523188e+03 ||r(i)||/||b|| 1.e+00
  1 KSP preconditioned resid norm 7.940694187370e+02 true resid norm 
4.331011797078e+02 ||r(i)||/||b|| 1.361096707691e-01
  2 KSP preconditioned resid norm 6.141876183555e+01 true resid norm 
2.734346095946e+01 ||r(i)||/||b|| 8.593164007057e-03
  3 KSP preconditioned resid norm 4.872887149917e+00 true resid norm 
1.774255242955e+00 ||r(i)||/||b|| 5.575909470898e-04
  4 KSP preconditioned resid norm 3.088357668927e-01 true resid norm 
1.183728642343e-01 ||r(i)||/||b|| 3.720075662179e-05
  5 KSP preconditioned resid norm 2.030016543073e-02 true resid norm 
7.924623904393e-03 ||r(i)||/||b|| 2.490452580442e-06
  6 KSP preconditioned resid norm 1.458276941086e-03 true resid norm 
6.781128809522e-04 ||r(i)||/||b|| 2.131089114856e-07
  0 KSP preconditioned resid norm 6.230592591466e+02 true resid norm 
1.879478105170e+02 ||r(i)||/||b|| 1.e+00
  1 KSP preconditioned resid norm 3.825349376322e+01 true resid norm 
7.755266613308e+02 ||r(i)||/||b|| 4.126287287931e+00
  2 KSP preconditioned resid norm 4.321561767174e+00 true resid norm 
2.170558998883e+02 ||r(i)||/||b|| 1.154873255992e+00
  3 KSP preconditioned resid norm 2.806349660119e-01 true resid norm 
2.931496742303e+01 ||r(i)||/||b|| 1.559739767247e-01
  4 KSP preconditioned resid norm 1.707567397460e-02 true resid norm 
2.684913551118e+00 ||r(i)||/||b|| 1.428542074383e-02
  5 KSP preconditioned resid norm 1.741069717192e-03 true resid norm 
2.914639372698e-01 ||r(i)||/||b|| 1.550770591410e-03
  6 KSP preconditioned resid norm 

Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-08-01 Thread Matthew Knepley
On Wed, Aug 1, 2018 at 9:02 AM Pierpaolo Minelli 
wrote:

> Il giorno 27 lug 2018, alle ore 18:32, Smith, Barry F. 
> ha scritto:
>
> On Jul 27, 2018, at 3:26 AM, Pierpaolo Minelli 
> wrote:
>
>
> Finally, I have a question. In my simulation I solve the two systems at
> each step of the calculation, and it was my habit to use the following
> option after the first resolution and before solving the system in the
> second time step:
>
> call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr)
>
> Since this option was incompatible with the use of MUMPS or SuperLU_Dist,
> I commented on it and noticed, to my surprise, that iterative methods were
> not affected by this comment, rather they were slightly faster. Is this
> normal? Or do I use this command incorrectly?
>
>
>   Presuming this is a linear problem?
>
>
>   You should run with -ksp_monitor_true_residual and compare the final
> residual norms (at linear system convergence). Since KSP uses a relative
> decrease in the residual norm to declare convergence what you have told us
> isn't enough to determine if one is converging "faster" to the solution
> then the other.
>
>   Barry
>
>
> Yes, there are two linear problems. The first in the field of complex
> numbers (which I divided into two problems in the field of real numbers as
> suggested by Matthew) and the second in the field of real numbers.
>
> These are the results obtained using the option -ksp_monitor_true_residual:
>
> *-pc_type gamg -pc_gamg_agg_nsmooths 1 -pc_gamg_reuse_interpolation true
> -pc_gamg_square_graph 1 -pc_gamg_threshold 0. -ksp_rtol 1.e-7
> -ksp_monitor_true_residual*
>
>   0 KSP preconditioned resid norm 1.324344286254e-02 true resid norm
> 2.979865703850e-03 ||r(i)||/||b|| 1.e+00
>   1 KSP preconditioned resid norm 3.399266083153e-03 true resid norm
> 1.196951495628e+05 ||r(i)||/||b|| 4.016796777391e+07
>   2 KSP preconditioned resid norm 6.287919852336e-04 true resid norm
> 4.429876706490e+04 ||r(i)||/||b|| 1.486602802524e+07
>   3 KSP preconditioned resid norm 8.836547690039e-05 true resid norm
> 1.182383826632e+04 ||r(i)||/||b|| 3.967909778970e+06
>   4 KSP preconditioned resid norm 1.291370058561e-05 true resid norm
> 2.801893692950e+03 ||r(i)||/||b|| 9.402751571421e+05
>   5 KSP preconditioned resid norm 2.07398951e-06 true resid norm
> 6.312112895919e+02 ||r(i)||/||b|| 2.118254150770e+05
>   6 KSP preconditioned resid norm 3.283811876800e-07 true resid norm
> 8.777865833701e+01 ||r(i)||/||b|| 2.945725313178e+04
>   7 KSP preconditioned resid norm 5.414680273500e-08 true resid norm
> 1.610127004050e+01 ||r(i)||/||b|| 5.403354258448e+03
>   8 KSP preconditioned resid norm 9.645834363683e-09 true resid norm
> 3.006444251909e+00 ||r(i)||/||b|| 1.008919377818e+03
>   9 KSP preconditioned resid norm 1.915420455785e-09 true resid norm
> 6.672996533262e-01 ||r(i)||/||b|| 2.239361500298e+02
>  10 KSP preconditioned resid norm 3.334928638696e-10 true resid norm
> 1.185976397497e-01 ||r(i)||/||b|| 3.979965929219e+01
>

You can see from the "true resid norm" that your complex problem is not
actually being solved. ML and Hypre have similar results.
I would guess that your coarse grid is near singular.

The real problem is being solved correctly, although you are still 100x off
the true residual so the preconditioner is not great.
Have you tested with a manufactured solution?

  Thanks,

 Matt


>   0 KSP preconditioned resid norm 1.416256896904e+04 true resid norm
> 6.623626291881e+05 ||r(i)||/||b|| 1.e+00
>   1 KSP preconditioned resid norm 3.781264980774e+03 true resid norm
> 1.283809201228e+11 ||r(i)||/||b|| 1.938227104995e+05
>   2 KSP preconditioned resid norm 7.392413714593e+02 true resid norm
> 4.990467508600e+10 ||r(i)||/||b|| 7.534343407504e+04
>   3 KSP preconditioned resid norm 1.087641767696e+02 true resid norm
> 1.367263690390e+10 ||r(i)||/||b|| 2.06470610e+04
>   4 KSP preconditioned resid norm 1.627726591174e+01 true resid norm
> 3.451534923895e+09 ||r(i)||/||b|| 5.210944536719e+03
>   5 KSP preconditioned resid norm 2.564636460142e+00 true resid norm
> 7.980525032990e+08 ||r(i)||/||b|| 1.204857381941e+03
>   6 KSP preconditioned resid norm 4.252626820180e-01 true resid norm
> 1.151817528111e+08 ||r(i)||/||b|| 1.738953070953e+02
>   7 KSP preconditioned resid norm 6.758292325957e-02 true resid norm
> 2.065701091779e+07 ||r(i)||/||b|| 3.118686050134e+01
>   8 KSP preconditioned resid norm 1.099617201063e-02 true resid norm
> 3.470561062696e+06 ||r(i)||/||b|| 5.239669192917e+00
>   9 KSP preconditioned resid norm 2.195352537111e-03 true resid norm
> 7.056823048483e+05 ||r(i)||/||b|| 1.065401750871e+00
>  10 KSP preconditioned resid norm 4.380752631896e-04 true resid norm
> 1.440377395627e+05 ||r(i)||/||b|| 2.174605468598e-01
>
>   0 KSP preconditioned resid norm 4.970534641714e+02 true resid norm
> 1.879478105170e+02 ||r(i)||/||b|| 1.e+00
>   1 KSP preconditioned resid norm 9.825390294838e+01 true resid norm
> 

Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-08-01 Thread Pierpaolo Minelli


> Il giorno 27 lug 2018, alle ore 18:32, Smith, Barry F.  
> ha scritto:
> 
> 
> 
>> On Jul 27, 2018, at 3:26 AM, Pierpaolo Minelli  
>> wrote:
>> 
>> 
>> Finally, I have a question. In my simulation I solve the two systems at each 
>> step of the calculation, and it was my habit to use the following option 
>> after the first resolution and before solving the system in the second time 
>> step:
>> 
>> call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr)
>> 
>> Since this option was incompatible with the use of MUMPS or SuperLU_Dist, I 
>> commented on it and noticed, to my surprise, that iterative methods were not 
>> affected by this comment, rather they were slightly faster. Is this normal? 
>> Or do I use this command incorrectly?
> 
>   Presuming this is a linear problem?



> 
>   You should run with -ksp_monitor_true_residual and compare the final 
> residual norms (at linear system convergence). Since KSP uses a relative 
> decrease in the residual norm to declare convergence what you have told us 
> isn't enough to determine if one is converging "faster" to the solution then 
> the other.
> 
>   Barry

Yes, there are two linear problems. The first in the field of complex numbers 
(which I divided into two problems in the field of real numbers as suggested by 
Matthew) and the second in the field of real numbers. 

These are the results obtained using the option -ksp_monitor_true_residual:

-pc_type gamg -pc_gamg_agg_nsmooths 1 -pc_gamg_reuse_interpolation true 
-pc_gamg_square_graph 1 -pc_gamg_threshold 0. -ksp_rtol 1.e-7 
-ksp_monitor_true_residual

  0 KSP preconditioned resid norm 1.324344286254e-02 true resid norm 
2.979865703850e-03 ||r(i)||/||b|| 1.e+00
  1 KSP preconditioned resid norm 3.399266083153e-03 true resid norm 
1.196951495628e+05 ||r(i)||/||b|| 4.016796777391e+07
  2 KSP preconditioned resid norm 6.287919852336e-04 true resid norm 
4.429876706490e+04 ||r(i)||/||b|| 1.486602802524e+07
  3 KSP preconditioned resid norm 8.836547690039e-05 true resid norm 
1.182383826632e+04 ||r(i)||/||b|| 3.967909778970e+06
  4 KSP preconditioned resid norm 1.291370058561e-05 true resid norm 
2.801893692950e+03 ||r(i)||/||b|| 9.402751571421e+05
  5 KSP preconditioned resid norm 2.07398951e-06 true resid norm 
6.312112895919e+02 ||r(i)||/||b|| 2.118254150770e+05
  6 KSP preconditioned resid norm 3.283811876800e-07 true resid norm 
8.777865833701e+01 ||r(i)||/||b|| 2.945725313178e+04
  7 KSP preconditioned resid norm 5.414680273500e-08 true resid norm 
1.610127004050e+01 ||r(i)||/||b|| 5.403354258448e+03
  8 KSP preconditioned resid norm 9.645834363683e-09 true resid norm 
3.006444251909e+00 ||r(i)||/||b|| 1.008919377818e+03
  9 KSP preconditioned resid norm 1.915420455785e-09 true resid norm 
6.672996533262e-01 ||r(i)||/||b|| 2.239361500298e+02
 10 KSP preconditioned resid norm 3.334928638696e-10 true resid norm 
1.185976397497e-01 ||r(i)||/||b|| 3.979965929219e+01
  0 KSP preconditioned resid norm 1.416256896904e+04 true resid norm 
6.623626291881e+05 ||r(i)||/||b|| 1.e+00
  1 KSP preconditioned resid norm 3.781264980774e+03 true resid norm 
1.283809201228e+11 ||r(i)||/||b|| 1.938227104995e+05
  2 KSP preconditioned resid norm 7.392413714593e+02 true resid norm 
4.990467508600e+10 ||r(i)||/||b|| 7.534343407504e+04
  3 KSP preconditioned resid norm 1.087641767696e+02 true resid norm 
1.367263690390e+10 ||r(i)||/||b|| 2.06470610e+04
  4 KSP preconditioned resid norm 1.627726591174e+01 true resid norm 
3.451534923895e+09 ||r(i)||/||b|| 5.210944536719e+03
  5 KSP preconditioned resid norm 2.564636460142e+00 true resid norm 
7.980525032990e+08 ||r(i)||/||b|| 1.204857381941e+03
  6 KSP preconditioned resid norm 4.252626820180e-01 true resid norm 
1.151817528111e+08 ||r(i)||/||b|| 1.738953070953e+02
  7 KSP preconditioned resid norm 6.758292325957e-02 true resid norm 
2.065701091779e+07 ||r(i)||/||b|| 3.118686050134e+01
  8 KSP preconditioned resid norm 1.099617201063e-02 true resid norm 
3.470561062696e+06 ||r(i)||/||b|| 5.239669192917e+00
  9 KSP preconditioned resid norm 2.195352537111e-03 true resid norm 
7.056823048483e+05 ||r(i)||/||b|| 1.065401750871e+00
 10 KSP preconditioned resid norm 4.380752631896e-04 true resid norm 
1.440377395627e+05 ||r(i)||/||b|| 2.174605468598e-01

  0 KSP preconditioned resid norm 4.970534641714e+02 true resid norm 
1.879478105170e+02 ||r(i)||/||b|| 1.e+00
  1 KSP preconditioned resid norm 9.825390294838e+01 true resid norm 
6.304087699909e+03 ||r(i)||/||b|| 3.354169267824e+01
  2 KSP preconditioned resid norm 1.317425630977e+01 true resid norm 
1.659038483292e+03 ||r(i)||/||b|| 8.827123224947e+00
  3 KSP preconditioned resid norm 1.267331175258e+00 true resid norm 
3.723773819327e+02 ||r(i)||/||b|| 1.981280765700e+00
  4 KSP preconditioned resid norm 1.451198865319e-01 true resid norm 
6.113281457366e+01 ||r(i)||/||b|| 3.252648403059e-01
  5 KSP preconditioned resid norm 2.428012832580e-02 true resid norm 
9.525516489005e+00 

Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-07-27 Thread Smith, Barry F.



> On Jul 27, 2018, at 3:26 AM, Pierpaolo Minelli  
> wrote:
> 
> 
> Finally, I have a question. In my simulation I solve the two systems at each 
> step of the calculation, and it was my habit to use the following option 
> after the first resolution and before solving the system in the second time 
> step:
> 
> call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr)
> 
> Since this option was incompatible with the use of MUMPS or SuperLU_Dist, I 
> commented on it and noticed, to my surprise, that iterative methods were not 
> affected by this comment, rather they were slightly faster. Is this normal? 
> Or do I use this command incorrectly?

   Presuming this is a linear problem?

   You should run with -ksp_monitor_true_residual and compare the final 
residual norms (at linear system convergence). Since KSP uses a relative 
decrease in the residual norm to declare convergence what you have told us 
isn't enough to determine if one is converging "faster" to the solution then 
the other.

   Barry


> 
> Thanks
> 
> Pierpaolo
> 
>> Il giorno 23 lug 2018, alle ore 15:43, Mark Adams  ha 
>> scritto:
>> 
>> Note, as Barry said, GAMG works with native complex numbers. You can start 
>> with your original complex build and use '-pc_type gamg'.
>> Mark
>> 
>> On Mon, Jul 23, 2018 at 6:52 AM Pierpaolo Minelli  
>> wrote:
>> 
>> 
>> > Il giorno 20 lug 2018, alle ore 19:58, Smith, Barry F. 
>> >  ha scritto:
>> > 
>> > 
>> > 
>> >> On Jul 20, 2018, at 7:01 AM, Pierpaolo Minelli  
>> >> wrote:
>> >> 
>> >> Hi,
>> >> 
>> >> in my code I have to solve both a system in the field of real numbers and 
>> >> in the field of complex numbers.
>> >> My approach has been as follows.
>> >> First I configured PETSc with the --with-scalar-type=complex option.
>> >> Using this option I have unfortunately lost the possibility to use the 
>> >> two preconditioners ML and Hypre.
>> > 
>> >You should still be able to use the PETSc PCGAMG algebraic multigrid 
>> > solver. Have you tried that? If there are issues let us know because we 
>> > would like to continue to improve the performance of PCGAMG to get it to 
>> > be closer to as good as ML and hypre.
>> > 
>> >   Barry
>> > 
>> 
>> I will try to convert, as suggested by Matthew, my complex system in a 
>> system twice as large in real numbers. When i finish, i will try to use ML, 
>> Hypre and GAMG and i let you know if there are any performance differences.
>> 
>> Thanks
>> 
>> Pierpaolo
>> 
>> 
>> >> I later created two subspaces of Krylov and tried to solve the two 
>> >> systems as I used to when solving the only equation in the real numbers 
>> >> field.
>> >> In order to correctly solve the system in the field of real numbers I had 
>> >> to transform the coefficients from real to complex with an imaginary part 
>> >> equal to zero.
>> >> 
>> >> Is there a possibility to use a different and better approach to solve my 
>> >> problem?
>> >> 
>> >> Perhaps an approach where you can continue to use ML and Hypre for system 
>> >> solving in the real numbers field or where you don't need to use complex 
>> >> numbers when real numbers would actually suffice?
>> >> 
>> >> Thanks in advance
>> >> 
>> >> Pierpaolo
>> >> 
>> > 
>> 
> 



Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-07-27 Thread Pierpaolo Minelli

Hi,

I tried to follow Matthew's suggestion by dividing the system in the complex 
field into two systems in the real numbers field. In practice I used three 
subspaces of Krylov, one for the first system in the real number field and two 
for the system in the complex number field. Using real numbers, I was able to 
use the ML and Hypre preconditioners again.
I have performed the following tests using the following default options and 
using the PETSc version configured with "--with-scalar-type=real (default 
value)":

(1) -pc_type gamg -pc_gamg_agg_nsmooths 1 -pc_gamg_reuse_interpolation true 
-pc_gamg_square_graph 1 -pc_gamg_threshold 0. -ksp_rtol 1.e-7
(2) -ksp_type preonly -pc_type lu -pc_factor_mat_solver_type mumps
(3) -ksp_type preonly -pc_type lu -pc_factor_mat_solver_type superlu_dist
4) -pc_type ml -ksp_monitor -ksp_rtol 1.e-7
(5) -pc_type hypre -ksp_rtol 1.e-7

All methods resolve both systems correctly, but iterative methods (1,4,5) are 
faster. Among iterative methods using Hypre or ML PCs, I get better performance 
(solve time) than GAMG. 

Previously configuring PETSc with --with-scalar-type=complex I had only been 
able to perform the tests (1,2,3) and in that case the resolution times were 
roughly the same and comparable to the resolution time of case 1) when using 
only real numbers.

Finally, I have a question. In my simulation I solve the two systems at each 
step of the calculation, and it was my habit to use the following option after 
the first resolution and before solving the system in the second time step:

call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr)

Since this option was incompatible with the use of MUMPS or SuperLU_Dist, I 
commented on it and noticed, to my surprise, that iterative methods were not 
affected by this comment, rather they were slightly faster. Is this normal? Or 
do I use this command incorrectly?

Thanks

Pierpaolo

> Il giorno 23 lug 2018, alle ore 15:43, Mark Adams  ha 
> scritto:
> 
> Note, as Barry said, GAMG works with native complex numbers. You can start 
> with your original complex build and use '-pc_type gamg'.
> Mark
> 
> On Mon, Jul 23, 2018 at 6:52 AM Pierpaolo Minelli  > wrote:
> 
> 
> > Il giorno 20 lug 2018, alle ore 19:58, Smith, Barry F.  > > ha scritto:
> > 
> > 
> > 
> >> On Jul 20, 2018, at 7:01 AM, Pierpaolo Minelli  >> > wrote:
> >> 
> >> Hi,
> >> 
> >> in my code I have to solve both a system in the field of real numbers and 
> >> in the field of complex numbers.
> >> My approach has been as follows.
> >> First I configured PETSc with the --with-scalar-type=complex option.
> >> Using this option I have unfortunately lost the possibility to use the two 
> >> preconditioners ML and Hypre.
> > 
> >You should still be able to use the PETSc PCGAMG algebraic multigrid 
> > solver. Have you tried that? If there are issues let us know because we 
> > would like to continue to improve the performance of PCGAMG to get it to be 
> > closer to as good as ML and hypre.
> > 
> >   Barry
> > 
> 
> I will try to convert, as suggested by Matthew, my complex system in a system 
> twice as large in real numbers. When i finish, i will try to use ML, Hypre 
> and GAMG and i let you know if there are any performance differences.
> 
> Thanks
> 
> Pierpaolo
> 
> 
> >> I later created two subspaces of Krylov and tried to solve the two systems 
> >> as I used to when solving the only equation in the real numbers field.
> >> In order to correctly solve the system in the field of real numbers I had 
> >> to transform the coefficients from real to complex with an imaginary part 
> >> equal to zero.
> >> 
> >> Is there a possibility to use a different and better approach to solve my 
> >> problem?
> >> 
> >> Perhaps an approach where you can continue to use ML and Hypre for system 
> >> solving in the real numbers field or where you don't need to use complex 
> >> numbers when real numbers would actually suffice?
> >> 
> >> Thanks in advance
> >> 
> >> Pierpaolo
> >> 
> > 
> 



Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-07-23 Thread Mark Adams
Note, as Barry said, GAMG works with native complex numbers. You can start
with your original complex build and use '-pc_type gamg'.
Mark

On Mon, Jul 23, 2018 at 6:52 AM Pierpaolo Minelli 
wrote:

>
>
> > Il giorno 20 lug 2018, alle ore 19:58, Smith, Barry F. <
> bsm...@mcs.anl.gov> ha scritto:
> >
> >
> >
> >> On Jul 20, 2018, at 7:01 AM, Pierpaolo Minelli <
> pierpaolo.mine...@cnr.it> wrote:
> >>
> >> Hi,
> >>
> >> in my code I have to solve both a system in the field of real numbers
> and in the field of complex numbers.
> >> My approach has been as follows.
> >> First I configured PETSc with the --with-scalar-type=complex option.
> >> Using this option I have unfortunately lost the possibility to use the
> two preconditioners ML and Hypre.
> >
> >You should still be able to use the PETSc PCGAMG algebraic multigrid
> solver. Have you tried that? If there are issues let us know because we
> would like to continue to improve the performance of PCGAMG to get it to be
> closer to as good as ML and hypre.
> >
> >   Barry
> >
>
> I will try to convert, as suggested by Matthew, my complex system in a
> system twice as large in real numbers. When i finish, i will try to use ML,
> Hypre and GAMG and i let you know if there are any performance differences.
>
> Thanks
>
> Pierpaolo
>
>
> >> I later created two subspaces of Krylov and tried to solve the two
> systems as I used to when solving the only equation in the real numbers
> field.
> >> In order to correctly solve the system in the field of real numbers I
> had to transform the coefficients from real to complex with an imaginary
> part equal to zero.
> >>
> >> Is there a possibility to use a different and better approach to solve
> my problem?
> >>
> >> Perhaps an approach where you can continue to use ML and Hypre for
> system solving in the real numbers field or where you don't need to use
> complex numbers when real numbers would actually suffice?
> >>
> >> Thanks in advance
> >>
> >> Pierpaolo
> >>
> >
>
>


Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-07-23 Thread Pierpaolo Minelli



> Il giorno 20 lug 2018, alle ore 19:58, Smith, Barry F.  
> ha scritto:
> 
> 
> 
>> On Jul 20, 2018, at 7:01 AM, Pierpaolo Minelli  
>> wrote:
>> 
>> Hi,
>> 
>> in my code I have to solve both a system in the field of real numbers and in 
>> the field of complex numbers.
>> My approach has been as follows.
>> First I configured PETSc with the --with-scalar-type=complex option.
>> Using this option I have unfortunately lost the possibility to use the two 
>> preconditioners ML and Hypre.
> 
>You should still be able to use the PETSc PCGAMG algebraic multigrid 
> solver. Have you tried that? If there are issues let us know because we would 
> like to continue to improve the performance of PCGAMG to get it to be closer 
> to as good as ML and hypre.
> 
>   Barry
> 

I will try to convert, as suggested by Matthew, my complex system in a system 
twice as large in real numbers. When i finish, i will try to use ML, Hypre and 
GAMG and i let you know if there are any performance differences.

Thanks

Pierpaolo


>> I later created two subspaces of Krylov and tried to solve the two systems 
>> as I used to when solving the only equation in the real numbers field.
>> In order to correctly solve the system in the field of real numbers I had to 
>> transform the coefficients from real to complex with an imaginary part equal 
>> to zero.
>> 
>> Is there a possibility to use a different and better approach to solve my 
>> problem?
>> 
>> Perhaps an approach where you can continue to use ML and Hypre for system 
>> solving in the real numbers field or where you don't need to use complex 
>> numbers when real numbers would actually suffice?
>> 
>> Thanks in advance
>> 
>> Pierpaolo
>> 
> 



Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-07-20 Thread Smith, Barry F.



> On Jul 20, 2018, at 7:01 AM, Pierpaolo Minelli  
> wrote:
> 
> Hi,
> 
> in my code I have to solve both a system in the field of real numbers and in 
> the field of complex numbers.
> My approach has been as follows.
> First I configured PETSc with the --with-scalar-type=complex option.
> Using this option I have unfortunately lost the possibility to use the two 
> preconditioners ML and Hypre.

You should still be able to use the PETSc PCGAMG algebraic multigrid 
solver. Have you tried that? If there are issues let us know because we would 
like to continue to improve the performance of PCGAMG to get it to be closer to 
as good as ML and hypre.

   Barry

> I later created two subspaces of Krylov and tried to solve the two systems as 
> I used to when solving the only equation in the real numbers field.
> In order to correctly solve the system in the field of real numbers I had to 
> transform the coefficients from real to complex with an imaginary part equal 
> to zero.
> 
> Is there a possibility to use a different and better approach to solve my 
> problem?
> 
> Perhaps an approach where you can continue to use ML and Hypre for system 
> solving in the real numbers field or where you don't need to use complex 
> numbers when real numbers would actually suffice?
> 
> Thanks in advance
> 
> Pierpaolo
> 



Re: [petsc-users] Solving Linear Systems with Scalar Real and Complex

2018-07-20 Thread Matthew Knepley
On Fri, Jul 20, 2018 at 8:01 AM Pierpaolo Minelli 
wrote:

> Hi,
>
> in my code I have to solve both a system in the field of real numbers and
> in the field of complex numbers.
> My approach has been as follows.
> First I configured PETSc with the --with-scalar-type=complex option.
> Using this option I have unfortunately lost the possibility to use the two
> preconditioners ML and Hypre.
> I later created two subspaces of Krylov and tried to solve the two systems
> as I used to when solving the only equation in the real numbers field.
> In order to correctly solve the system in the field of real numbers I had
> to transform the coefficients from real to complex with an imaginary part
> equal to zero.
>
> Is there a possibility to use a different and better approach to solve my
> problem?
>
> Perhaps an approach where you can continue to use ML and Hypre for system
> solving in the real numbers field or where you don't need to use complex
> numbers when real numbers would actually suffice?
>

Yes, any linear system in complex numbers can be converted to a system
twice as large in real numbers. So far,
I think this is the best way to handle it, especially the elliptic ones.

  Thanks,

 Matt


> Thanks in advance
>
> Pierpaolo
>
>

-- 
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/