def BrefBrs(params, outkeys): Inform.Display(params['nodes'], params['itera'], 'BrefBrs') bar = progressbar.ProgressBar(widgets=[progressbar.Bar(), ' (', progressbar.ETA(), ') ']) outnames = {key: DataOut( name = outkeys[key], method = 'brs', nd = params['nodes'], it = params['itera'], pic = params['picit']) for key in outkeys} n = Stepsize() for u in range(n.st): step = params['tend']/n.step[u] p = Particle(params['nodes'], n.step[u]) p.S, p.ST, p.SQ, p.Sx, p.QQ, p.Q, p.dt, p.wi = p.GetMatrices(params['nodes'], 0.0, step) bar = progressbar.ProgressBar() for i in bar(range(int(n.step[u]))): p.SweeperNoVelUp(params['nodes'], params['itera'], p.x, p.v, p.x0, p.v0, p.x_, p.v_, 'IntegrateOff') p.UpdateDat(params['nodes']) if p.P.Bound(p.xend[params['nodes'] - 1, :]): lastpnt = i break p.GetBrefPoint(i, params['nodes'], step, p.xend, p.vend, p.dt) p.GetStanDev(step, outnames['deviation'].fullname, params) p.RHSeval(params, outnames['deviation'].fullname, 'BrefBrs')
def BrefGMRes(params, outkeys, keyinteg): Inform.Display(params['nodes'], params['itera'], 'BrefGMRes') bar = progressbar.ProgressBar(widgets=[progressbar.Bar(), ' (', progressbar.ETA(), ') ']) outnames = {key: DataOut( name = outkeys[key], method = 'gm', nd = params['nodes'], it = params['itera'], pic = params['picit']) for key in outkeys} type = 'lobatto' integrate = True bfield = True n = Stepsize() for u in range(n.st): step = params['tend']/n.step[u] p = Particle(params['nodes'], n.step[u]) gmres = gmres_sdc(dt = step, nodes = params['nodes'], kiter = params['itera'], pic = params['picit'], nsteps = int(n.step[u]), type=type, integrate=integrate) x_gm, v_gm, stats = gmres.run(bfield = bfield, outnames = outnames, params = params) p.RHSeval(params, outnames['deviation'].fullname, 'BrefGMRes')