Académique Documents
Professionnel Documents
Culture Documents
Tutorial Week 10
Internal bone remodelling
Introduction
This tutorial will introduce the necessary steps to simulate internal bone remodelling
of an implanted femur using ANSYS. You will learn to:
Export this geometry from ScanIP as an IGS file. The femoral component of the hip
implant is available for download on the course website (FemoralImplant.IGS), under
the tutorial content for week 4, shown below.
AMME4981 Applied Biomedical Engineering
AMME9981 Computational Biomedical Engineering
Once you have both IGS geometries, they can be imported into Workbench. While it
is possible to import geometries directly into ANSYS Classic, the CAD interfaces in
Workbench are significantly more modern and work much better with external
geometry files. Start a new Mechanical Model module in the Workbench project
window. Double-click on geometry to open Design Modeler. Import both the femur
and implant geometries. They should look something like this:
The process of aligning these two geometries is provided in the week 4 tutorial. This
involves a simple body translation to move the implant into the correct position as
shown.
Once correctly aligned, a cavity for the implant in the femur is required. Use the
Boolean subtraction function provided in Design Modeler (Create > Boolean) to
AMME4981 Applied Biomedical Engineering
AMME9981 Computational Biomedical Engineering
create this cavity. Remember to select the femur as the target body and the implant
as the tool body, and ensure Preserve tool bodies is enabled (Yes).
Pay attention! At this point, the instructions deviate from week 4’s tutorial.
For this model, we are going to assume that the bone and implant are glued
together. We could allow Workbench to apply the default bonded condition to the
contact surfaces between these two geometries, but the simplest way to define this
relationship is to form a single part. Do this by selecting both geometries in the tree
outline, right-clicking and choosing Form New Part. For the mesh-savvy amongst
you, forming a new part enforces a contiguous mesh between the implant and the
bone. This means that the implant and bone will share the same nodes along their
interface, effectively gluing the two bodies together, and negating the need for
special contact conditions.
The result will be a single part containing two individual bodies. Don’t worry,
separate material properties may still be assigned to these two bodies. Close the
Design Modeler window, and it’s probably a good idea to save your project file at this
point.
The FE Modeler module enables the export of mesh objects created in Workbench
to a variety of formats, including to ANSYS Classic by creating an APDL input file. It
will also translate the materials specified in Engineering Data and the Named
Selections defined in the Mechanical application to their APDL analogues.
Before opening FE Modeler, ensure that the unit used for the model are in metres,
not millimetres. You can do this by checking the Properties of the Assembly Mesh
in the Outline pane. If you don’t see Outline and Properties panes, go to View >
Outline and View > Properties in the project window.
Open FE Modeler by double-clicking the Model component. Ensure that the Target
System is Mechanical APDL. You can check out the features of your mesh in the
outline tree. If all the instructions have been followed correctly, all you need to do is
click on Write Solver File. This writes all the mesh data to an APDL input file. You
can preview the contents of this file under Generate Data. Name your input file
“A3_mesh.inp” so it can be identified later.
AMME4981 Applied Biomedical Engineering
AMME9981 Computational Biomedical Engineering
Some of these commands will be explained later in this tutorial when you work with
the template input file. The ! character denotes a comment, as does the /com
command. Briefly, the above set of commands opens the pre-processing module
(PREP7), sets up two materials (MP), with Young’s modulus (EX) and Poisson’s
ratio (NUXY), and then specifies a type of element to use (ET), which is called
MESH200. The Young’s modulus and Poisson’s ratio of the materials you specified
in Engineering Data previously should be reflected in the MP commands. All we want
in this input file is the definition of the nodes, elements, and the named selection,
which is called a component in APDL. So either delete, or comment out the above
selection of commands. You should end up with the nodal listing (list of node
numbers and their co-ordinates):
nblock,3
(1i8,3e20.9e3)
<nodes>
AMME4981 Applied Biomedical Engineering
AMME9981 Computational Biomedical Engineering
and the element listing (list of element numbers, the material number, element type,
and the nodes that are used to construct them):
eblock,19,solid,12307
(19i8)
<elements>
and the component listing (component from the Named Selection, and the
associated node numbers):
CMBLOCK,NECK ,NODE, 37
(8i10)
<nodes>
Note that the CMBLOCK command, which is used to define the component,
specifies 37 nodes. This is important later, when we apply forces on these nodes.
Then go to the very end of the input file (Ctrl+End), and delete the following
unnecessary commands.
!
! BOUNDARY CONDITIONS
!
!
! LOADS
!
!
! Solution
!
!
! Turn output back on
!
/GOPR
!
FINI
/GOPR
To enable the set-up of model, /PREP7 command is issued to activate the pre-
processing modules in ANSYS. After this, we can define the materials, mesh, and
loads.
AMME4981 Applied Biomedical Engineering
AMME9981 Computational Biomedical Engineering
et,1,SOLID187 defines element type number 1 as a SOLID187, which is a 10-
node tetrahedral element (10 nodes means it has mid-side nodes and therefore has
quadratic shape functions). This matches the type of mesh we defined in Step 2.
Next we need to define the material properties of the femur bone (material number
1). As the Young’s modulus of the femur bone is going to change in response to a
mechanical stimulus, TB,ELASTIC,1 is used to make a material table that can be
used to define changing elastic material properties (i.e. Young’s modulus and
Poisson’s ratio).
This work-around allows us to directly change the Young’s modulus of the bone by
changing UF01 using a Fortran subroutine. Note that the Poisson’s ratio will stay the
same here.
The implant is then given regular material properties using the MP command. You
can change the numbers to give the implant a Young’s modulus (EX) and Poisson’s
ratio (NUXY) of your own choosing.
Next, it’s time to import the mesh you defined in the “A3_mesh.inp” APDL file. You
can insert it using: /INPUT,A3_MESH,inp. This type of command can be used to
input any APDL code into the file without having to copy and paste it over.
Following this are commands that give an initial value to the UF01 field variable that
was defined earlier. The femur bone elements need this for the first time-step (before
any bone remodelling has occurred). In this example, we’ve assumed that the bone
is completely homogeneous, and has a Young’s modulus of approximately 10.5
GPa.
To fix the base of the femur, the nodes on the bottom face of the femur need to be
selected. The following commands select these nodes, set their displacements in the
AMME4981 Applied Biomedical Engineering
AMME9981 Computational Biomedical Engineering
X, Y, and Z directions to 0, and then re-select everything to prevent confusion with
the following commands.
NSEL,S,LOC,Z,-445.9e-3
D,ALL,UX,0
D,ALL,UY,0
D,ALL,UZ,0
ALLSEL
Forces in the Z direction (FZ) can be applied onto the component/named selection
that was defined from Workbench. Specify the name of the component (NECK) when
issuing the F command. Forces can also be applied in the X (FX) and Y (FY)
directions as well by issuing multiple commands. Note that the force is applied to
each node, so we divide the total force by the number of nodes noted earlier in the
component definition (37 nodes for the example given in Step 4).
The final part of the APDL input file specifies the solution settings.
antype,transient
time,24
deltim,1
outres,all,all
outres,svar,all
solve
finish
save
These commands specify a transient analysis type (ANTYPE), which will terminate at
time = 24 (TIME), in increments of 1 (DELTIM), and export all the results for all the
time-steps (OUTRES), including the state variable (SVAR) which will contain the bone
density data. SOLVE executes the solution. SAVE creates a .DB file that can be used
to reopen the model in the ANSYS Classic GUI.
You may add your own post-processing commands to save the bone density plots
automatically after it finishes solving (see Appendix). Once you have completed
creating the APDL input file, save it with a different filename (e.g. A3_solve.inp)
Before we run our APDL input file (A3_solve.inp), ANSYS needs to know if there is a
subroutine we would like to use, and where it is located. Let’s assume you followed
the instructions above and put all the pre-compiled files into the working directory
(e.g. “assignment”). Use the following commands to set a temporary ANSYS
environmental variable, and check that it has been set properly.
set ANS_USER_PATH=C:\Users\your_unikey\Desktop\assignment
echo %ANS_USER_PATH%
-j specifies the job name (and the name of the files that get dumped in your working
directory)
• Main Menu > General Postproc > Plot Results > Nodal Solution > Stress >
von Mises stress
• plnsol,s,eqv
AMME4981 Applied Biomedical Engineering
AMME9981 Computational Biomedical Engineering
Sometimes contour limits don’t show enough of the distribution, so you can change
them.
• PlotCtrls > Style > Contours > Uniform Contours > User specified
• /cont,,10,0,,1e6
/replot
For the example /cont command, 10 is the number of contour levels, 0 is the
minimum level, and 1e6 is the maximum level.
Any results over the maximum contour level will show up as grey. If you find this
disconcerting, you can change it to red.
• PlotCtrls > Style > Colors > Contour Colors > Color above contours
• /color,smax,red
To plot bone density, which was stored as state variable, use the following
command.
• plnsol,svar,1
You can use the same contour controls to show which parts of the bone remodel the
most. Keep in mind that the first time-step shows no remodelling, as the bone starts
off as a homogeneous 1800 kg/m3. Bone density data is available for all remaining
time-steps. A more advanced subroutine would include greyscale data from CT
scans to create an initially inhomogeneous femur bone.
Once you are done with the current time-step, move to the next one and so on.
• Main Menu > General Postproc > Read Results > Next Set
• Enter the following APDL commands into the Scripting bar
set,,2
Add this set of commands to some of the initial post-processing commands (/POST1
and the contour controls) and you can then put it in the solvable APDL input file.
Alternatively, just save it in a text file, and read it in through the Classic GUI.
• File > Read Input From…