Example #1
0
def antikink_v0_95():
	dx = 0.025

	xLim = [-60,0]

	M  = int((xLim[1] - xLim[0])/dx) + 1
	x = np.linspace(xLim[0],xLim[1],M)

	v0 = .95
	x0 = -20

	state = SG.kink(x,0,v0,x0,epsilon=-1)
	field = SG.SineGordon(timeStepFunc='eulerRobin', state=state)
	return field
xLim = [-40, 0]  # x range

v0 = 0.875  # Antikink's initial velocity
x0 = -20  # Antikink's initial position
k = np.linspace(0, 0.2, 2001)  # Values for the Robin boundary parameter

dk = k[1] - k[0]
print('dk', dk)

### Setup x grid
M = int((xLim[1] - xLim[0]) / dx) + 1
x = np.linspace(xLim[0], xLim[1], M)

### Run the time evolution for each value of k and save the resulting field
state = SG.kink(x, 0, v0, x0, -1)
field = SG.SineGordon(state)
for t in [1000]:
    field.time_evolve('euler_robin',
                      t + abs(x0) / v0,
                      dt=dt,
                      k=k,
                      dirichletValue=2 * pi,
                      dynamicRange=True)
    field.save(
        f'v875Kinematics_k{len(k)}_t{t}_dx{str(dx)[2:]}_dt{str(dt)[2:]}_field.nc'
    )  # save field to disk

### Find the bound state eigenvalues associated with the solitons produced in the antikink/boundary collision
### Ignore any breathers with frequency > 0.999
fieldFileName = f'v875Kinematics_k{len(k)}_t1000_dx{str(dx)[2:]}_dt{str(dt)[2:]}_field.nc'
Example #3
0
from SolitonScattering import SG

dx = 0.25
dt = 0.2

xLim = [-60,0]

M  = int((xLim[1] - xLim[0])/dx) + 1
x = np.linspace(xLim[0],xLim[1],M)

v0, k = .95, .145
x0 = -10

### start with an antikink with initial velocity v0 and position x0
state = SG.kink(x,0,v0,x0,epsilon=-1)
field = SG.SineGordon(timeStepFunc='eulerRobin', state=state)

### plot the initial state of this field
field.show(saveFile='SGRobinEx_initialField.pdf', useTex=True)

### time evolve the field to t=200 and plot
field.time_evolve(tFin=150, dt=dt, k=k, dirichletValue=2*pi, dynamicRange=True)
field.show(saveFile='SGRobinEx_finalField.pdf', useTex=True)

### revert the field to its original state and save an animation of the time evolution
field.reset_state()
field.save_animation('SGRobinEx.mov', skipFrames=10, tFin=100, fps=60, dt=dt, k=k, dirichletValue=2*pi)

### find the bound state eigenvalues
vRange = [-0.96, 0]
def tevolve(v, k):
	state = SG.kink(x,0,v,x0,-1)
	field = SG.SineGordon(state)
	field.time_evolve('euler_robin', 100+abs(x0)/v, dt=dt, k=k, dirichletValue=2*pi, asymptoticBoundary={'L':2*pi},
		progressBar=False)
	return float(field.state['u'][{'x':-1}].data)