Example d28: FFD mechanics of two hamstrings during hip flexion.

This example illustrates FFD mechanics of two hamstrings during hip flexion.

0 degrees flexion 60 degrees flexion
Fig. 1 0 degrees flexion Fig. 2 60 degrees flexion


The comfile run by this example is as follows:


############################################################
# This example illustrates FFD-mechanics of the two 
# hamstring muscles (semimembranosus and semitendinosus)
# during a hip flexion movement. The muscles are defined 
# inside host meshes which also have a similar shape to
# the muscle, as in extended-FFD. Mechanics is solved on
# the hosts, with different material properties for tendon
# and muscle, and volume conservation. The embedded muscles
# are then updated at each load step. Similar to example
# d27, contact is between the two embedded slave bodies and 
# the muscle hosts are constrained to ensure no overlap
# between the muscles.
############################################################

fem def para;r;FARO;example
fem def region;r;FARO;example
fem def coord 3,1

fem def base;r;bicubic_linear_tricubic;example
$REG=1;

################ muscle host MESHES ################
# host_list 

@host_list = ('semitendinosus','semimembranosus');
foreach $component(@host_list)
{ 
# Host mesh
fem def node;r;host_$component;example region $REG 
fem def element;r;host_$component;example region $REG

fem up node der 1 linear reg $REG
fem up node der 2 linear reg $REG
fem up node der 3 linear reg $REG
fem update scale_factors normalise reg $REG

if($REG==1){fem group elements 8001,8004 as TEN2 reg $REG}
if($REG==1){fem group elements 8002,8003 as MUSCLE2 reg $REG}
if($REG==1){fem group nodes 8009..8020 as PRESCRIBE2 reg $REG}
if($REG==1){fem group nodes 8001..8008 as FREE2 reg $REG}

if($REG==2){fem group elements 7001,7003 as TEN reg $REG}
if($REG==2){fem group elements 7002,7004 as MUSCLE reg $REG}
if($REG==2){fem group nodes 7009..7016 as PRESCRIBE reg $REG}
if($REG==2){fem group nodes 7001..7008,7021..7024 as FREE reg $REG}

fem def fibre;r;host_$component;example region $REG
fem def elem;r;host_$component;example fibre region $REG

fem def field;r;host_$component;example region $REG
fem def elem;r;host_$component;example field region $REG

#fem exp nodes;host_zero_$component as host_$component region $REG;
#fem exp elem;host_zero_$component as host_$component region $REG;

# host 
fem def equa;r;host_$component;example reg $REG
fem def mate;r;host_$component;example reg $REG
fem def init;r;host_$component;example reg $REG

# put initial host geometry into fields 1,2,3
fem update field 1 reg $REG subst geometry x reg $REG;
fem update field 2 reg $REG subst geometry y reg $REG;
fem update field 3 reg $REG subst geometry z reg $REG;
fem update field 4 reg $REG subst geometry x reg $REG;
fem update field 5 reg $REG subst geometry y reg $REG;
fem update field 6 reg $REG subst geometry z reg $REG;
fem update field 7 reg $REG subst geometry x reg $REG;
fem update field 8 reg $REG subst geometry y reg $REG;
fem update field 9 reg $REG subst geometry z reg $REG;

$REG=$REG+1;
}

################ bone MESHES ################ 

# bone_list 
@bone_list = ('femur','tibia','hip');
foreach $component(@bone_list)
{ 
# Read in bone
fem def node;r;test_$component;example region $REG 
fem def element;r;test_$component;example region $REG

fem change nodes translate by -241,-170,877 reg $REG

# Field 
fem def field;r;simulate_$component;example region $REG 
fem def elem;r;simulate_$component;example field region $REG 

## Export initial bone
#fem exp nodes;initial_$component as $component region $REG
#fem exp elem;initial_$component as $component region $REG

# put initial geometry into fields 1,2,3
fem update field 1 reg $REG subst geometry x reg $REG;
fem update field 2 reg $REG subst geometry y reg $REG;
fem update field 3 reg $REG subst geometry z reg $REG;
fem update field 4 reg $REG subst geometry x reg $REG;
fem update field 5 reg $REG subst geometry y reg $REG;
fem update field 6 reg $REG subst geometry z reg $REG;
fem update field 7 reg $REG subst geometry x reg $REG;
fem update field 8 reg $REG subst geometry y reg $REG;
fem update field 9 reg $REG subst geometry z reg $REG;

$REG=$REG+1;
}

################ SLAVE_muscles MESH ################ 


# muscle_list
@muscle_list = ('semitendinosus','semimembranosus')
foreach $component(@muscle_list)
{ 
# Read in muscle

fem def node;r;simulate_$component;example region $REG
fem def element;r;simulate_$component;example region $REG

fem change nodes translate by -241,-170,877 reg $REG

# Field 
fem def field;r;simulate_$component;example region $REG
fem def elem;r;simulate_$component;example field region $REG

## Export initial muscle
#fem exp nodes;initial_$component as $component region $REG
#fem exp elem;initial_$component as $component region $REG

# slave
fem def equa;r;simulate_$component;example reg $REG
fem def mate;r;simulate_$component;example reg $REG
fem def init;r;simulate_$component;example reg $REG

# put initial geometry into fields 1,2,3
fem update field 1 reg $REG subst geometry x reg $REG;
fem update field 2 reg $REG subst geometry y reg $REG;
fem update field 3 reg $REG subst geometry z reg $REG;
fem update field 4 reg $REG subst geometry x reg $REG;
fem update field 5 reg $REG subst geometry y reg $REG;
fem update field 6 reg $REG subst geometry z reg $REG;
fem update field 7 reg $REG subst geometry x reg $REG;
fem update field 8 reg $REG subst geometry y reg $REG;
fem update field 9 reg $REG subst geometry z reg $REG;

if($REG==6){fem def xi;c nodes contain of $REG in 1 loose}
#if($REG==6){fem def xi;w;$component nodes contain of $REG in 1}
if($REG==7){fem def xi;c nodes contain of $REG in 2 loose}
#if($REG==7){fem def xi;w;$component nodes contain of $REG in 2}

$REG=$REG+1;
}

#######################################

# define contact parameters
fem def contact;r;contact;example

fem def solve;r;contact;example coupled reg 1,2

# Load steps
#for ($j=1;$j<61;$j++)
for ($j=1;$j<5;$j++) # for testing
{
# Precribe rotation
fem change nodes translate by 0,-0.33,1.25 node 8009..8012 reg 1
fem change nodes translate by 0,0.083,0.83 node 7009..7012 reg 2
fem change nodes rotate by -1 about 0,0,0 axis 1,0,0 reg 5

# Update muscle in host and export
fem update field 1 reg 1 subst geometry x reg 1;
fem update field 2 reg 1 subst geometry y reg 1;
fem update field 3 reg 1 subst geometry z reg 1;
fem update geometry x reg 1 subst field 4 reg 1
fem update geometry y reg 1 subst field 5 reg 1
fem update geometry z reg 1 subst field 6 reg 1
fem def xi;r;semitendinosus;example nodes contain of 6 in 1 reg 6
fem update mesh position fit of 6 in 1
fem update geometry x reg 1 subst field 1 reg 1
fem update geometry y reg 1 subst field 2 reg 1
fem update geometry z reg 1 subst field 3 reg 1
fem update field 4 reg 1 subst geometry x reg 1;
fem update field 5 reg 1 subst geometry y reg 1;
fem update field 6 reg 1 subst geometry z reg 1;

# Update muscle in host and export
fem update field 1 reg 2 subst geometry x reg 2;
fem update field 2 reg 2 subst geometry y reg 2;
fem update field 3 reg 2 subst geometry z reg 2;
fem update geometry x reg 2 subst field 4 reg 2
fem update geometry y reg 2 subst field 5 reg 2
fem update geometry z reg 2 subst field 6 reg 2
fem def xi;r;semimembranosus;example nodes contain of 7 in 2 reg 7
fem update mesh position fit of 7 in 2
fem update geometry x reg 2 subst field 1 reg 2
fem update geometry y reg 2 subst field 2 reg 2
fem update geometry z reg 2 subst field 3 reg 2
fem update field 4 reg 2 subst geometry x reg 2;
fem update field 5 reg 2 subst geometry y reg 2;
fem update field 6 reg 2 subst geometry z reg 2;

fem update solution from geometry substitute reg 1,2

$CONVERGED=0;
while ($CONVERGED==0) 
#for ($z=1;$z<2;$z++)
{

######################################################contact setup

## Faces: (slave) semitendinosus
## 3418,3421,3424,3426,3429,3431,3434,3436,3439,3441

## Faces: (master) semimembranosus
## 3487,3491,3495,3498,3502,3505,3509,3512

fem def xi;c contact faces 3418,3421,3424,3426,3429,3431,3434,3436,3439,3441 points 6 reg 6

# Define data at xi positions 
fem def data;c from_xi reg 6
# Calculate xi in slave host
fem def xi;c closest reg 1

# Update slave info
fem update data field to slave reg 1

# Project onto target face (master surface)
fem group faces 3487,3491,3495,3498,3502,3505,3509,3512 as TARGET reg 7
fem def xi;c closest_face faces TARGET reg 7

# store projection gap in data fields
fem update data field from gap reg 7  

# Change Master object to host
# Create data from xi points
fem def data;c from_xi reg 7

# Generate xi in host
fem def xi;c closest reg 2

# Update master info
fem update data field to master reg 2 

######################################################solve

# Place initial geometry YP(ny,3) into XP
FEM up geom from sol YP_index 3 to 1..3 reg 1,2
fem solve error 0.1 iterate 15 coupled reg 1,2
# update XP from YP
FEM up geom from sol to 1..3 reg 1,2

# Update muscle in host and export
fem update field 1 reg 1 subst geometry x reg 1;
fem update field 2 reg 1 subst geometry y reg 1;
fem update field 3 reg 1 subst geometry z reg 1;
fem update geometry x reg 1 subst field 4 reg 1
fem update geometry y reg 1 subst field 5 reg 1
fem update geometry z reg 1 subst field 6 reg 1
fem def xi;r;semitendinosus;example nodes contain of 6 in 1 reg 6
fem update mesh position fit of 6 in 1
fem update geometry x reg 1 subst field 1 reg 1
fem update geometry y reg 1 subst field 2 reg 1
fem update geometry z reg 1 subst field 3 reg 1
fem update field 4 reg 1 subst geometry x reg 1;
fem update field 5 reg 1 subst geometry y reg 1;
fem update field 6 reg 1 subst geometry z reg 1;

# Update muscle in host and export
fem update field 1 reg 2 subst geometry x reg 2;
fem update field 2 reg 2 subst geometry y reg 2;
fem update field 3 reg 2 subst geometry z reg 2;
fem update geometry x reg 2 subst field 4 reg 2
fem update geometry y reg 2 subst field 5 reg 2
fem update geometry z reg 2 subst field 6 reg 2
fem def xi;r;semimembranosus;example nodes contain of 7 in 2 reg 7
fem update mesh position fit of 7 in 2
fem update geometry x reg 2 subst field 1 reg 2
fem update geometry y reg 2 subst field 2 reg 2
fem update geometry z reg 2 subst field 3 reg 2
fem update field 4 reg 2 subst geometry x reg 2;
fem update field 5 reg 2 subst geometry y reg 2;
fem update field 6 reg 2 subst geometry z reg 2;

}

##export tibia and host
#fem exp nodes;hip_$j as hip region 5
#fem exp nodes;host_semitendinosus_$j as host_semitendinosus reg 1
#fem exp nodes;host_semimembranosus_$j as host_semimembranosus reg 2

# Update muscle in host and export
fem update field 1 reg 1 subst geometry x reg 1;
fem update field 2 reg 1 subst geometry y reg 1;
fem update field 3 reg 1 subst geometry z reg 1;
fem update geometry x reg 1 subst field 4 reg 1
fem update geometry y reg 1 subst field 5 reg 1
fem update geometry z reg 1 subst field 6 reg 1
fem def xi;r;semitendinosus;example nodes contain of 6 in 1 reg 6
fem update mesh position fit of 6 in 1
#fem exp nodes;semitendinosus_$j as semitendinosus region 6
fem update geometry x reg 1 subst field 1 reg 1
fem update geometry y reg 1 subst field 2 reg 1
fem update geometry z reg 1 subst field 3 reg 1
fem update field 4 reg 1 subst geometry x reg 1;
fem update field 5 reg 1 subst geometry y reg 1;
fem update field 6 reg 1 subst geometry z reg 1;

# Update muscle in host and export
fem update field 1 reg 2 subst geometry x reg 2;
fem update field 2 reg 2 subst geometry y reg 2;
fem update field 3 reg 2 subst geometry z reg 2;
fem update geometry x reg 2 subst field 4 reg 2
fem update geometry y reg 2 subst field 5 reg 2
fem update geometry z reg 2 subst field 6 reg 2
fem def xi;r;semimembranosus;example nodes contain of 7 in 2 reg 7
fem update mesh position fit of 7 in 2
#fem exp nodes;semimembranosus_$j as semimembranosus reg 7
fem update geometry x reg 2 subst field 1 reg 2
fem update geometry y reg 2 subst field 2 reg 2
fem update geometry z reg 2 subst field 3 reg 2
fem update field 4 reg 2 subst geometry x reg 2;
fem update field 5 reg 2 subst geometry y reg 2;
fem update field 6 reg 2 subst geometry z reg 2;

## Update scale factors so will equal arc-lengths
#fem update scale_factors normalise reg 6,7
#fem list lines;lines_$j 

}

Additional testing commands:



Files used by this example are:

Name                             Modified     Size

example_d28.com 23-Apr-2008 11k FARO.ippara 09-Nov-2008 6.0k FARO.ipregi 04-Oct-2004 93 bicubic_linear_tricubic.ipbase 04-Oct-2004 11k contact.ipcont 25-Sep-2008 627 contact.ipdata 04-Oct-2004 46k contact.ipsolv 16-Aug-2010 2.7k contact.ipsolv.old 13-Apr-2007 2.5k contact.ipxi 04-Oct-2004 36k contact.irsolv 16-Aug-2010 3.0k contact.irsolv.old 13-Apr-2007 2.8k contact_slave.ipxi 04-Oct-2004 36k contact_target.ipxi 04-Oct-2004 38k femur_host.ipelfd 04-Oct-2004 709 femur_host.ipfiel 04-Oct-2004 5.7k hamstring_host.ipelfb 04-Oct-2004 944 hamstring_host.ipelfd 04-Oct-2004 1.9k hamstring_host.ipfibr 04-Oct-2004 25k hamstring_host.ipfiel 04-Oct-2004 75k hamstring_host.ipmate 04-Oct-2004 7.6k host_hamstring.ipelem 04-Oct-2004 625 host_hamstring.ipequa 04-Oct-2004 2.0k host_hamstring.ipinit 04-Oct-2004 5.0k host_hamstring.ipmate 04-Oct-2004 7.6k host_hamstring.ipnode 04-Oct-2004 2.2k host_semimembranosus.ipelem 04-Oct-2004 2.2k host_semimembranosus.ipelfb 04-Oct-2004 1.2k host_semimembranosus.ipelfd 04-Oct-2004 2.5k host_semimembranosus.ipequa 04-Oct-2004 2.2k host_semimembranosus.ipfibr 04-Oct-2004 31k host_semimembranosus.ipfiel 04-Oct-2004 93k host_semimembranosus.ipinit 04-Oct-2004 5.0k host_semimembranosus.ipmate 04-Oct-2004 7.5k host_semimembranosus.ipnode 04-Oct-2004 37k host_semitendinosus.ipelem 04-Oct-2004 2.2k host_semitendinosus.ipelfb 04-Oct-2004 1.2k host_semitendinosus.ipelfd 04-Oct-2004 2.5k host_semitendinosus.ipequa 04-Oct-2004 2.2k host_semitendinosus.ipfibr 04-Oct-2004 31k host_semitendinosus.ipfiel 04-Oct-2004 93k host_semitendinosus.ipinit 04-Oct-2004 5.0k host_semitendinosus.ipmate 04-Oct-2004 7.6k host_semitendinosus.ipnode 04-Oct-2004 37k mesh_semitendinosus.ipelem 04-Oct-2004 18k mesh_semitendinosus.ipnode 04-Oct-2004 44k semimembranosus.ipelem 04-Oct-2004 10k semimembranosus.ipnode 04-Oct-2004 32k semimembranosus.ipxi 04-Oct-2004 2.9k semimembranosus_muscle.txt 04-Oct-2004 1.1k semimembranosus_tendon.txt 04-Oct-2004 1.1k semitendinosus.ipxi 04-Oct-2004 4.2k semitendinosus_muscle.txt 04-Oct-2004 0 semitendinosus_tendon.txt 04-Oct-2004 0 simulate_femur.ipelem 04-Oct-2004 473k simulate_femur.ipelfd 04-Oct-2004 501k simulate_femur.ipfiel 04-Oct-2004 1.8M simulate_femur.ipnode 04-Oct-2004 841k simulate_hip.ipelem 04-Oct-2004 43k simulate_hip.ipelfd 04-Oct-2004 51k simulate_hip.ipfiel 04-Oct-2004 1.0M simulate_hip.ipnode 04-Oct-2004 407k simulate_semimembranosus.ipelem 04-Oct-2004 12k simulate_semimembranosus.ipelfd 04-Oct-2004 14k simulate_semimembranosus.ipequa 04-Oct-2004 2.2k simulate_semimembranosus.ipfiel 04-Oct-2004 80k simulate_semimembranosus.ipinit 04-Oct-2004 1.0k simulate_semimembranosus.ipmate 04-Oct-2004 5.5k simulate_semimembranosus.ipnode 04-Oct-2004 32k simulate_semitendinosus.ipelem 04-Oct-2004 18k simulate_semitendinosus.ipelfd 04-Oct-2004 22k simulate_semitendinosus.ipequa 04-Oct-2004 2.2k simulate_semitendinosus.ipfiel 04-Oct-2004 113k simulate_semitendinosus.ipinit 04-Oct-2004 1.0k simulate_semitendinosus.ipmate 04-Oct-2004 5.5k simulate_semitendinosus.ipnode 04-Oct-2004 46k simulate_tibia.ipelem 04-Oct-2004 96k simulate_tibia.ipelfd 04-Oct-2004 102k simulate_tibia.ipfiel 04-Oct-2004 402k simulate_tibia.ipnode 04-Oct-2004 180k test.ipelem 04-Oct-2004 10k test.ipnode 04-Oct-2004 32k test_femur.ipelem 04-Oct-2004 473k test_femur.ipnode 04-Oct-2004 924k test_hip.ipelem 04-Oct-2004 43k test_hip.ipnode 04-Oct-2004 419k test_output.com 04-Oct-2004 0 test_tibia.ipelem 04-Oct-2004 96k test_tibia.ipnode 04-Oct-2004 203k view.com 04-Oct-2004 2.1k

Download the entire example:

Name                      Modified     Size

examples_d_d2_d28.tar.gz 17-Aug-2010 767k

Testing status by version:

StatusTestedReal time (s)
hpc_cmo64_irixSuccessSun Jul 31 02:34:23 20051433
rs6000-aix
cm64SuccessWed Mar 4 01:58:35 2009478
x86_64-linux
cmSuccessSun Mar 6 00:07:25 2016180

Testing status by file:


Html last generated: Sun Mar 6 05:51:25 2016

Input last modified: Mon Aug 16 11:35:03 2010


CMISS Help / Examples / d / d2 / d28