Direct LU solver
    Amit.Itagi at seagate.com 
    Amit.Itagi at seagate.com
       
    Fri Feb 29 08:23:22 CST 2008
    
    
  
Matt/Hong/Satish,
My toy-problem would run with the command line options. However, the
in-code options were still giving a problem. I also found that I had a
Petsc version compiled with the debugging flag off. On recompiling Petsc by
turning the debugging flag on, the in-code options worked. I am wondering
about the cause for this behavior.
Thanks for your help. I will now fiddle around with the actual application.
Rgds,
Amit
                                                                           
             Satish Balay                                                  
             <balay at mcs.anl.go                                             
             v>                                                         To 
             Sent by:                  petsc-users at mcs.anl.gov             
             owner-petsc-users                                          cc 
             @mcs.anl.gov                                                  
             No Phone Info                                         Subject 
             Available                 Re: Direct LU solver                
                                                                           
                                                                           
             02/28/2008 05:58                                              
             PM                                                            
                                                                           
                                                                           
             Please respond to                                             
             petsc-users at mcs.a                                             
                  nl.gov                                                   
                                                                           
                                                                           
On Thu, 28 Feb 2008, Amit.Itagi at seagate.com wrote:
> Matt and Hong,
>
> I will try to customize the example. However, since my application
involves
> multiple ksp solvers (using different algorithms), I would really like to
> set the options with in the code, instead of on the command line. Is
there
> a way of doing this ?
-ksp_type preonly -pc_type lu -mat_type superlu_dist
There are 2 ways of doing this.
One is within the code:
    MatCreate(&mat);
    MatSetType(mat,MATSUPERLU_DIST);
    MatSetFromOptions(mat);
    KSPSetType(ksp,KSPPREONLY);
    KSPGetPC(ksp,&pc);
    PCSetType(pc,PCLU);
    KSPSetFromOptions(ksp);
etc..
Another way is to give each object a prefix [if you have multiple
objects of the same type. You can use this prefix with the command
line options.
For eg:
    KSPCreate(&ksp1)
    KSPCreate(&ksp2)
    KSPSetOptionsPrefix(ksp1,"a_")
    KSPSetOptionsPrefix(ksp2,"b_")
Now you can use -a_ksp_type gmres -b_ksp_type cg
etc..
Satish
    
    
More information about the petsc-users
mailing list