Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Моделирование процессов сушки пористых и объемных тел.docx
Скачиваний:
2
Добавлен:
22.06.2024
Размер:
342.55 Кб
Скачать

Приложение

Код программы:

using System;

using System.IO;

class Program

{

const int n = 60000;

static double rove, T0, Sl0, m, p, pz, Tz, rol, cl, rom, cm, lamdal, lamdam, L, D, xs, TOL, h, tkon;

static double[] tau = new double[n + 1], Sl = new double[n + 1], Slp = new double[n + 1];

static double[] ro = new double[n + 1], rop = new double[n + 1], T = new double[n + 1], Tp = new double[n + 1];

static double[] alfa = new double[n + 1], beta = new double[n + 1];

static double Fcmp(int i)

{

return -2 - h * h / (D * tau[i]);

}

static double Ffmp(int i)

{

return -h * h / tau[i] / D * Tp[i];

}

static double Fcms(int i)

{

return -2 - rom * cm * h * h / (lamdam * tau[i]);

}

static double Ffms(int i)

{

return -h * h / tau[i] / lamdam * rom * cm * Tp[i];

}

static double Fcm(int i)

{

return -2 - ((1 - m) * rom * cm + m * rol * cl * Slp[i]) * h * h / (((1 - m) * lamdam + m * lamdal * Slp[i]) * tau[i]);

}

static double Ffm(int i)

{

return -h * h / tau[i] / ((1 - m) * lamdam + m * lamdal * Slp[i]) * ((1 - m) * rom * cm + m * rol * cl * Slp[i]) * Tp[i] + m * L * rol * (Sl[i] - Slp[i]);

}

static void InitializeVariables()

{

tkon = 1000;

time = 0;

rove = 0;

T0 = 20;

Sl0 = 0.05;

m = 0.5;

p = 100000;

pz = 110000;

Tz = 957;

rol = 1000;

cl = 4200;

rom = 925;

cm = 1000;

lamdam = 0.15;

lamdal = 0.65;

L = 2260000;

D = 0.00003;

xs = 0;

TOL = 0.05;

h = TOL / 750;

Sl[0] = Sl0;

Slp[0] = Sl0;

T[0] = T0;

Tp[0] = T0;

ro[0] = 0;

}

static void Main(string[] args)

{

InitializeVariables();

using (StreamWriter f1 = new StreamWriter("T1.txt"), f2 = new StreamWriter("po1.txt"), f3 = new StreamWriter("Sl1.txt"))

{

int y = (int)(TOL / h);

double time = 0;

int i = 1;

tau[1] = 0.0001;

while (time < tkon)

{

CalculatePhysics(i, y);

UpdateVariables(i, y);

WriteToFile(f1, f2, f3, y);

i++;

time += tau[i];

}

Console.WriteLine($"Simulation completed in {time} seconds.");

}

Console.ReadKey();

}

static void CalculatePhysics(int i, int y)

{

// Insert physics calculations here

}

static void UpdateVariables(int i, int y)

{

// Update variables for next iteration

}

static void WriteToFile(StreamWriter f1, StreamWriter f2, StreamWriter f3, int y)

{

for (int j = 0; j <= y; j++)

{

f1.WriteLine(Tp[j]);

f2.WriteLine(rop[j] / 200); // Assuming normalization is needed

f3.WriteLine(Sl[j]);

}

}

}

54