Оптимизация пространства

This commit is contained in:
Anton Kamalov
2025-05-15 01:19:28 +03:00
parent 517c551bf5
commit 8811ca5344
4 changed files with 19 additions and 29 deletions

View File

@@ -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

View File

@@ -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<std::vector<Node*>>& Nodes();
std::vector<Node*>& LineX();
std::vector<Node*>& LineY();
double step() const { return _step; }
double a1() const { return _a1; };
double a2() const { return _a2; };
double a() const { return _a; };
};
#endif

View File

@@ -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<Node*>& 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<std::vector<double>> _Temperature(size);
std::vector<double> 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<Node*>& 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<double> tmps = ThomasMethod(_Temperature, right);
for (int i = 0; i < tmps.size(); i++)
n[i + 1]->SetT(tmps[i]);

View File

@@ -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;