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. |
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]; |
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 |
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) |