AnyFE Tool for Ansys (APDL code generator)

Hi,

does anyone have a template for the APDL code generator to create code for Ansys workbench? If so it would be nice if you could share =)

Best regards

Patrick

Hi Patrick,

This template is a part of the APDL converter package - you can find it in the “examples” folder. I am not sure whether it will work fine with the workbench, but it should be possible to modify it if needed in ANSYS classical.

Regards,
Pavel

Hi Pavel,

thanks for you reply.
I know that there is a template but this doesn’t work with workbench. I thought maybe somebody might have already modified the template to make it work with workbench and would be willing to share…

I also have a problem in running the APDL code in classical because if I do the same as in the tutorial for my model it doesn’t work.
I exported a femur from AnyBody, and created an iges from that stl. Subsequently I imported the iges Ansys classical and created the CS with #1000. After that I tried to run the APDL code. I get thousands of warnings now:

*** WARNING ***                         CP =     211.366   TIME= 07:45:15
 No *DO trips needed, enter *ENDDO .                                     

 *** WARNING ***                         CP =     211.506   TIME= 07:45:15
 Node 0 of *GET command is undefined.                                    
  Line= *get,nlocx,NODE,nodeNext,LOC,X                                   
  The *GET command is ignored.                                           

 *** WARNING ***                         CP =     211.584   TIME= 07:45:15
 Node 0 of *GET command is undefined.                                    
  Line= *get,nlocy,NODE,nodeNext,LOC,Y                                   
  The *GET command is ignored.                                           

 *** WARNING ***                         CP =     211.600   TIME= 07:45:15
 Node 0 of *GET command is undefined.                                    
  Line= *get,nlocz,NODE,nodeNext,LOC,Z                                   
  The *GET command is ignored.   

finally the error

 *** ERROR ***                           CP =      97.173   TIME= 07:00:06
 There are no elements defined.   

Do you have any ideas?

Best regards, Patrick

Hi Patrick,

Yes, we have done some modifications to the template to make it a little bit more stable - see the attachment. But I can’t guarantee that it will nicely work in Workbench. Please check whether that helps or not.

Regarding the problem: have you meshed your model? It seems that it does not have any nodes for *GET.

Regards,
Pavel

Hello Pavel,

thank you for the script. Unfortunately it doesn’t work for me in ansys classic, I always get the error:

Node 250000 is attached to VOLUME 1 and cannot be altered.

Best regards,

Patrick

That node is a maximum numbered node that was created artificially to define inertia relief related nodes. You can create another number. Please check the APDL code to see what is happening inside. I can assist with that if you have any questions.

Pavel

[SIZE=2]This are the information from the output window, do these help?

CURRENT JOBNAME REDEFINED AS loadstep0

PARAMETER FORCENR =     0.000000000

PARAMETER POSX =   -0.2821486649E-01

PARAMETER POSY =   -0.6632222442E-01

PARAMETER POSZ =    0.1632586468E-01

PARAMETER FORCEX =    0.2172682860E-14

PARAMETER FORCEY =    0.2667947713E-14

PARAMETER FORCEZ =   -0.4873721508E-15

PARAMETER MOMENTX =     0.000000000

PARAMETER MOMENTY =     0.000000000

PARAMETER MOMENTZ =     0.000000000

         ***** ANSYS ANALYSIS DEFINITION (PREP7) *****

ENTER  /SHOW,DEVICE-NAME  TO ENABLE GRAPHIC DISPLAY
ENTER  FINISH             TO LEAVE PREP7
PRINTOUT KEY SET TO /GOPR (USE /NOPR TO SUPPRESS)

ACTIVE COORDINATE SYSTEM SET TO   1000  (CARTESIAN)

PARAMETER LOCALNR =     250000.0000

PARAMETER NODEFORCENR =     250000.0000

COORDINATE SYSTEM DEFINITION BASED ON CSYS =   1000

COORDINATE SYSTEM 250000 DEFINITION.  TYPE= 0  (CARTESIAN)
  XC,YC,ZC= -28.215     -66.322      16.326
  ANGLES=    0.00    0.00    0.00   PARAMETERS=   1.000   1.000

COORDINATE SYSTEM DEFINITION BASED ON GLOBAL ORIGIN

COORDINATE SYSTEM 250000 DEFINITION.  TYPE= 0  (CARTESIAN)
  XC,YC,ZC= -28.215     -66.322      16.326
  ANGLES=    0.00    0.00    0.00   PARAMETERS=   1.000   1.000
  ORIENTATION=  1.00  0.00  0.00   0.00  1.00  0.00   0.00  0.00  1.00

ACTIVE COORDINATE SYSTEM SET TO 250000  (CARTESIAN)

ACTIVE COORDINATE SYSTEM SET TO 250000  (CARTESIAN)

NODE   250000  KCS=****  X,Y,Z=  0.0000      0.0000      0.0000

*** ERROR ***                           CP =       6.474   TIME= 16:30:01
Node 250000 is attached to VOLUME 1 and cannot be altered.[/SIZE]

I somehow got it to work but now I have another question:
Which units do the AnyBody exported forces and moments have? They seem to be quite small.

Patrick, good to hear.

Check ‘scale’ factor in the template. It is used for conversion from mm to m, where moments will be scaled accordingly.

Regards,
Pavel

Hi Pavel,

another question: Do you use the file you uploaded exactly as it is? Because the beam is commented out and I thought the beams are imperative for the script to work?

Regards

Patrick

Another question is why the nodes are so far away from the bone (look at the screenshot below):

Hi Patrick,

I am a little puzzled - when you say it is outcommented. The version on the official website has still a small section with common material properties for beams. But it is not the latest version, which I expected to find. In the latest version this section is indeed commented, but below the beam elements are still created. The difference is that the material properties had to be adjusted for each element. I will attach the latest version of the template to this message.

Regards,
Pavel

I have a feeling that these are some via points. A good check would be to find the hip and knee joint reaction forces and if they are in place - then all is fine.

Pavel

Pavel, you are right there are via points from the SartoriusProximal…

Thanks again for the file I’ll have a look into it.

Thanks, the template is working.

But I have another question:
Unfortunately the Joint forces are not attached very reasonably. They are attached to some nodes the same way the muscle forces are which seems not be to very reasonable to me. In the picture you can see what I mean: The forces are acting at a very small area.

Maybe it would be more useful to use the whole surface of the femoral head? Maybe you have already spent some time thinking about this problem and would like to share your ideas. I would be very grateful.

Patrick

Hi Patrick,

Yes, you are absolutely right. It has to be applied differently. In reality this force should be applied to acetabular cup that is in contact with the femoral head via a rigid constraint. In case there is no cup - you could apply to a subsurface on the femoral head by creating a component in ANSYS and replacing selection block in the APDL resultant code for this particular force with CMSEL, compname, s or a little more complex selection method.

Hope this helps,
Pavel

Hi,

another question occured:
When I use two segments it seems like the beams are only connected to one of them.

Do you have any idea?

Best regards,
Patrick

Hi Patrick,

Yes, you should look at the selection block of the APDL script. The APDL template that you used did not know about the configuration and components in your model and, thus, used a generic selection procedure, but it has to customized. You need to reselect proper components. I would recommend to create 2 templates for pelvis and for femur. For the former you define a component called pelvis (select pelvis nodes) and modify selection procedure accordingly, for the latter define the femur component.

Something like:
clocal,1001,2,nlocx,nlocy,nlocz
CMSEL,s,PELVIS
nsel,r,loc,x,0,RadiusSel

Hope this helps,
Pavel

Hi Pavel,

I also had that idea but tried to place the cmsel command somewhere else in the code. Unfortunately neither positions work for me.

I created the named selections from nodes in workbench, not in classic, but it should work somehow nevertheless, shouldn’t it?

Regards,
Patrick

Hi Patrick,

You can check in ANSYS Classical whether those components are present or not. If they are not - it will not work.

I have tried something like that with the conversion templates (but yes, i first work from Classical, once everything works go to WB) - it worked for me just fine. So please have a look and make sure the components are present.

Otherwise it is quite difficult for me to help from here.

Best regards,
Pavel