help-octave
[Top][All Lists]

## Re: secs1d pin diode help

 From: Carlo De Falco Subject: Re: secs1d pin diode help Date: Mon, 23 Oct 2017 14:27:43 +0000

Hi,
> On 23 Oct 2017, at 13:58, tkroezen <address@hidden> wrote:
>
> Hi,
>
> I am having some trouble trying to simulate a PIN diode in secs1d. My
> approach was to alter the PN diode code included as the example in the
> documentation file, but unfortunately this hasn't produced any results yet.

First of all, note that the PIN diode is not a very simple device to simulate
and it is actually one case that puts the Gummel algorithm under a lot of
stress,
you may need to carefully tweak mesh refinement, tolerances and initial guess
in order to get this to work and in the end probably the Newton algorithm will
still work better for this case anyway.

> The only changes I made to the code are listed below.
> change lines 63 until 68 to:
> /Na = 1e23 * (x <= x_pi_jun);
> N_0 = 1e16 .* (x > x_pi_jun) .* (x <= x_in_jun);
> Nd = 1e23 * (x > x_in_jun);
> D  = Nd - Na + N_0;
>

actually this is incomplete, the values of x_pi_jun,  x_in_jun are not known.

> change lines 70 until 83 to:
> /V_p = -1;
> V_n =  0;
>
> Fp = V_p * (x <= x_pi_jun);
> Fn = Fp;
>
> p = Na .* (x <= x_pi_jun) + ni^2/Nd .* (x >= x_in_jun);
> n = ni^2/Na .* (x <= x_pi_jun) + Nd.* (x >= x_in_jun);
> V = Fn + Vth * log (n / ni);/
>

these conditions are slightly inconsistent at the contacts where one must apply

p + D - n = 0
p .* n = ni^2

if either Nd or Na are very high as in your case the inconsistency is quite
small
but still can lead to some algorithmic instability some times.

> Unfortunately this produces the following errors:
>
> /error: bimu_bernoulli: invalid conversion from NaN to logical
> error: called from
>    bimu_bernoulli at line 45 column 11
>    secs1d_dd_gummel_map at line 94 column 12
>    secs1d_dd_gummel_map_example_PIN at line 147 column 49
> error: evaluating argument list element number 1
> error: called from
>    bimu_bernoulli at line 45 column 11
>    secs1d_dd_gummel_map at line 94 column 12
>    secs1d_dd_gummel_map_example_PIN at line 147 column 49/
>
> I do not know what produces this error, does anyone perhaps know what I did
> wrong?

This happens when, at any point in the iterative algorithm, the carrier
densities happen
to become negative. This is of course physically inconsistent and leads to all
sorts of
hard to understand errors and in the and the state vector shows over- and
under-flows and/or
Not-a-Number (NaN) entries.

If your initial guess is correct, which I haven't been able to test, the
problem is with
algorithm convergence so you may want to try:

- mesh refinement near space-charge regions
- a smoother initial guess
- continuation (i.e. start from an equilibrium solution then apply small
voltage steps)
- switch from Gummel to Newton

>
> Tijmen

If you need more help, you will need to pass the full script you are using,
rather
than send it via email you may want to write it here:

http://wiki.octave.org/Secs1d_package

where I uploaded the PN diode examplke as a starting point.

HTH,
c.