Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contexts #6

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
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
20 changes: 13 additions & 7 deletions src/python/cantilever_growth.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,29 +129,35 @@
numberOfZNodes = numberOfGlobalZElements*(numberOfNodesXi-1)+1
numberOfNodes = numberOfXNodes*numberOfYNodes*numberOfZNodes


worldRegion = iron.Region()
iron.Context.WorldRegionGet(worldRegion)

#iron.DiagnosticsSetOn(iron.DiagnosticTypes.FROM,[1,2,3,4,5],"diagnostics",["FiniteElasticity_FiniteElementResidualEvaluate"])

# Get the number of computational nodes and this computational node number
numberOfComputationalNodes = iron.ComputationalNumberOfNodesGet()
computationalNodeNumber = iron.ComputationalNodeNumberGet()
computationEnvironment = iron.ComputationEnvironment()
iron.Context.ComputationEnvironmentGet(computationEnvironment)
numberOfComputationalNodes = computationEnvironment.NumberOfWorldNodesGet()
computationalNodeNumber = computationEnvironment.WorldNodeNumberGet()

# Create a 3D rectangular cartesian coordinate system
coordinateSystem = iron.CoordinateSystem()
coordinateSystem.CreateStart(coordinateSystemUserNumber)
coordinateSystem.CreateStart(coordinateSystemUserNumber,iron.Context)
coordinateSystem.DimensionSet(numberOfDimensions)
coordinateSystem.CreateFinish()

# Create a region and assign the coordinate system to the region
region = iron.Region()
region.CreateStart(regionUserNumber,iron.WorldRegion)
region.CreateStart(regionUserNumber,worldRegion)
region.LabelSet("Region")
region.CoordinateSystemSet(coordinateSystem)
region.CreateFinish()

# Define basis functions

uBasis = iron.Basis()
uBasis.CreateStart(uBasisUserNumber)
uBasis.CreateStart(uBasisUserNumber,iron.Context)
uBasis.NumberOfXiSet(numberOfDimensions)
uBasis.TypeSet(iron.BasisTypes.LAGRANGE_HERMITE_TP)
if (uInterpolation == LINEAR_LAGRANGE):
Expand All @@ -168,7 +174,7 @@

if (pInterpolation > CONSTANT_LAGRANGE):
pBasis = iron.Basis()
pBasis.CreateStart(pBasisUserNumber)
pBasis.CreateStart(pBasisUserNumber,iron.Context)
pBasis.NumberOfXiSet(numberOfDimensions)
pBasis.TypeSet(iron.BasisTypes.LAGRANGE_HERMITE_TP)
if (pInterpolation == LINEAR_LAGRANGE):
Expand Down Expand Up @@ -442,7 +448,7 @@
problemSpecification = [iron.ProblemClasses.ELASTICITY,
iron.ProblemTypes.FINITE_ELASTICITY,
iron.ProblemSubtypes.FINITE_ELASTICITY_WITH_GROWTH_CELLML]
problem.CreateStart(problemUserNumber,problemSpecification)
problem.CreateStart(problemUserNumber,iron.Context,problemSpecification)
problem.CreateFinish()

# Create control loops
Expand Down
84 changes: 84 additions & 0 deletions src/python/stressgrowth.cellml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version='1.0'?>
<!--
This CellML file was generated on 3/04/2014 at 12:12:01 at p.m. using:

COR (0.9.31.1409)
Copyright 2002-2014 Dr Alan Garny
http://cor.physiol.ox.ac.uk/ - [email protected]

CellML 1.0 was used to generate this model
http://www.cellml.org/
-->
<model cmeta:id="stressgrowth" name="stressgrowth" 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#">
<units name="millisecond">
<unit prefix="milli" units="second"/>
</units>
<units name="per_millisecond">
<unit exponent="-1" prefix="milli" units="second"/>
</units>
<units name="stress">
<unit units="dimensionless"/>
</units>
<component name="Main">
<variable initial_value="0.000005" name="S11" units="stress"/>
<variable initial_value="0.000001" name="S22" units="stress"/>
<variable initial_value="0.0000001" name="S33" units="stress"/>
<variable initial_value="0.02" name="bff" units="stress"/>
<variable initial_value="0.015" name="bnn" units="stress"/>
<variable initial_value="0.001" name="bss" units="stress"/>
<variable name="time" units="millisecond"/>
<variable initial_value="1.0" name="lambda1" units="dimensionless"/>
<variable initial_value="1.0" name="lambda2" units="dimensionless"/>
<variable initial_value="1.0" name="lambda3" units="dimensionless"/>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>time</ci>
</bvar>
<ci>lambda1</ci>
</apply>
<apply>
<times/>
<cn cellml:units="per_millisecond">1</cn>
<ci>bff</ci>
<ci>S11</ci>
</apply>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>time</ci>
</bvar>
<ci>lambda2</ci>
</apply>
<apply>
<times/>
<cn cellml:units="per_millisecond">1</cn>
<ci>bss</ci>
<ci>S22</ci>
</apply>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>time</ci>
</bvar>
<ci>lambda3</ci>
</apply>
<apply>
<times/>
<cn cellml:units="per_millisecond">1</cn>
<ci>bnn</ci>
<ci>S33</ci>
</apply>
</apply>
</math>
</component>
</model>