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

Add AddBoundingBox option for ModelTemplates

parent 5f478851
......@@ -11,6 +11,7 @@ public:
virtual void add_to_sketch(Sketch &s, std::shared_ptr<Vertex> origin) = 0;
bool Convexify{false};
bool AddBoundingBox{false};
std::vector<std::shared_ptr<Vertex>> V;
std::vector<std::shared_ptr<LineSegment>> L;
......
#include "SynchronousReluctanceRotor.h"
void SynchronousReluctanceRotor::add_to_sketch(Sketch &s, std::shared_ptr<Vertex> origin) {
std::cout << "TODO: Clean up circular gutter center point calculation" << std::endl; // Put in a geometric utility library
// Dimensions are approximate, sketch.solve() + constraints will impose real values
double_t ri = InnerRadius;
double_t ro = OuterRadius;
......@@ -173,4 +175,22 @@ void SynchronousReluctanceRotor::add_to_sketch(Sketch &s, std::shared_ptr<Vertex
s.new_element<LineSegment>(origin, V[0]);
s.new_element<LineSegment>(origin, V0p);
}
if (AddBoundingBox) {
double_t rb = ro * std::min(2.0, std::abs(sqrt(8.0 / (1.0 + std::cos(M_PI * 2.0 / Poles))) - 1.0));
auto v1p = s.select_periodic_vertex(V[1],origin,360.0/Poles);
auto v11 = s.new_element<Vertex>(rb,0.0);
auto v11p = s.new_element<Vertex>(rb * std::cos(M_PI * 2.0 / Poles), rb * std::sin(M_PI * 2.0 / Poles));
auto l0 = s.new_element<LineSegment>(V[1], v11);
auto l1 = s.new_element<LineSegment>(v1p, v11p);
auto co = s.new_element<CircularArc>(v11,v11p,origin,rb);
s.new_element<Radius>(co,rb);
s.new_element<Horizontal>(l0);
s.new_element<Angle>(l0,l1,360.0/Poles);
s.new_element<Coincident<LineSegment>>(origin,l1);
}
}
\ No newline at end of file
#ifndef OERSTED_TEST_MODELTEMPLATES_HPP
#define OERSTED_TEST_MODELTEMPLATES_HPP
#include "gtest.h"
#include "Sketch.hpp"
#include "Mesh.hpp"
#include "ModelTemplates.hpp"
#define SAVE_DIR "./test/output/Model\\ Templates/"
#include "gtest.h"
#define SAVE_DIR "./test/output/Model Templates/"
#endif //OERSTED_TEST_MODELTEMPLATES_HPP
\ No newline at end of file
......@@ -19,6 +19,7 @@ TEST_F(Synchronous_Reluctance_Rotor, basic_test) {
srr.AngularThickness = {3.2,3.2,3.2,3.2,3.2,3.2};
srr.Convexify = true; std::cout << "// TODO: Mesh creation fails with non-convex domains" << std::endl;
srr.AddBoundingBox = true; std::cout << "TODO: Mesh creation fails with small gaps for rotor bridges without an outer boundary" << std::endl;
Sketch sketch;
......@@ -35,8 +36,10 @@ TEST_F(Synchronous_Reluctance_Rotor, basic_test) {
Mesh mesh{sketch};
mesh.create();std::cout << "TODO: Mesh creation fails with small gaps for rotor bridges";
mesh.create();
mesh.MinimumElementQuality = 0.5;
EXPECT_TRUE(mesh.refine());
mesh.save_as(SAVE_DIR,"Synchronous_Reluctance_Rotor");
......
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