Testing the new axial and shear scenarios

This commit is contained in:
Iason 2021-03-02 20:32:43 +02:00
parent 4a03c435c2
commit ae636c3af5
3 changed files with 61 additions and 61 deletions

View File

@ -38,14 +38,14 @@ download_project(PROJ MYSOURCES
endif()
##Polyscope
#download_project(PROJ POLYSCOPE
# GIT_REPOSITORY https://github.com/nmwsharp/polyscope.git
# GIT_TAG master
# PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/
# ${UPDATE_DISCONNECTED_IF_AVAILABLE}
#)
#add_subdirectory(${POLYSCOPE_SOURCE_DIR})
#add_compile_definitions(POLYSCOPE_DEFINED)
download_project(PROJ POLYSCOPE
GIT_REPOSITORY https://github.com/nmwsharp/polyscope.git
GIT_TAG master
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
add_subdirectory(${POLYSCOPE_SOURCE_DIR})
add_compile_definitions(POLYSCOPE_DEFINED)
#dlib
download_project(PROJ DLIB
@ -88,5 +88,5 @@ target_include_directories(${PROJECT_NAME}
)
link_directories(${MYSOURCES_SOURCE_DIR}/boost_graph/libs)
#target_link_libraries(${PROJECT_NAME} polyscope Eigen3::Eigen matplot dlib::dlib)
target_link_libraries(${PROJECT_NAME} -static Eigen3::Eigen matplot dlib::dlib)
target_link_libraries(${PROJECT_NAME} polyscope Eigen3::Eigen matplot dlib::dlib)
#target_link_libraries(${PROJECT_NAME} -static Eigen3::Eigen matplot dlib::dlib)

View File

@ -52,8 +52,8 @@ int main(int argc, char *argv[]) {
settings_optimization.numberOfFunctionCalls =
input_numberOfFunctionCallsDefined ? std::atoi(argv[3]) : 100;
settings_optimization.normalizationStrategy =
ReducedModelOptimizer::Settings::NormalizationStrategy::Epsilon;
settings_optimization.normalizationParameter = 0.003;
ReducedModelOptimizer::Settings::NormalizationStrategy::NonNormalized;
settings_optimization.normalizationParameter = 0.0003;
settings_optimization.solutionAccuracy = 0.01;
// Optimize pair

View File

@ -784,31 +784,31 @@ ReducedModelOptimizer::createScenarios(
//// Axial
SimulationScenario scenarioName = SimulationScenario::Axial;
// NewMethod
// for (auto viPairIt = m_fullPatternOppositeInterfaceViMap.begin();
// viPairIt != m_fullPatternOppositeInterfaceViMap.end(); viPairIt++) {
// if (viPairIt != m_fullPatternOppositeInterfaceViMap.begin()) {
// CoordType forceDirection(1, 0, 0);
// const auto viPair = *viPairIt;
// nodalForces[viPair.first] =
// Vector6d({forceDirection[0], forceDirection[1], forceDirection[2],
// 0,
// 0, 0}) *
// forceMagnitude * 10;
// fixedVertices[viPair.second] =
// std::unordered_set<DoFType>{0, 1, 2, 3, 4, 5};
// }
// }
// OldMethod
for (const auto &viPair : m_fullPatternOppositeInterfaceViMap) {
CoordType forceDirection =
(pMesh->vert[viPair.first].cP() - pMesh->vert[viPair.second].cP())
.Normalize();
nodalForces[viPair.first] = Vector6d({forceDirection[0], forceDirection[1],
forceDirection[2], 0, 0, 0}) *
forceMagnitude * 10;
fixedVertices[viPair.second] =
std::unordered_set<DoFType>{0, 1, 2, 3, 4, 5};
for (auto viPairIt = m_fullPatternOppositeInterfaceViMap.begin();
viPairIt != m_fullPatternOppositeInterfaceViMap.end(); viPairIt++) {
if (viPairIt != m_fullPatternOppositeInterfaceViMap.begin()) {
CoordType forceDirection(1, 0, 0);
const auto viPair = *viPairIt;
nodalForces[viPair.first] =
Vector6d({forceDirection[0], forceDirection[1], forceDirection[2], 0,
0, 0}) *
forceMagnitude * 10;
fixedVertices[viPair.second] =
std::unordered_set<DoFType>{0, 1, 2, 3, 4, 5};
}
}
// OldMethod
// for (const auto &viPair : m_fullPatternOppositeInterfaceViMap) {
// CoordType forceDirection =
// (pMesh->vert[viPair.first].cP() - pMesh->vert[viPair.second].cP())
// .Normalize();
// nodalForces[viPair.first] = Vector6d({forceDirection[0],
// forceDirection[1],
// forceDirection[2], 0, 0, 0}) *
// forceMagnitude * 10;
// fixedVertices[viPair.second] =
// std::unordered_set<DoFType>{0, 1, 2, 3, 4, 5};
// }
scenarios[scenarioName] = std::make_shared<SimulationJob>(
SimulationJob(pMesh, simulationScenarioStrings[scenarioName],
fixedVertices, nodalForces, {}));
@ -818,32 +818,32 @@ ReducedModelOptimizer::createScenarios(
fixedVertices.clear();
nodalForces.clear();
// NewMethod
// for (auto viPairIt = m_fullPatternOppositeInterfaceViMap.begin();
// viPairIt != m_fullPatternOppositeInterfaceViMap.end(); viPairIt++) {
// if (viPairIt != m_fullPatternOppositeInterfaceViMap.begin()) {
// CoordType forceDirection(0, 1, 0);
// const auto viPair = *viPairIt;
// nodalForces[viPair.first] =
// Vector6d({forceDirection[0], forceDirection[1], forceDirection[2],
// 0,
// 0, 0}) *
// forceMagnitude * 10;
// fixedVertices[viPair.second] =
// std::unordered_set<DoFType>{0, 1, 2, 3, 4, 5};
// }
// }
// OldMethod
for (const auto &viPair : m_fullPatternOppositeInterfaceViMap) {
CoordType v =
(pMesh->vert[viPair.first].cP() - pMesh->vert[viPair.second].cP())
.Normalize();
CoordType forceDirection = (v ^ patternPlaneNormal).Normalize();
nodalForces[viPair.first] = Vector6d({forceDirection[0], forceDirection[1],
forceDirection[2], 0, 0, 0}) *
0.40 * forceMagnitude;
fixedVertices[viPair.second] =
std::unordered_set<DoFType>{0, 1, 2, 3, 4, 5};
for (auto viPairIt = m_fullPatternOppositeInterfaceViMap.begin();
viPairIt != m_fullPatternOppositeInterfaceViMap.end(); viPairIt++) {
if (viPairIt != m_fullPatternOppositeInterfaceViMap.begin()) {
CoordType forceDirection(0, 1, 0);
const auto viPair = *viPairIt;
nodalForces[viPair.first] =
Vector6d({forceDirection[0], forceDirection[1], forceDirection[2], 0,
0, 0}) *
forceMagnitude * 10;
fixedVertices[viPair.second] =
std::unordered_set<DoFType>{0, 1, 2, 3, 4, 5};
}
}
// OldMethod
// for (const auto &viPair : m_fullPatternOppositeInterfaceViMap) {
// CoordType v =
// (pMesh->vert[viPair.first].cP() - pMesh->vert[viPair.second].cP())
// .Normalize();
// CoordType forceDirection = (v ^ patternPlaneNormal).Normalize();
// nodalForces[viPair.first] = Vector6d({forceDirection[0],
// forceDirection[1],
// forceDirection[2], 0, 0, 0}) *
// 0.40 * forceMagnitude;
// fixedVertices[viPair.second] =
// std::unordered_set<DoFType>{0, 1, 2, 3, 4, 5};
// }
scenarios[scenarioName] = std::make_shared<SimulationJob>(
SimulationJob(pMesh, simulationScenarioStrings[scenarioName],
fixedVertices, nodalForces, {}));