Added functions for parsing SimulationJob

This commit is contained in:
iasonmanolas 2022-07-12 13:01:23 +03:00
parent adaf49627f
commit b4928c720b
2 changed files with 23 additions and 22 deletions

View File

@ -93,7 +93,7 @@ void ChronosEulerSimulationModel::parseForces(
}
void ChronosEulerSimulationModel::parseConstrainedVertices(
const std::shared_ptr<SimulationJob> &pJob,
const std::shared_ptr<const SimulationJob> &pJob,
const std::vector<std::shared_ptr<chrono::fea::ChNodeFEAxyzrot>> &edgeMeshVertsToChronoNodes,
chrono::ChSystemSMC &my_system)
{
@ -138,16 +138,16 @@ void ChronosEulerSimulationModel::parseConstrainedVertices(
SimulationResults ChronosEulerSimulationModel::executeSimulation(
const std::shared_ptr<SimulationJob> &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;

View File

@ -16,6 +16,15 @@ class ChronosEulerSimulationModel : public SimulationModel
std::shared_ptr<chrono::fea::ChMesh> mesh_chronos;
std::vector<std::shared_ptr<chrono::fea::ChNodeFEAxyzrot>> edgeMeshVertsToChronoNodes;
static void parseConstrainedVertices(
const std::shared_ptr<const SimulationJob> &pJob,
const std::vector<std::shared_ptr<chrono::fea::ChNodeFEAxyzrot>> &edgeMeshVertsToChronoNodes,
chrono::ChSystemSMC &my_system);
static void parseForces(
const std::shared_ptr<chrono::fea::ChMesh> &mesh_chronos,
const std::vector<std::shared_ptr<chrono::fea::ChNodeFEAxyzrot>> &edgeMeshVertsToChronoNodes,
const std::unordered_map<VertexIndex, Vector6d> &nodalExternalForces);
public:
ChronosEulerSimulationModel();
SimulationResults executeSimulation(const std::shared_ptr<SimulationJob> &pJob) override;
@ -24,15 +33,7 @@ public:
const std::shared_ptr<SimulationMesh> &pMesh,
std::vector<std::shared_ptr<chrono::fea::ChNodeFEAxyzrot>> &edgeMeshVertsToChronosNodes);
private:
static void parseConstrainedVertices(
const std::shared_ptr<SimulationJob> &pJob,
const std::vector<std::shared_ptr<chrono::fea::ChNodeFEAxyzrot>> &edgeMeshVertsToChronoNodes,
chrono::ChSystemSMC &my_system);
static void parseForces(
const std::shared_ptr<chrono::fea::ChMesh> &mesh_chronos,
const std::vector<std::shared_ptr<chrono::fea::ChNodeFEAxyzrot>> &edgeMeshVertsToChronoNodes,
const std::unordered_map<VertexIndex, Vector6d> &nodalExternalForces);
inline const static std::string label{"Chronos_nonLinear_Euler"};
};
#endif // CHRONOSEULERSIMULATIONMODEL_HPP