élasticité expansion-réaction diffusion
L'installation Elasticité dynamique agit comme un filtre et génère de nouveaux espaces démultipliés, comme un empilement quasi infini d'horizons. Par principe de réflexion, la pièce absorbe l'image de l'environnement et accumule les points de vue ; le mouvement permanent requalifie continuellement ce qui est regardé et entendu.
Ce post étudie une reaction de reaction diffusion sur la structure.
In [11]:
%load_ext autoreload
%autoreload 2
In [12]:
import elasticite as el
import numpy as np
np.set_printoptions(precision=2, suppress=True)
import matplotlib.pyplot as plt
In [13]:
class EdgeGrid(el.EdgeGrid):
def update_particles(self):
self.particles[2,:] = np.cos((self.t + np.linspace(0, 1., self.N_particles))*2*np.pi)
def update(self):
self.update_particles()
e = EdgeGrid(N_lame=25, grid_type='line')
e.animate()
Out[13]:
In [14]:
CC = e.particles[:, :, np.newaxis]-e.particles[:, np.newaxis, :] # 2xNxN ; en metres
distance = np.sqrt(np.sum(CC**2, axis=0))# NxN ; en metres
print(distance)
print(np.tanh(np.linspace(-2, 2, 15)))
d_min, d_max = .2, 1.
f = lambda d: 900./ e.N_particles* (np.exp(-d/d_max)/d_max - np.exp(-d/d_min)/d_min)
print(f(np.linspace(0, 2, 15)))
In [15]:
class EdgeGrid(el.EdgeGrid):
def update_particles(self):
CC = self.particles[:, :, np.newaxis]-self.particles[:, np.newaxis, :] # 2xNxN ; en metres
distance = np.sqrt(np.sum(CC**2, axis=0))# NxN ; en metres
d_min, d_max = .2, 1.5
#f = lambda d: -100./ self.N_particles* (np.exp(-d/d_max)/d_max - np.exp(-d/d_min)/d_min)
#f = lambda d: 100./ self.N_particles* (np.exp(-d/d_max) - np.exp(-d/d_min))
f = lambda d: -20./ self.N_particles* (np.exp(-d/d_max)/d_max - np.exp(-d/d_min)/d_min)
#R = lambda w: - 3.5*np.sin(2*np.pi*w)
#R = lambda w: w*(1 - w**2)
R = lambda w: .2*np.tanh(w) # (1+w)*(1-w)
w = self.particles[2,:]
#print('w_t', (np.dot(f(distance), w)).mean(), (np.dot(f(distance), w)).std())
#w *= (1-self.dt)
w += np.tanh(np.dot(f(distance), w) + R(w))*self.dt
#print(w.min(), w.max())
#w /= np.absolute(w).max()
self.particles[2,:] = w
def update(self):
self.update_particles()
e = EdgeGrid(N_lame=25, grid_type='line')
#e.particles[2, :] = 0
#e.particles[2, 0] = -1.
#e.particles[2, -1] = 1.
#e.particles[2, :] = 2*np.random.rand(e.N_particles)-1
e.animate(duration=40, fps=10, fname='../files/2015-10-14_elasticite/reaction-diffusion.mp4')
Out[15]:
In [16]:
class EdgeGrid(el.EdgeGrid):
def update_particles(self):
CC = self.particles[:, :, np.newaxis]-self.particles[:, np.newaxis, :] # 2xNxN ; en metres
distance = np.sqrt(np.sum(CC**2, axis=0))# NxN ; en metres
d_min, d_max = .2, 1.5
#f = lambda d: -100./ self.N_particles* (np.exp(-d/d_max)/d_max - np.exp(-d/d_min)/d_min)
#f = lambda d: 100./ self.N_particles* (np.exp(-d/d_max) - np.exp(-d/d_min))
f = lambda d: 20./ self.N_particles* (np.exp(-d/d_max)/d_max - np.exp(-d/d_min)/d_min)
#R = lambda w: - 3.5*np.sin(2*np.pi*w)
#R = lambda w: w*(1 - w**2)
R = lambda w: -10.*np.tanh(w) # (1+w)*(1-w)
w = self.particles[2,:]
#print('w_t', (np.dot(f(distance), w)).mean(), (np.dot(f(distance), w)).std())
#w *= (1-self.dt)
w += np.tanh(np.dot(f(distance), w) + R(w))*self.dt
#print(w.min(), w.max())
#w /= np.absolute(w).max()
self.particles[2,:] = w
def update(self):
self.update_particles()
e = EdgeGrid(N_lame=25, grid_type='line')
#e.particles[2, :] = 0
#e.particles[2, 0] = -1.
#e.particles[2, -1] = 1.
#e.particles[2, :] = 2*np.random.rand(e.N_particles)-1
e.animate(duration=40, fps=10, fname='../files/2015-10-14_elasticite/reaction-diffusion-up.mp4')
Out[16]:
In [17]:
class EdgeGrid(el.EdgeGrid):
def update_particles(self):
CC = self.particles[:, :, np.newaxis]-self.particles[:, np.newaxis, :] # 2xNxN ; en metres
distance = np.sqrt(np.sum(CC**2, axis=0))# NxN ; en metres
d_min, d_max = .2, 1.5
#f = lambda d: -100./ self.N_particles* (np.exp(-d/d_max)/d_max - np.exp(-d/d_min)/d_min)
#f = lambda d: 100./ self.N_particles* (np.exp(-d/d_max) - np.exp(-d/d_min))
f = lambda d: 20./ self.N_particles* (np.exp(-d/d_max)/d_max - np.exp(-d/d_min)/d_min)
#R = lambda w: - 3.5*np.sin(2*np.pi*w)
#R = lambda w: w*(1 - w**2)
R = lambda w: -10.*np.tanh(w) # (1+w)*(1-w)
w = self.particles[2,:]
#print('w_t', (np.dot(f(distance), w)).mean(), (np.dot(f(distance), w)).std())
#w *= (1-self.dt)
w += np.tanh(np.dot(f(distance), w) + R(w))*self.dt
#print(w.min(), w.max())
#w /= np.absolute(w).max()
self.particles[2,:] = w
def update(self):
self.update_particles()
e = EdgeGrid(N_lame=25, grid_type='line')
#e.particles[2, :] = 0
#e.particles[2, 0] = -1.
#e.particles[2, -1] = 1.
#e.particles[2, :] = 2*np.random.rand(e.N_particles)-1
e.animate(duration=40, fps=10, fname='../files/2015-10-14_elasticite/reaction-diffusion-up.mp4')
Out[17]:
git¶
In [18]:
!git s
In [19]:
!git commit -am' expansion - équation de reaction diffusion'
In [20]:
! git push
In [21]:
!git pull