Changed float to double in element dimensions and material. Changed the ground of truth displacements of the unit tests since they were affected by the change.
This commit is contained in:
parent
bf77c9e64d
commit
51244853f1
26
beam.hpp
26
beam.hpp
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
struct RectangularBeamDimensions {
|
struct RectangularBeamDimensions {
|
||||||
inline static std::string name{"Rectangular"};
|
inline static std::string name{"Rectangular"};
|
||||||
float b;
|
double b;
|
||||||
float h;
|
double h;
|
||||||
RectangularBeamDimensions(const float &width, const float &height)
|
RectangularBeamDimensions(const double &width, const double &height)
|
||||||
: b(width), h(height) {
|
: b(width), h(height) {
|
||||||
assert(width > 0 && height > 0);
|
assert(width > 0 && height > 0);
|
||||||
}
|
}
|
||||||
|
|
@ -17,12 +17,12 @@ struct RectangularBeamDimensions {
|
||||||
|
|
||||||
struct CylindricalBeamDimensions {
|
struct CylindricalBeamDimensions {
|
||||||
inline static std::string name{"Cylindrical"};
|
inline static std::string name{"Cylindrical"};
|
||||||
float od; // Cylinder outside diameter
|
double od; // Cylinder outside diameter
|
||||||
float
|
double
|
||||||
id; // Cylinder inside diameter
|
id; // Cylinder inside diameter
|
||||||
// https://www.engineeringtoolbox.com/area-moment-inertia-d_1328.html
|
// https://www.engineeringtoolbox.com/area-moment-inertia-d_1328.html
|
||||||
CylindricalBeamDimensions(const float &outsideDiameter,
|
CylindricalBeamDimensions(const double &outsideDiameter,
|
||||||
const float &insideDiameter)
|
const double &insideDiameter)
|
||||||
: od(outsideDiameter), id(insideDiameter) {
|
: od(outsideDiameter), id(insideDiameter) {
|
||||||
assert(outsideDiameter > 0 && insideDiameter > 0 &&
|
assert(outsideDiameter > 0 && insideDiameter > 0 &&
|
||||||
outsideDiameter > insideDiameter);
|
outsideDiameter > insideDiameter);
|
||||||
|
|
@ -31,14 +31,20 @@ struct CylindricalBeamDimensions {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ElementMaterial {
|
struct ElementMaterial {
|
||||||
float poissonsRatio; // NOTE: if I make this double the unit
|
double poissonsRatio; // NOTE: if I make this double the unit
|
||||||
// tests produced different results and thus fail
|
// tests produced different results and thus fail
|
||||||
double youngsModulus;
|
double youngsModulus;
|
||||||
ElementMaterial(const float &poissonsRatio, const double &youngsModulus)
|
ElementMaterial(const double &poissonsRatio, const double &youngsModulus)
|
||||||
: poissonsRatio(poissonsRatio), youngsModulus(youngsModulus) {
|
: poissonsRatio(poissonsRatio), youngsModulus(youngsModulus) {
|
||||||
assert(poissonsRatio <= 0.5 && poissonsRatio >= -1);
|
assert(poissonsRatio <= 0.5 && poissonsRatio >= -1);
|
||||||
}
|
}
|
||||||
ElementMaterial() : poissonsRatio(0.3), youngsModulus(200) {}
|
ElementMaterial() : poissonsRatio(0.3), youngsModulus(200) {}
|
||||||
|
std::string toString() const {
|
||||||
|
return std::string("Material:") + std::string("\nPoisson's ratio=") +
|
||||||
|
std::to_string(poissonsRatio) +
|
||||||
|
std::string("\nYoung's Modulus(GPa)=") +
|
||||||
|
std::to_string(youngsModulus / 1e9);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BEAM_HPP
|
#endif // BEAM_HPP
|
||||||
|
|
|
||||||
|
|
@ -1865,9 +1865,12 @@ FormFinder::executeSimulation(const std::shared_ptr<SimulationJob> &pJob,
|
||||||
std::cout << "Non terminating simulation found. Saved simulation job to:"
|
std::cout << "Non terminating simulation found. Saved simulation job to:"
|
||||||
<< dir << std::endl;
|
<< dir << std::endl;
|
||||||
std::cout << "Exiting.." << std::endl;
|
std::cout << "Exiting.." << std::endl;
|
||||||
// FormFinder debug;
|
FormFinder debug;
|
||||||
// debug.executeSimulation(pJob, true, true, true);
|
FormFinder::Settings settings;
|
||||||
// std::terminate();
|
settings.shouldDraw = true;
|
||||||
|
settings.beVerbose = true;
|
||||||
|
debug.executeSimulation(pJob, settings);
|
||||||
|
std::terminate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -333,11 +333,11 @@ bool SimulationMesh::savePly(const std::string &plyFilename) {
|
||||||
nanoply::NanoPlyWrapper<VCGEdgeMesh>::CustomAttributeDescriptor customAttrib;
|
nanoply::NanoPlyWrapper<VCGEdgeMesh>::CustomAttributeDescriptor customAttrib;
|
||||||
customAttrib.GetMeshAttrib(plyFilename);
|
customAttrib.GetMeshAttrib(plyFilename);
|
||||||
|
|
||||||
dimensions = getBeamDimensions();
|
std::vector<CrossSectionType> dimensions = getBeamDimensions();
|
||||||
customAttrib.AddEdgeAttribDescriptor<CrossSectionType, float, 2>(
|
customAttrib.AddEdgeAttribDescriptor<CrossSectionType, float, 2>(
|
||||||
plyPropertyBeamDimensionsID, nanoply::NNP_LIST_INT8_FLOAT32,
|
plyPropertyBeamDimensionsID, nanoply::NNP_LIST_INT8_FLOAT32,
|
||||||
dimensions.data());
|
dimensions.data());
|
||||||
material = getBeamMaterial();
|
std::vector<ElementMaterial> material = getBeamMaterial();
|
||||||
customAttrib.AddEdgeAttribDescriptor<vcg::Point2f, float, 2>(
|
customAttrib.AddEdgeAttribDescriptor<vcg::Point2f, float, 2>(
|
||||||
plyPropertyBeamMaterialID, nanoply::NNP_LIST_INT8_FLOAT32,
|
plyPropertyBeamMaterialID, nanoply::NNP_LIST_INT8_FLOAT32,
|
||||||
material.data());
|
material.data());
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
struct Element;
|
struct Element;
|
||||||
struct Node;
|
struct Node;
|
||||||
using CrossSectionType = RectangularBeamDimensions;
|
// using CrossSectionType = RectangularBeamDimensions;
|
||||||
// using CrossSectionType = CylindricalBeamDimensions;
|
using CrossSectionType = CylindricalBeamDimensions;
|
||||||
|
|
||||||
class SimulationMesh : public VCGEdgeMesh {
|
class SimulationMesh : public VCGEdgeMesh {
|
||||||
private:
|
private:
|
||||||
|
|
@ -20,8 +20,8 @@ private:
|
||||||
const std::string plyPropertyBeamDimensionsID{"beam_dimensions"};
|
const std::string plyPropertyBeamDimensionsID{"beam_dimensions"};
|
||||||
const std::string plyPropertyBeamMaterialID{"beam_material"};
|
const std::string plyPropertyBeamMaterialID{"beam_material"};
|
||||||
const std::string plyPropertyBeamProperties{"beam_properties"};
|
const std::string plyPropertyBeamProperties{"beam_properties"};
|
||||||
std::vector<ElementMaterial> material;
|
// std::vector<ElementMaterial> material;
|
||||||
std::vector<CrossSectionType> dimensions;
|
// std::vector<CrossSectionType> dimensions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PerEdgeAttributeHandle<Element> elements;
|
PerEdgeAttributeHandle<Element> elements;
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue