# nt,ot,dt,\ # nx,ox,dx,\ # a=1.0) # sol1 = a1.solve() # display2d(nt,ot,dt,nx,ox,dx,sol1,fnum,title) # j = int(0.2/dt) # graph_A(sol1,nx,ox,dx,j,fnum+1,dt,title) # fnum+=2 # ############### Exercise 3 ####################### print "Exercise 2.3: controled solution" exact = fhw01.u_exact(nt,nx) display2d(nt,ot,dt,nx,ox,dx,exact,fnum,"Exact solution") a1 = heq.implicitEuler(fhw01.f_exact,fhw01.v_exact,\ nt,ot,dt,\ nx,ox,dx,\ a=1.0) sol1 = a1.solve() display2d(nt,ot,dt,nx,ox,dx,sol1,fnum+1,"eE solution") e = exact - sol1 display2d(nt,ot,dt,nx,ox,dx,e,fnum+2,"solution error") inferror = fhw01.inf_norm(e,1) graph_f(inferror,nt,ot,dt,fnum+3,"solution error") show()
N = 11 ot,dt,nt = ganesh2Toto(1.,M) ox,dx,nx = ganesh2Toto(1.,N) # Exercise sheet 2 a1 = heq.explicitEuler(f1,v1,\ nt,ot,dt,\ nx,ox,dx,\ a=1.0) sol1 = a1.solve() display2d(nt,ot,dt,nx,ox,dx,sol1,1) display2d(nt,ot,dt,nx,ox,dx,f1(nx,nt),2) graph_f(v1(nx),nx,ox,dx,3) a2 = heq.implicitEuler(f1,v1,\ nt,ot,dt,\ nx,ox,dx,\ a=1.0) sol2 = a2.solve() display2d(nt,ot,dt,nx,ox,dx,sol2,4) show()