Ejemplo n.º 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'
Ejemplo n.º 3
0
dx = 0.25
dt = 0.2

xLim = [-20, 0]

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

v0 = np.array([0.4, 0.6, 0.8])
# v0 = 0.6
k = np.array([0, 0.2, 0.4, 0.6])
# k = 0.2
# v0, k = 0.6, 0.9
x0 = -10

state = SG.kink(x, 0, v0, x0, -1)
field = SG.SineGordon(timeStepFunc='eulerRobin', state=state)

### XXX: What if tFin could be a function of the paramters?
### so tFin = lambda v0, x0: x0/v0 + 200
field.time_evolve(tFin=150,
                  dt=dt,
                  k=k,
                  dirichletValue=2 * pi,
                  dynamicRange=True)

vRange = [-0.95, 0]
eigenvalues = field.boundStateEigenvalues(vRange,
                                          selection={
                                              'v': 1,
                                              'k': 1
Ejemplo n.º 4
0
import numpy as np
from numpy import pi
import os

import dash
import dash_core_components as dcc
import dash_html_components as html

dir_path = os.path.dirname(__file__)
if dir_path:
    dir_path += '/'
arrayFile = dir_path + 'v875Kinematics_k201_t1000_dx025_dt02_eigenvalues.nc'

with xr.open_dataset(arrayFile, engine='h5netcdf') as eigenvalues:
    from SolitonScattering import SG
    eigenvalues = SG.ScatteringData(eigenvalues)
    typed_kinematics = eigenvalues.typed_kinematics()

graph = dcc.Graph(id='v95Kinematics',
                  figure={
                      'data': [
                          {
                              'x': eigenvalues.data['k'].data,
                              'y': typed_kinematics['Kink']['speed'][:, 0],
                              'name': 'Kink',
                              'line': {
                                  'color': '#1f77b4'
                              },
                          },
                          {
                              'x': eigenvalues.data['k'].data,
Ejemplo n.º 5
0
dx = 0.0025
dt = 0.002

xLim = [-40, 0]  # x range

v0 = 0.95  # Antikink's initial velocity
x0 = -20  # Antikink's initial position
k = np.linspace(0.06, 0.075, 7501)  # Values for the Robin boundary parameter
print('dk', k[1] - k[0])

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

### Run the time evolution and save the result ###
state = SG.kink(x, 0, v0, x0, -1)
field = SG.SineGordon(state)
tList = [
    100
]  # t=100 -> ~104 hours compute time!  Hope to get this down in the future.
for t in tList:
    field.time_evolve('euler_robin',
                      t + abs(x0) / v0,
                      dt=dt,
                      k=k,
                      dirichletValue=2 * pi,
                      asymptoticBoundary={'L': 2 * pi})
    field.save(
        f'v95Kinematics_k{len(k)}_t{t}_dx{str(dx)[2:]}_dt{str(dt)[2:]}_field.nc'
    )  # save field to disk
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)
from SolitonScattering import SG

dx = 0.025
dt = 0.02

xLim = [-40, 0]

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

v0 = 0.95
k = 0.145
x0 = -20

state = SG.kink(x, 0, v0, x0, epsilon=-1)
field = SG.SineGordon(timeStepFunc='eulerRobin', **state)
"""
Looping over field.eigenfunction_wronskian(m, ODEIntMethod='CRungeKuttaArray') seems to be the quickest by far
"""
import time


def times(N):
    mu = np.linspace(0.2, 1.5, N)
    t0 = time.clock()

    for m in mu:
        field.eigenfunction_wronskian(m, ODEIntMethod='RungeKuttaArray')
    t1 = time.clock()
Ejemplo n.º 8
0
from matplotlib import pyplot as plt
import xarray as xr

from SolitonScattering import SG

dx = 0.025
dt = 0.02

xLim = [-40, 0]
x0 = -20

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

v0 = np.linspace(0.01, 0.99, 981)  # step size 0.001
k = np.linspace(0, 0.5, 501)  # step size 0.001

state = SG.kink(x, 0, v0, x0, -1)
field = SG.SineGordon(state)
field.time_evolve(
    'euler_robin',
    lambda v: 1000 + abs(x0) / v,
    dt=dt,
    k=k,
    dirichletValue=2 * pi,
    asymptoticBoundary={'L': 2 * pi},
    progressBar=True,
)

field.state.to_netcdf('Snapshot_t100_001.nc', engine='h5netcdf')