Example h1: Creating time variables from published/user defined data

This example illustrates how an ".iptime" file can be created from published data. The former is an input to CM to define time dependent variables. e.g. time dependent non-standard boundary conditions. In this example we consider aortic pressure variation at the proximal end of the aorta wrt time. This pressure variation is cyclic with an approximate period of 0.87 seconds or the frequency of about 69 cycles per minute (human heart beat rate). A plot of published data (Smith, N.P, PhD thesis, UoA, 1999, pp. 195) is used. Initially we create a scan image of this plot and save as, say , 'pressure_cycle.jpg'. The time axis of the plot varies from 0 - 2 seconds (2 units) while the pressure axis varies from 9 - 15 kPa (6 units). Leave sufficient margins around the plot, 0.5 units on both sides of the time axis and 1 unit on both sides of the pressure axis. This gives us 3 units horizontally and 8 units vertically. When scanning stick to these boundaries.

Time variation of Aortic Pressure


The comfile run by this example is as follows:

gfx create window 1

# Since we work on plane rather than in space, make the window layout 2d
gfx modify window 1 layout 2d;

gfx read nodes example frame
gfx read elements example frame
gfx modify window 1 image view_all

# This creates a 2-D rectangular element of 3 units wide and 8 units tall
# Notice how the texture coordinates are defined in the "frame.exnode" and "frame.exelem"

# Now we read in the image 'pressure_cycle.jpg", create a texture and then material from the texture.
gfx create texture pressure image example pressure_cycle.jpg height 8 width 3
gfx create material pressure texture pressure
gfx modify g_element frame surfaces select_on material pressure texture_coordinates texture selected_material default_selected render_shaded

# As the aspect ratio of the image is not suitable for working on it, we need to scale it properly for the visualization purposes.
gfx modify window 1 view ndc_placement 0 0 4 1

# This sets aspect ratio of the image to 4:1. It is to note that the absolute coordinates of the element nodes have not changed.

# It is now necessary to create nodes. This can be done by node tool. In order to extract the variation of pressure wrt time over a complete cycle we may need about 10 linear segments. This means 11 nodes. 

gfx define field coordinates finite_element number_of_components 2 real coordinate component_names x y         
                                          # defines a coordinate field
gfx create material purple diffuse 1 0 1  # creates a material purple
gfx set line_width 2                      # sets the line width to 2

gfx create egroup entry_pressure          # creates a node/element group
gfx modify g_element entry_pressure node_points glyph cross general size "0.05*0.2*0.0" centre 0,0,0 select_on material purple selected_material default_selected 
                                          # modifies the glyphs
gfx modify g_element entry_pressure lines select_on material purple selected_material default_selected
                                          # modifies the line material

gfx node_tool coordinate_field coordinates create define group entry_pressure
                                          # invokes node tool to create nodes

gfx set order object entry_pressure position 1
                                          # sets the order of position to 1
# Now you can create 11 nodes by clicking the left mouse button. After creating the nodes turn off the node creation option from the node tool before editing the nodes. 

gfx node_tool coordinate_field coordinates no_create no_define group entry_pressure
gfx node_tool coordinate_field coordinates edit group entry_pressure
                                          # turns on the node editing mode
# Once the nodes are placed on the correct positions, 1D linear elements can be created using element creator. 

gfx create element_creator
gfx element_creator coordinate_field coordinates create dimension 1 group entry_pressure

# create 1D linear elements by clicking on relevant nodes.
# edit the node position as required and save node and elements.

gfx write nodes group entry_pressure entry     
                                 # writes out only nodes in entry_pressure group
gfx write elements group entry_pressure entry

# You may create any number of exnode files for each time-dependent variables.

# Now you can exit CMGUI and run the perl script exn2ipt (see below for the link) to create 
# the iptime file. For usage of this script type exn2ipt -help. Further details of the format 
# of iptime can be obtained by studying IPTIME subroutine in CM module fe11.f.

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

# You can view the final form of the pressure curve by reloading CMGUI and running following commands.

gfx create window 1
gfx modify window 1 layout 2d
gfx create material purple diffuse 1 0 1
gfx create material blue diffuse 0 0 1 
gfx set line_width 2                     
gfx read nodes example frame
gfx read elements example frame
gfx create texture pressure image example pressure_cycle.jpg height 8 width 3
gfx create material pressure texture pressure
gfx modify g_element frame surfaces select_on material pressure texture_coordinates texture selected_material default_selected render_shaded
gfx modify window 1 image view_all
gfx modify window 1 view ndc_placement 0 0 4 1
gfx read nodes example entry
gfx read elements example entry
gfx modify g_element entry_pressure lines select_on material purple selected_material default_selected
gfx modify g_element entry_pressure node_points glyph cross general size "0.05*0.2*0.0" centre 0,0,0 select_on material blue selected_material default_selected
gfx set order object entry_pressure position 1

Files used by this example are:

Name                Modified     Size

example_h1.com 08-Oct-2001 4.8k entry.exelem 04-Oct-2001 1.3k entry.exnode 04-Oct-2001 634 exn2ipt 05-Oct-2001 7.8k frame.exelem 04-Oct-2001 1.9k frame.exnode 04-Oct-2001 530 pressure_cycle.jpg 08-Oct-2001 28k

Download the entire example:

Name                  Modified     Size

examples_h_h1.tar.gz 19-Aug-2006 432k

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

Input last modified: Mon Oct 8 09:32:15 2001


CMISS Help / Examples / h / h1