import numpy as np
import matplotlib.pyplot as plt
import tellurium as te
Y, X = np.mgrid[0:8:200j, 0:8:200j]
r = te.loada('''
J1: -> x; k1/(1+y^n1) - k2*x;
J2: -> y; k3/(1+x^n2) - k4*y;
x = 4; y = -4;
k1 = 12; k3 = 12; k2 = 2; k4 = 2
n1 = 4; n2 = 4
''')
m = r.simulate (0, 8, 100)
U = np.empty_like(X)
V = np.empty_like(X)
for (i,j), value in np.ndenumerate(X):
r.x = X[i][j]; r.y = Y[i][j]
U[i][j] = r.J1; V[i][j] = r.J2
plt.figure(figsize=(10,7))
plt.xlabel('x', fontsize='16')
plt.ylabel('y', fontsize='16')
plt.ylim((-0.1,8))
plt.xlim((-0.1,8))
plt.streamplot(X, Y, U, V, density=[2, 2])
r.steadyStateSolver.allow_presimulation = False
r.x = 5.999; r.y = 0.00462
r.steadyState()
plt.plot(r.x, r.y, 'ro', markersize=12)
r.x = 0.0046; r.y = 5.999
r.steadyState()
plt.plot(r.x, r.y, 'bo', markersize=12)
r.x = 1.359; r.y = 1.359
r.steadyState()
plt.plot(r.x, r.y, 'go', markersize=12)
plt.show()
No comments:
Post a Comment