The simulation in the optimization of the full pattern scenario magnitudes uses the kinetic energy as a convergence criterion
This commit is contained in:
parent
e7e6971296
commit
56844f1f99
|
@ -98,6 +98,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
if (!optimizationAlreadyComputed) {
|
||||
auto start = std::chrono::system_clock::now();
|
||||
const std::vector<size_t> numberOfNodesPerSlot{1, 0, 0, 2, 1, 2, 1};
|
||||
assert(interfaceNodeIndex == numberOfNodesPerSlot[0] + numberOfNodesPerSlot[3]);
|
||||
ReducedModelOptimizer optimizer(numberOfNodesPerSlot);
|
||||
|
@ -108,6 +109,9 @@ int main(int argc, char *argv[]) {
|
|||
optimizationResults.label = optimizationName;
|
||||
optimizationResults.baseTriangleFullPattern.copy(fullPattern);
|
||||
optimizationResults.settings = settings_optimization;
|
||||
auto end = std::chrono::system_clock::now();
|
||||
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
|
||||
optimizationResults.time = elapsed.count() / 1000.0;
|
||||
|
||||
// Export results
|
||||
if (optimizationResults.numberOfSimulationCrashes != 0) {
|
||||
|
|
|
@ -848,7 +848,6 @@ void ReducedModelOptimizer::runOptimization(const Settings &settings,
|
|||
xMax(i) = settings.xRanges[i].max;
|
||||
}
|
||||
|
||||
auto start = std::chrono::system_clock::now();
|
||||
dlib::function_evaluation result_dlib;
|
||||
double (*objF)(double, double, double, double, double,double,double) = &objective;
|
||||
result_dlib = dlib::find_min_global(objF,
|
||||
|
@ -857,11 +856,7 @@ void ReducedModelOptimizer::runOptimization(const Settings &settings,
|
|||
dlib::max_function_calls(settings.numberOfFunctionCalls),
|
||||
std::chrono::hours(24 * 365 * 290),
|
||||
settings.solverAccuracy);
|
||||
auto end = std::chrono::system_clock::now();
|
||||
auto elapsed =
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
|
||||
getResults(result_dlib, settings, results);
|
||||
results.time = elapsed.count() / 1000.0;
|
||||
}
|
||||
|
||||
void ReducedModelOptimizer::constructAxialSimulationScenario(
|
||||
|
@ -1035,8 +1030,15 @@ double fullPatternMaxSimulationForceTranslationalObjective(const double &forceMa
|
|||
DRMSimulationModel simulator;
|
||||
DRMSimulationModel::Settings settings;
|
||||
settings.totalExternalForcesNormPercentageTermination = 1e-2;
|
||||
// settings.shouldUseTranslationalKineticEnergyThreshold = true;
|
||||
// settings.totalTranslationalKineticEnergyThreshold = 1e-7;
|
||||
settings.shouldUseTranslationalKineticEnergyThreshold = true;
|
||||
settings.totalTranslationalKineticEnergyThreshold = 1e-14;
|
||||
settings.shouldUseTranslationalKineticEnergyThreshold = true;
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
// settings.shouldDraw = true;
|
||||
// settings.isDebugMode = true;
|
||||
// settings.drawingStep = 100000;
|
||||
// settings.shouldCreatePlots = true;
|
||||
#endif
|
||||
SimulationResults results = simulator.executeSimulation(std::make_shared<SimulationJob>(job),
|
||||
settings);
|
||||
const double &desiredDisplacementValue = global.desiredMaxDisplacementValue;
|
||||
|
@ -1146,6 +1148,9 @@ ReducedModelOptimizer::createFullPatternSimulationScenarios(
|
|||
job.pMesh = pMesh;
|
||||
|
||||
//// Axial
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
std::cout << "Computing Axial scenarios.." << std::endl;
|
||||
#endif
|
||||
const double maxForceMagnitude_axial = getFullPatternMaxSimulationForce(
|
||||
BaseSimulationScenario::Axial);
|
||||
const double minForceMagnitude_axial = -maxForceMagnitude_axial;
|
||||
|
@ -1162,6 +1167,9 @@ ReducedModelOptimizer::createFullPatternSimulationScenarios(
|
|||
for (int axialSimulationScenarioIndex = 0;
|
||||
axialSimulationScenarioIndex < numberOfSimulationScenarios_axial;
|
||||
axialSimulationScenarioIndex++) {
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
std::cout << "Computing Axial scenario:" << axialSimulationScenarioIndex << std::endl;
|
||||
#endif
|
||||
job.nodalExternalForces.clear();
|
||||
job.constrainedVertices.clear();
|
||||
job.nodalForcedDisplacements.clear();
|
||||
|
@ -1193,6 +1201,9 @@ ReducedModelOptimizer::createFullPatternSimulationScenarios(
|
|||
for (int shearSimulationScenarioIndex = 0;
|
||||
shearSimulationScenarioIndex < numberOfSimulationScenarios_shear;
|
||||
shearSimulationScenarioIndex++) {
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
std::cout << "Computing shear scenario:" << shearSimulationScenarioIndex << std::endl;
|
||||
#endif
|
||||
job.constrainedVertices.clear();
|
||||
job.nodalExternalForces.clear();
|
||||
job.label = baseSimulationScenarioNames[BaseSimulationScenario::Shear] + "_"
|
||||
|
@ -1219,6 +1230,9 @@ ReducedModelOptimizer::createFullPatternSimulationScenarios(
|
|||
for (int bendingSimulationScenarioIndex = 0;
|
||||
bendingSimulationScenarioIndex < numberOfSimulationScenarios_bending;
|
||||
bendingSimulationScenarioIndex++) {
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
std::cout << "Computing bending scenario:" << bendingSimulationScenarioIndex << std::endl;
|
||||
#endif
|
||||
job.nodalExternalForces.clear();
|
||||
job.constrainedVertices.clear();
|
||||
job.label = baseSimulationScenarioNames[BaseSimulationScenario::Bending] + "_"
|
||||
|
@ -1248,6 +1262,9 @@ ReducedModelOptimizer::createFullPatternSimulationScenarios(
|
|||
for (int domeSimulationScenarioIndex = 0;
|
||||
domeSimulationScenarioIndex < numberOfSimulationScenarios_dome;
|
||||
domeSimulationScenarioIndex++) {
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
std::cout << "Computing dome scenario:" << domeSimulationScenarioIndex << std::endl;
|
||||
#endif
|
||||
job.constrainedVertices.clear();
|
||||
job.nodalExternalForces.clear();
|
||||
job.nodalForcedDisplacements.clear();
|
||||
|
@ -1275,6 +1292,9 @@ ReducedModelOptimizer::createFullPatternSimulationScenarios(
|
|||
for (int saddleSimulationScenarioIndex = 0;
|
||||
saddleSimulationScenarioIndex < numberOfSimulationScenarios_saddle;
|
||||
saddleSimulationScenarioIndex++) {
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
std::cout << "Computing saddle scenario:" << saddleSimulationScenarioIndex << std::endl;
|
||||
#endif
|
||||
job.constrainedVertices.clear();
|
||||
job.nodalExternalForces.clear();
|
||||
job.nodalForcedDisplacements.clear();
|
||||
|
@ -1409,7 +1429,7 @@ void ReducedModelOptimizer::optimize(
|
|||
DRMSimulationModel::Settings simulationSettings;
|
||||
simulationSettings.shouldDraw = false;
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
const bool drawFullPatternSimulationResults = false;
|
||||
const bool drawFullPatternSimulationResults = true;
|
||||
if (drawFullPatternSimulationResults) {
|
||||
global.fullPatternSimulationJobs[0]->pMesh->registerForDrawing(
|
||||
ReducedPatternOptimization::Colors::fullInitial);
|
||||
|
|
Loading…
Reference in New Issue