test #1
39
src/main.cpp
39
src/main.cpp
@@ -2,6 +2,8 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <Solver.hpp>
|
#include <Solver.hpp>
|
||||||
|
|
||||||
|
#define STEP 1
|
||||||
|
|
||||||
#define WIDTH 500.
|
#define WIDTH 500.
|
||||||
#define HEIGHT 400.
|
#define HEIGHT 400.
|
||||||
|
|
||||||
@@ -11,8 +13,8 @@
|
|||||||
//#define SQUARE_Y 155.
|
//#define SQUARE_Y 155.
|
||||||
//#define SQUARE_SIDE 100.
|
//#define SQUARE_SIDE 100.
|
||||||
|
|
||||||
#define HOLE_X 355.
|
#define HOLE_X 155.
|
||||||
#define HOLE_Y 155.
|
#define HOLE_Y 255.
|
||||||
#define HOLE_RADIUS 50.
|
#define HOLE_RADIUS 50.
|
||||||
|
|
||||||
#define CONDUCTIVITY 50. // Теплопроводность материала
|
#define CONDUCTIVITY 50. // Теплопроводность материала
|
||||||
@@ -29,42 +31,41 @@ void visualize(std::ofstream& file, std::string filename, int time_end) {
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
/* Граничные условия:
|
/* Граничные условия:
|
||||||
1 - нагрев
|
1 - нагрев
|
||||||
2 - теплоизоляция
|
2 - теплоизоляция
|
||||||
3 - конвекция
|
3 - конвекция
|
||||||
4 - отсутствует
|
4 - отсутствует
|
||||||
*/
|
*/
|
||||||
int left = 3;
|
int left = 1;
|
||||||
int top = 1;
|
int top = 3;
|
||||||
int right = 3;
|
int right = 1;
|
||||||
int bottom = 1;
|
int bottom = 3;
|
||||||
int r2 = 3;
|
int arc_bound = 4;
|
||||||
int s = 3;
|
int hole_bound = 2;
|
||||||
|
|
||||||
double step_5 = 5;
|
double step_5 = 5;
|
||||||
double step_10 = 10;
|
double step_10 = 10;
|
||||||
|
|
||||||
double time_step = 1;
|
|
||||||
double time_end = 100;
|
double time_end = 100;
|
||||||
|
|
||||||
std::map<std::string, double> plate{
|
std::map<std::string, double> plate{
|
||||||
{"a", WIDTH / 2}, {"b", HEIGHT / 2}, {"h_x", 1 / WIDTH}, {"h_y", 1 / HEIGHT}
|
{"a", WIDTH / 2}, {"b", HEIGHT / 2}, {"h_x", 1 / WIDTH}, {"h_y", 1 / HEIGHT}
|
||||||
};
|
};
|
||||||
std::map<std::string, double> arc{
|
std::map<std::string, double> arc{
|
||||||
{"a", WIDTH - ARC_RADIUS}, {"b", HEIGHT - ARC_RADIUS}, {"h_x", 1 / ARC_RADIUS}, {"h_y", 1 / ARC_RADIUS}
|
{"a", WIDTH - ARC_RADIUS}, {"b", HEIGHT - ARC_RADIUS}, {"h_x", 1 / ARC_RADIUS}, {"h_y", 1 / ARC_RADIUS}
|
||||||
};
|
};
|
||||||
std::map<std::string, double> circle{
|
std::map<std::string, double> circle{
|
||||||
{"a", HOLE_X}, {"b", HOLE_Y}, {"h_x", 1 / HOLE_RADIUS}, {"h_y", 1 / HOLE_RADIUS}
|
{"a", HOLE_X}, {"b", HOLE_Y}, {"h_x", 1 / HOLE_RADIUS}, {"h_y", 1 / HOLE_RADIUS}
|
||||||
};
|
};
|
||||||
|
|
||||||
Object obj;
|
Object obj;
|
||||||
obj.Add_Form("Circle", circle, true, s);
|
obj.Add_Form("Circle", circle, true, hole_bound);
|
||||||
obj.Add_Form("Arc", arc, true, r2);
|
obj.Add_Form("Arc", arc, true, arc_bound);
|
||||||
obj.Add_Form("Rectangle", plate, false, 1);
|
obj.Add_Form("Rectangle", plate, false, 1);
|
||||||
|
|
||||||
System explicit5(obj, step_5, CONDUCTIVITY);
|
System explicit5(obj, step_5, CONDUCTIVITY);
|
||||||
System explicit10(obj, step_10, CONDUCTIVITY);
|
System explicit10(obj, step_10, CONDUCTIVITY);
|
||||||
|
|
||||||
System implicit5(obj, step_5, CONDUCTIVITY);
|
System implicit5(obj, step_5, CONDUCTIVITY);
|
||||||
System implicit10(obj, step_10, CONDUCTIVITY);
|
System implicit10(obj, step_10, CONDUCTIVITY);
|
||||||
|
|
||||||
@@ -74,14 +75,14 @@ int main()
|
|||||||
implicit5.DefineBounds(left, top, right, bottom);
|
implicit5.DefineBounds(left, top, right, bottom);
|
||||||
implicit10.DefineBounds(left, top, right, bottom);
|
implicit10.DefineBounds(left, top, right, bottom);
|
||||||
|
|
||||||
Solver slv5("explicit5.txt", "implicit5.txt", time_step);
|
Solver slv5("explicit5.txt", "implicit5.txt", STEP);
|
||||||
Solver slv10("explicit10.txt", "implicit10.txt", time_step);
|
Solver slv10("explicit10.txt", "implicit10.txt", STEP);
|
||||||
|
|
||||||
slv5.SolveExplicit(explicit5, time_end);
|
slv5.SolveExplicit(explicit5, time_end);
|
||||||
slv5.SolveImplicit(implicit5, time_end);
|
slv5.SolveImplicit(implicit5, time_end);
|
||||||
slv10.SolveExplicit(explicit10, time_end);
|
slv10.SolveExplicit(explicit10, time_end);
|
||||||
slv10.SolveImplicit(implicit10, time_end);
|
slv10.SolveImplicit(implicit10, time_end);
|
||||||
|
|
||||||
std::ofstream script("es10.plt");
|
std::ofstream script("es10.plt");
|
||||||
visualize(script, "explicit10.txt", time_end);
|
visualize(script, "explicit10.txt", time_end);
|
||||||
script.close();
|
script.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user