Esempio n. 1
0
firstNodeDomain = decomposition.NodeDomainGet(firstNodeNumber, 1)
lastNodeDomain = decomposition.NodeDomainGet(lastNodeNumber, 1)
if firstNodeDomain == computationalNodeNumber:
    boundaryConditions.SetNode(dependentField, iron.FieldVariableTypes.U, 1, 1,
                               firstNodeNumber, 1,
                               iron.BoundaryConditionsTypes.FIXED, 0.0)
if lastNodeDomain == computationalNodeNumber:
    boundaryConditions.SetNode(dependentField, iron.FieldVariableTypes.U, 1, 1,
                               lastNodeNumber, 1,
                               iron.BoundaryConditionsTypes.FIXED, 1.0)
solverEquations.BoundaryConditionsCreateFinish()

# Solve the problem
problem.Solve()

# Export results
baseName = "laplace"
dataFormat = "PLAIN_TEXT"
fml = iron.FieldMLIO()
fml.OutputCreate(mesh, "", baseName, dataFormat)
fml.OutputAddFieldNoType(baseName + ".geometric", dataFormat, geometricField,
                         iron.FieldVariableTypes.U,
                         iron.FieldParameterSetTypes.VALUES)
fml.OutputAddFieldNoType(baseName + ".phi", dataFormat, dependentField,
                         iron.FieldVariableTypes.U,
                         iron.FieldParameterSetTypes.VALUES)
fml.OutputWrite("LaplaceExample.xml")
fml.Finalise()

iron.Finalise()
Esempio n. 2
0
except IOError:
    print('Could not open Outlet boundary node file: ' + filename)

# -----------------------------------------------
#  Set up general problem
# -----------------------------------------------

(coordinateSystemUserNumber, regionUserNumber, linearBasisUserNumber,
 quadraticBasisUserNumber, generatedMeshUserNumber, meshUserNumber,
 decompositionUserNumber, geometricFieldUserNumber,
 equationsSetFieldUserNumber, dependentFieldUserNumber,
 materialsFieldUserNumber, analyticFieldUserNumber, equationsSetUserNumber,
 problemUserNumber) = range(1, 15)

#Initialise fieldML IO
fieldmlInfo = iron.FieldMLIO()
fieldmlInfo.InputCreateFromFile(fieldmlInput)

# Creation a RC coordinate system
coordinateSystem = iron.CoordinateSystem()
fieldmlInfo.InputCoordinateSystemCreateStart("CylinderMesh.coordinates",
                                             coordinateSystem,
                                             coordinateSystemUserNumber)
coordinateSystem.CreateFinish()
numberOfDimensions = coordinateSystem.DimensionGet()

# Create a region
region = iron.Region()
region.CreateStart(regionUserNumber, iron.WorldRegion)
region.label = "Cylinder"
region.coordinateSystem = coordinateSystem