Beispiel #1
0
def createBasis(interpolationType, basisUserNumber):
    basis = CMISS.Basis()
    basis.CreateStart(basisUserNumber)
    basis.type = CMISS.BasisTypes.LAGRANGE_HERMITE_TP
    basis.numberOfXi = numberOfXi
    basis.interpolationXi = [interpolationType] * numberOfXi
    basis.quadratureNumberOfGaussXi = [numGauss] * numberOfXi
    basis.CreateFinish()
    return basis
Beispiel #2
0
# Set all diganostic levels on for testing
#CMISS.DiagnosticsSetOn(CMISS.DiagnosticTypes.All,[1,2,3,4,5],"Diagnostics",["DOMAIN_MAPPINGS_LOCAL_FROM_GLOBAL_CALCULATE"])

numberOfLoadIncrements = 2
numberGlobalXElements = 1
numberGlobalYElements = 1
numberGlobalZElements = 1
InterpolationType = 1
if (numberGlobalZElements == 0):
    numberOfXi = 2
else:
    numberOfXi = 3

# Get the number of computational nodes and this computational node number
numberOfComputationalNodes = CMISS.ComputationalNumberOfNodesGet()
computationalNodeNumber = CMISS.ComputationalNodeNumberGet()

# Create a 3D rectangular cartesian coordinate system
coordinateSystem = CMISS.CoordinateSystem()
coordinateSystem.CreateStart(coordinateSystemUserNumber)
coordinateSystem.DimensionSet(3)
coordinateSystem.CreateFinish()

# Create a region and assign the coordinate system to the region
region = CMISS.Region()
region.CreateStart(regionUserNumber, CMISS.WorldRegion)
region.LabelSet("Region")
region.coordinateSystem = coordinateSystem
region.CreateFinish()
Beispiel #3
0
    hasDerivatives = False
elif opts.interpolation == "cubic-hermite":
    interpolationType = CMISS.BasisInterpolationSpecifications.CUBIC_HERMITE
    numGauss = 4
    hasDerivatives = True

(coordinateSystemUserNumber, regionUserNumber, basisUserNumber,
 generatedMeshUserNumber, meshUserNumber, decompositionUserNumber,
 geometricFieldUserNumber, equationsSetFieldUserNumber,
 dependentFieldUserNumber, equationsSetUserNumber,
 problemUserNumber) = range(1, 12)

# Output all diagnostics in Neumann integration routine
CMISS.DiagnosticsSetOn(CMISS.DiagnosticTypes.IN, [1, 2, 3, 4, 5],
                       "diagnostics", [
                           "BoundaryConditions_NeumannIntegrate",
                           "BoundaryConditions_NeumannMatricesInitialise"
                       ])

# Get the computational nodes information
numberOfComputationalNodes = CMISS.ComputationalNumberOfNodesGet()
computationalNodeNumber = CMISS.ComputationalNodeNumberGet()

# Creation a rectangular cartesian coordinate system
coordinateSystem = CMISS.CoordinateSystem()
coordinateSystem.CreateStart(coordinateSystemUserNumber)
coordinateSystem.dimension = 3
coordinateSystem.CreateFinish()

# Create a region in the world region
region = CMISS.Region()
#Mesh component numbers
linearMeshComponentNumber = 1
#Fields
geometricFieldUserNumber = main_dynamicCai.user_number
fibreFieldUserNumber = main_dynamicCai.user_number + 1
dependentFieldUserNumber = main_dynamicCai.user_number + 2
materialsFieldUserNumber = main_dynamicCai.user_number + 3
equationsSetFieldUserNumber = main_dynamicCai.user_number + 4
cellMLModelsFieldUserNumber = main_dynamicCai.user_number + 5
cellMLStateFieldUserNumber = main_dynamicCai.user_number + 6
cellMLParametersFieldUserNumber = main_dynamicCai.user_number + 7
cellMLIntermediateFieldUserNumber = main_dynamicCai.user_number + 8

#DOC-START parallel information
# Get the number of computational nodes and this computational node number
numberOfComputationalNodes = CMISS.ComputationalNumberOfNodesGet()
computationalNodeNumber = CMISS.ComputationalNodeNumberGet()
#DOC-END parallel information

#DOC-START initialisation
# Create a 2D rectangular cartesian coordinate system
coordinateSystem = CMISS.CoordinateSystem()
coordinateSystem.CreateStart(coordinateSystemUserNumber)
coordinateSystem.DimensionSet(1)
coordinateSystem.CreateFinish()

# Create a region and assign the coordinate system to the region
region = CMISS.Region()
region.CreateStart(regionUserNumber, CMISS.WorldRegion)
region.LabelSet("Region")
region.coordinateSystem = coordinateSystem
basisUserNumber = 1
pressureBasisUserNumber = 2
generatedMeshUserNumber = 1
meshUserNumber = 1
decompositionUserNumber = 1
geometricFieldUserNumber = 1
fibreFieldUserNumber = 2
materialFieldUserNumber = 3
dependentFieldUserNumber = 4
equationsSetUserNumber = 1
equationsSetFieldUserNumber = 5
problemUserNumber = 1

# Set all diganostic levels on for testing
CMISS.DiagnosticsSetOn(CMISS.DiagnosticTypes.ALL, [1, 2, 3, 4, 5],
                       "Diagnostics",
                       ["DOMAIN_MAPPINGS_LOCAL_FROM_GLOBAL_CALCULATE"])

numberGlobalXElements = 1
numberGlobalYElements = 1
numberGlobalZElements = 1
totalNumberOfNodes = 8
totalNumberOfElements = 1
InterpolationType = 1
if (UsePressureBasis):
    numberOfMeshComponents = 2
else:
    numberOfMeshComponents = 1
if (numberGlobalZElements == 0):
    numberOfXi = 2
else:
Beispiel #6
0
startTime, stopTime, timeIncrement = 0.0, 0.4, 0.2
solverTheta = 1.0

geometryInterpolation = CMISS.BasisInterpolationSpecifications.QUADRATIC_LAGRANGE
velocityInterpolation = CMISS.BasisInterpolationSpecifications.QUADRATIC_LAGRANGE
pressureInterpolation = CMISS.BasisInterpolationSpecifications.LINEAR_LAGRANGE
numGauss = 3

(coordinateSystemUserNumber, regionUserNumber, generatedMeshUserNumber,
 meshUserNumber, decompositionUserNumber, geometricFieldUserNumber,
 equationsSetFieldUserNumber, dependentFieldUserNumber,
 materialsFieldUserNumber, equationsSetUserNumber,
 problemUserNumber) = range(1, 12)

# Get the computational nodes information
numberOfComputationalNodes = CMISS.ComputationalNumberOfNodesGet()
computationalNodeNumber = CMISS.ComputationalNodeNumberGet()

# Creation a rectangular cartesian coordinate system
coordinateSystem = CMISS.CoordinateSystem()
coordinateSystem.CreateStart(coordinateSystemUserNumber)
coordinateSystem.dimension = 3
coordinateSystem.CreateFinish()

# Create a region in the world region
region = CMISS.Region()
region.CreateStart(regionUserNumber, CMISS.WorldRegion)
region.label = "NavierStokesRegion"
region.coordinateSystem = coordinateSystem
region.CreateFinish()
Beispiel #7
0
    regionUserNumber,
    basisUserNumber,
    generatedMeshUserNumber,
    meshUserNumber,
    decompositionUserNumber,
    geometricFieldUserNumber,
    equationsSetFieldUserNumber,
    dependentFieldUserNumber,
    equationsSetUserNumber,
    problemUserNumber) = range(1,12)

numberGlobalXElements = 5
numberGlobalYElements = 5
numberGlobalZElements = 5

CMISS.DiagnosticsSetOn(CMISS.DiagnosticTypes.IN,[1,2,3,4,5],"Diagnostics",["DOMAIN_MAPPINGS_LOCAL_FROM_GLOBAL_CALCULATE"])

# Get the computational nodes information
numberOfComputationalNodes = CMISS.ComputationalNumberOfNodesGet()
computationalNodeNumber = CMISS.ComputationalNodeNumberGet()

# Creation a RC coordinate system
coordinateSystem = CMISS.CoordinateSystem()
coordinateSystem.CreateStart(coordinateSystemUserNumber)
coordinateSystem.dimension = 3
coordinateSystem.CreateFinish()

# Create a region
region = CMISS.Region()
region.CreateStart(regionUserNumber,CMISS.WorldRegion)
region.label = "LaplaceRegion"
from opencmiss import CMISS

#Initialising Coordinate System
coordinateSystem = CMISS.CoordinateSystem()
#Creates a wrapper that points to internal coordinate system. CMISS needs a numeric pointer
#so we create a usernumber as below.
coordinateSystemUserNumber = 1
coordinateSystem.CreateStart(coordinateSystemUserNumber)
#Setting dimensions because why not
coordinateSystem.dimension = 3
coordinateSystem.CreateFinish()
##Coordinate System done!

#Create a region
regionUserNumber = 1
region = CMISS.Region()
#As above
region.CreateStart(regionUserNumber, CMISS.WorldRegion)
#The create start for a region by definition requires another region as one of its parameters
region.label = "LaplaceRegion"
region.coordinateSystem = coordinateSystem
region.CreateFinish()
#Above should be pretty straight forward.
##Region done!

#Create a basis needed for interpolation of field values. Think FEM?
basisUserNumber = 1
basis = CMISS.Basis()
basis.CreateStart(basisUserNumber)
basis.type = CMISS.BasisTypes.LAGRANGE_HERMITE_TP
basis.numberOfXi = 2