From 517c551bf5c46847971b1bcff1a9d8a230fe650c Mon Sep 17 00:00:00 2001 From: Anton Kamalov Date: Thu, 15 May 2025 00:35:37 +0300 Subject: [PATCH 1/3] USTAL --- MemMAPR_winda.vcxproj | 1 + src/Solver.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/MemMAPR_winda.vcxproj b/MemMAPR_winda.vcxproj index 3f8476d..c1c60de 100644 --- a/MemMAPR_winda.vcxproj +++ b/MemMAPR_winda.vcxproj @@ -111,6 +111,7 @@ true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true + ./include Console diff --git a/src/Solver.cpp b/src/Solver.cpp index 2f3284a..93eded0 100644 --- a/src/Solver.cpp +++ b/src/Solver.cpp @@ -1,6 +1,6 @@ #include "Solver.hpp" -void Solver::SolveExplicit(System& program, double tstop) const { - std::ofstream output(filename_expl); +void Solver::SolveImplicit(System& program, double tstop) const { + std::ofstream output(filename_impl); //output << "t x y T" << std::endl; for (double t = 0.0; t < tstop; t += delta) { @@ -50,8 +50,8 @@ void Solver::SolveExplicit(System& program, double tstop) const { } } -void Solver::SolveImplicit(System& sys, double tstop) const { - std::ofstream output(filename_impl); +void Solver::SolveExplicit(System& sys, double tstop) const { + std::ofstream output(filename_expl); //output << "t x y T" << std::endl; for (double t = 0.; t < tstop; t += delta) { @@ -66,7 +66,7 @@ void Solver::SolveImplicit(System& sys, double tstop) const { 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); - double t = delta * (tx + ty) + node->T(); + double t = delta * (tx + ty) * sys.a1()/pow(sys.step(), 2) + node->T(); node->SetT(t); } } From 8811ca53446525de341cce45ae9f7f56a5cff8e2 Mon Sep 17 00:00:00 2001 From: Anton Kamalov Date: Thu, 15 May 2025 01:19:28 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF=D1=80=D0=BE=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D1=81=D1=82=D0=B2=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MemMAPR_winda.sln | 10 +--------- include/System.hpp | 8 +++----- src/Solver.cpp | 18 +++++++++--------- src/main.cpp | 12 ++++++------ 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/MemMAPR_winda.sln b/MemMAPR_winda.sln index 7b8044a..337f9ab 100644 --- a/MemMAPR_winda.sln +++ b/MemMAPR_winda.sln @@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35707.178 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Main_program", "MemMAPR_winda.vcxproj", "{86DC468D-3A9F-48AB-80FC-059A120499AA}" -EndProject -Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "MemMAPR_visual", "..\MemMAPR_visual\MemMAPR_visual.pyproj", "{C56779D9-6429-49A0-8E09-0AE6A666EA21}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MemMAPR_main", "MemMAPR_winda.vcxproj", "{86DC468D-3A9F-48AB-80FC-059A120499AA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -29,12 +27,6 @@ Global {86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|x64.Build.0 = Release|x64 {86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|x86.ActiveCfg = Release|Win32 {86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|x86.Build.0 = Release|Win32 - {C56779D9-6429-49A0-8E09-0AE6A666EA21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C56779D9-6429-49A0-8E09-0AE6A666EA21}.Debug|x64.ActiveCfg = Debug|Any CPU - {C56779D9-6429-49A0-8E09-0AE6A666EA21}.Debug|x86.ActiveCfg = Debug|Any CPU - {C56779D9-6429-49A0-8E09-0AE6A666EA21}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C56779D9-6429-49A0-8E09-0AE6A666EA21}.Release|x64.ActiveCfg = Release|Any CPU - {C56779D9-6429-49A0-8E09-0AE6A666EA21}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/include/System.hpp b/include/System.hpp index c56be73..8d513bd 100644 --- a/include/System.hpp +++ b/include/System.hpp @@ -6,18 +6,16 @@ class System{ Object& _obj; Mesh _mesh; - double _a1; - double _a2; + double _a; double _step; public: -System(Object& obj, double step = 10., double a1 = 1., double a2 = 1.): _obj(obj), _mesh(obj, step), _a1(a1), _a2(a2), _step(step) {} +System(Object& obj, double step = 10., double a1 = 1.): _obj(obj), _mesh(obj, step), _a(a1), _step(step) {} void DefineBounds(int, int, int, int); std::vector>& Nodes(); std::vector& LineX(); std::vector& LineY(); double step() const { return _step; } - double a1() const { return _a1; }; - double a2() const { return _a2; }; + double a() const { return _a; }; }; #endif diff --git a/src/Solver.cpp b/src/Solver.cpp index 93eded0..fbbbec4 100644 --- a/src/Solver.cpp +++ b/src/Solver.cpp @@ -66,7 +66,7 @@ void Solver::SolveExplicit(System& sys, double tstop) const { 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); - double t = delta * (tx + ty) * sys.a1()/pow(sys.step(), 2) + node->T(); + double t = delta * (tx + ty) * sys.a()/pow(sys.step(), 2) + node->T(); node->SetT(t); } } @@ -85,17 +85,17 @@ void Solver::SolveLine(System& sys, std::vector& n) const { /* Защита от нуля */ if (mu2 == 0.) mu2 = .1; - double val2 = -(2 * sys.a1()) / (pow(sys.step(), 2)) - 1 / delta; - double val1 = sys.a1() / (pow(sys.step(), 2)); + double val2 = -(2 * sys.a()) / (pow(sys.step(), 2)) - 1 / delta; + double val1 = sys.a() / (pow(sys.step(), 2)); std::vector> _Temperature(size); std::vector right(size); for (int i = 0; i < _Temperature.size(); i++) _Temperature[i].resize(3, 0.0); - _Temperature[0][0] = -(2 * sys.a1()) / (mu1 * pow(sys.step(), 2)) - 1 / delta; /* Первый узел по X */ - _Temperature[0][1] = (2 * sys.a1()) / ((mu1 + 1) * pow(sys.step(), 2)); /* Первый узел по Y */ - _Temperature.back()[1] = (2 * sys.a1()) / ((mu2 + 1) * pow(sys.step(), 2)); - _Temperature.back()[2] = -(2 * sys.a1()) / (mu2 * pow(sys.step(), 2)) - 1 / delta; + _Temperature[0][0] = -(2 * sys.a()) / (mu1 * pow(sys.step(), 2)) - 1 / delta; /* Первый узел по X */ + _Temperature[0][1] = (2 * sys.a()) / ((mu1 + 1) * pow(sys.step(), 2)); /* Первый узел по Y */ + _Temperature.back()[1] = (2 * sys.a()) / ((mu2 + 1) * pow(sys.step(), 2)); + _Temperature.back()[2] = -(2 * sys.a()) / (mu2 * pow(sys.step(), 2)) - 1 / delta; for (int i = 1; i < size - 1; i++) { _Temperature[i][0] = val1; @@ -105,8 +105,8 @@ void Solver::SolveLine(System& sys, std::vector& n) const { for (int i = 0; i < right.size(); i++) right[i] = -n[i + 1]->T() / delta; - right.front() += -(2 * sys.a1() * n.front()->T()) / (mu1 * (mu1 + 1) * pow(sys.step(), 2)); - right.back() += -(2 * sys.a1() * n.back()->T()) / (mu2 * (mu2 + 1) * pow(sys.step(), 2)); + 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 tmps = ThomasMethod(_Temperature, right); for (int i = 0; i < tmps.size(); i++) n[i + 1]->SetT(tmps[i]); diff --git a/src/main.cpp b/src/main.cpp index eab61bf..4bf4d80 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,7 @@ #define HOLE_Y 255. #define HOLE_RADIUS 50. -#define CONDUCTIVITY 50. // Теплопроводность материала +#define CONDUCTIVITY 90. // Теплопроводность материала void visualize(std::ofstream& file, std::string filename, int time_end) { file << "set cbrange [" << 0 << ":" << 100 << "]" << std::endl; @@ -36,12 +36,12 @@ int main() 3 - конвекция 4 - отсутствует */ - int left = 3; - int top = 1; - int right = 3; - int bottom = 1; + int left = 1; + int top = 3; + int right = 1; + int bottom = 3; int arc_bound = 3; - int hole_bound = 1; + int hole_bound = 2; double step_5 = 5; double step_10 = 10; From 7c53da719967720290f257ca0382c81628982cf1 Mon Sep 17 00:00:00 2001 From: Anton Kamalov Date: Thu, 15 May 2025 01:24:54 +0300 Subject: [PATCH 3/3] fix --- src/Solver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Solver.cpp b/src/Solver.cpp index fbbbec4..9f7beb5 100644 --- a/src/Solver.cpp +++ b/src/Solver.cpp @@ -66,7 +66,7 @@ void Solver::SolveExplicit(System& sys, double tstop) const { 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); - double t = delta * (tx + ty) * sys.a()/pow(sys.step(), 2) + node->T(); + double t = delta * (tx + ty) * sys.a() + node->T(); node->SetT(t); } }