help me with code PLZ

I dont know why am getting mistakes?


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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
  #include <iostream> //1
#include <cmath> //2
#include <fstream> //3
//4
const long N = 50; //radius r, j napravlenie 5
const long Nx = 201; // z = 100 m, i napravlenie 6
void dThomas(long n, double a[], double b[], double c[], double d[], double x[]); //7
int main()//8
{ //9
	double a[N], b[N], c[N], d[N], r[N], z[Nx], T[N], Tb_int[N], Tb_int2[N], T_b[Nx], old_T[N], Nu[Nx], //10
		Eh[N], A[N], dr[N], drr[N], dz[Nx], dzz[Nx], k_f, mu_f, //11
		cp_f, R, U, rho_f, alpha_f, Re, Pe, Pr, Prt, T_0, T_w, Vz[N], Vplus[N], Yplus[N], B[N], E[N]; //12
	int j, i; //13
	//double sum; //14
	//double sum2; //15
	//double sum3; //15
	//double test; //16
	std::ofstream out1; //17
	out1.precision(16); //18
	//19
	A[N] = Eh[N] + 0.325; //20
	k_f = 0.13; //21
	mu_f = 0.01;
	cp_f = 2000.0;
	R = 0.05;
	U = 1.0;
	rho_f = 800.0;
	alpha_f = 0.325;
	Re = 8000.0;
	Pr = mu_f*cp_f / k_f;
	Prt = 0.85 + 0.015 / Pr;
	Pe = Re*Pr;
	T_0 = 50.0;
	T_w = 5.0; //32
	Nu[0] = 0;

	for (j = 0; j <= N - 1; j++)
	{
		dr[0] = 0.1;
		dr[j] = 1.1*dr[j - 1];
		r[j] = R / 1163.9085287969600*dr[j]; // eto chislo summa 
		drr[j] = r[j] - r[j-1]; //40

		Yplus[j] = (1 - r[j] / R)*(Re / 2) * pow(0.0042272297408, 0.5); // chislo f iz Newton
		if ((Yplus[j]) <= 5.0)
		{
			Vplus[j] = Yplus[j]; //45
		}
		else if (0.5 < Yplus[j] <= 30.0)
		{
			Vplus[j] = 5.0*log(Yplus[j]) - 3.05;
		}
		else (Yplus[j] > 30.0); //51
		{
			Vplus[j] = 2.5*log(Yplus[j] + 5.5);
		}
		Vz[j] = Vplus[j] * 0.06501714959; // V* znachenie zavisit ot Newton 55
		old_T[j] = T_0;
		Eh[j] = alpha_f*Pr / Prt*B[j];
		B[j] = E[j] / 0.0000125; // 0.0000125 - kinematic viscosity, m/p B[j] - new const; E-eddy diffusivity


		if (((Yplus[j]) <= 80.0) && ((Yplus[j]) <= 5.0)) //61
		{
			B[j] = pow((0.4*Yplus[j]), 2)*(1 - 2.7183*pow((-Yplus[j] / 26), 2) * 1.0); //63
		}
		if (((Yplus[j]) <= 80.0) && ((0.5 < Yplus[j] <= 30.0)))
		{
			B[j] = pow((0.4*Yplus[j]), 2)*(1 - 2.7183*pow((-Yplus[j] / 26), 2) * 5.0 / Yplus[j]);
		}
		if (((Yplus[j]) <= 80.0) && (Yplus[j] > 30.0))
		{
			B[j] = pow((0.4*Yplus[j]), 2)*(1 - 2.7183*pow((-Yplus[j] / 26), 2) * 2.5 / Yplus[j]); //71
		}
		if ((Yplus[j]) > 80.0);
		{
			B[j] = 0.4*Yplus[j] / 6.0*(1 - r[j] / R)*((1 + 2 * pow((r[j] / R), 2))); //75
		}
	}

	a[0] = 0.0; //79
	a[N - 1] = 0.0;
	b[0] = 1.0;
	b[N - 1] = 1.0;
	c[0] = -1.0;
	c[N - 1] = 0.0;
	d[0] = 0.0;
	d[N - 1] = T_w;
	out1.open("out1.txt");
	out1 << "    z\\r    ";
	for (j = 0; j <= N - 1; j++)
	{
		out1 << r[j] << "     ";
	}
	out1 << "\n";
	out1 << 0.0 << "   ";
	for (j = 0; j <= N - 1; j++)
	{
		out1 << old_T[j] << "    ";
	}
	out1 << "\n";

	for (i = 0; i <= Nx - 1; i++)
	{
		dz[0] = 0.001;
		dz[i] = 0.1*dz[i - 1];
		z[i] = 100 / 2088958.03106511000 * dz[i];
		dzz[i] = dz[i] - dz[i-1];

		out1 << dzz[i] * i << "   ";
		for (j = 1; j <= N - 2; j++)
		{
			a[j] = -1.0*((r[j] * A[j] + (r[j - 1] * A[j - 1])) / (r[j] * drr[j] * (drr[j + 1] + drr[j])));
			b[j] = (Vz[j] / dzz[i]) + (1 / (r[j] * (drr[j + 1] + drr[j])))*((r[j + 1] * A[j] + r[j] * A[j]) / drr[j + 1] + ((drr[j] * A[j] + drr[j - 1] * A[j - 1]) / dr[j]));
			c[j] = -1.0*((r[j] * A[j] + (r[j - 1] * A[j - 1])) / (r[j] * drr[j] * (drr[j + 1] + drr[j])));
			d[j] = old_T[j] / dzz[i] * Vz[j];
		}
		dThomas(N, a, b, c, d, T);
		for (j = 0; j <= N - 1; j++)
		{
			out1 << T[j] << "        ";
		}
	}
}
void dThomas(long n, double a[], double b[], double c[], double d[], double x[])
{
	long i;
	c[0] = c[0] / b[0];
	for (i = 1; i <= n - 1; i++)
	{
		c[i] = c[i] / (b[i] - a[i] * c[i - 1]);
	}
	d[0] = d[0] / b[0];
	for (i = 1; i <= n - 1; i++)
	{
		d[i] = (d[i] - a[i] * d[i - 1]) / (b[i] - a[i] * c[i - 1]);
	}
	x[n - 1] = d[n - 1];
	for (i = n - 2; i >= 0; i--)
	{
		x[i] = d[i] - c[i] * x[i + 1];
	}
}.
closed account (E0p9LyTq)
What is the code supposed to do, and what are the mistakes that are occurring?

Help up to help you by providing more information.
Topic archived. No new replies allowed.