Skip to content

Instantly share code, notes, and snippets.

View davidshepherd7's full-sized avatar

David Nikel-Shepherd davidshepherd7

View GitHub Profile
double Problem::
adaptive_unsteady_newton_solve(const double &dt_desired,
const double &epsilon,
const bool &shift_values)
{
//First, we need to backup the existing dofs, in case the timestep is
//rejected
//Find total number of dofs on current processor
unsigned n_dof_local = dof_distribution_pt()->nrow_local();
#!/bin/sh
# This script will setup Evm (Emacs Version Manager) and Cask on
# Travis to use for Emacs Lisp testing.
#
# In .travis.yml, add this:
#
# - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh
#
# Emacs 24.3 is installed in the above script because Cask requires
def emr_step(dt_n, y_n, dy_n, dt_nm1, y_nm1):
"""Take a single step of the explicit midpoint rule.
From G&S pg. 715 and Prinja's thesis pg.45.
"""
dtr = dt_n / dt_nm1
y_np1 = (1 - dtr**2)*y_n + (1 + dtr)*dt_n*dy_n + (dtr**2)*(y_nm1)
return y_np1
def bdf2_dydt(ts, ys):
"""Get dy/dt at time ts[-1] (allowing for varying dt).