Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <stdio.h>
- #include <cmath>
- #include <windows.h>
- #define _USE_MATH_DEFINES
- using namespace std;
- #define m 9.1094e-28
- #define MN2 46.4968e-24
- #define n0 1e16
- #define ne 1e12
- #define q 4.8032e-10
- #define En 0 //в Td
- #define d 3.91665e-5
- #define T0 0.02586 //300K 1K = 1.3806*10^-16 erg
- #define Te 1.5
- #define eps0 1.6e-12 //перевод энергии
- #define B0 2.4668e-4
- #define Tk 0.25862 //3000K
- #define hw 0.29299
- #define hw0 0.00178
- #define logL 10
- #define PI 3.14159265
- #define N 100001 //кол-во шагов по времени
- #define M 400 //кол-во шагов по энергии
- #define t 1e-16//шаг по времени
- #define h 0.1 //шаг по энергии эВ
- #define z 8 //количество нужных шагов по энергии
- double T[100][2]; // транспортное сечение
- double R[100][2]; // вращательное сечение
- double VL[100][2]; // электронное возбуждение
- double VW[100][2]; // полная колебаловка
- double W1[100][2], W2[100][2], W3[100][2], W4[100][2], W5[100][2], W6[100][2], W7[100][2], W8[100][2]; // колебаловка поуровневая
- double CS_Ex_1[100][2], CS_Ex_2[100][2], CS_Ex_3[100][2], CS_Ex_4[100][2], CS_Ex_5[100][2],
- CS_Ex_6[100][2], CS_Ex_7[100][2], CS_Ex_8[100][2], CS_Ex_9[100][2], CS_Ex_10[100][2], CS_Ex_11[100][2]; // электронное возбуждеиние
- double I11, I21, I13, I14, I15, I16, I17, I18 = 0; // интегралы при решении уравнения для ЗС колебательной энергии
- double e; // передаваемое значение энергии
- char type; // тип сечения
- int a;
- void init() {
- FILE *transp; transp = fopen("C:\\Users\\superior\\Documents\\cross_section\\transfer.txt", "r");
- FILE *rot; rot = fopen("C:\\Users\\superior\\Documents\\cross_section\\rotat.txt", "r");
- FILE *vl; vl = fopen("C:\\Users\\superior\\Documents\\cross_section\\vl.txt", "r");
- FILE *vw; vw = fopen("C:\\Users\\superior\\Documents\\cross_section\\vw.txt", "r");
- FILE *w1; w1 = fopen("C:\\Users\\superior\\Documents\\cross_section\\w1.txt", "r");
- FILE *w2; w2 = fopen("C:\\Users\\superior\\Documents\\cross_section\\w2.txt", "r");
- FILE *w3; w3 = fopen("C:\\Users\\superior\\Documents\\cross_section\\w3.txt", "r");
- FILE *w4; w4 = fopen("C:\\Users\\superior\\Documents\\cross_section\\w4.txt", "r");
- FILE *w5; w5 = fopen("C:\\Users\\superior\\Documents\\cross_section\\w5.txt", "r");
- FILE *w6; w6 = fopen("C:\\Users\\superior\\Documents\\cross_section\\w6.txt", "r");
- FILE *w7; w7 = fopen("C:\\Users\\superior\\Documents\\cross_section\\w7.txt", "r");
- FILE *w8; w8 = fopen("C:\\Users\\superior\\Documents\\cross_section\\w8.txt", "r");
- FILE *CS_Ex_1_file; CS_Ex_1_file = fopen("C:\\cross_section\\ex\\E1.txt", "r");
- FILE *CS_Ex_2_file; CS_Ex_2_file = fopen("C:\\cross_section\\ex\\E2.txt", "r");
- FILE *CS_Ex_3_file; CS_Ex_3_file = fopen("C:\\cross_section\\ex\\E3.txt", "r");
- FILE *CS_Ex_4_file; CS_Ex_4_file = fopen("C:\\cross_section\\ex\\E4.txt", "r");
- FILE *CS_Ex_5_file; CS_Ex_5_file = fopen("C:\\cross_section\\ex\\E5.txt", "r");
- FILE *CS_Ex_6_file; CS_Ex_6_file = fopen("C:\\cross_section\\ex\\E6.txt", "r");
- FILE *CS_Ex_7_file; CS_Ex_7_file = fopen("C:\\cross_section\\ex\\E7.txt", "r");
- FILE *CS_Ex_8_file; CS_Ex_8_file = fopen("C:\\cross_section\\ex\\E8.txt", "r");
- FILE *CS_Ex_9_file; CS_Ex_9_file = fopen("C:\\cross_section\\ex\\E9.txt", "r");
- FILE *CS_Ex_10_file; CS_Ex_10_file = fopen("C:\\cross_section\\ex\\E10.txt", "r");
- FILE *CS_Ex_11_file; CS_Ex_11_file = fopen("C:\\cross_section\\ex\\E11.txt", "r");
- for (int i = 0; i < 100; i++) {
- for (int j = 0; j < 2; j++) {
- T[i][j] = 0; R[i][j] = 0; VL[i][j] = 0; VW[i][j] = 0;
- W1[i][j] = 0;W2[i][j] = 0; W3[i][j] = 0; W4[i][j] = 0; W5[i][j] = 0; W6[i][j] = 0; W7[i][j] = 0; W8[i][j] = 0;
- CS_Ex_1[i][j] = 0; CS_Ex_2[i][j] = 0; CS_Ex_3[i][j] = 0; CS_Ex_4[i][j] = 0; CS_Ex_5[i][j] = 0; CS_Ex_6[i][j] = 0; CS_Ex_7[i][j] = 0; CS_Ex_8[i][j] = 0; CS_Ex_9[i][j] = 0; CS_Ex_10[i][j] = 0; CS_Ex_11[i][j] = 0;
- }
- }
- for (int i = 0; i<100; i++) {
- for (int j = 0; j<2; j++) {
- fscanf(transp, "%lf", &T[i][j]);
- fscanf(rot, "%lf", &R[i][j]);
- fscanf(vl, "%lf", &VL[i][j]);
- fscanf(vw, "%lf", &VW[i][j]);
- fscanf(w1, "%lf", &W1[i][j]);
- fscanf(w2, "%lf", &W2[i][j]);
- fscanf(w3, "%lf", &W3[i][j]);
- fscanf(w4, "%lf", &W4[i][j]);
- fscanf(w5, "%lf", &W5[i][j]);
- fscanf(w6, "%lf", &W6[i][j]);
- fscanf(w7, "%lf", &W7[i][j]);
- fscanf(w8, "%lf", &W8[i][j]);
- fscanf(CS_Ex_1_file, "%lf", &CS_Ex_1[i][j]);
- fscanf(CS_Ex_2_file, "%lf", &CS_Ex_2[i][j]);
- fscanf(CS_Ex_3_file, "%lf", &CS_Ex_3[i][j]);
- fscanf(CS_Ex_4_file, "%lf", &CS_Ex_4[i][j]);
- fscanf(CS_Ex_5_file, "%lf", &CS_Ex_5[i][j]);
- fscanf(CS_Ex_6_file, "%lf", &CS_Ex_6[i][j]);
- fscanf(CS_Ex_7_file, "%lf", &CS_Ex_7[i][j]);
- fscanf(CS_Ex_8_file, "%lf", &CS_Ex_8[i][j]);
- fscanf(CS_Ex_9_file, "%lf", &CS_Ex_9[i][j]);
- fscanf(CS_Ex_10_file, "%lf", &CS_Ex_10[i][j]);
- fscanf(CS_Ex_11_file, "%lf", &CS_Ex_11[i][j]);
- }
- }
- fclose(transp); fclose(rot); fclose(vl); fclose(vw);
- fclose(w1); fclose(w2); fclose(w3); fclose(w4); fclose(w5); fclose(w6); fclose(w7); fclose(w8);
- fclose(CS_Ex_1_file); fclose(CS_Ex_2_file); fclose(CS_Ex_3_file); fclose(CS_Ex_4_file); fclose(CS_Ex_5_file); fclose(CS_Ex_6_file); fclose(CS_Ex_7_file); fclose(CS_Ex_8_file); fclose(CS_Ex_9_file); fclose(CS_Ex_10_file); fclose(CS_Ex_11_file);
- }
- double cs(double e, string type) {
- double sigma;
- if (type == "r") {
- for (int i = 0; i < 26; i++) {
- if (R[i][0] == e) {
- sigma = R[i][1];
- return sigma;
- }
- if (R[i][0] > e) {
- sigma = (R[i - 1][1] + (R[i][1] - R[i - 1][1])*(e - R[i - 1][0]) / (R[i][0] - R[i - 1][0]));
- return sigma;
- }
- }
- if (R[25][0] < e) {
- sigma = 0;
- }
- if (R[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "t") {
- for (int i = 0; i < 54; i++) {
- if (T[i][0] == e) {
- sigma = T[i][1];
- return sigma;
- }
- if (T[i][0] > e) {
- sigma = (T[i - 1][1] + (T[i][1] - T[i - 1][1])*(e - T[i - 1][0]) / (T[i][0] - T[i - 1][0]));
- return sigma;
- }
- }
- if (T[53][0] < e) {
- sigma = 0;
- }
- if (T[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "l") {
- for (int i = 0; i < 68; i++) {
- if (VL[i][0] > e) {
- sigma = (VL[i - 1][1] + (VL[i][1] - VL[i - 1][1])*(e - VL[i - 1][0]) / (VL[i][0] - VL[i - 1][0]))*1e-16;
- break;
- }
- if (VL[i][0] == e) {
- sigma = VL[i][1] * 1e-16;
- break;
- }
- }
- if (VL[66][0] < e) {
- sigma = (VL[65][1] + (VL[66][1] - VL[65][1])*(e - VL[65][0]) / (VL[66][0] - VL[65][0]))*1e-16;
- }
- }
- else if (type == "w") {
- for (int i = 0; i < 28; i++) {
- if (VW[i][0] == e) {
- sigma = VW[i][1];
- return sigma;
- }
- if (R[i][0] > e) {
- sigma = (R[i - 1][1] + (R[i][1] - R[i - 1][1])*(e - R[i - 1][0]) / (R[i][0] - R[i - 1][0]));
- return sigma;
- }
- }
- if (R[25][0] < e) {
- sigma = 0;
- }
- if (R[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "w1") {
- for (int i = 0; i < 49; i++) {
- if (W1[i][0] == e) {
- sigma = W1[i][1];
- return sigma;
- }
- if (W1[i][0] > e) {
- sigma = (W1[i - 1][1] + (W1[i][1] - W1[i - 1][1])*(e - W1[i - 1][0]) / (W1[i][0] - W1[i - 1][0]));
- return sigma;
- }
- }
- if (W1[48][0] < e) {
- sigma = 0;
- return sigma;
- }
- if (W1[0][0] > e) {
- sigma = 0;
- return sigma;
- }
- }
- else if (type == "w2") {
- for (int i = 0; i < 24; i++) {
- if (W2[i][0] == e) {
- sigma = W2[i][1];
- return sigma;
- }
- if (W2[i][0] > e) {
- sigma = (W2[i - 1][1] + (W2[i][1] - W2[i - 1][1])*(e - W2[i - 1][0]) / (W2[i][0] - W2[i - 1][0]));
- return sigma;
- }
- }
- if (W2[23][0] < e) {
- sigma = 0;
- return sigma;
- }
- if (W2[0][0] > e) {
- sigma = 0;
- return sigma;
- }
- }
- else if (type == "w3") {
- for (int i = 0; i < 20; i++) {
- if (W3[i][0] == e) {
- sigma = W3[i][1];
- return sigma;
- }
- if (W3[i][0] > e) {
- sigma = (W3[i - 1][1] + (W3[i][1] - W3[i - 1][1])*(e - W3[i - 1][0]) / (W3[i][0] - W3[i - 1][0]));
- return sigma;
- }
- }
- if (W3[19][0] < e) {
- sigma = 0;
- return sigma;
- }
- if (W3[0][0] > e) {
- sigma = 0;
- return sigma;
- }
- }
- else if (type == "w4") {
- for (int i = 0; i < 18; i++) {
- if (W4[i][0] == e) {
- sigma = W4[i][1];
- return sigma;
- }
- if (W4[i][0] > e) {
- sigma = (W4[i - 1][1] + (W4[i][1] - W4[i - 1][1])*(e - W4[i - 1][0]) / (W4[i][0] - W4[i - 1][0]));
- return sigma;
- }
- }
- if (W4[17][0] < e) {
- sigma = 0;
- return sigma;
- }
- if (W4[0][0] > e) {
- sigma = 0;
- return sigma;
- }
- }
- else if (type == "w5") {
- for (int i = 0; i < 18; i++) {
- if (W5[i][0] == e) {
- sigma = W5[i][1];
- return sigma;
- }
- if (W5[i][0] > e) {
- sigma = (W5[i - 1][1] + (W5[i][1] - W5[i - 1][1])*(e - W5[i - 1][0]) / (W5[i][0] - W5[i - 1][0]));
- return sigma;
- }
- }
- if (W5[17][0] < e) {
- sigma = 0;
- return sigma;
- }
- if (W5[0][0] > e) {
- sigma = 0;
- return sigma;
- }
- }
- else if (type == "w6") {
- for (int i = 0; i < 16; i++) {
- if (W6[i][0] == e) {
- sigma = W6[i][1];
- return sigma;
- }
- if (W6[i][0] > e) {
- sigma = (W6[i - 1][1] + (W6[i][1] - W6[i - 1][1])*(e - W6[i - 1][0]) / (W6[i][0] - W6[i - 1][0]));
- return sigma;
- }
- }
- if (W6[15][0] < e) {
- sigma = 0;
- return sigma;
- }
- if (W6[0][0] > e) {
- sigma = 0;
- return sigma;
- }
- }
- else if (type == "w7") {
- for (int i = 0; i < 18; i++) {
- if (W7[i][0] == e) {
- sigma = W7[i][1];
- return sigma;
- }
- if (W7[i][0] > e) {
- sigma = (W7[i - 1][1] + (W7[i][1] - W7[i - 1][1])*(e - W7[i - 1][0]) / (W7[i][0] - W7[i - 1][0]));
- return sigma;
- }
- }
- if (W7[17][0] < e) {
- sigma = 0;
- return sigma;
- }
- if (W7[0][0] > e) {
- sigma = 0;
- return sigma;
- }
- }
- else if (type == "w8") {
- for (int i = 0; i < 16; i++) {
- if (W8[i][0] == e) {
- sigma = W8[i][1];
- return sigma;
- }
- if (W8[i][0] > e) {
- sigma = (W8[i - 1][1] + (W8[i][1] - W8[i - 1][1])*(e - W8[i - 1][0]) / (W8[i][0] - W8[i - 1][0]));
- return sigma;
- }
- }
- if (W8[15][0] < e) {
- sigma = 0;
- return sigma;
- }
- if (W8[0][0] > e) {
- sigma = 0;
- return sigma;
- }
- }
- else if (type == "E1") {
- for (int i = 0; i < 24; i++) {
- if (CS_Ex_1[i][0] == e) {
- sigma = CS_Ex_1[i][1];
- return sigma;
- }
- if (CS_Ex_1[i][0] > e) {
- sigma = (CS_Ex_1[i - 1][1] + (CS_Ex_1[i][1] - CS_Ex_1[i - 1][1])*(e - CS_Ex_1[i - 1][0]) / (CS_Ex_1[i][0] - CS_Ex_1[i - 1][0]));
- return sigma;
- }
- }
- if (CS_Ex_1[23][0] < e) {
- sigma = 0;
- }
- if (CS_Ex_1[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "E2") {
- for (int i = 0; i < 24; i++) {
- if (CS_Ex_2[i][0] == e) {
- sigma = CS_Ex_2[i][1];
- return sigma;
- }
- if (CS_Ex_2[i][0] > e) {
- sigma = (CS_Ex_2[i - 1][1] + (CS_Ex_2[i][1] - CS_Ex_2[i - 1][1])*(e - CS_Ex_2[i - 1][0]) / (CS_Ex_2[i][0] - CS_Ex_2[i - 1][0]));
- return sigma;
- }
- }
- if (CS_Ex_2[23][0] < e) {
- sigma = 0;
- }
- if (CS_Ex_2[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "E3") {
- for (int i = 0; i < 24; i++) {
- if (CS_Ex_3[i][0] == e) {
- sigma = CS_Ex_3[i][1];
- return sigma;
- }
- if (CS_Ex_3[i][0] > e) {
- sigma = (CS_Ex_3[i - 1][1] + (CS_Ex_3[i][1] - CS_Ex_3[i - 1][1])*(e - CS_Ex_3[i - 1][0]) / (CS_Ex_3[i][0] - CS_Ex_3[i - 1][0]));
- return sigma;
- }
- }
- if (CS_Ex_3[23][0] < e) {
- sigma = 0;
- }
- if (CS_Ex_3[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "E4") {
- for (int i = 0; i < 24; i++) {
- if (CS_Ex_4[i][0] == e) {
- sigma = CS_Ex_4[i][1];
- return sigma;
- }
- if (CS_Ex_4[i][0] > e) {
- sigma = (CS_Ex_4[i - 1][1] + (CS_Ex_4[i][1] - CS_Ex_4[i - 1][1])*(e - CS_Ex_4[i - 1][0]) / (CS_Ex_4[i][0] - CS_Ex_4[i - 1][0]));
- return sigma;
- }
- }
- if (CS_Ex_4[23][0] < e) {
- sigma = 0;
- }
- if (CS_Ex_4[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "E5") {
- for (int i = 0; i < 24; i++) {
- if (CS_Ex_5[i][0] == e) {
- sigma = CS_Ex_5[i][1];
- return sigma;
- }
- if (CS_Ex_5[i][0] > e) {
- sigma = (CS_Ex_5[i - 1][1] + (CS_Ex_5[i][1] - CS_Ex_5[i - 1][1])*(e - CS_Ex_5[i - 1][0]) / (CS_Ex_5[i][0] - CS_Ex_5[i - 1][0]));
- return sigma;
- }
- }
- if (CS_Ex_5[23][0] < e) {
- sigma = 0;
- }
- if (CS_Ex_5[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "E6") {
- for (int i = 0; i < 24; i++) {
- if (CS_Ex_6[i][0] == e) {
- sigma = CS_Ex_6[i][1];
- return sigma;
- }
- if (CS_Ex_6[i][0] > e) {
- sigma = (CS_Ex_6[i - 1][1] + (CS_Ex_6[i][1] - CS_Ex_6[i - 1][1])*(e - CS_Ex_6[i - 1][0]) / (CS_Ex_6[i][0] - CS_Ex_6[i - 1][0]));
- return sigma;
- }
- }
- if (CS_Ex_6[23][0] < e) {
- sigma = 0;
- }
- if (CS_Ex_6[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "E7") {
- for (int i = 0; i < 24; i++) {
- if (CS_Ex_7[i][0] == e) {
- sigma = CS_Ex_7[i][1];
- return sigma;
- }
- if (CS_Ex_7[i][0] > e) {
- sigma = (CS_Ex_7[i - 1][1] + (CS_Ex_7[i][1] - CS_Ex_7[i - 1][1])*(e - CS_Ex_7[i - 1][0]) / (CS_Ex_7[i][0] - CS_Ex_7[i - 1][0]));
- return sigma;
- }
- }
- if (CS_Ex_7[23][0] < e) {
- sigma = 0;
- }
- if (CS_Ex_7[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "E8") {
- for (int i = 0; i < 18; i++) {
- if (CS_Ex_8[i][0] == e) {
- sigma = CS_Ex_8[i][1];
- return sigma;
- }
- if (CS_Ex_8[i][0] > e) {
- sigma = (CS_Ex_8[i - 1][1] + (CS_Ex_8[i][1] - CS_Ex_8[i - 1][1])*(e - CS_Ex_8[i - 1][0]) / (CS_Ex_8[i][0] - CS_Ex_8[i - 1][0]));
- return sigma;
- }
- }
- if (CS_Ex_8[17][0] < e) {
- sigma = 0;
- }
- if (CS_Ex_8[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "E9") {
- for (int i = 0; i < 28; i++) {
- if (CS_Ex_9[i][0] == e) {
- sigma = CS_Ex_9[i][1];
- return sigma;
- }
- if (CS_Ex_9[i][0] > e) {
- sigma = (CS_Ex_9[i - 1][1] + (CS_Ex_9[i][1] - CS_Ex_9[i - 1][1])*(e - CS_Ex_9[i - 1][0]) / (CS_Ex_9[i][0] - CS_Ex_9[i - 1][0]));
- return sigma;
- }
- }
- if (CS_Ex_9[27][0] < e) {
- sigma = 0;
- }
- if (CS_Ex_9[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "E10") {
- for (int i = 0; i < 16; i++) {
- if (CS_Ex_10[i][0] == e) {
- sigma = CS_Ex_10[i][1];
- return sigma;
- }
- if (CS_Ex_10[i][0] > e) {
- sigma = (CS_Ex_10[i - 1][1] + (CS_Ex_10[i][1] - CS_Ex_10[i - 1][1])*(e - CS_Ex_10[i - 1][0]) / (CS_Ex_10[i][0] - CS_Ex_10[i - 1][0]));
- return sigma;
- }
- }
- if (CS_Ex_10[15][0] < e) {
- sigma = 0;
- }
- if (CS_Ex_10[0][0] > e) {
- sigma = 0;
- }
- }
- else if (type == "E11") {
- for (int i = 0; i < 24; i++) {
- if (CS_Ex_11[i][0] == e) {
- sigma = CS_Ex_11[i][1];
- return sigma;
- }
- if (CS_Ex_11[i][0] > e) {
- sigma = (CS_Ex_11[i - 1][1] + (CS_Ex_11[i][1] - CS_Ex_11[i - 1][1])*(e - CS_Ex_11[i - 1][0]) / (CS_Ex_11[i][0] - CS_Ex_11[i - 1][0]));
- return sigma;
- }
- }
- if (CS_Ex_11[23][0] < e) {
- sigma = 0;
- }
- if (CS_Ex_11[0][0] > e) {
- sigma = 0;
- }
- }
- return sigma;
- }
- void main() {
- double Cmaxwell = pow((2*PI*m*T0),-1.5); // константа в функции распределения максвелла
- init();
- double **C_S = new double*[13];
- for (int i = 0; i < 21; i++) {
- C_S[i] = new double[M];
- }
- for (int j = 0; j < M; j++) {
- C_S[0][j] = cs(h*j, "t");
- C_S[1][j] = cs(h*j, "r");
- C_S[2][j] = cs(h*j, "E1");
- C_S[3][j] = cs(h*j, "E2");
- C_S[4][j] = cs(h*j, "E3");
- C_S[5][j] = cs(h*j, "E4");
- C_S[6][j] = cs(h*j, "E5");
- C_S[7][j] = cs(h*j, "E6");
- C_S[8][j] = cs(h*j, "E7");
- C_S[9][j] = cs(h*j, "E8");
- C_S[10][j] = cs(h*j, "E9");
- C_S[11][j] = cs(h*j, "E10");
- C_S[12][j] = cs(h*j, "E11");
- C_S[13][j] = cs(h*j, "w1");
- C_S[14][j] = cs(h*j, "w2");
- C_S[15][j] = cs(h*j, "w3");
- C_S[16][j] = cs(h*j, "w4");
- C_S[17][j] = cs(h*j, "w5");
- C_S[18][j] = cs(h*j, "w6");
- C_S[19][j] = cs(h*j, "w7");
- C_S[20][j] = cs(h*j, "w8");
- }
- FILE *FREE; FREE = fopen("C:\\FREE.txt", "w");
- FILE *integral; integral = fopen("C:\\integral.txt", "w");
- double A, B, C, D, E, Lambda; // константы в изначальной разностной схеме
- double C1, C2, C3, C4; // контанты в конечной разностной схеме
- double I = 0; // нормировочный интеграл
- double Fp[M], Fn[M]; // Fp - предыдуший шаг по времени, Fn - следующий шаг по времени
- double F[z][M]; // массив куда записывается функция распределения на нужных шагах
- // пороги возбуждения электронных уровней
- int Ts_Ex_1 = (int)floor(6.17 / h);
- int Ts_Ex_2 = (int)floor(7 / h);
- int Ts_Ex_3 = (int)floor(7.35 / h);
- int Ts_Ex_4 = (int)floor(7.36 / h);
- int Ts_Ex_5 = (int)floor(8.16 / h);
- int Ts_Ex_6 = (int)floor(8.4 / h);
- int Ts_Ex_7 = (int)floor(8.55 / h);
- int Ts_Ex_8 = (int)floor(8.89 / h);
- int Ts_Ex_9 = (int)floor(11.03 / h);
- int Ts_Ex_10 = (int)floor(11.87 / h);
- int Ts_Ex_11 = (int)floor(12.25 / h);
- int TS_Vibr_01 = (int)floor(0.3 / h);
- int TS_Vibr_02 = (int)floor(1.8 / h);
- int TS_Vibr_03 = (int)floor(2 / h);
- int TS_Vibr_04 = (int)floor(2.1 / h);
- int TS_Vibr_05 = (int)floor(2.2 / h);
- int TS_Vibr_06 = (int)floor(2.3 / h);
- int TS_Vibr_07 = (int)floor(2.4 / h);
- int TS_Vibr_08 = (int)floor(2.6 / h);
- double SUM_CS_VIBR = 0; //сумма сечений колебательного возбуждения
- double VIBR_1_01, VIBR_1_02, VIBR_1_03, VIBR_1_04, VIBR_1_05, VIBR_1_06, VIBR_1_07, VIBR_1_08 ;//константа для прямых ударов второго рода
- double VIBR_2_01, VIBR_2_02, VIBR_2_03, VIBR_2_04, VIBR_2_05, VIBR_2_06, VIBR_2_07, VIBR_2_08 ; //константы для обратных ударов второго рода
- double SUM_VIBR1 = 0; // сумма констант для прямых ударов второго рода
- double SUM_VIBR2 = 0; // сумма констант для обратных ударов первого рода
- double SUM_VIBR3 = 0; //сумма для констант обратных ударов второго рода
- double G, G1, G2, G3, G4, G5, G6, G7, G8, G9, G10, G11; //отн. засел. колеб. сост
- double G0; //отн. засел. эл. сост
- double Ex_sum = 0; //сумма сечений колебательного возбуждения
- double Ex1 = 0, Ex2 = 0, Ex3 = 0, Ex4 = 0, Ex5 = 0, Ex6 = 0, Ex7 = 0, Ex8 = 0, Ex9 = 0, Ex10 = 0, Ex11 = 0; //константа колебательного возбуждения для ударов второго рода
- double SUM_EX = 0; // сумма констант прямых ударов второго рода
- double PartFun = 0.847037;
- A = sqrt(m / 2)*sqrt(eps0)/n0;
- B = ((q*En*1e-19)*(q*En*1e-19))/ (9*3 * eps0);
- C = d*T0*eps0;
- D = d*eps0;
- E = 4 * B0*eps0;
- G = eps0*exp((hw0*pow((0 + 0.5),2) - hw*(0 + 0.5))/Tk)/ PartFun;
- G1 = eps0*exp((hw0*pow((1 + 0.5), 2) - hw*(1 + 0.5)) / Tk) / PartFun;
- G2 = eps0*exp((hw0*pow((2 + 0.5), 2) - hw*(2 + 0.5)) / Tk) / PartFun;
- G3 = eps0*exp((hw0*pow((3 + 0.5), 2) - hw*(3 + 0.5)) / Tk) / PartFun;
- G4 = eps0*exp((hw0*pow((4 + 0.5), 2) - hw*(4 + 0.5)) / Tk) / PartFun;
- G5 = eps0*exp((hw0*pow((5 + 0.5), 2) - hw*(5 + 0.5)) / Tk) / PartFun;
- G6 = eps0*exp((hw0*pow((6 + 0.5), 2) - hw*(6 + 0.5)) / Tk) / PartFun;
- G7 = eps0*exp((hw0*pow((7 + 0.5), 2) - hw*(7 + 0.5)) / Tk) / PartFun;
- G8 = eps0*exp((hw0*pow((8 + 0.5), 2) - hw*(8 + 0.5)) / Tk) / PartFun;
- G9 = eps0*exp((hw0*pow((9 + 0.5), 2) - hw*(9 + 0.5)) / Tk) / PartFun;
- G10 = eps0*exp((hw0*pow((10 + 0.5), 2) - hw*(10 + 0.5)) / Tk) / PartFun;
- G11 = eps0*exp((hw0*pow((11 + 0.5), 2) - hw*(11 + 0.5)) / Tk) / PartFun;
- G0 = eps0 * 1 / 1.07674; //Электронные состояния
- Lambda = 2 * PI*pow(q, 4)*(ne / n0)*logL;
- for (int j = 0; j < M; j++) { //начальное условие
- Fp[j] = 2 * PI*pow(2 * m, 1.5)*Cmaxwell*exp(-h*j / T0);
- }
- for (int i = 1; i < N; i++) {
- for (int j = 1; j < M - 1; j++) {
- C1 = (B*(h*j) / C_S[0][j]) + C*(h*j)*(h*j)*C_S[0][j];
- C2 = D*(h*j)*(h*j)*C_S[0][j] + E*(h*j)*C_S[1][j];
- C3 = B*(C_S[0][j] - j*(C_S[0][j+1] - C_S[0][j])) / (C_S[0][j] * C_S[0][j]) +2 * C*(h*j)*C_S[0][j] + C*(h*j)*(j)*(C_S[0][j+1] - C_S[0][j]) + C2;
- C4 = 2 * D*(h*j)*C_S[0][j] + D*(h*j)*(j)*(C_S[0][j+1] - C_S[0][j]) + E*C_S[1][j] + E*(j)*(C_S[1][j+1] - C_S[1][j]);
- if (j + Ts_Ex_1 < M) {
- Ex1 = (h*j + 6.17)*C_S[2][j + Ts_Ex_1] * Fp[j + Ts_Ex_1];
- }
- else (Ex1 = 0);
- if (j + Ts_Ex_2 < M) {
- Ex2 = (h*j + 7)*C_S[3][j + Ts_Ex_2] * Fp[j + Ts_Ex_2];
- }
- else (Ex2 = 0);
- if (j + Ts_Ex_3 < M) {
- Ex3 = (h*j + 7.35)*C_S[4][j + Ts_Ex_3] * Fp[j + Ts_Ex_3];
- }
- else (Ex3 = 0);
- if (j + Ts_Ex_4 < M) {
- Ex4 = (h*j + 7.36)*C_S[5][j + Ts_Ex_4] * Fp[j + Ts_Ex_4];
- }
- else (Ex4 = 0);
- if (j + Ts_Ex_5 < M) {
- Ex5 = (h*j + 8.16)*C_S[6][j + Ts_Ex_5] * Fp[j + Ts_Ex_5];
- }
- else (Ex5 = 0);
- if (j + Ts_Ex_6 < M) {
- Ex6 = (h*j + 8.4)*C_S[7][j + Ts_Ex_6] * Fp[j + Ts_Ex_6];
- }
- else (Ex6 = 0);
- if (j + Ts_Ex_7 < M) {
- Ex7 = (h*j + 8.55)*C_S[8][j + Ts_Ex_7] * Fp[j + Ts_Ex_7];
- }
- else (Ex7 = 0);
- if (j + Ts_Ex_8 < M) {
- Ex8 = (h*j + 8.89)*C_S[9][j + Ts_Ex_8] * Fp[j + Ts_Ex_8];
- }
- else (Ex8 = 0);
- if (j + Ts_Ex_9 < M) {
- Ex9 = (h*j + 11.03)*C_S[10][j + Ts_Ex_9] * Fp[j + Ts_Ex_9];
- }
- else (Ex9 = 0);
- if (j + Ts_Ex_10 < M) {
- Ex10 = (h*j + 11.87)*C_S[11][j + Ts_Ex_10] * Fp[j + Ts_Ex_10];
- }
- else (Ex10 = 0);
- if (j + Ts_Ex_11 < M) {
- Ex11 = (h*j + 12.25)*C_S[12][j + Ts_Ex_11] * Fp[j + Ts_Ex_11];
- }
- else (Ex11 = 0);
- SUM_EX = Ex1 + Ex2 + Ex3 + Ex4 + Ex5 + Ex6 + Ex7 + Ex8 + Ex9 + Ex10 + Ex11;
- Ex_sum = C_S[2][j] + C_S[3][j] + C_S[4][j] + C_S[5][j] + C_S[6][j] + C_S[7][j] + C_S[8][j] + C_S[9][j] + C_S[10][j] + C_S[11][j] + C_S[12][j];
- if (j + TS_Vibr_01 < M) {
- VIBR_1_01 = (h*j + 0.3)*C_S[13][j + TS_Vibr_01];
- }
- else (VIBR_1_01 = 0);
- if (j + TS_Vibr_02 < M) {
- VIBR_1_02 = (h*j + 1.8)*C_S[14][j + TS_Vibr_02];
- }
- else (VIBR_1_02 = 0);
- if (j + TS_Vibr_03 < M) {
- VIBR_1_03 = (h*j + 2)*C_S[15][j + TS_Vibr_03];
- }
- else (VIBR_1_03 = 0);
- if (j + TS_Vibr_04 < M) {
- VIBR_1_04 = (h*j + 2.1)*C_S[16][j + TS_Vibr_04];
- }
- else (VIBR_1_04 = 0);
- if (j + TS_Vibr_05 < M) {
- VIBR_1_05 = (h*j + 2.2)*C_S[17][j + TS_Vibr_05];
- }
- else (VIBR_1_05 = 0);
- if (j + TS_Vibr_06 < M) {
- VIBR_1_06 = (h*j + 2.3)*C_S[18][j + TS_Vibr_06];
- }
- else (VIBR_1_06 = 0);
- if (j + TS_Vibr_07 < M) {
- VIBR_1_07 = (h*j + 2.4)*C_S[19][j + TS_Vibr_07];
- }
- else (VIBR_1_07 = 0);
- if (j + TS_Vibr_08 < M) {
- VIBR_1_08 = (h*j + 2.6)*C_S[20][j + TS_Vibr_08];
- }
- else (VIBR_1_08 = 0);
- if (j - TS_Vibr_01 >= 0) {
- VIBR_2_01 = C_S[13][j] * Fp[j - TS_Vibr_01];
- }
- else (VIBR_2_01 = 0);
- if (j - TS_Vibr_02 >= 0) {
- VIBR_2_02 = C_S[14][j] * Fp[j - TS_Vibr_02];
- }
- else (VIBR_2_02 = 0);
- if (j - TS_Vibr_03 >= 0) {
- VIBR_2_03 = C_S[15][j] * Fp[j - TS_Vibr_03];
- }
- else (VIBR_2_03 = 0);
- if (j - TS_Vibr_04 >= 0) {
- VIBR_2_04 = C_S[16][j] * Fp[j - TS_Vibr_04];
- }
- else (VIBR_2_04 = 0);
- if (j - TS_Vibr_05 >= 0) {
- VIBR_2_05 = C_S[17][j] * Fp[j - TS_Vibr_05];
- }
- else (VIBR_2_05 = 0);
- if (j - TS_Vibr_06 >= 0) {
- VIBR_2_06 = C_S[18][j] * Fp[j - TS_Vibr_06];
- }
- else (VIBR_2_06 = 0);
- if (j - TS_Vibr_07 >= 0) {
- VIBR_2_07 = C_S[19][j] * Fp[j - TS_Vibr_07];
- }
- else (VIBR_2_07 = 0);
- if (j - TS_Vibr_08 >= 0) {
- VIBR_2_08 = C_S[20][j] * Fp[j - TS_Vibr_08];
- }
- else (VIBR_2_08 = 0);
- SUM_VIBR1 = VIBR_1_01 * Fp[j + TS_Vibr_01] + VIBR_1_02 * Fp[j + TS_Vibr_02] + VIBR_1_03 * Fp[j + TS_Vibr_03] +
- VIBR_1_04 * Fp[j + TS_Vibr_04] + VIBR_1_05 * Fp[j + TS_Vibr_05] + VIBR_1_06 * Fp[j + TS_Vibr_06] + VIBR_1_07 * Fp[j + TS_Vibr_07] + VIBR_1_08 * Fp[j + TS_Vibr_08];
- SUM_CS_VIBR = C_S[13][j] + C_S[14][j] + C_S[15][j] + C_S[16][j] + C_S[17][j] + C_S[18][j] + C_S[19][j] + C_S[20][j];
- SUM_VIBR2 = G1*VIBR_1_01*exp(hw/Tk) + G2*VIBR_1_02*exp(2*hw/Tk) + G3*VIBR_1_03*exp(3*hw/Tk) + G4*VIBR_1_04*exp(4*hw/Tk) + G5*VIBR_1_05*exp(5*hw/Tk) + G6*VIBR_1_06*exp(6*hw/Tk) + G7*VIBR_1_07*exp(7*hw/Tk) + G8*VIBR_1_08*exp(8*hw/Tk);
- SUM_VIBR3 = G1*VIBR_2_01*exp(hw/Tk) + G2*VIBR_2_02*exp(2*hw/Tk) + G3*VIBR_2_03*exp(3*hw/Tk) + G4*VIBR_2_04*exp(4*hw/Tk) + G5*VIBR_2_05*(5*hw/Tk) + G6*VIBR_2_06*(6*hw/Tk) + G7*VIBR_2_07*exp(7*hw/Tk) + G8*VIBR_2_08*exp(8*hw/Tk);
- Fn[j] = Fp[j] + (t / (A*sqrt(h*j))) * ((Fp[j+1]+Fp[j-1] - 2*Fp[j])*C1/(h*h) + (Fp[j]-Fp[j-1])*C3/h + Fp[j]*C4
- - G0*(h*j)*Fp[j] * Ex_sum + G0*SUM_EX
- - G*(h*j)*Fp[j] * SUM_CS_VIBR + G*SUM_VIBR1
- -SUM_VIBR2*Fp[j] + (h*j)*SUM_VIBR3);
- if (i == 2) { F[0][j] = Fn[j]; }
- if (i == 10) { F[1][j] = Fn[j]; }
- if (i == 100) { F[2][j] = Fn[j]; }
- if (i == 1000) { F[3][j] = Fn[j]; }
- if (i == 10000) { F[4][j] = Fn[j]; }
- if (i == 100000) { F[5][j] = Fn[j]; }
- if (i == 1000000) { F[6][j] = Fn[j]; }
- if (i == 10000000) { F[7][j] = Fn[j]; }
- // if (i == 100000000) { F[8][j] = Fn[j]; }
- I = I + Fn[j] * sqrt(h*j)*h;
- // printf("%e\n", SUM_VIBR3);
- // Sleep(0);
- }
- // printf("\n");
- // Sleep(1000);
- Fn[M - 1] = 0; // Добавили граничные условия справа
- Fn[0] = Fn[1]; // и слева
- // I = I * (2 * PI)*pow((2 * m), 1.5);
- for (int j = 0; j < M; j++) {
- Fp[j] = Fn[j];
- }
- // printf("%e\n", I);
- // Sleep(10000);
- I = 0;
- }
- for (int j = 0; j < M; j++) {
- for (int i = 0; i < z; i = i++) {
- F[i][0] = F[i][1];
- F[i][M - 1] = 0;
- fprintf(FREE, "%e\t", F[i][j]);
- }
- fprintf(FREE, "\n");
- }
- for (int i = 0; i < 2; i++) {
- delete[]C_S[i];
- }
- fclose(FREE);
- fclose(integral);
- }
Add Comment
Please, Sign In to add comment