From b4928c720bec00976070458a234c25dcfed5de9f Mon Sep 17 00:00:00 2001 From: iasonmanolas Date: Tue, 12 Jul 2022 13:01:23 +0300 Subject: [PATCH] Added functions for parsing SimulationJob --- chronoseulersimulationmodel.cpp | 26 +++++++++++++------------- chronoseulersimulationmodel.hpp | 19 ++++++++++--------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/chronoseulersimulationmodel.cpp b/chronoseulersimulationmodel.cpp index 119c939..c07c183 100644 --- a/chronoseulersimulationmodel.cpp +++ b/chronoseulersimulationmodel.cpp @@ -93,7 +93,7 @@ void ChronosEulerSimulationModel::parseForces( } void ChronosEulerSimulationModel::parseConstrainedVertices( - const std::shared_ptr &pJob, + const std::shared_ptr &pJob, const std::vector> &edgeMeshVertsToChronoNodes, chrono::ChSystemSMC &my_system) { @@ -138,16 +138,16 @@ void ChronosEulerSimulationModel::parseConstrainedVertices( SimulationResults ChronosEulerSimulationModel::executeSimulation( const std::shared_ptr &pJob) { - assert(pJob->pMesh->VN() != 0); - const bool structureInitialized = mesh_chronos != nullptr; - const bool wasInitializedWithDifferentStructure = structureInitialized - && (pJob->pMesh->EN() - != mesh_chronos->GetNelements() - || pJob->pMesh->VN() - != mesh_chronos->GetNnodes()); - if (!structureInitialized || wasInitializedWithDifferentStructure) { - setStructure(pJob->pMesh); - } + // assert(pJob->pMesh->VN() != 0); + // const bool structureInitialized = mesh_chronos != nullptr; + // const bool wasInitializedWithDifferentStructure = structureInitialized + // && (pJob->pMesh->EN() + // != mesh_chronos->GetNelements() + // || pJob->pMesh->VN() + // != mesh_chronos->GetNnodes()); + // if (!structureInitialized || wasInitializedWithDifferentStructure) { + setStructure(pJob->pMesh); + // } chrono::ChSystemSMC my_system; // chrono::irrlicht::ChIrrApp application(&my_system, // L"Irrlicht FEM visualization", @@ -186,7 +186,7 @@ SimulationResults ChronosEulerSimulationModel::executeSimulation( // solver->SetTolerance(1e-8); solver->EnableWarmStart(true); // IMPORTANT for convergence when using EULER_IMPLICIT_LINEARIZED solver->EnableDiagonalPreconditioner(true); - my_system.SetSolverForceTolerance(1e-6); + // my_system.SetSolverForceTolerance(1e-6); solver->SetVerbose(false); SimulationResults simulationResults; @@ -231,7 +231,7 @@ SimulationResults ChronosEulerSimulationModel::executeSimulation( simulationResults.displacements[vi][5] = eulerAngles[2]; } - simulationResults.setLabelPrefix("chronos"); + simulationResults.simulationModelUsed = label; return simulationResults; // VCGEdgeMesh deformedMesh; diff --git a/chronoseulersimulationmodel.hpp b/chronoseulersimulationmodel.hpp index 9496f55..1a9b02d 100644 --- a/chronoseulersimulationmodel.hpp +++ b/chronoseulersimulationmodel.hpp @@ -16,6 +16,15 @@ class ChronosEulerSimulationModel : public SimulationModel std::shared_ptr mesh_chronos; std::vector> edgeMeshVertsToChronoNodes; + static void parseConstrainedVertices( + const std::shared_ptr &pJob, + const std::vector> &edgeMeshVertsToChronoNodes, + chrono::ChSystemSMC &my_system); + static void parseForces( + const std::shared_ptr &mesh_chronos, + const std::vector> &edgeMeshVertsToChronoNodes, + const std::unordered_map &nodalExternalForces); + public: ChronosEulerSimulationModel(); SimulationResults executeSimulation(const std::shared_ptr &pJob) override; @@ -24,15 +33,7 @@ public: const std::shared_ptr &pMesh, std::vector> &edgeMeshVertsToChronosNodes); -private: - static void parseConstrainedVertices( - const std::shared_ptr &pJob, - const std::vector> &edgeMeshVertsToChronoNodes, - chrono::ChSystemSMC &my_system); - static void parseForces( - const std::shared_ptr &mesh_chronos, - const std::vector> &edgeMeshVertsToChronoNodes, - const std::unordered_map &nodalExternalForces); + inline const static std::string label{"Chronos_nonLinear_Euler"}; }; #endif // CHRONOSEULERSIMULATIONMODEL_HPP