/[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 976 by johnpye, Tue Dec 19 13:52:51 2006 UTC revision 977 by johnpye, Wed Dec 20 00:39:52 2006 UTC
# Line 89  Line 89 
89  #define FEX_DEBUG  #define FEX_DEBUG
90  #define JEX_DEBUG  #define JEX_DEBUG
91    
92    const IntegratorInternals integrator_ida_internals = {
93        integrator_ida_create
94        ,integrator_ida_params_default
95        ,integrator_analyse_dae /* note, this routine is back in integrator.c */
96        ,integrator_ida_solve
97        ,integrator_ida_free
98        ,INTEG_IDA
99        ,"IDA"
100    };
101    
102  /**  /**
103      Struct containing any stuff that IDA needs that doesn't fit into the      Struct containing any stuff that IDA needs that doesn't fit into the
104      common IntegratorSystem struct.      common IntegratorSystem struct.
# Line 785  int integrator_ida_djex(long int Neq, re Line 795  int integrator_ida_djex(long int Neq, re
795          /* insert values into the Jacobian row in appropriate spots (can assume Jac starts with zeros -- IDA manual) */          /* insert values into the Jacobian row in appropriate spots (can assume Jac starts with zeros -- IDA manual) */
796          for(j=0; j < count; ++j){                    for(j=0; j < count; ++j){          
797              var_yindex = blsys->y_id[variables[j]];              var_yindex = blsys->y_id[variables[j]];
798                ASC_ASSERT_RANGE(var_yindex, -Jac->N, Jac->N);
799              if(var_yindex >= 0){              if(var_yindex >= 0){
800                  asc_assert(blsys->y[var_yindex]==enginedata->varlist[variables[j]]);                  asc_assert(blsys->y[var_yindex]==enginedata->varlist[variables[j]]);
801                  DENSE_ELEM(Jac,i,var_yindex) += derivatives[j];                  DENSE_ELEM(Jac,i,var_yindex) += derivatives[j];
# Line 924  int integrator_ida_jvex(realtype tt, N_V Line 935  int integrator_ida_jvex(realtype tt, N_V
935                  */                  */
936                                    
937                  var_yindex = blsys->y_id[variables[j]];                  var_yindex = blsys->y_id[variables[j]];
938                  /* CONSOLE_DEBUG("j = %d: variables[j] = %d, y_id = %d",j,variables[j],var_yindex); */                  CONSOLE_DEBUG("j = %d: variables[j] = %d, y_id = %ld",j,variables[j],var_yindex);
939                    ASC_ASSERT_RANGE(-var_yindex-1, -NV_LENGTH_S(v),NV_LENGTH_S(v));
940    
941                  if(var_yindex >= 0){                  if(var_yindex >= 0){
942  #ifdef JEX_DEBUG  #ifdef JEX_DEBUG
# Line 937  int integrator_ida_jvex(realtype tt, N_V Line 949  int integrator_ida_jvex(realtype tt, N_V
949  #endif  #endif
950                      Jv_i += derivatives[j] * NV_Ith_S(v,var_yindex);                      Jv_i += derivatives[j] * NV_Ith_S(v,var_yindex);
951                  }else{                  }else{
                     ASC_ASSERT_LT(-var_yindex-1, NV_LENGTH_S(v));  
952  #ifdef JEX_DEBUG  #ifdef JEX_DEBUG
953                      fprintf(stderr,"Jv[%d] += %f (dF[%d]/dydot[%ld] = %f, v[%ld] = %f)\n", i                      fprintf(stderr,"Jv[%d] += %f (dF[%d]/dydot[%ld] = %f, v[%ld] = %f)\n", i
954                          , derivatives[j] * NV_Ith_S(v,-var_yindex-1)                          , derivatives[j] * NV_Ith_S(v,-var_yindex-1)

Legend:
Removed from v.976  
changed lines
  Added in v.977

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