Automatic electric field computation

examples/auto_efield.py demonstrates how drift can be added self-consistently by calculating the electric field generated from the concentration profile of charged species.

$ python auto_efield.py --help
usage: auto_efield.py [-h] [-D D] [--t0 T0] [--tend TEND] [--x0 X0]
                      [--xend XEND] [-N N] [-b BASE] [-o OFFSET]
                      [--mobility MOBILITY] [--nt NT] [-g GEOM] [--logt]
                      [--logy] [--logx] [--random] [--nstencil NSTENCIL]
                      [--lrefl] [--rrefl] [--num-jacobian] [--method METHOD]
                      [-p] [--savefig SAVEFIG] [-a ATOL] [--rtol RTOL]
                      [--random-seed RANDOM_SEED] [--surf-chg SURF_CHG]
                      [--sigma-q SIGMA_Q] [--sigma-skew SIGMA_SKEW] [-v]

optional arguments:
  -h, --help            show this help message and exit
  -D D, --D D           0.0
  --t0 T0               0.0
  --tend TEND           7.0
  --x0 X0               0.1
  --xend XEND           1.0
  -N N, --N N           1024
  -b BASE, --base BASE  0.5
  -o OFFSET, --offset OFFSET
                        0.25
  --mobility MOBILITY   0.3
  --nt NT               25
  -g GEOM, --geom GEOM  'f'
  --logt                False
  --logy                False
  --logx                False
  --random              False
  --nstencil NSTENCIL   3
  --lrefl               False
  --rrefl               False
  --num-jacobian        False
  --method METHOD       'bdf'
  -p, --plot            False
  --savefig SAVEFIG     'None'
  -a ATOL, --atol ATOL  1e-06
  --rtol RTOL           1e-06
  --random-seed RANDOM_SEED
                        42
  --surf-chg SURF_CHG   (0.0, 0.0)
  --sigma-q SIGMA_Q     101
  --sigma-skew SIGMA_SKEW
                        0.5
  -v, --verbose         False

Here is an example generated by:

$ python auto_efield.py --plot --savefig auto_efield.png
../_images/auto_efield.png
auto_efield.gaussian(x, mu, sigma, logy, logx, geom)[source]
auto_efield.integrate_rd(D=0.0, t0=0.0, tend=7.0, x0=0.1, xend=1.0, N=1024, base=0.5, offset=0.25, mobility=0.3, nt=25, geom='f', logt=False, logy=False, logx=False, random=False, nstencil=3, lrefl=False, rrefl=False, num_jacobian=False, method='bdf', plot=False, savefig='None', atol=1e-06, rtol=1e-06, random_seed=42, surf_chg=(0.0, 0.0), sigma_q=101, sigma_skew=0.5, verbose=False)[source]
auto_efield.pair_of_gaussians(x, offsets, sigma, logy, logx, geom)[source]
auto_efield.sigm(x, lim=150.0, n=8)[source]