compartments = [] compartments += theHeart numberOfCircuits = 2 for i in range(numberOfCircuits): # create a new circuit newCircuit = [Artery(), TerminalVessel(), Artery()] # add to list of all compartments compartments += newCircuit # connect as a ring theHeart[1].addNeighbour(newCircuit[0]) newCircuit[0].addNeighbour(newCircuit[1]) newCircuit[1].addNeighbour(newCircuit[2]) newCircuit[2].addNeighbour(theHeart[0]) system = CompartmentSet(*compartments) subsystem = CompartmentSet(*(theHeart + newCircuit)) # integration and output if not os.path.exists('out'): os.makedirs('out') with open("out/humanP.dat", "w+") as outputFileP: with open("out/humanQ.dat", "w+") as outputFileQ: t = 0 while t < tIntegration + tEinschwing: t += dt system.integrate(t) # print to file if t > tEinschwing: print(" ".join([str(v) for v in subsystem.P1]), file=outputFileP)
L=300., C=0.0000001, P1=2000., P2=2000., Q1=0.0, Q2=0.0 ) ] # connect as a ring compartments[0].addNeighbour(compartments[1]) compartments[1].addNeighbour(compartments[2]) compartments[2].addNeighbour(compartments[3]) compartments[3].addNeighbour(compartments[4]) compartments[4].addNeighbour(compartments[0]) system = CompartmentSet(*compartments) # integration and output if not os.path.exists('out'): os.makedirs('out') with open("out/humanP.dat", "w+") as outputFileP: with open("out/humanQ.dat", "w+") as outputFileQ: t = 0 while t < tIntegration + tEinschwing: t += dt system.integrate(t) # print to file if t > tEinschwing: print(" ".join([str(v) for v in system.P1]), file=outputFileP) print(" ".join([str(v)