Qihan, Indeed, if you change any of the Chrono sources, you will obviously have to rebuild.
I have somewhere code that allows changing the contact force calculation in user code only (which would not require rebuilding the Chrono libraries). That uses a mechanism similar to what I implemented for overriding the default composite material combination laws (which Luning also mentioned in another reply). I will consider pushing that to the Chrono repository one of these days. --Radu From: [email protected] <[email protected]> On Behalf Of Qihan Xuan Sent: Wednesday, June 15, 2022 4:04 AM To: ProjectChrono <[email protected]> Subject: [chrono] Re: Modify the contact model in source code Thanks! It works. By the way, I find I have to compile Chrono after modifying the source code. Here's the tutorial on how to compile Chrono, https://api.projectchrono.org/development/tutorial_install_chrono.html If you want want to check whether your Chrono is updated, you can check this file: D:/Chrono_v7_build/lib/Release/ChronoEngine.lib Thanks, Qihan On Tuesday, June 14, 2022 at 3:08:03 PM UTC-4 [email protected] wrote: In the core module of Chrono, you can modify your contact force model in this file, src/chrono/physics/ChContactSMC.h The function you need to look at is CalculateForce() ChVector<> CalculateForce( double delta, ///< overlap in normal direction const ChVector<>& normal_dir, ///< normal contact direction (expressed in global frame) const ChVector<>& vel1, ///< velocity of contact point on objA (expressed in global frame) const ChVector<>& vel2, ///< velocity of contact point on objB (expressed in global frame) const ChMaterialCompositeSMC& mat ///< composite material for contact pair ) The following two lines match the equations you screenshotted. Note that kn, gn, kt, gt are computed differently depending on the contact force model you choose. forceN and forceT are normal and tangential force magnitude. // Calculate the magnitudes of the normal and tangential contact forces double forceN = kn * delta - gn * relvel_n_mag; double forceT = kt * delta_t + gt * relvel_t_mag; You can implement the model however you want. Thank you, Luning On Tuesday, June 14, 2022 at 12:59:22 PM UTC-5 [email protected] wrote: Hi all, I have a question about changing the contact model in the Chrono. By the way, I am using (the core module of) Chrono. The viscoelastic model shows the damping term is proportional to velocity. Can we change it? [cid:~WRD1557.jpg] We are studying fish motion on mud, which is shear-thinning<https://en.wikipedia.org/wiki/Shear_thinning> interaction. For example, we hope the damping term is proportional to the square root of the velocity. Can it be tuned by ourselves? Thanks, Qihan -- You received this message because you are subscribed to the Google Groups "ProjectChrono" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/bbaca2da-0e2b-4467-a197-5907b07d16d4n%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/bbaca2da-0e2b-4467-a197-5907b07d16d4n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "ProjectChrono" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/PH0PR06MB8237480B41D4FA6275CEE0B7A7AE9%40PH0PR06MB8237.namprd06.prod.outlook.com.
