Skip to content

Commit

Permalink
finishing documenting the CellML aspects of the clyinder extension ex…
Browse files Browse the repository at this point in the history
…ample.
  • Loading branch information
David Nickerson committed Nov 6, 2014
1 parent 699ff96 commit 080be67
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,18 +377,17 @@
MooneyRivlinModel)
#DOC-END define CellML models field


#DOC-START define CellML parameters and intermediate fields
#Create the CellML parameters field --- the strain field
CellMLParametersField = CMISS.Field()
CellML.ParametersFieldCreateStart(CellMLParametersFieldUserNumber,CellMLParametersField)
CellML.ParametersFieldCreateFinish()

# Create the CellML intermediate field --- the stress field

CellMLIntermediateField = CMISS.Field()
CellML.IntermediateFieldCreateStart(CellMLIntermediateFieldUserNumber,CellMLIntermediateField)
CellML.IntermediateFieldCreateFinish()

#DOC-END define CellML parameters and intermediate fields

# Create equations
equations = CMISS.Equations()
Expand All @@ -397,13 +396,15 @@
equations.outputType = CMISS.EquationsOutputTypes.NONE
equationsSet.EquationsCreateFinish()

#DOC-START define CellML finite elasticity problem
#Define the problem
problem = CMISS.Problem()
problem.CreateStart(problemUserNumber)
problem.SpecificationSet(CMISS.ProblemClasses.ELASTICITY,
CMISS.ProblemTypes.FINITE_ELASTICITY,
CMISS.ProblemSubTypes.FINITE_ELASTICITY_CELLML)
problem.CreateFinish()
#DOC-END define CellML finite elasticity problem

#Create the problem control loop
problem.ControlLoopCreateStart()
Expand All @@ -429,6 +430,7 @@
#linearSolver.LibraryTypeSet(CMISS.SolverLibraries.SUPERLU)
problem.SolversCreateFinish()

#DOC-START define CellML solver
#Create the problem solver CellML equations
CellMLSolver = CMISS.Solver()
problem.CellMLEquationsCreateStart()
Expand All @@ -437,6 +439,7 @@
CellMLSolver.CellMLEquationsGet(CellMLEquations)
CellMLEquations.CellMLAdd(CellML)
problem.CellMLEquationsCreateFinish()
#DOC-END define CellML solver

#Create the problem solver equations
solver = CMISS.Solver()
Expand Down
28 changes: 27 additions & 1 deletion FiniteElasticity/HomogeneousPipeAxialExtension/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,41 @@ Now that we have imported the CellML model that we wish to use in our simulation

Finishing the CellML environment creation will now trigger the OpenCMISS to instantiate the CellML model(s) in that environment as executable code. No further changes to that code are possible.

We now need to define the :term:`CellML models field` for our finite elasticity model. First (lines 2-4 below) we create a default OpenCMISS field and set it as the CellML environment's models field. We then iterate over all elements in our finite element model and set each Gauss point in all elements to be associated with the Money-Rivlin model we imported into our CellML environment above.
We now need to define the :term:`CellML models field` for our finite elasticity model. First (lines 2-4 below) we create a default OpenCMISS field and set it as the CellML environment's models field. We then iterate over all elements in our finite element model and set each Gauss point in all elements to be associated with the Mooney-Rivlin model we imported into our CellML environment above.

.. literalinclude:: HomogeneousPipeAxialExtension.py
:language: python
:linenos:
:start-after: #DOC-START define CellML models field
:end-before: #DOC-END define CellML models field

The :term:`CellML parameters field` and :term:`CellML intermediate field` are simply created with standard default OpenCMISS fields, as shown below.

.. literalinclude:: HomogeneousPipeAxialExtension.py
:language: python
:linenos:
:start-after: #DOC-START define CellML parameters and intermediate fields
:end-before: #DOC-END define CellML parameters and intermediate fields

The CellML environment is now set-up and ready to use with the single Mooney-Rivlin model that we have imported. When defining the finite elasticity problem in OpenCMISS it is important that the CellML subtype is specified to ensure that the CellML constitutive law is used:

.. literalinclude:: HomogeneousPipeAxialExtension.py
:language: python
:linenos:
:start-after: #DOC-START define CellML finite elasticity problem
:end-before: #DOC-END define CellML finite elasticity problem

And then we need to define the numerical solver to use for the CellML constitutive law that we are using:

.. literalinclude:: HomogeneousPipeAxialExtension.py
:language: python
:linenos:
:start-after: #DOC-START define CellML solver
:end-before: #DOC-END define CellML solver

In line 2 we create a new default solver and then initialise it as the CellML solver from the general non-linear solver that we are using for the finite elasticity model (line 4). Lines 5 and 6 show the creation of the CellML equations and initialising them from the CellML solver. Finally, in line 7 we add the :term:`CellML environment` containing our constitutive model to the CellML equations.

The CellML constitutive law is now defined as part of the general finite elasticity model and the simulation can be performed following assignment of the required boundary conditions, etc.

Results
+++++++
Expand Down
8 changes: 7 additions & 1 deletion glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ Glossary
In order to uniquely identify variables from CellML models using a text string, OpenCMISS-Iron methods use identifiers of the form: ``component_name/variable_name``. Where ``component_name`` is the value of the name attribute of the component in which the desired variable is located and the ``variable_name`` is the value of that variable's name attribute. Variables in the CellML model which are connected can be addressed by any of the relevant CellML variable ID's.

CellML models field
The field which associates CellML models within a given :term:`CellML environment` to finite element models in OpenCMISS.
The field which associates CellML models within a given :term:`CellML environment` to finite element models in OpenCMISS.

CellML parameters field
The OpenCMISS field which is used to define spatially varying :term:`known` parameters in the CellML models for a given :term:`CellML environment`.

CellML intermediate field
The OpenCMISS field which is used to contain the intermediate variables for the CellML models for a given :term:`CellML environment`, these are :term:`wanted` variables which are not state variables in the CellML model(s).

0 comments on commit 080be67

Please sign in to comment.