Example a8: Deformation with time, morphing, timekeeper: incision in the eye

This example shows an incision in the cornea of the eye. The deformation of the eye as the cut grows is demonstrated using the time slider and morphing with old-style graphics commands.

Screenshot of example a/a8

The comfile run by this example is as follows:

#Example_a8: Deformation with time, morphing, timekeeper: incision in the eye
# A large proportion of modelling problems involve the time change of some or
# all field quantities such as geometry, stress etc. Cmgui has several features
# to aid visualisation of such changing fields.
# This example looks at the the growth of a slit in the cornea of the eye. It
# starts with the cornea under pressure, which causes the cut to open. There are
# 11 node files describing the geometry over time, which are read in and
# viewed. Graphical element groups are used to create a simple animation of the
# incision, that  can be controlled with the time slider on the graphics window.
# Create some materials for use in this example.
gfx create material slit_lines ambient 0 0 0 diffuse 1 0 0
gfx create material slit ambient 0 0 0 diffuse 1 1 1
gfx create material nonslit ambient 0 0 0 diffuse 1 1 1
gfx create material optic_zone ambient 0 0 1 diffuse 0 0 1
# Read in the nodes and the three element groups: slit, nonslit and optic_zone.
# The nonslit group shows the cornea in its position before the slit appeared -
# it will not be shown in this example, but you may with to view it and the
# slitted state simultaneously.
gfx read nodes example pressurized.exnode time 0
gfx read elements example slit_field.exelem
gfx read elements example nonslit_field.exelem
gfx read elements example optic_zone_field.exelem
# Create a window and show the mesh in perspective.
gfx create window
gfx mod win 1 view perspective

# Clear graphics and increase the discretization for the elements that "wrap" around the whole eye
gfx modify g_element slit general clear
gfx modify g_element nonslit general clear element_discretization "50*8*8"
gfx modify g_element optic_zone general clear element_discretization "50*8*8"

# Show exterior surfaces on all groups, and exterior lines on the slit group.
gfx modify g_element slit lines exterior mat slit_lines
gfx modify g_element slit surfaces exterior mat slit
gfx modify g_element nonslit surfaces exterior mat nonslit
gfx modify g_element optic_zone surfaces exterior mat optic_zone

for ($i = 1 ; $i < 11 ; $i++)
	 gfx read nodes example unzip$i.exnode time $i;
# Note that the red lines become a little obscured by the white surfaces, giving
# them a dashed look. This artefact results from small differences in the depth
# calculated for lines and surfaces meaning that neither is completely in front
# of the other. CMGUI uses a workaround to improve the situation, that perturbes
# the lines a small distance toward the viewer:
gfx modify window 1 set perturb_lines
# This command is very useful for displaying outlines of elements over surfaces
# in finite element meshes. Note however that it can cause small visual
# artefacts where surfaces intersect, andyou can always return to normal line
# mode with the 'normal_lines' option of the above command.
# CMGUI uses an object called a "timekeeper" to control display and animation of
# time aware objects. At present, there is only one timekeeper called 'default'
# which you can control with the 'gfx timekeeper' set of commands.
# There is a graphical controller called the time_editor.
gfx create time_editor
# To play an animation of the incision in the eye, type:
gfx timekeeper default play minimum 0 maximum 10 swing
# The timekeeper will play backwards and forwards between the minimum and maximum
# values
# Note that you can still interact with the program while it is playing. Try
# changing your view of the part of the eye in the graphics window. Furthermore,
# the timekeeper will keep on playing past the times in the graphics objects, so
# you must stop it. At the same time, let us return to the first time:
gfx timekeeper default stop set_time 0
# Now play it back at three times the original speed:
gfx timekeeper default play speed 3
# ... and stop it at any time with:
gfx timekeeper default stop
# As a separate example, you may wish to look at the stress distribution in the
# cornea. Without doing any of the above commands, uncomment and try the
# following:
#gfx read nodes example unzip10_stress.exnode
#gfx read elements example unzip10_stress.exelem
#gfx mod g_e cornea general element_discretization 14*4
#gfx mod g_e cornea surfaces scalar general
#gfx mod spectrum default autorange

Files used by this example are:

Name                     Modified     Size

example_a8.com 17-Mar-2014 4.3k COPYRIGHT 17-Mar-2014 504 nonslit_field.exelem 17-Mar-2014 22k optic_zone_field.exelem 17-Mar-2014 8.9k pressurized.exnode 17-Mar-2014 7.8k slit_field.exelem 17-Mar-2014 38k unzip1.exnode 17-Mar-2014 7.8k unzip10.exnode 17-Mar-2014 7.8k unzip10_stress.exelem 17-Mar-2014 65k unzip10_stress.exnode 17-Mar-2014 11k unzip2.exnode 17-Mar-2014 7.8k unzip3.exnode 17-Mar-2014 7.8k unzip4.exnode 17-Mar-2014 7.8k unzip5.exnode 17-Mar-2014 7.8k unzip6.exnode 17-Mar-2014 7.8k unzip7.exnode 17-Mar-2014 7.8k unzip8.exnode 17-Mar-2014 7.8k unzip9.exnode 17-Mar-2014 7.8k

Download the entire example:

Name                  Modified     Size

examples_a_a8.tar.gz 09-Mar-2016 133k

Testing status by version:

StatusTestedReal time (s)
cmgui-wxFailureSun Mar 6 00:10:42 20163
last breakTue Feb 24 03:11:00 20152
cmgui-wx-debugFailureSun Mar 6 00:13:58 20162
last breakTue Feb 24 03:13:00 20152
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:14:30 20163
last breakTue Feb 24 03:13:00 20153
cmgui-wx-debug-valgrindFailureSun Mar 6 00:59:04 201640
last breakSun Mar 6 00:58:00 201640
cmgui-wxFailureSun Mar 6 00:01:27 20161
last breakSun Mar 6 00:01:00 20161
cmgui-wx-debugFailureSun Mar 6 00:01:27 20160
last breakSun Mar 6 00:01:00 20160
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:01:27 20160
last breakSun Mar 6 00:01:00 20160
cmgui-wx-debug-valgrindFailureSun Mar 6 00:03:14 20169
last breakSun Mar 6 00:03:00 20169
cmgui-wx-gcc-cad-debug-valgrindSuccessThu Jan 7 00:02:22 20167

Testing status by file:

Html last generated: Wed Mar 9 16:01:15 2016

Input last modified: Wed Mar 9 15:49:39 2016

CMISS Help / Examples / a / a8