jrleeman / rsfmodel

Rate and state frictional solver
MIT License
31 stars 12 forks source link

Integrator Settings #5

Closed jrleeman closed 9 years ago

jrleeman commented 9 years ago

We need to enable passing other settings to the integrator. I've noticed in some cases that the integrator will die when doing something like setting the maximum step size to a much smaller size works.

import numpy as np
import matplotlib.pyplot as plt
import rsf

model = rsf.RateState()

# Set model initial conditions
model.mu0 = 0.6 # Friction initial (at the reference velocity)
model.a = 0.007 # Empirical coefficient for the direct effect
model.b = 0.003 # Empirical coefficient for the evolution effect
model.dc = 100. # Critical slip distance
model.k = 0.00128 # Normalized System stiffness (friction/micron)
model.v = 300. # Initial slider velocity, generally is vlp(t=0)
model.vref = 300. # Reference velocity, generally vlp(t=0)
model.stateLaw = rsf.dieterichState # Which state relation we want to use

model.model_time = np.arange(0,450.01,0.01)

lp_velocity = 300* np.ones_like(model.model_time)
lp_velocity[10*100:12*100] = -300. 
lp_velocity[12*100:110.5*100] = 0.

# Set the model load point velocity, must be same shape as model.model_time
model.loadpoint_velocity = lp_velocity

# Run the model!
results = model.solve()

# Make the phase plot
model.phasePlot()

# Make a plot in displacement
model.dispPlot()

# Make a plot in time
model.timePlot()
dopplershift commented 9 years ago

One solution would be to have solve() take arbitrary keyword arguments with **kwargs and then pass them to odeint().