[petsc-users] Nested Fieldsplit for custom index sets

Barry Smith bsmith at mcs.anl.gov
Wed Jul 27 11:09:14 CDT 2016


  
  Please send a complete code that you think should work that doesn't so we can understand the exact issue.


> On Jul 26, 2016, at 10:54 PM, Safin, Artur <aks084000 at utdallas.edu> wrote:
> 
> Barry,
> 
>> Do you have a call to KSPSetFromOptions() before the call PCFieldSplitGetSubKSP()? I am guessing not which means that the PC does not yet know that it is of type fieldplit.
> 
> Yes, I call KSPSetFromOptions() for the global matrix at the beginning of the code. Should I also do it for the ksp I obtain from PCFieldSplitGetSubKSP()?
> 
> The program has no problem doing fieldsplit for the global matrix; my issue is that I cannot get it to recognize a fieldsplit within a fieldsplit.
> 
> This is the whole code for the solver:
> 
> --------------------------------------------------------------------------------------------------------------------------------
>  KSP ksp;
>  KSPCreate(mpi_communicator, &ksp);
>  KSPSetType(ksp, KSPGMRES);
>  KSPSetOperators(ksp, A_petsc, A_petsc);
>  KSPSetFromOptions(ksp);
> 
>  PC pc;
>  KSPGetPC(ksp, &pc);
> 
>  // Define the fieldsplit for the global matrix
>  PCFieldSplitSetIS(pc, "P", P_IS);
>  PCFieldSplitSetIS(pc, "T", T_IS);
> 
>  // fieldsplit for submatrix P:
>  KSP *ksp_all, ksp_P;
>  PCFieldSplitGetSubKSP(pc, &i, &ksp_all);
> 
>  ksp_P = ksp_all[0];
>  PC pc_P;
>  KSPGetPC(ksp_P, &pc_P); // This should be the preconditioner for fieldsplit P
>  PCFieldSplitSetIS(pc_P, "A", P_A_IS);
>  PCFieldSplitSetIS(pc_P, "B", P_B_IS);
> 
>  KSPSolve(ksp, b_petsc, u_petsc);
> --------------------------------------------------------------------------------------------------------------------------------
> 
> Thanks,
> 
> Artur
> 



More information about the petsc-users mailing list