Re: [petsc-dev] [petsc-users] Multiple solves with PCMG fail
On Wed, Oct 22, 2014 at 2:25 AM, Jed Brown <[email protected]> wrote:
Barry Smith <[email protected]> writes:
Jed
There are some additional issues when the GMRES runs for zero iterations in computing eigenvalues for Cheby.
Hmm, what is right? Suggest that the user set -ksp_chebyshev_estimate_eigenvalues_random? Automatically fall back to that?
Are you implying that PETSc is using the RHS to compute the spectra for cheby?
Just picking arbitrary values doesn't seem right because the solver won't work right on the next solve.
static PetscErrorCode KSPChebyshevComputeExtremeEigenvalues_Private(KSP kspest,PetscReal *emin,PetscReal *emax) { PetscErrorCode ierr; PetscInt n,neig; PetscReal *re,*im,min,max;
PetscFunctionBegin; ierr = KSPGetIterationNumber(kspest,&n);CHKERRQ(ierr); ierr = PetscMalloc2(n,&re,n,&im);CHKERRQ(ierr); ierr = KSPComputeEigenvalues(kspest,n,re,im,&neig);CHKERRQ(ierr); min = PETSC_MAX_REAL; max = PETSC_MIN_REAL; for (n=0; n<neig; n++) { min = PetscMin(min,re[n]); max = PetscMax(max,re[n]); } ierr = PetscFree2(re,im);CHKERRQ(ierr); *emax = max; *emin = min;
* thread #1: tid = 0x3c16cf, 0x00000001041b6777 libpetsc.3.5.dylib`KSPSolve_Chebyshev(ksp=0x00007fb85197ac60) + 1495 at cheby.c:378, queue = 'com.apple.main-thread', stop reason = step over frame #0: 0x00000001041b6777 libpetsc.3.5.dylib`KSPSolve_Chebyshev(ksp=0x00007fb85197ac60) + 1495 at cheby.c:378 375 cheb->emin = cheb->tform[0]*min + cheb->tform[1]*max; 376 cheb->emax = cheb->tform[2]*min + cheb->tform[3]*max; 377 -> 378 cheb->estimate_current = PETSC_TRUE; 379 } 380 381 ksp->its = 0; (lldb) p cheb->emin (PetscReal) $11 = -1.7976931348623158E+307 (lldb) p cheb->emax (PetscReal) $12 = -Inf
This puts giberish into the eigenvalue estimates.
I am not sure how you want to handle this?
The zero right hand side zero, initial guess case is a great corner case for testing complicated solvers :-) I’d forgotten about it for many years
participants (1)
-
Mark Adams