This commit is contained in:
2025-05-15 02:00:37 +03:00
parent 7c53da7199
commit 6482df0727
13 changed files with 205 additions and 206 deletions

View File

@@ -61,8 +61,7 @@ void Solver::SolveExplicit(System& sys, double tstop) const {
if (!node->IsBound()) {
/* Tx = T_right - 2T_current + T_left / delta_x ^ 2 */
/* Ty = T_upper - 2T_current + T_down / delta_y ^ 2*/
/* T_new = delta_t * a * (delta_x + delta_y) + T_current
(для удобства коээфициент a = 1) */
/* T_new = delta_t * a * (delta_x + delta_y) + T_current */
double tx = (node->r()->T() - 2 * node->T() + node->l()->T()) / pow(sys.step(), 2);
double ty = (node->u()->T() - 2 * node->T() + node->d()->T()) / pow(sys.step(), 2);
@@ -107,12 +106,12 @@ void Solver::SolveLine(System& sys, std::vector<Node*>& n) const {
right[i] = -n[i + 1]->T() / delta;
right.front() += -(2 * sys.a() * n.front()->T()) / (mu1 * (mu1 + 1) * pow(sys.step(), 2));
right.back() += -(2 * sys.a() * n.back()->T()) / (mu2 * (mu2 + 1) * pow(sys.step(), 2));
std::vector<double> tmps = ThomasMethod(_Temperature, right);
for (int i = 0; i < tmps.size(); i++)
n[i + 1]->SetT(tmps[i]);
std::vector<double> tmp = ThomasMethod(_Temperature, right);
for (int i = 0; i < tmp.size(); i++)
n[i + 1]->SetT(tmp[i]);
}
/* Метод прогонки для численного решения СЛАУ */
std::vector<double> Solver::ThomasMethod(std::vector<std::vector<double>>& A, std::vector<double>& b) const {
int row = b.size() - 1;