from hopf.simulation import Simulation

# Sphere integrator
s = Simulation()
s.load_initial_conditions('svs5_poles.mat')
s.sigma = 0.25
s.run_simulation(h=0.3, tmax=1000, sim='sphere-midpoint-momentum')
s.post_process()
s.save_results('data/svs5_poles_sphere_long_025.mat')

# RK4 integrator
s = Simulation()
s.load_initial_conditions('svs5_poles.mat')
s.sigma = 0.25
s.run_simulation(h=0.3, tmax=1000, sim='rk4')
s.post_process()
s.save_results('data/svs5_poles_rk4_long_025.mat')

# MP integrator
s = Simulation()
s.load_initial_conditions('svs5_poles.mat')
s.sigma = 0.25
s.run_simulation(h=0.3, tmax=1000, sim='midpoint')
s.post_process()
s.save_results('data/svs5_poles_mp_long_025.mat')

# LP integrator
s = Simulation()
s.load_initial_conditions('svs5_poles.mat')
s.sigma = 0.25
s.run_simulation(h=0.3, tmax=1000, sim='lie-poisson')
Пример #2
0
print X



#phi = inverse_hopf(X)

# Save initial conditions
save_initial_conditions('equatorial_ring_40.mat', gamma, X, sigma)

# Sphere integrator
s = Simulation()
s.load_initial_conditions('equatorial_ring_40.mat')
s.run_simulation(tmax=50, sim='sphere-midpoint')
s.post_process()
s.save_results('data/equatorial_sphere.mat')

# RK4 integrator
s = Simulation()
s.load_initial_conditions('equatorial_ring_40.mat')
s.run_simulation(tmax=50, sim='rk4')
s.post_process()
s.save_results('data/equatorial_rk4.mat')

# Midpoint integrator
s = Simulation()
s.load_initial_conditions('equatorial_ring_40.mat')
s.run_simulation(tmax=50, sim='midpoint')
s.post_process()
s.save_results('data/equatorial_mp.mat')
from hopf.simulation import Simulation

# Sphere integrator
s = Simulation()
s.load_initial_conditions('collapse3.mat')

# Medium regularization
s.sigma = 0.10
s.run_simulation(tmax=500, numpoints=500, sim='sphere-midpoint')
s.post_process()
s.save_results('data/collapse3_sphere_sigma10_sim_long.mat')

# Runge-Kutta, medium regularization
s.sigma = 0.10
s.run_simulation(tmax=500, numpoints=500, sim='rk4')
s.post_process()
s.save_results('data/collapse3_rk4_sigma10_sim_long.mat')

# Lie-Poisson, medium regularization
s.sigma = 0.10
s.run_simulation(tmax=500, numpoints=500, sim='lie-poisson')
s.post_process()
s.save_results('data/collapse3_lp_sigma10_sim_long.mat')

# Midpoint, medium regularization
s.sigma = 0.10
s.run_simulation(tmax=500, numpoints=500, sim='midpoint')
s.post_process()
s.save_results('data/collapse3_mp_sigma10_sim_long.mat')
from hopf.simulation import Simulation
from numpy import logspace
import scipy

## Simulations for different time scales (sphere integrator)

s = Simulation()
s.load_initial_conditions('pd_initial_conditions.mat')

for n, h in enumerate(logspace(-4, -1, 10)):
    s.run_simulation(tmax=10, h=h, sim='sphere-midpoint', diagnostics=True)
    s.post_process()

    filename = 'data/pd_sphere_order_%d.mat' % n
    s.save_results(filename)

## Simulations for different time scales (RK2 integrator)

s = Simulation()
s.load_initial_conditions('pd_initial_conditions.mat')

for n, h in enumerate(logspace(-4, -1, 10)):
    s.run_simulation(tmax=10, h=h, sim='rk2', diagnostics=True)
    s.post_process()

    filename = 'data/pd_rk_order_%d.mat' % n
    s.save_results(filename)


## Simulations for different time scales (Lie-Poisson integrator)
Пример #5
0
from hopf.simulation import Simulation

# Sphere integrator
s = Simulation()
s.load_initial_conditions('svs5_poles.mat')
s.run_simulation(tmax=100, sim='sphere-midpoint-momentum')
s.post_process()
s.save_results('data/svs5_poles_sphere.mat')

# RK4 integrator
s = Simulation()
s.load_initial_conditions('svs5_poles.mat')
s.run_simulation(tmax=100, sim='rk4')
s.post_process()
s.save_results('data/svs5_poles_rk4.mat')
Пример #6
0
# Sphere integrator
s = Simulation()
s.load_initial_conditions('collapse3.mat')

# No regularization
#s.sigma = 0.0
#s.run_simulation(tmax=15, numpoints=75, sim='sphere-midpoint')
#s.post_process()
#s.save_results('data/collapse3_sphere_sigma00_sim.mat')

# Medium regularization
s.sigma = 0.10
s.run_simulation(tmax=15, numpoints=75, sim='sphere-midpoint')
s.post_process()
s.save_results('data/collapse3_sphere_sigma10_sim.mat')

# Large regularization
s.sigma = 0.25
s.run_simulation(tmax=15, numpoints=75, sim='sphere-midpoint')
s.post_process()
s.save_results('data/collapse3_sphere_sigma25_sim.mat')

# Runge-Kutta, medium regularization
s.sigma = 0.10
s.run_simulation(tmax=15, numpoints=75, sim='rk4')
s.post_process()
s.save_results('data/collapse3_rk4_sigma10_sim.mat')

# Lie-Poisson, medium regularization
s.sigma = 0.10
Пример #7
0
from hopf.simulation import Simulation

##### Long time

# Sphere integrator
s = Simulation()
s.load_initial_conditions('pd_initial_conditions.mat')
s.run_simulation(tmax=1000, sim='sphere-midpoint')
s.post_process()
s.save_results('data/pd_sphere_long.mat')

# RK4 integrator
s = Simulation()
s.load_initial_conditions('pd_initial_conditions.mat')
s.run_simulation(tmax=1000, sim='rk4')
s.post_process()
s.save_results('data/pd_rk4_long.mat')

# Midpoint integrator
s = Simulation()
s.load_initial_conditions('pd_initial_conditions.mat')
s.run_simulation(tmax=1000, sim='midpoint')
s.post_process()
s.save_results('data/pd_mp_long.mat')

# Lie-Poisson integrator
s = Simulation()
s.load_initial_conditions('pd_initial_conditions.mat')
s.run_simulation(tmax=1000, sim='lie-poisson')
s.post_process()
s.save_results('data/pd_lp_long.mat')
Пример #8
0
from hopf.simulation import Simulation

s = Simulation()
s.load_initial_conditions('random40.mat')
s.sigma = 0.10
s.run_simulation(h = 0.1, tmax=2000, numpoints=1000, sim='sphere-midpoint')
s.post_process()
s.save_results('data/generic40_T200_sphere.mat')

s = Simulation()
s.load_initial_conditions('random40.mat')
s.sigma = 0.10
s.run_simulation(h = 0.1, tmax=2000, numpoints=1000, sim='rk4')
s.post_process()
s.save_results('data/generic40_T200_rk4.mat')

s = Simulation()
s.load_initial_conditions('random40.mat')
s.sigma = 0.10
s.run_simulation(h = 0.1, tmax=2000, numpoints=1000, sim='midpoint')
s.post_process()
s.save_results('data/generic40_T200_mp.mat')

s = Simulation()
s.load_initial_conditions('random40.mat')
s.sigma = 0.10
s.run_simulation(h = 0.1, tmax=2000, numpoints=1000, sim='lie-poisson')
s.post_process()
s.save_results('data/generic40_T200_lp.mat')