Commit 5f478851 authored by Pries, Jason's avatar Pries, Jason

Work on SynchronousReluctanceRotor ModelTemplate

parent 0ae85aed
......@@ -4,7 +4,7 @@ project(Oersted)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 --coverage -fopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -fopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fopenmp")
include_directories(./lib/)
include_directories(./lib/Eigen/)
......
......@@ -61,10 +61,91 @@ void SynchronousReluctanceRotor::add_to_sketch(Sketch &s, std::shared_ptr<Vertex
auto f3 = s.new_element<Fixation>(v3);
auto l0 = s.new_element<LineSegment>(v0,v1);
L.push_back(l0);
//auto l1 = s.new_element<LineSegment>(origin,v2); // for construction
//auto l2 = s.new_element<LineSegment>(origin,v3); // for construction
auto c0 = s.new_element<CircularArc>(v2,v3,origin,ro-dra[j]);
C.push_back(c0);
{
double_t x0 = xr[j];
double_t y0 = yr[j];
double_t x1 = xa[j];
double_t y1 = ya[j];
double_t dx = x1 - x0;
double_t dy = y1 - y0;
double_t t0 = atan2(dy, dx);
double_t t1 = t0 + M_PI_2;
double_t x2 = 0.5 * (x0 + x1);
double_t y2 = 0.5 * (y0 + y1);
double_t a0 = -sin(M_PI / Np);
double_t b0 = +cos(M_PI / Np);
double_t a1 = -sin(t1);
double_t b1 = +cos(t1);
double_t c = a1 * x2 + b1 * y2;
double_t d = a0 * b1 - a1 * b0;
double_t x3 = -b0 * c / d;
double_t y3 = +a0 * c / d;
double_t r3 = hypot(x3 - x1, y3 - y1);
auto vc1 = s.new_element<Vertex>(x3, y3);
s.new_element<Coincident<LineSegment>>(vc1, L[1]);
auto c1 = s.new_element<CircularArc>(v1, v3, vc1, r3);
C.push_back(c1);
}
{
double_t x0 = xr[j+1];
double_t y0 = yr[j+1];
double_t x1 = xa[j+1];
double_t y1 = ya[j+1];
double_t dx = x1 - x0;
double_t dy = y1 - y0;
double_t t0 = atan2(dy, dx);
double_t t1 = t0 + M_PI_2;
double_t x2 = 0.5 * (x0 + x1);
double_t y2 = 0.5 * (y0 + y1);
double_t a0 = -sin(M_PI / Np);
double_t b0 = +cos(M_PI / Np);
double_t a1 = -sin(t1);
double_t b1 = +cos(t1);
double_t c = a1 * x2 + b1 * y2;
double_t d = a0 * b1 - a1 * b0;
double_t x3 = -b0 * c / d;
double_t y3 = +a0 * c / d;
double_t r3 = hypot(x3 - x1, y3 - y1);
auto vc1 = s.new_element<Vertex>(x3, y3);
s.new_element<Coincident<LineSegment>>(vc1, L[1]);
auto c1 = s.new_element<CircularArc>(v0, v2, vc1, r3);
C.push_back(c1);
}
//auto vc2 = s.new_element<Vertex>(1.1 * ro * cos(a180p), 1.1 * ro * sin(a180p));
//s.new_element<Coincident<LineSegment>>(vc2,L[1]);
//auto c2 = s.new_element<CircularArc>(v0,v2,vc2,RadialThickness[j]);
//C.push_back(c2);
}
// Impose constraints
......@@ -72,6 +153,8 @@ void SynchronousReluctanceRotor::add_to_sketch(Sketch &s, std::shared_ptr<Vertex
s.new_element<Radius>(C[0],ri);
s.new_element<Radius>(C[1],ro);
s.new_element<Coincident<LineSegment>>(origin,L[1]);
s.new_element<Angle>(L[0],L[1],180.0 / Np);
double_t tol = s.solve();
......@@ -86,6 +169,8 @@ void SynchronousReluctanceRotor::add_to_sketch(Sketch &s, std::shared_ptr<Vertex
tol = s.solve();
if (Convexify) {
throw;
auto V0p = s.select_periodic_vertex(V[0],origin, 360.0 / Poles);
s.new_element<LineSegment>(origin, V[0]);
s.new_element<LineSegment>(origin, V0p);
}
}
\ No newline at end of file
......@@ -13,12 +13,12 @@ TEST_F(Synchronous_Reluctance_Rotor, basic_test) {
srr.InnerRadius = 25.4e-3;
srr.OuterRadius = 89e-3-0.03*25.4e-3;
srr.AngularBridgeThickness = {0.5e-3};
srr.RadialBridgeThickness = {0.5e-3};
srr.RadialThickness = {5.0e-3,5.0e-3};
srr.AngularThickness = {5.0,5.0};
srr.AngularBridgeThickness = {0.5e-3,0.5e-3,0.5e-3};
srr.RadialBridgeThickness = {0.5e-3,0.5e-3,0.5e-3};
srr.RadialThickness = {5.0e-3,5.0e-3,5.0e-3,5.0e-3,5.0e-3,5.0e-3};
srr.AngularThickness = {3.2,3.2,3.2,3.2,3.2,3.2};
//srr.Convexify = true; std::cout << "//Mesh creation fails with non-convex domains" << std::endl;
srr.Convexify = true; std::cout << "// TODO: Mesh creation fails with non-convex domains" << std::endl;
Sketch sketch;
......@@ -33,13 +33,11 @@ TEST_F(Synchronous_Reluctance_Rotor, basic_test) {
EXPECT_TRUE(sketch.build());
/*
Mesh mesh{sketch};
mesh.create();
mesh.create();std::cout << "TODO: Mesh creation fails with small gaps for rotor bridges";
mesh.MinimumElementQuality = 0.5;
EXPECT_TRUE(mesh.refine());
mesh.save_as(SAVE_DIR,"Distributed_Winding_Stator");
*/
mesh.save_as(SAVE_DIR,"Synchronous_Reluctance_Rotor");
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment