diff --git a/src/pe/cr/HCSITS.h b/src/pe/cr/HCSITS.h index 17987b7a559a718caa932b876292d7ec5e3eb72c..41f863e370a10f446270e657ec5e1675277ba302 100644 --- a/src/pe/cr/HCSITS.h +++ b/src/pe/cr/HCSITS.h @@ -32,6 +32,7 @@ #include "pe/rigidbody/RigidBody.h" #include "pe/Types.h" +#include <core/config/Config.h> #include <core/DataTypes.h> #include <core/debug/Debug.h> #include <core/logging/Logging.h> @@ -261,9 +262,6 @@ private: typedef HardContactSemiImplicitTimesteppingSolvers HCSITS; - - - //================================================================================================= // // GET FUNCTIONS @@ -455,8 +453,16 @@ inline bool HardContactSemiImplicitTimesteppingSolvers::isSyncRequiredLocally() } //************************************************************************************************* -} +} // namespace cr } // namespace pe -} + +/** + * \brief configures HardContactSemiImplicitTimesteppingSolvers with parameters from config file + * \param config handle to config block + * \param cr collision resolution object to configure + */ +void configure( const Config::BlockHandle& config, pe::cr::HCSITS& cr); + +} // namespace walberla #include "HCSITS.impl.h" diff --git a/src/pe/cr/HCSITS.impl.h b/src/pe/cr/HCSITS.impl.h index 30f9914587ef2970e1522f5ae8d89eeef1601650..d2c8b9ba70816a9baf9bdb4280e1f984e8204afa 100644 --- a/src/pe/cr/HCSITS.impl.h +++ b/src/pe/cr/HCSITS.impl.h @@ -1798,8 +1798,53 @@ inline void HardContactSemiImplicitTimesteppingSolvers::integratePositions( Body } //************************************************************************************************* - } // namespace cr } // namespace pe + +inline +void configure( const Config::BlockHandle& config, pe::cr::HCSITS& cr ) +{ + using namespace pe; + + int HCSITSmaxIterations = config.getParameter<int>("HCSITSmaxIterations", 10); + WALBERLA_LOG_INFO_ON_ROOT("HCSITSmaxIterations: " << HCSITSmaxIterations); + + real_t HCSITSRelaxationParameter = config.getParameter<real_t>("HCSITSRelaxationParameter", real_t(0.75) ); + WALBERLA_LOG_INFO_ON_ROOT("HCSITSRelaxationParameter: " << HCSITSRelaxationParameter); + + real_t HCSITSErrorReductionParameter = config.getParameter<real_t>("HCSITSErrorReductionParameter", real_t(0.8) ); + WALBERLA_LOG_INFO_ON_ROOT("HCSITSErrorReductionParameter: " << HCSITSErrorReductionParameter); + + std::string HCSITSRelaxationModelStr = config.getParameter<std::string>("HCSITSRelaxationModelStr", "ApproximateInelasticCoulombContactByDecoupling" ); + WALBERLA_LOG_INFO_ON_ROOT("HCSITSRelaxationModelStr: " << HCSITSRelaxationModelStr); + + cr::HCSITS::RelaxationModel HCSITSRelaxationModel; + if (HCSITSRelaxationModelStr == "InelasticFrictionlessContact") + { + HCSITSRelaxationModel = cr::HCSITS::InelasticFrictionlessContact; + } else if (HCSITSRelaxationModelStr == "ApproximateInelasticCoulombContactByDecoupling") + { + HCSITSRelaxationModel = cr::HCSITS::ApproximateInelasticCoulombContactByDecoupling; + } else if (HCSITSRelaxationModelStr == "InelasticCoulombContactByDecoupling") + { + HCSITSRelaxationModel = cr::HCSITS::InelasticCoulombContactByDecoupling; + } else if (HCSITSRelaxationModelStr == "InelasticGeneralizedMaximumDissipationContact") + { + HCSITSRelaxationModel = cr::HCSITS::InelasticGeneralizedMaximumDissipationContact; + } else + { + WALBERLA_ABORT("Unknown HCSITSRelaxationModel: " << HCSITSRelaxationModelStr); + } + + Vec3 globalLinearAcceleration = config.getParameter<Vec3>("globalLinearAcceleration", Vec3(0, 0, 0)); + WALBERLA_LOG_INFO_ON_ROOT("globalLinearAcceleration: " << globalLinearAcceleration); + + cr.setMaxIterations( uint_c(HCSITSmaxIterations) ); + cr.setRelaxationModel( HCSITSRelaxationModel ); + cr.setRelaxationParameter( HCSITSRelaxationParameter ); + cr.setErrorReductionParameter( HCSITSErrorReductionParameter ); + cr.setGlobalLinearAcceleration( globalLinearAcceleration ); +} + } // namespace walberla