Skip to content

Instantly share code, notes, and snippets.

# scenario: want to make this json data structure from a shell script (and store it in a variable):
#
# "menuitem": [
# {"value": "New", "onclick": "CreateNewDoc()"},
# {"value": "Open", "onclick": "OpenDoc()"},
# {"value": "Close", "onclick": "CloseDoc()"}
# ]
#!/usr/bin/python
from numpy import *
import sys
def forward22(uvec,vvec,xvec,tval,f,i):
return f(uvec[i+1],vvec[i+1],xvec[i+1],tval)-f(uvec[i],vvec[i],xvec[i],tval)
def backward22(uvec,vvec,xvec,tval,f,i):
return f(uvec[i],vvec[i],xvec[i],tval)-f(uvec[i-1],vvec[i-1],xvec[i-1],tval)
def mac22bf(uvec,vvec,dt,dx,fu,fv,gu,gv,xvec,t):
# predict: Backward! (needs numerical BC treatment at j=N)