Example 5g1: Mooney Rivlin defined using CellML for a cube sheared in the xz plane

This example illustrates the Mooney-Rivlin constitutive material law, defined by a CellML version of the model.Here is a PDF of the model equations. The example simulates shearing of a cube in the xz plane, with the Mooney-Rivlin material law defined via CellML

NOTE: This example requires a CellML 1.0 enabled version of CMISS to run.


The comfile run by this example is as follows:

# Example showing how to use a cellml model to implement a passive mechanics 
# constitutive law
#********************************************************************************************************************************
# TIME PERFORMANCE IS CURRENTLY EXTREMELY BAD - REALLY SLOW.
# A BETTER VERSION OF THIS FEATURE IS CURRENTLY BEING DEVELOPED TO MAKE IT PRACTICAL TO USE
#********************************************************************************************************************************

# IMPORTANT NOTES ON ASSUMPTIONS AND UNDERLYING OPERATIONS
#********************************************************************************************************************************
# It is assumed that the green-strain components used in the cellml model are taken from the following indices in the RCQS array
# RCQS 3 - E11 comp 1 in CMISS
# RCQS 4 - E12 comp 4 in CMISS
# RCQS 5 - E13 comp 5 in CMISS
# RCQS 6 - E22 comp 2 in CMISS
# RCQS 7 - E23 comp 6 in CMISS
# RCQS 8 - E33 comp 3 in CMISS
#********************************************************************************************************************************
# It is assumed that once the cellml file has been evaluated for deviatoric components of stress, the resultant values are stored 
# in the following indices of the YQS array. They are then copied to the YG array 
# YQS 2 - Tdev11 - YG 1
# YQS 3 - Tdev12 - YG 2
# YQS 4 - Tdev13 - YG 3
# YQS 5 - Tdev22 - YG 4
# YQS 6 - Tdev23 - YG 5
# YQS 7 - Tdev33 - YG 6
#********************************************************************************************************************************
# CellML stores variables defined in the cellml file in alphanumeric order in the RCQS and YQS arrays. Also, upper case is given
# higher precedence than lower case when storing in cell indices. So, E11 will be stored before c1. Therefore, make sure that
# variable names are chosen so that they do not change the indices in which Eij are stored due to the assumption specified previously
#********************************************************************************************************************************
# It is currently assumed that all cell problems are solved in class 2.
#********************************************************************************************************************************
# IF ANY OF THE ABOVE CONSTRAINTS RESTRICT YOU IN SOLVING YOUR PROBLEM, THE CODE IN ZERE50 AND OPSTRE MUST BE ALTERED TO 
# GENERALISE WHICH ARRAYS ARE USED.
#********************************************************************************************************************************

# If the example path is not set, default to current directory
if (!defined $example) {
    $example = "./";
}

# Drop off the trailing / in the example path
$chopped = chop $example;
if ($chopped ne "/") {
    $example .= $chopped;
}

#**************************************************************
#Set up CMISS mechanics model
#
#
fem def para;r;emech;example 
fem def coor 3,1

# Set up bases
fem define bas;r;TriCubicHerm;example #defines tricubic Hermite basis function for 3D geometry
fem def;add base;r;BiCubicHerm;example #defines bicubic Hermite basis function for 2D faces of geometry
fem def;add base;r;TriLinear;example #defines a trilinear basis function for the interpolation of grid parameters
fem def;add base;r;BiLinear;example #defines bilinear basis function

# Load the mesh
fem define node;r;cubeherm_cube;example #define 8 nodes
fem define elem;r;cubeherm_cube;example #define 1 element
fem def fibre;r;cubeherm_cube;example  #define fibre field. Lined up with rectangular cartesian coordinates in this example
fem def elem;r;cubeherm_cube;example  fibre #define the elemental description of fibre field

# Define equations, materials and boundary conditions

fem def equa;r;mechanics;example  lock #defines the finite elasticity equation for 3D problem. lock ensures that the equation options are not overwritten in memory
fem def mat;r;mooney_rivCellML;example #choose to have stresses defined at gauss points with grid coupling
fem def init;r;cubeherm_cubesheared_cube;example #define the shearing boundary conditions on the xz plane
fem def solve;r;cubeherm;example #define the solver to be used for the finite elasticity equations

#
fem group elem 1 as ALL_ELEMENTS #group the element and call it ALL_ELEMENTS

#In this example we define displacements
#**************************************************************
#
#
#**************************************************************
#set up a finite difference grid for the cell problem in class 2
#
# WHEN DEFINING GRID GAUSS QUALIFIER SETS UP GRID POINTS AT GAUSS POINTS
# IF YOU WANT A GRID SCHEME NOT AT GAUSS POINTS, THE SIMULATION WILL RUN VERY SLOWLY
# AS YOU ARE NOW DEALING WITH A MORE GENERAL CASE.

fem def grid;r;cubeherm_cube;example gauss class 2 #set up a grid at gauss scheme. choose trilinear basis (basis no. 5) to interpolate between grid points

fem update grid geometry #sets up the grid geometry

#group the grid points in the element group ALL_ELEMENTS as ALL_GRID_POINTS
fem group grid element ALL_ELEMENTS as ALL_GRID_POINTS


#define a cellml equation - see cellml.ipequa. The options chosen may seem wrong. 
#But the choices made allow us to use features that have been developed for cellular based modelling of cardiac electrical activation in CMISS, for our problem. 

fem def equa;r;cellml;example class 2 

#fem def equa;r;user_cell;example class 2 #defines a cellml equation - see cellml.ipequa
#
# set up conductivities- defaulted. Once again, stuff that we don't need for finite elasticity, but currently required to use features of electrical activation

fem def mate;d class 2 

#define which FILENAME.cml file to read in as a material law. You have to save Tdev11...Tdev33 as they are going to be used in stress calculations. 
#Eij are spatially varying - obvious I hope, because strain at each gauss point can be different
#c1 and c2 are constant throughout volume in this example.

fem define cell;r;mooney_rivlin;example class 2 

# needed for spatially varying parameters.green strain components in this case are the only spatially varying parameters

fem def mate;r;mooney_rivlin;example cell class 2

#no flux boundary condition etc for electrical activation problems defined in next command
#Once again  just default as we only need it to use some features otherwise inaccessible
fem def init;d class 2  

#The solve file below is needed for solving differential equations present in electromechanics models. 
#We need to read this in eventhough we are not using it for the completely passive deformation example
#Do not worry about the options chosen in this file. 
#You can just default everything, its once again needed just to allow us to use features of electrical activation in CMISS

fem def solv;r;cell-hmt-implicit-adams;example class 2 

# Initialise solvers.
#runs the cellml time integration solver stuff once to initialise cellml solver things. The "0" class 2 to 0 says you have a 0 time step for the integration

fem solve class 2 to 0; 

#**************************************************************
fem solve iter 20 # solve the finite elasticity mechanics problem

Additional testing commands:

fem list stress at 1 strain_energy

Files used by this example are:

Name                              Modified     Size

example_5g1.com 21-Jul-2009 7.1k BiCubicHerm.ipbase 17-Feb-2004 1.6k BiLinear.ipbase 13-Feb-2004 1.2k TriCubicHerm.ipbase 13-Feb-2004 1.9k TriLinear.ipbase 13-Feb-2004 1.4k cell-hmt-implicit-adams.ipsolv 13-Apr-2007 2.6k cellml.ipequa 13-Feb-2004 1.5k cubeherm.ipsolv 16-Aug-2010 2.3k cubeherm.ipsolv.old 01-Apr-2009 2.2k cubeherm_cube.ipelem 01-Apr-2009 576 cubeherm_cube.ipelfb 13-Feb-2004 389 cubeherm_cube.ipfibr 13-Feb-2004 12k cubeherm_cube.ipgrid 01-Apr-2009 610 cubeherm_cube.ipnode 27-Mar-2004 14k cubeherm_cubesheared_cube.ipinit 11-Apr-2009 3.8k emech.ippara 13-Feb-2004 5.9k mechanics.ipequa 02-May-2004 2.0k mooney_rivCellML.ipmate 13-Feb-2004 695 mooney_rivlin.cml 13-Feb-2004 11k mooney_rivlin.ipcell 17-Feb-2004 2.4k mooney_rivlin.ipmatc 13-Feb-2004 2.1k test_output.com 21-Jul-2009 35

Download the entire example:

Name                      Modified     Size

examples_5_5g_5g1.tar.gz 16-Aug-2014 27k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:03:00 20162
cm-debugSuccessSat Mar 5 00:19:46 201611
mips-irix
cmSuccessSun Aug 19 01:38:37 200710
cm-debugSuccessWed Aug 15 01:41:33 200739
cm-debug-clear-mallocSuccessSat Aug 18 02:08:20 200778
cm-debug-clear-malloc7SuccessMon Aug 20 02:42:59 200763
cm64SuccessSun Aug 19 01:39:07 20079
cm64-debugSuccessTue Aug 21 01:42:29 200745
cm64-debug-clear-mallocSuccessTue Feb 1 09:46:33 200525
rs6000-aix
cmSuccessWed Mar 4 01:08:54 20092
cm-debugSuccessMon Mar 2 01:11:52 200913
cm64SuccessWed Mar 4 01:08:54 20092
cm64-debugSuccessTue Mar 3 01:16:17 200913
x86_64-linux
cmSuccessSun Mar 6 00:01:04 20161
cm-debugSuccessSat Mar 5 00:01:58 20164

Testing status by file:


Html last generated: Sun Mar 6 05:50:28 2016

Input last modified: Fri Aug 15 11:59:12 2014


CMISS Help / Examples / 5 / 5g / 5g1