Large AnySurf3 File Making Model Slow

Hey,

I am trying to import an STL file of a knee implant into my model. I have done this previously and it worked great. However, this time my STL file is a 3D scan of an implant. My model was able to convert the STL into an AnySurf3 file but it took some time. The problem I have is the AnySurf3 file is now 87,000 KB while my previous AnySurf3 file was 391 KB. This is causing my model to take over an hour to run instead of taking just 10 seconds with my previous STL. I was wondering if AnyBody had any suggestions of a way to make the file smaller to help my model run more faster? Previously somebody from AnyBody support remeshed my old STL file and made the file size smaller. I would appreciate any suggestions.

Thanks,
Michael

Hi Michael,

Could you explain how you use the STL in your model? Is there contact? Do you use MeshRefinitement in this contact definition? How is the new mesh different to the old one? Are these two unrelated STLs?

Please have a look at Meshlab - it can be used to simplify the mesh without significant reduction in the shape accuracy.

Regards,
Pavel

Hi Pavel,

Thank you for responding to my question.

The STLs are the two components of a knee replacement. One located on the femur (thigh) and one located on the tibia (shank). These two are in contact and are moving across one another, so the smooth shape does matter.

What is Mesh Refinement? Is that cleaning up the STLs with a software?

These are two totally different STLs. My old STLs I designed on Solidworks but these new STLs are actual 3D scans of an implant so they are a much larger file.

I will take a look at Meshlab! Thank you for the suggestion.

Thanks,
Michael

Michael,

AnyForceSurfaceContact class that you most likely use has 2 members: MeshRefinementMaster and MeshRefinementSlave. If you use those it will significantly slow down your simulation. Could you check?

Otherwise try remeshing your implants - you can sacrifice a tiny fraction of the volumetric accuracy, but gain a lot of speed.

Let us know if that worked and please share the solution with us for other users to know.

Kind regards,
Pavel

Pavel,

Thank you so much for your advice. My model now computes in 10 seconds instead of 2 hours. Removing the MeshRefinement did not make a big difference in the simulation time; however, when I remeshed my implant using a program called 3-Matic it began it ran my simulation exponentially faster.

I have one more quick question. Now that my model is working, I noticed that my implants are going through each other as I flex the knee. I have an AnyForceSurfaceContact that has a pressure module of 9.3E9*2. This should keep the implant from going through each other correct? Do you have any suggestions of what my be preventing this from working?

Thanks again for your help.

Thanks,
Michael

Michael,

Yes, they would typically penetrate some amount, but through the pressure module you could control the acceptable level. If you have cartilage tissue this penetration may reflect the elastic properties and the corresponding deformation of the soft tissues, and, thus, will need a smaller value.

Regards,
Pavel

Pavel,

I adjusted the pressure module and still got the same results. I turned the pressure module off and then increased the pressure module to 9e20 to just see if it changed anything, but it did not. I kept getting the same amount of penetration as seen in the picture attached, no matter if the pressure module was on or not. Here is my code for the pressure module.

[SIZE=3] [SIZE=2]AnyForceSurfaceContact[/SIZE][/SIZE] FSurf = {
AnySurface &sMaster = Main.HumanModel.BodyModel.Left.Leg.Seg.Shank.STLpoint.Tibial;
AnySurface &sSlave = Main.HumanModel.BodyModel.Left.Leg.Seg.Thigh.STLpoint.Femur;
PressureModule = 9.3e20;
ForceViewOnOff = On;
MeshRefinementMaster = 0;
MeshRefinementSlave = 0;
SingleSidedOnOff= On;
[SIZE=2]};// end of surface contact
[/SIZE]

To me it does not seem like it is working. I do not have any cartilage tissue, I just have implant which should not have elastic properties. To me it seems like it is following the path of the bone instead of my implant. Do you have any suggestions of how to get the surface contact to work so the knee will follow the implant geometry?

Thanks,
Michael

Hi Michael,

I do not know the details of your model, but it sounds to me that you have not constructed the right model yet. If you did not have Force-Dependent Kinematics (FDK) degrees of freedom or did not switch the FDK solver on - it was not supposed to change the kinematics. I just presume that this is the case.

Try looking at the FDK tutorial and check that your approach is similar to the one in the tutorial.

Another good advice would be to start very simple and understand how FDK works by having, say, a 2-surface example, where one surface is pushed through another by means of a force. Or something like that.

Regards,
Pavel

Pavel,

Thank you for your reply. I have the FDK solver on as well as Force dependent degrees of freedom. With my old STL files I was able to flex the knee without the implants going through each other. It is just with my new files that it is not working. I was wondering if the meshing could effect the surface force because when I do run my model I get a warning saying there is degenerated triangles in one of my surface files. I’m not sure what this error means, but I am guessing it could effect the surface contact force if there is an error in one of the surfaces?

Thanks,
Michael

Michael,

If that is the case - then something else is missing. Replacing the surfaces should not change the behaviour dramatically.

Having degenerated triangles is, in general, something that you should avoid. But i would not expect it to have this effect.

Unfortunately, it is quite hard to answer “please help me, it does not work” questions :wink: So here my guesswork continues and a few suggestions:

  • Could it be that you only replace the drawing objects, but not the actual surfaces?
  • Could you show the difference between “Old” and “New” code side by side?
  • Could you switch the old surfaces back to make sure it still works?
  • Could you try a simple case like I suggested to drive both “Old” and “New” set of surfaces through each other? It should behave very similar
  • Do you get a warning message that “Final force error = …” through all the steps of your simulation?
  • Do the implants start in the penetrated state?
  • Do these surfaces only contain articulation part (open) or have everything (solids)?
    Regards,
    Pavel

Pavel,

I remeshed my STL so when I ran it I did not get the triangle mesh waning any more. Then I ran my program and it worked again. So for future users I would suggest making sure that there are no errors in the STL in order to make sure the Surface force contact works.

My model is running now but it is doing things that are not correct. My ligaments are straining more than to strain value I am setting for them. I have the strain value set for 6% and they are straining more than 50%. So my model, is running but the data I am getting is not valid. I was wondering if I set up my Ligament properties correctly.

[SIZE=3] [SIZE=2]AnyForce[/SIZE][/SIZE] ACLForce = {
AnyVar k = 254; //stiffness
AnyVar lr = 0.02903382;//ligament length
AnyVar er = 0.06;//strain
AnyKinMeasure& meas = .PLine;
AnyVar l0 = lr/(er+1); //slack length
AnyVar esp0 = 0.03; //strain
AnyVar esp = (meas.Pos[0]-l0)/l0;
AnyFloat Val = {
iffun(gteqfun(esp,0.0),iffun(gtfun(esp,2esp0),-k(esp-esp0),-k1/4(esp^2/esp0)*0),0.0)
};//Val
F = Val;
};//ACLForce
[SIZE=3][SIZE=2][/SIZE][/SIZE]
[SIZE=3][SIZE=2][/SIZE][/SIZE]
[SIZE=3][SIZE=2][COLOR=black]I am not a 100% about all the variables. I took most of these from the KneeBend Beta model. I was wondering if you had any explanations or suggestions for my ligament properties and why they are not working as I would expect?[/SIZE][/COLOR][/SIZE]
[SIZE=3][SIZE=2][COLOR=#000000][/SIZE][/COLOR][/SIZE]
[SIZE=3][SIZE=2][COLOR=#000000]Thanks,[/SIZE][/COLOR][/SIZE]
[SIZE=3][SIZE=2][COLOR=#000000]Michael
[/SIZE][/COLOR][/SIZE]

Michael,

Good to hear that refining your mesh helped. But this particular problem will not always cause the model to stop “moving”. Sometimes in introduces kinks in the solution only. What looked like an absence of motion was most likely inability of the solver to find the right solution, and this, in turn, kept the initial guess as a temporary solution to proceed to the next step. So if you observe the “absence of motion” + messages from the solver containing “final force error” - it means that the solver cannot solve the problem in this particular timestep for one or another reason, which could be related to the surface quality.

Secondly, definition of the ligament model looks ok - i guess you’ve changed nothing compared to the TKA-KneeBendDemo model. I can’t help you with the actual values because they are very case specific, especially not being able to play with the model. Typically a thorough calibration study is needed to get them right. So please check your calibration procedures to be 100% sure about the values. It might also be that this particular ligament is OK, but the other is too tight/too short, which causes a softer one to elongate more.

Do you use patient-specific bones? I can see that you decreased the stiffness by ~75%, and ACL length is smaller as compared to the Beta model implementation.

Regards,
Pavel

Hi Pavel,

I currently run a calibration study which gives me the ligament value lengths at zero degrees of flexion but this is the only calibration study I do. Would suggest another type of calibration?

You are right about the ligament stiffness being low. I looked up in literature and the ACL has a stiffness of 254 N/mm. I forgot to do unit conversions into AnyBody to make it 254e3 N/m. However this is way greater than the Betas stiffness.

My model does not work at this stiffness of 254e3 but it does work at 254e2 N/m. If I use the higher stiffness the implants go through each other. Do you have any suggestions of how to keep the implants from going through each other at a stiffness of 254e3 N/m? I still have the problem with my ligaments elongating to much, so I believe that if I can get this larger stiffness to work it might solve the elongation problem.

The second question I have, is when I flex my knee, the implant does not stay at the lowest contact point. In other words the ligaments do not seem to be balancing the knee which is causing the thigh to roll back on the shank instead of just rotating. I believe this has to do with my ligament calibration possibly. Would you agree with this as being a possibility? If so, how would you calibrate these ligaments because currently I only calibrate them at zero degrees of flexion.

Thanks,
Michael

Hi Pavel,

Adding on to my most recent post I realized I made a mistake. The K value I was entering isn’t stiffness/mm it is just the stiffness in N. I changed this value close to what the beta has and what I found in other literature values. This is what my ligament code looks like now.

[SIZE=3] [SIZE=2]AnyForce[/SIZE][/SIZE] ACLForce = {
AnyVar k = 9000; //stiffness
AnyVar lr = 0.0289;//******************************
AnyVar er = 0.06;//strain
AnyKinMeasure& meas = .PLine;
AnyVar l0 = lr/(er+1); //slack length
AnyVar esp0 = 0.03; //strain
AnyVar esp = (meas.Pos[0]-l0)/l0;
AnyFloat Val = {
iffun(gteqfun(esp,0.0),iffun(gtfun(esp,2esp0),-k(esp-esp0),-k1/4(esp^2/esp0)*0),0.0)
};//Val
AnyVar EqStiffness = k/l0;
F = Val;
};//ACLForce

[COLOR=black]I realized that the stiffness is calculated at the end with k/l0 to give me N/mm. This seems to be working okay now. [/COLOR]
[COLOR=#000000][/COLOR]
[COLOR=#000000]I am still running into the problem with the ligaments not doing a good job at balancing the knee allowing it to roll off the back of the knee. I was wondering if you had any suggestions?[/COLOR]
[COLOR=#000000][/COLOR]
[COLOR=#000000]Thanks,[/COLOR]
[COLOR=#000000]Michael
[/COLOR]

Dear [COLOR=#000000]Michael,

There is no single solution which guarantees the proper working of a FDK model.

One way that I can suggest is to define a linear and a rotational spring between the femoral and the tibial parts.

Then you can modify the real ligaments(stiffness) until those artificial ligaments are not necessary.

I hope this may be helpful to you.

Best regards,
Moonki
[/COLOR]