problem = CMISS.Problem() problem.CreateStart(problemUserNumber) problem.SpecificationSet(CMISS.ProblemClasses.ELASTICITY, CMISS.ProblemTypes.FINITE_ELASTICITY, CMISS.ProblemSubTypes.NONE) problem.CreateFinish() # Create the problem control loop problem.ControlLoopCreateStart() controlLoop = CMISS.ControlLoop() problem.ControlLoopGet([CMISS.ControlLoopIdentifiers.NODE], controlLoop) controlLoop.MaximumIterationsSet(numberOfLoadIncrements) problem.ControlLoopCreateFinish() # Create problem solver nonLinearSolver = CMISS.Solver() linearSolver = CMISS.Solver() problem.SolversCreateStart() problem.SolverGet([CMISS.ControlLoopIdentifiers.NODE], 1, nonLinearSolver) nonLinearSolver.outputType = CMISS.SolverOutputTypes.PROGRESS nonLinearSolver.NewtonJacobianCalculationTypeSet( CMISS.JacobianCalculationTypes.EQUATIONS) nonLinearSolver.NewtonLinearSolverGet(linearSolver) linearSolver.linearType = CMISS.LinearSolverTypes.DIRECT #linearSolver.libraryType = CMISS.SolverLibraries.LAPACK problem.SolversCreateFinish() # Create solver equations and add equations set to solver equations solver = CMISS.Solver() solverEquations = CMISS.SolverEquations() problem.SolverEquationsCreateStart()
problem.ControlLoopCreateStart() controlLoop = CMISS.ControlLoop() problem.ControlLoopGet([CMISS.ControlLoopIdentifiers.NODE], controlLoop) if currentTime >= 0 and currentTime < 500: controlLoop.TimesSet(0.0, 1.5, pdeTimeStep) else: controlLoop.TimesSet(500, 501.5, pdeTimeStep) # controlLoop.OutputTypeSet(CMISS.ControlLoopOutputTypes.TIMING) controlLoop.OutputTypeSet(CMISS.ControlLoopOutputTypes.NONE) controlLoop.TimeOutputSet(outputFrequency) problem.ControlLoopCreateFinish() #Create the problem solvers daeSolver = CMISS.Solver() dynamicSolver = CMISS.Solver() problem.SolversCreateStart() # Get the first DAE solver problem.SolverGet([CMISS.ControlLoopIdentifiers.NODE], 1, daeSolver) daeSolver.DAETimeStepSet(odeTimeStep) daeSolver.OutputTypeSet(CMISS.SolverOutputTypes.NONE) # Get the second dynamic solver for the parabolic problem problem.SolverGet([CMISS.ControlLoopIdentifiers.NODE], 2, dynamicSolver) dynamicSolver.OutputTypeSet(CMISS.SolverOutputTypes.NONE) problem.SolversCreateFinish() #DOC-START define CellML solver #Create the problem solver CellML equations cellMLEquations = CMISS.CellMLEquations() problem.CellMLEquationsCreateStart()
equationsSet.EquationsCreateFinish() # Create Laplace problem problem = CMISS.Problem() problem.CreateStart(problemUserNumber) problem.SpecificationSet(CMISS.ProblemClasses.CLASSICAL_FIELD, CMISS.ProblemTypes.LAPLACE_EQUATION, CMISS.ProblemSubTypes.STANDARD_LAPLACE) problem.CreateFinish() # Create control loops problem.ControlLoopCreateStart() problem.ControlLoopCreateFinish() # Create problem solver solver = CMISS.Solver() problem.SolversCreateStart() problem.SolverGet([CMISS.ControlLoopIdentifiers.NODE], 1, solver) solver.outputType = CMISS.SolverOutputTypes.PROGRESS solver.linearType = CMISS.LinearSolverTypes.ITERATIVE solver.linearIterativeAbsoluteTolerance = 1.0E-12 solver.linearIterativeRelativeTolerance = 1.0E-12 problem.SolversCreateFinish() # Create solver equations and add equations set to solver equations solver = CMISS.Solver() solverEquations = CMISS.SolverEquations() problem.SolverEquationsCreateStart() problem.SolverGet([CMISS.ControlLoopIdentifiers.NODE], 1, solver) solver.SolverEquationsGet(solverEquations) solverEquations.sparsityType = CMISS.SolverEquationsSparsityTypes.SPARSE
problem.CreateFinish() # Create control loops and set the time parameters timeLoop = CMISS.ControlLoop() problem.ControlLoopCreateStart() problem.ControlLoopGet([CMISS.ControlLoopIdentifiers.NODE], timeLoop) timeLoop.TimesSet(startTime, stopTime, timeIncrement) # Disable time output as fluid_mechanics_IO_routines crashes timeLoop.TimeOutputSet(0) problem.ControlLoopCreateFinish() # Create problem solvers problem.SolversCreateStart() # Set dynamic solver properties dynamicSolver = CMISS.Solver() dynamicSolverIndex = 1 problem.SolverGet([CMISS.ControlLoopIdentifiers.NODE], dynamicSolverIndex, dynamicSolver) dynamicSolver.outputType = CMISS.SolverOutputTypes.PROGRESS dynamicSolver.dynamicTheta = [solverTheta] # Set nonlinear solver properties nonlinearSolver = CMISS.Solver() dynamicSolver.DynamicNonlinearSolverGet(nonlinearSolver) nonlinearSolver.newtonJacobianCalculationType = ( CMISS.JacobianCalculationTypes.EQUATIONS) nonlinearSolver.outputType = CMISS.SolverOutputTypes.NONE nonlinearSolver.newtonAbsoluteTolerance = 1.0e-10 nonlinearSolver.newtonRelativeTolerance = 1.0e-10