diff --git a/FiniteElasticity/HomogeneousPipeAxialExtension/HomogeneousPipeAxialExtension.py b/FiniteElasticity/HomogeneousPipeAxialExtension/HomogeneousPipeAxialExtension.py index e4ef2490..06725ee0 100755 --- a/FiniteElasticity/HomogeneousPipeAxialExtension/HomogeneousPipeAxialExtension.py +++ b/FiniteElasticity/HomogeneousPipeAxialExtension/HomogeneousPipeAxialExtension.py @@ -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() @@ -397,6 +396,7 @@ equations.outputType = CMISS.EquationsOutputTypes.NONE equationsSet.EquationsCreateFinish() +#DOC-START define CellML finite elasticity problem #Define the problem problem = CMISS.Problem() problem.CreateStart(problemUserNumber) @@ -404,6 +404,7 @@ 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() @@ -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() @@ -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() diff --git a/FiniteElasticity/HomogeneousPipeAxialExtension/README.rst b/FiniteElasticity/HomogeneousPipeAxialExtension/README.rst index 1966534c..f7b78d0c 100644 --- a/FiniteElasticity/HomogeneousPipeAxialExtension/README.rst +++ b/FiniteElasticity/HomogeneousPipeAxialExtension/README.rst @@ -92,7 +92,7 @@ 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 @@ -100,7 +100,33 @@ We now need to define the :term:`CellML models field` for our finite elasticity :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 +++++++ diff --git a/glossary.rst b/glossary.rst index 7b88672b..8bcda7b0 100644 --- a/glossary.rst +++ b/glossary.rst @@ -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. \ No newline at end of file + 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). \ No newline at end of file