/[ascend]/trunk/base/generic/solver/ida.c
ViewVC logotype

Diff of /trunk/base/generic/solver/ida.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1011 by johnpye, Tue Jan 2 12:10:53 2007 UTC revision 1012 by johnpye, Wed Jan 3 03:13:20 2007 UTC
# Line 34  Line 34 
34    
35  /* ASCEND includes */  /* ASCEND includes */
36  #include "ida.h"  #include "ida.h"
37    #include "idalinear.h"
38  #include <utilities/error.h>  #include <utilities/error.h>
39  #include <utilities/ascConfig.h>  #include <utilities/ascConfig.h>
40  #include <utilities/ascSignal.h>  #include <utilities/ascSignal.h>
# Line 165  void integrator_ida_error(int error_code Line 166  void integrator_ida_error(int error_code
166          , char *msg, void *eh_data          , char *msg, void *eh_data
167  );  );
168    
169    /* dense jacobian evaluation for IDADense dense direct linear solver */
170  int integrator_ida_djex(long int Neq, realtype tt  int integrator_ida_djex(long int Neq, realtype tt
171          , N_Vector yy, N_Vector yp, N_Vector rr          , N_Vector yy, N_Vector yp, N_Vector rr
172          , realtype c_j, void *jac_data, DenseMat Jac          , realtype c_j, void *jac_data, DenseMat Jac
173          , N_Vector tmp1, N_Vector tmp2, N_Vector tmp3          , N_Vector tmp1, N_Vector tmp2, N_Vector tmp3
174  );  );
175    
176    /* sparse jacobian evaluation for ASCEND's sparse direct solver */
177    IntegratorSparseJacFn integrator_ida_sjex;
178    
179  typedef struct{  typedef struct{
180      long nsteps;      long nsteps;
181      long nrevals;      long nrevals;
# Line 360  int integrator_ida_params_default(Integr Line 365  int integrator_ida_params_default(Integr
365      slv_param_char(p,IDA_PARAM_LINSOLVER      slv_param_char(p,IDA_PARAM_LINSOLVER
366              ,(SlvParameterInitChar){{"linsolver"              ,(SlvParameterInitChar){{"linsolver"
367              ,"Linear solver",1              ,"Linear solver",1
368              ,"See IDA manual, section 5.5.3."              ,"See IDA manual, section 5.5.3. Choose 'ASCEND' to use the linsolqr"
369          }, "SPGMR"}, (char *[]){"DENSE","BAND","SPGMR","SPBCG","SPTFQMR",NULL}              " direct linear solver bundled with ASCEND, 'DENSE' to use the dense"
370                " solver bundled with IDA, or one of the Krylov solvers SPGMR, SPBCG"
371                " or SPTFQMR (which still need preconditioners to be implemented"
372                " before they can be very useful."
373            }, "ASCEND"}, (char *[]){"ASCEND","DENSE","BAND","SPGMR","SPBCG","SPTFQMR",NULL}
374      );      );
375    
376      slv_param_int(p,IDA_PARAM_MAXL      slv_param_int(p,IDA_PARAM_MAXL
# Line 536  int integrator_ida_solve( Line 545  int integrator_ida_solve(
545      /* attach linear solver module, using the default value of maxl */      /* attach linear solver module, using the default value of maxl */
546      linsolver = SLV_PARAM_CHAR(&(blsys->params),IDA_PARAM_LINSOLVER);      linsolver = SLV_PARAM_CHAR(&(blsys->params),IDA_PARAM_LINSOLVER);
547      CONSOLE_DEBUG("ASSIGNING LINEAR SOLVER '%s'",linsolver);      CONSOLE_DEBUG("ASSIGNING LINEAR SOLVER '%s'",linsolver);
548      if(strcmp(linsolver,"DENSE")==0){      if(strcmp(linsolver,"ASCEND")==0){
549            CONSOLE_DEBUG("ASCEND DIRECT SOLVER, size = %d",size);
550            IDAASCEND(ida_mem,size);
551            IDAASCENDSetJacFn(ida_mem, &integrator_ida_sjex, (void *)blsys);
552    
553            flagfntype = "IDAASCEND";
554            flagfn = &IDAASCENDGetLastFlag;
555            flagnamefn = &IDAASCENDGetReturnFlagName;
556    
557        }else if(strcmp(linsolver,"DENSE")==0){
558          CONSOLE_DEBUG("DENSE DIRECT SOLVER, size = %d",size);          CONSOLE_DEBUG("DENSE DIRECT SOLVER, size = %d",size);
559          flag = IDADense(ida_mem, size);          flag = IDADense(ida_mem, size);
560          switch(flag){          switch(flag){
# Line 1242  int integrator_ida_jvex(realtype tt, N_V Line 1260  int integrator_ida_jvex(realtype tt, N_V
1260      return 0;      return 0;
1261  }  }
1262    
1263    /* sparse jacobian evaluation for IDAASCEND sparse direct linear solver */
1264    int integrator_ida_sjex(long int Neq, realtype tt
1265            , N_Vector yy, N_Vector yp, N_Vector rr
1266            , realtype c_j, void *jac_data, mtx_matrix_t Jac
1267            , N_Vector tmp1, N_Vector tmp2, N_Vector tmp3
1268    );
1269    
1270  /*----------------------------------------------  /*----------------------------------------------
1271    JACOBI PRECONDITIONER -- EXPERIMENTAL.    JACOBI PRECONDITIONER -- EXPERIMENTAL.
1272  */  */

Legend:
Removed from v.1011  
changed lines
  Added in v.1012

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22