- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
void main_calc(double *j0, double *v0, double *r0, double *L, double *L1, double *w0, double *gamma1, int *Num, double **array, int *Ng)
{
double *jc, *Pvh, *h, *vf, *R, *j0, *v0, *r0, *L,*L1, *w0, *gamma1, cm, vfm, *xi, *w, *b, *BB, *Num, E, v, z, t, k1[2], k2[2], k3[2], k4[2],TimeF,C0[mmax][pmax], gamma2[mmax][pmax];
const double PI = 3.14159265358979323;
int i, m, j, k, p, Size1, Size2;
const int mmax = 3000, pmax = 20;
double *jc2, *Pvih;
double CJ, x;
int i1;
/*j0=new double;
v0=new double;
r0=new double;
L=new double;
L1=new double;
w0=new double;
gamma1=new double;
Num=new int;*/
ofstream fil;
fil.open("current");
Pvh = new double[*Num];
h = new double[*Num];
vf = new double[*Num];
R = new double[*Num];
//entry(j0,v0,r0,L,L1,w0,gamma1,Num, Pvh, h, vf, R);
TimeF = *Ng*dt;
for (i = 0; i < *Num; i++){
Pvh[i] = array[0][i];
h[i] = array[1][i];
vf[i] = array[2][i];
R[i] = array[3][i];
}
Size1 = *L1 / dz1;
for (i = 0; i<*Num; i++) {
if (TimeF<(2 * PI / (h[i] * (*w0)))) {
TimeF = (2 * PI / (h[i] * (*w0)));
}
}
cout << "TimeF=" << TimeF << endl;
Size2 = 20 * PI / (*w0*dt1);
if (Size1>mmax) { cout << "Error: increase mmax!" << endl; }
cout << "Size1=" << Size1 << " Size2=" << Size2 << endl;
//C0=new double[(Size1+5)*(Size2+5)];
//gamma2=new double[(Size1+5)*(Size2+5)];
jc = new double[*Ng];
jc2 = new double[*Ng];
b = new double[*Num];
w = new double[*Num];
xi = new double[*Num];
BB = new double[*Num];
ofstream fil2;
fil2.open("w");
for (i = 0; i<*Num; i++) {
w[i] = h[i] * (*w0);
fil2 << w[i] << endl;
b[i] = w[i] / vf[i];
cm = 3.0; vfm = vf[i] / 1e8;
xi[i] = w[i] * sqrt(1.0 / (cm*cm) + 1.0 / (vfm*vfm)) / 1e8;
BB[i] = (I0(xi[i] * (*r0))*I0(xi[i] * (*r0)) - I1(xi[i] * (*r0))*I1(xi[i] * (*r0)) - 1.0);
BB[i] = b[i] * sqrt(2.0*R[i] * Pvh[i] / (BB[i]));
}
fil2.close();
m = 0;
t = 0;
do {
m = m + 1;
t = t + dt;
jc[m] = 0.0;
} while (t<TimeF);
//cout <<F1n(0.03,0,jc,BB,w,b,xi,r0) << endl;
GreatMASTERcpp 27.12.2015 23:00 # −1
v = *v0;
z = 0.0;
t = (i - 1)*dt;
m = i - 1;
jc2[0] = *j0;
for (j = 0; j<*Num; j++) {
i1 = 0;
x = 0.0;
do {
C0[i1][j] = BB[j];
gamma2[i1][j] = 0.0;
i1 = i1 + 1;
x = x + dz1;
} while (x<*L1);
}
do {
E = 0.0;
for (j = 0; j<*Num; j++) {
C0[0][j] = BB[j];
gamma2[0][j] = 0.0;
x = dz1;
p = 1;
do {C0[p][j] = C0[p][j] - (vf[j] * dt / dz1)*(C0[p][j] - C0[p - 1][j]) - vf[j] * dt*exp(-5 * x)*(F1n(x, j, jc, BB, w, b, xi, r0)*cos(gamma2[p][j] * x) - F2n(x, j, jc, BB, w, b, xi, r0)*sin(gamma2[p][j] * x)) / (4.0*PI*Pvh[j]);
gamma2[p][j] = gamma2[p][j] - (vf[j] * dt / dz1)*(gamma2[p][j] - gamma2[p - 1][j]) + (vf[j] * dt / (C0[p][j] * x))*exp(-5 * x)*(F1n(x, j, jc, BB, w, b, xi, r0)*sin(gamma2[p][j] * x) + F2n(x, j, jc, BB, w, b, xi, r0)*cos(gamma2[p][j] * x)) / (4.0*PI*Pvh[j]);
x = x + dz1;
//cout <<x<<" "<< C0[p][j] <<" "<<gamma2[p][j]<<endl;
p = p + 1;
} while (x<*L1);
x = 0.0;
p = 0;
do {
if ((z<(x + dz1))&(z>x)) {
CJ = C0[p][j] * exp(5 * z)*cos(z*gamma2[p][j]);
}
p = p + 1;
x = x + dz1;
} while (x<*L1);
E = E + CJ*I0(xi[j] * (*r0))*cos(2.0*PI*(j + 1)*z / (*L))*cos(w[k] * t);
}
k1[1] = eta*E;
k1[2] = v;
v = v + (k1[1])*dt;
z = z + (k1[2])*dt;
t = t + dt;
m = m + 1;
//cout << z <<" "<< v <<endl;
if (z <= *L1) {
jc2[m] = jc2[m] + *j0*(*v0) / v;
}
else {
t = TimeF;
}
cout << i << " " << m << " " << z << " " << v << endl;
//fil3 << i << " " << m << " " << z << " " << v << endl;
} while (t<TimeF);
}
kegdan 28.12.2015 00:16 # +3
Abbath 28.12.2015 01:37 # 0
kegdan 28.12.2015 02:07 # +2
GreatMASTERcpp 27.12.2015 23:01 # 0
bormand 27.12.2015 23:40 # +1
Antervis 28.12.2015 06:41 # +10
kegdan 28.12.2015 19:20 # 0
3.14159265 28.12.2015 20:06 # +1
> double *jc, *Pvh, *h, *vf, *R, *j0, *v0, *r0, *L,*L1, *w0, *gamma1, cm, vfm, *xi, *w, *b, *BB, *Num, E, v, z, t, k1[2], k2[2], k3[2], k4[2],TimeF,C0[mmax][pmax], gamma2[mmax][pmax];
Можно было не продолжать. Потому дальше не читал.