-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkergdriver.c
95 lines (81 loc) · 1.66 KB
/
kergdriver.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <stdio.h>
#include <math.h>
#include "6erg.h"
#include "k6erg.c"
/*#include "solout.c"*/
#include "cblock.h"
/* global variable declarations */
/* double F[N];
double Y[N];
long int *np;
double *xp; */
double current[C],vset1,iinf,oinf;
void main()
{
double state[N];
double fstate[N];
double rtol[N],atol[N];
int itol,ijac,mljac,mujac;
int imas,mlmas,mumas;
int iout,lwork,liwork,lrcont;
int iwork[LIWORK];
double work[LWORK];
extern int out_();
int n,idid;
double x,xend,h;
FILE *fp;
int i,j;
n=N;
for(i=0;i<7;i++) {iwork[i]=0;
work[i]=0.0;}
rtol[0]=1.0e-6;
atol[0]=.01*rtol[0];
rtol[1]=1.0e-9;
atol[1]=1.0e-12;
for(i=2;i<N;i++) {rtol[i]=0.001;
atol[i]=0.01*rtol[i];}
iwork[2] = 10000000;
itol=1;
ijac=0;
mljac=n;
mujac=0;
imas=0;
mlmas=n;
mumas=0;
lwork=LWORK;
liwork=LIWORK;
lrcont=LRCONT;
iout=1;
h=1e-4;
x=START_TIME;
scan_(state);
deriv_(&n,&x,state,fstate);
if (PULSEON>0 && PULSEON<ENDTIME)
{xend = PULSEON;
radau5_(&n,deriv_,&x,state,&xend,&h,
rtol,atol,&itol,
dummy,&ijac,&mljac,&mujac,
mas,&imas,&mlmas,&mumas,
out_,&iout,
work,&lwork,iwork,&liwork,&lrcont,&idid);
}
if (xend<PULSEOFF&& PULSEOFF<ENDTIME)
{xend = PULSEOFF;
radau5_(&n,deriv_,&x,state,&xend,&h,
rtol,atol,&itol,
dummy,&ijac,&mljac,&mujac,
mas,&imas,&mlmas,&mumas,
out_,&iout,
work,&lwork,iwork,&liwork,&lrcont,&idid);
}
if(x<ENDTIME)
{xend=ENDTIME;
radau5_(&n,deriv_,&x,state,&xend,&h,
rtol,atol,&itol,
dummy,&ijac,&mljac,&mujac,
mas,&imas,&mlmas,&mumas,
out_,&iout,
work,&lwork,iwork,&liwork,&lrcont,&idid);}
dump_(state);
fflush(stdout);
}