Home › Forum › SOFA › Using SOFA › [SOLVED] Units of simulation
Tagged: 64_bits, SOFA_17.06, SOFA_1706, units, Windows_7
- This topic has 6 replies, 4 voices, and was last updated 6 years, 10 months ago by Hugo.
-
AuthorPosts
-
20 November 2017 at 14:26 #10158swkhangBlocked
Hello, I’m a SOFA beginner.
I will try to simulate the deformation of soft tissue applying the mass-spring model.Currently, the object is drawn on the simulation, the mass-spring model is applied, and non-rigid deformation occurs.
However, the movement is unrealistic.
The exact reason is unknown, but it is presumed that the parameters used in the simulation do not fit realistically.I was looking for a forum or documents, I can’t find a description of the units used in the simulation.
I would like to know the basic units of parameters used in SOFA simulation. (Gravity, coordinates, stiffness of spring, stiffness of mouse event etc ..)I appreciate your advice.
swkhang.
20 November 2017 at 14:58 #10160VincentBlockedHi swkhang,
There are no default units in SOFA, you have to define them yourself. If you decide to use meters for size and kg for mass, your gravity will have units of m/s^2, your mass density kg/m^3 and Young’s modulus in Pa (or N/m^2). If you decide to measure size in millimeters, everything else has to be changed accordingly, so you would get a gravity in mm/s^2, a mass density in kg/mm^2 and Young’s modulus in MPa.
For springs, I’m guessing the coordinates/size is the most important unit. A stiffness of 10000 in meters would not be so large (N/m), but in mm it would be huge (N/mm). The same goes for mouse events, which are modeled with a spring.
Cheers,
Vincent22 November 2017 at 12:23 #10172GadBlockedHi,
I also have some questions regarding units, size of objects and parameters tweaking.
Here is a scene with two livers, one with its default size and another one 10 times smaller. Here is the full scene.
<Node name="root" gravity="0 -9.81 0" dt="0.005"> <VisualStyle displayFlags="hideVisual hideBehaviorModels showForceFields hideInteractionForceFields showCollisionModels hideBoundingCollisionModels hideMapping hideOptions" /> <DefaultPipeline name="DefaultCollisionPipeline" verbose="0" draw="0" depth="6" /> <BruteForceDetection name="Detection" /> <MinProximityIntersection name="Proximity" alarmDistance="3" contactDistance="0.2" /> <DefaultContactManager name="Response" response="default" /> <!-- REAL SIZE LIVER --> <Node name="Object" gravity="0 -9.81 0"> <EulerImplicitSolver name="Implicit Euler Solver" /> <CGLinearSolver template="GraphScattered" name="Conjugate Gradient" iterations="25" tolerance="1e-5" threshold="1e-5"/> <SparseGridTopology name="Embedded Sparse Grid" fileTopology="mesh/liver.obj" n="7 6 5" /> <MechanicalObject template="Vec3d" name="Particles" restScale="1" position="0 0 0" /> <UniformMass template="Vec3d" name="Mass" mass="1"/> <HexahedronFEMForceField template="Vec3d" name="FEM" poissonRatio="0.45" youngModulus="2000" /> <Node name="CollisionNode" gravity="0 -9.81 0"> <MeshTopology name="Mesh" fileTopology="mesh/liver.obj" /> <MechanicalObject template="Vec3d" name="CollisionObject" scale3d="1 1 1" restScale="1" /> <PointModel name="Points" contactStiffness="5000" /> <LineModel name="Lines" contactStiffness="5000" /> <TTriangleModel template="Vec3d" name="Triangles" contactStiffness="5000" /> <BarycentricMapping name="MechanicalMapping" /> </Node> </Node> <Node name="Obstacle" gravity="0 -9.81 0"> <MeshTopology name="Mesh" fileTopology="mesh/cube.obj" /> <MechanicalObject template="Vec3d" name="Obstacle" translation="0 -10 0" rotation="0 0 0" scale3d="10 1 10" restScale="1" /> <TTriangleModel template="Vec3d" name="Triangles" moving="0" simulated="0" contactStiffness="5000" contactFriction="0.9" /> <LineModel name="Lines" moving="0" simulated="0" contactStiffness="5000" contactFriction="0.9" /> <PointModel name="Points" moving="0" simulated="0" contactStiffness="5000" contactFriction="0.9" /> </Node> <!-- DOWNSIZED LIVER --> <Node name="Object" gravity="0 -9.81 0"> <EulerImplicitSolver name="Implicit Euler Solver" /> <CGLinearSolver template="GraphScattered" name="Conjugate Gradient" iterations="25" tolerance="1e-08" threshold="1e-16"/> <SparseGridTopology name="Embedded Sparse Grid" fileTopology="mesh/liver.obj" n="7 6 5" /> <MechanicalObject template="Vec3d" name="Particles" restScale="1" translation="20 0 0" scale3d="0.1 0.1 0.1"/> <UniformMass template="Vec3d" name="Mass" mass="0.001"/> <HexahedronFEMForceField template="Vec3d" name="FEM" poissonRatio="0.45" youngModulus="2000" /> <Node name="CollisionNode" gravity="0 -9.81 0"> <MeshTopology name="Mesh" fileTopology="mesh/liver.obj" /> <MechanicalObject template="Vec3d" name="CollisionObject" scale3d="1 1 1" restScale="1" /> <PointModel name="Points" contactStiffness="5000" /> <LineModel name="Lines" contactStiffness="5000" /> <TTriangleModel template="Vec3d" name="Triangles" contactStiffness="5000" /> <BarycentricMapping name="MechanicalMapping" /> </Node> </Node> <Node name="Obstacle" gravity="0 -9.81 0"> <MeshTopology name="Mesh" fileTopology="mesh/cube.obj" /> <MechanicalObject template="Vec3d" name="Obstacle" translation="20 -10 0" rotation="0 0 0" scale3d="1 1 1" restScale="1" /> <TTriangleModel template="Vec3d" name="Triangles" moving="0" simulated="0" contactStiffness="5000" contactFriction="0.9" /> <LineModel name="Lines" moving="0" simulated="0" contactStiffness="5000" contactFriction="0.9" /> <PointModel name="Points" moving="0" simulated="0" contactStiffness="5000" contactFriction="0.9" /> </Node> </Node>
Keeping the same Young’s modulus for both result in blowing up the smallest liver.
Increasing the Young’s modulus for the smallest results in a slower fall, unless decreasing dt to 0.001My question here, from a simple user point of view, is how one can easily keep consistency between useful parameters to keep the same results with different scales.
22 November 2017 at 13:29 #10173VincentBlockedHi Gad,
It’s actually not very simple to keep everything consistent. IT also depends on what you want to achieve. We could say there are some “base” unit types: distance (e.g. meter), mass (e.g. kilogram) and force (e.g. newton). We could also add time to those, but the units are usually assumed to be seconds. Every other quantity depends on these units, but you have to manage them yourself.
For example, in your scene you divided the size by 10. This means that, to obtain the exact same object behavior, you need to adjust gravity (units of size/time^2, so divide by 10), mass density (implicitly defined with the UniformMass, which has units of mass, so no need to change it), and Young’s modulus (units of force/size^2, so multiply by 100). The smaller object will appear to move more slowly, just like it would appear if you zoomed the camera out 10 times farther.
There are other things that need to be considered in your scene. The first is that contacts will also be different if you scale the object. If you keep the same contact stiffness for the smaller liver, the contacts will be 10 times stronger (units of force*size).
The second one is the solver used to advance the system in time. The more nodes there are in your liver model, the more iterations the CGLinearSolver needs to reach the solution. If it does only 25 iterations and does not actually converge, the objects in the scene will move more slowly than they should.Hope this helps.
Cheers,
Vincent27 November 2017 at 14:43 #10179GadBlockedThank you for your answer Vincent,
My idea is to keep the same unit system (ei SI system m, sec, kg, etc) but different size/volume. The analogy with the scene attached would be simulating a swiss ball, a basketball ball and a small rubber ball with the same solver without tweaking each object.
Regarding your answer, having a single set of parameters for the three objects isn’t feasible but they have to be set individually.
27 November 2017 at 15:22 #10180VincentBlockedHello Gad,
Then your scene parameters are set pretty much exactly as they should for what you want. I tried your scene and it worked directly. The two livers fall at the same speed, but they bounce differently, as expected. You might want to increase the max number of iterations of the CG solver for the smaller one, but other than the scene seems to run as it should.
In this particular case it’s better to use a separate solver instance for each object, since they have different convergence characteristics (the elements do not have the same size).
Cheers,
Vincent8 January 2018 at 18:03 #10276 -
AuthorPosts
- You must be logged in to reply to this topic.