Hi Mohammad, I assume you meant "restrict the motion in one direction and *disallow* it into other directions". You can do it. In fact, you can prescribe the motion in one direction while allowing free movements in other directions, too.
The methods you should use are the following: *SetFamilyPrescribedLinVel* *SetFamilyPrescribedAngVel* *AddFamilyPrescribedAcc* *AddFamilyPrescribedAngAcc* A better example is DEMdemo_WheelDP.cpp <https://github.com/projectchrono/DEM-Engine/blob/main/src/demo/DEMdemo_WheelDP.cpp>. There, *DEMSim.SetFamilyPrescribedAngVel(2, "0", to_string_with_precision(w_r), "0", false)* means Family 2 will always have 0 angular velocity in X, *w_r *angular velocity in Y, and 0 angular velocity in Z. Other simulation entities cannot change the angular velocities of the entities that are in Family 2. And, *DEMSim.SetFamilyPrescribedLinVel(2, to_string_with_precision(v_ref * (1. - TR)), "0", "none", false)* further specifies that Family 2 will always be moving linearly along X at *v_ref * (1. - TR)* velocity, not moving linearly along Y, and the linear motion is not prescribed along Z, meaning if the contact/environmental forces make the entities to move along Z, it will accept these changes, unlike in X or Y directions which are prescribed. You should keep the last argument to be *false *in your case. If it is *false*, then angular/linear velocity directions/components that are not specified *or* specified with "none", will just go with the "simulation physics" (instead of any user prescription). If it is *true*, then this family's angular/linear velocity becomes prescribed unconditionally (the solver does not attempt to change them), and any unspecified components will stay at the current value (0 as default). That is for the velocities. For the 2 acceleration-related methods, you can only "add" extra accelerations to a family; you cannot prescribe the acceleration that an entity experiences, because a contact is a contact, and you cannot wipe it out. (And if you do wish to manipulate contacts, custom contact models are your friends.) You can prescribe the consequence of these forces though, and that is the velocity. The string arguments in these methods can be a number or some expressions that may involve "t", the simulation time. So you can write something like "*5 / 10*" or "*sin(3.14 * 2 * t)*" as the argument, too. More such "user-referrable variables" might be added in future versions. But if it is some super complex motion that cannot be described with a simple expression, then you are better off just fixing the family (*SetFamilyFixed*), then using a tracker class to manually set the positions and velocities of the entity in question, step by step. Thank you, Ruochun On Thursday, January 5, 2023 at 3:28:28 PM UTC-6 [email protected] wrote: > Hi, > This is DEME related question > > Is it possible to restrict the motion in one direction and allow it into > other directions? For example, is it possible to apply some force to an > object (A) through an interaction with another object (B) and only allow > it (A) to move in the X direction when responding to that force but not the > Y and Z directions? An example code will be much appreciated. > > Thank you so much, > -- 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/c9a26e6e-d723-476c-9693-16fce81b8fd6n%40googlegroups.com.
