Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
cmake_minimum_required(VERSION 3.26 FATAL_ERROR)

if(DEFINED OpenCMISS_INSTALL_ROOT)
if(EXISTS "${OpenCMISS_INSTALL_ROOT}/libOpenCMISSSetup.cmake")
set(CMAKE_PROJECT_INCLUDE_BEFORE "${OpenCMISS_INSTALL_ROOT}/libOpenCMISSSetup.cmake")
endif()
endif()

set(ExampleName "mooney_rivlin_cellml")

cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
project(${ExampleName} VERSION 1.0.0 LANGUAGES C Fortran)

find_package(OpenCMISSLibs 1.3.0 COMPONENTS iron REQUIRED CONFIG)
find_package(libOpenCMISS 1.0.0 REQUIRED
COMPONENTS Fortran
)

add_subdirectory(src/fortran)
7 changes: 4 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ Building the example
Instructions on how to configure and build with CMake::

git clone https://github.com/OpenCMISS-Examples/mooney_rivlin_cellml.git
mkdir mooney_rivlin_cellml-build
cd mooney_rivlin_cellml-build
cmake -DOpenCMISSLibs_DIR=/path/to/opencmisslib/install ../mooney_rivlin_cellml
cd mooney_rivlin_cellml
mkdir build
cd build
cmake -DOpenCMISS_INSTALL_ROOT=/path/to/opencmiss/install ../.
make # cmake --build . will also work here and is much more platform agnostic.

Running the example
Expand Down
2 changes: 1 addition & 1 deletion src/fortran/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_executable(${ExampleName} ${ExampleName}.F90)

target_link_libraries(${ExampleName} PRIVATE opencmisslibs)
target_link_libraries(${ExampleName} PRIVATE OpenCMISS::libOpenCMISS_Fortran)

install(TARGETS ${ExampleName} DESTINATION bin)

Expand Down
199 changes: 45 additions & 154 deletions src/fortran/inputs/mooney_rivlin.xml
Original file line number Diff line number Diff line change
@@ -1,93 +1,6 @@
<?xml version="1.0" encoding="iso-8859-1"?>

<model
name="MooneyRivlin"
cmeta:id="MooneyRivlin"
xmlns="http://www.cellml.org/cellml/1.0#"
xmlns:cellml="http://www.cellml.org/cellml/1.0#"
xmlns:cmeta="http://www.cellml.org/metadata/1.0#">
<model xmlns="http://www.cellml.org/cellml/2.0#" xmlns:cellml="http://www.cellml.org/cellml/2.0#" name="MooneyRivlin" id="MooneyRivlin">

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cmeta="http://www.cellml.org/metadata/1.0#"
xmlns:bqs="http://www.cellml.org/bqs/1.0#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#">

<!-- metadata about the CellML document itself -->
<rdf:Description rdf:about="">
<dc:creator rdf:parseType="Resource">
<vCard:N rdf:parseType="Resource">
<vCard:Family>Nickerson</vCard:Family>
<vCard:Given>David</vCard:Given>
</vCard:N>
<vCard:EMAIL rdf:parseType="Resource">
<rdf:value>d.nickerson@auckland.ac.nz</rdf:value>
<rdf:type rdf:resource="http://imc.org/vCard/3.0#internet" />
</vCard:EMAIL>
<vCard:ORG rdf:parseType="Resource">
<vCard:Orgname>The University of Auckland</vCard:Orgname>
<vCard:Orgunit>The Bioengineering Institute</vCard:Orgunit>
</vCard:ORG>
</dc:creator>

<dcterms:created rdf:parseType="Resource">
<dcterms:W3CDTF>2003-11-28</dcterms:W3CDTF>
</dcterms:created>
</rdf:Description>

<!-- description of the model -->
<rdf:Description rdf:about="#MooneyRivlin">
<cmeta:comment rdf:parseType="Resource">
<rdf:value>
This is a CellML version of the Mooney-Rivlin constitutive material law,
defining the relation between the eight independent strain components
and the stress components. It is assumed that the strain components
will be controlled externally by the application using this CellML
model.
</rdf:value>
</cmeta:comment>
<bqs:reference>
<bqs:Pubmed_id>pubmed_id</bqs:Pubmed_id>
<bqs:JournalArticle rdf:parseType="Resource">
<dc:creator>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<bqs:Person rdf:parseType="Resource">
<vCard:N rdf:parseType="Resource">
<vCard:Family>Master</vCard:Family>
<vCard:Given>Andre</vCard:Given>
<vCard:Other>T</vCard:Other>
</vCard:N>
</bqs:Person>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<bqs:Person rdf:parseType="Resource">
<vCard:N rdf:parseType="Resource">
<vCard:Family>Bob</vCard:Family>
<vCard:Given>Billy</vCard:Given>
</vCard:N>
</bqs:Person>
</rdf:li>
</rdf:Seq>
</dc:creator>
<dc:title>
What cool article to reference ??
</dc:title>
<dcterms:issued rdf:parseType="Resource">
<dcterms:W3CDTF>year</dcterms:W3CDTF>
</dcterms:issued>
<bqs:Journal rdf:parseType="Resource">
<dc:title>The Journal of Cool Stuff</dc:title>
</bqs:Journal>
<bqs:volume>volume</bqs:volume>
<bqs:first_page>1</bqs:first_page>
<bqs:last_page>1000</bqs:last_page>
</bqs:JournalArticle>
</bqs:reference>
</rdf:Description>
</rdf:RDF>


<!-- Global units -->
<units name="strain">
Expand All @@ -106,77 +19,55 @@
<unit units="dimensionless"/>
</units>

<component name="interface" cmeta:id="interface">
<component name="interface" id="interface">

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cmeta="http://www.cellml.org/metadata/1.0#">
<rdf:Description rdf:about="#interface">
<cmeta:comment rdf:parseType="Resource">
<rdf:value>
We'll use this component as the "interface" to the model, all
other components are hidden via encapsulation in this component.
</rdf:value>
</cmeta:comment>
</rdf:Description>
</rdf:RDF>


<!-- Variables we expect to be set/controlled externally -->
<variable name="E11" units="strain" initial_value="0" private_interface="out"/>
<variable name="E22" units="strain" initial_value="0" private_interface="out"/>
<variable name="E33" units="strain" initial_value="0" private_interface="out"/>
<variable name="E12" units="strain" initial_value="0" private_interface="out"/>
<variable name="E13" units="strain" initial_value="0" private_interface="out"/>
<variable name="E23" units="strain" initial_value="0" private_interface="out"/>
<variable name="c1" units="strain" initial_value="2" private_interface="out"/>
<variable name="c2" units="strain" initial_value="6" private_interface="out"/>
<variable name="E11" units="strain" initial_value="0" interface="private"/>
<variable name="E22" units="strain" initial_value="0" interface="private"/>
<variable name="E33" units="strain" initial_value="0" interface="private"/>
<variable name="E12" units="strain" initial_value="0" interface="private"/>
<variable name="E13" units="strain" initial_value="0" interface="private"/>
<variable name="E23" units="strain" initial_value="0" interface="private"/>
<variable name="c1" units="strain" initial_value="2" interface="private"/>
<variable name="c2" units="strain" initial_value="6" interface="private"/>

<!-- Variables we want to make available externally -->
<variable name="Tdev11" units="stress" initial_value="0" public_interface="out" private_interface="in"/>
<variable name="Tdev22" units="stress" initial_value="0" public_interface="out" private_interface="in"/>
<variable name="Tdev33" units="stress" initial_value="0" public_interface="out" private_interface="in"/>
<variable name="Tdev12" units="stress" initial_value="0" public_interface="out" private_interface="in"/>
<variable name="Tdev13" units="stress" initial_value="0" public_interface="out" private_interface="in"/>
<variable name="Tdev23" units="stress" initial_value="0" public_interface="out" private_interface="in"/>
<variable name="Tdev11" units="stress" initial_value="0" interface="public_and_private"/>
<variable name="Tdev22" units="stress" initial_value="0" interface="public_and_private"/>
<variable name="Tdev33" units="stress" initial_value="0" interface="public_and_private"/>
<variable name="Tdev12" units="stress" initial_value="0" interface="public_and_private"/>
<variable name="Tdev13" units="stress" initial_value="0" interface="public_and_private"/>
<variable name="Tdev23" units="stress" initial_value="0" interface="public_and_private"/>

</component> <!--interface-->

<component name="equations" cmeta:id="equations">
<component name="equations" id="equations">

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cmeta="http://www.cellml.org/metadata/1.0#">
<rdf:Description rdf:about="#equations">
<cmeta:comment rdf:parseType="Resource">
<rdf:value>
In this simple model we only have one component, which holds the
six equations.
</rdf:value>
</cmeta:comment>
</rdf:Description>
</rdf:RDF>


<!-- Inputs -->
<variable name="E11" units="strain" public_interface="in"/>
<variable name="E22" units="strain" public_interface="in"/>
<variable name="E33" units="strain" public_interface="in"/>
<variable name="E12" units="strain" public_interface="in"/>
<variable name="E13" units="strain" public_interface="in"/>
<variable name="E23" units="strain" public_interface="in"/>
<variable name="c1" units="strain" public_interface="in"/>
<variable name="c2" units="strain" public_interface="in"/>
<variable name="E11" units="strain" interface="public"/>
<variable name="E22" units="strain" interface="public"/>
<variable name="E33" units="strain" interface="public"/>
<variable name="E12" units="strain" interface="public"/>
<variable name="E13" units="strain" interface="public"/>
<variable name="E23" units="strain" interface="public"/>
<variable name="c1" units="strain" interface="public"/>
<variable name="c2" units="strain" interface="public"/>

<!-- Outputs computed here -->
<variable name="Tdev11" units="stress" public_interface="out"/>
<variable name="Tdev22" units="stress" public_interface="out"/>
<variable name="Tdev33" units="stress" public_interface="out"/>
<variable name="Tdev12" units="stress" public_interface="out"/>
<variable name="Tdev13" units="stress" public_interface="out"/>
<variable name="Tdev23" units="stress" public_interface="out"/>
<variable name="Tdev11" units="stress" interface="public"/>
<variable name="Tdev22" units="stress" interface="public"/>
<variable name="Tdev33" units="stress" interface="public"/>
<variable name="Tdev12" units="stress" interface="public"/>
<variable name="Tdev13" units="stress" interface="public"/>
<variable name="Tdev23" units="stress" interface="public"/>

<!-- Temporary variables -->

<math xmlns="http://www.w3.org/1998/Math/MathML" cmeta:id="Tdev11_calculation_eq">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply id="Tdev11_calculation"><eq/>
<ci>Tdev11</ci>
<apply><plus/>
Expand All @@ -199,7 +90,7 @@
</apply>
</apply>
</math>
<math xmlns="http://www.w3.org/1998/Math/MathML" cmeta:id="Tdev22_calculation_eq">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply id="Tdev22_calculation"><eq/>
<ci>Tdev22</ci>
<apply><plus/>
Expand All @@ -222,7 +113,7 @@
</apply>
</apply>
</math>
<math xmlns="http://www.w3.org/1998/Math/MathML" cmeta:id="Tdev33_calculation_eq">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply id="Tdev33_calculation"><eq/>
<ci>Tdev33</ci>
<apply><plus/>
Expand All @@ -245,7 +136,7 @@
</apply>
</apply>
</math>
<math xmlns="http://www.w3.org/1998/Math/MathML" cmeta:id="Tdev12_calculation_eq">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply id="Tdev12_calculation"><eq/>
<ci>Tdev12</ci>
<apply><minus/>
Expand All @@ -257,7 +148,7 @@
</apply>
</apply>
</math>
<math xmlns="http://www.w3.org/1998/Math/MathML" cmeta:id="Tdev13_calculation_eq">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply id="Tdev13_calculation"><eq/>
<ci>Tdev13</ci>
<apply><minus/>
Expand All @@ -269,7 +160,7 @@
</apply>
</apply>
</math>
<math xmlns="http://www.w3.org/1998/Math/MathML" cmeta:id="Tdev23_calculation_eq">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply id="Tdev23_calculation"><eq/>
<ci>Tdev23</ci>
<apply><minus/>
Expand All @@ -283,8 +174,8 @@
</math>
</component><!--membrane-->

<connection>
<map_components component_1="interface" component_2="equations"/>
<connection component_1="interface" component_2="equations">

<map_variables variable_1="E11" variable_2="E11"/>
<map_variables variable_1="E22" variable_2="E22"/>
<map_variables variable_1="E33" variable_2="E33"/>
Expand All @@ -301,11 +192,11 @@
<map_variables variable_1="c2" variable_2="c2"/>
</connection>

<group>
<relationship_ref relationship="encapsulation"/>
<encapsulation>

<component_ref component="interface">
<component_ref component="equations"/>
</component_ref>
</group>
</encapsulation>

</model>
Loading