| version 1.1.1.1, 2001/09/20 14:12:01 |
version 1.1.1.1.2.1, 2002/09/13 18:38:34 |
| Line 37 int main(int argc, char **argv) |
|
| Line 37 int main(int argc, char **argv) |
|
| // Function void XGMainLoop(void) {{{ |
// Function void XGMainLoop(void) {{{ |
| void XGMainLoop(void) |
void XGMainLoop(void) |
| { |
{ |
| register int j, isp; |
register int j, isp, i; |
| float frac; |
float frac; |
| |
|
| t += dt; |
t += dt; |
| |
|
| for (isp=0; isp < nsp; isp++) { |
for (isp = 0; isp < nsp; isp++) { |
| if (!(k_count[isp]%sp_k[isp])) { |
for (i = 1; i < ng; i++) { |
| |
n1_delta[i] = sp_n[0][i] - sp_n[0][i - 1]; |
| |
n2_delta[i] = sp_n[1][i] - sp_n[1][i - 1]; |
| |
} |
| |
if (!(k_count[isp] % sp_k[isp])) { |
| it[isp]++; // Advance time for the species isp |
it[isp]++; // Advance time for the species isp |
| (*moveptr)(isp); // Advance position and velocity |
(*moveptr)(isp); // Advance position and velocity |
| adjust(isp); // Remove particles that cross boundaries |
adjust(isp); // Remove particles that cross boundaries |
| // Monte Carlo collisions for species isp |
// Monte Carlo collisions for species isp |
| (*mccptr) (isp); // mcc(isp); |
(*mccptr) (isp); // mcc(isp); |
| gather(isp); // Assign charge densities to the grid |
gather(isp); // Assign charge densities to the grid |
| k_count[isp]=0; // Reset species counter for subcycling |
k_count[isp]=0; // Reset species counter for subcycling |
| } |
} |
| k_count[isp]++; |
k_count[isp]++; |
| frac = ((float)k_count[isp])/sp_k[isp]; |
frac = ((float) k_count[isp]) / sp_k[isp]; |
| for (j=0; j<ng; j++) |
for (j = 0; j < ng; j++) |
| sp_n[isp][j]= (1- frac)*sp_n_0[isp][j] |
sp_n[isp][j]= (1- frac) * sp_n_0[isp][j] + |
| +frac*sp_n_k[isp][j] +sp_n_mcc[isp][j]; |
frac*sp_n_k[isp][j] + sp_n_mcc[isp][j]; |
| } |
} |
| fields(); |
fields(); |
| |
|
| |
// cyklus cez vsetky druhy castic neni potrebny, lebo my vypisujeme |
| |
// grad. koncentracii pre vsetky castice pre dane E(x) |
| |
// for (isp = 0; isp < nsp; isp++) { |
| |
for (i = 1; i < ng; i++) { |
| |
printf("%g\t%d\t% .6g\t% .6g\t% .6g\n", |
| |
t, i, e[i], n1_delta[i], n2_delta[i]); |
| |
} |
| |
// } |
| |
|
| if (theRunWithXFlag) |
if (theRunWithXFlag) |
| history(); |
history(); |
| } // }}} |
} // }}} |