IntegrateODE: BUG: too much accuracy requested

Hey,
I'm Anastasiia and I'm new user in Igor programming. For my work I'm trying to model drift diffusion process for solar cell.
I need to solve the system of equations that describes electron, hole mobility, current density, electric field and potential in active layer in solar cell. Originally this system of equations has two variables: x and t. But I didn't include t and made time independent system.

When I'm using methods 0 or 2 in IntegrateODE/M=1. My computer is calculating infinity. With m=2 and 3 (Adams Moulton and BDF) error appear: too much accuracy requested. Igor allow decrease step with help of E= eps. But it couldn't be decrease less then 1e-6. I cannot understand why.

Next key moment, I have to make loop FOR because with new value of voltage boundary condition is changed. So, in any new iteration all wave values must be changed. But changed only one wave, boundary condition of that changes.
DriftDiffusionModel.ipf (2.61 KB)
I see that your procedure prints out the value of V_ODEStepSize, and that it prints 1e-6. That is not the error tolerance, but the value of the integration variable. I think it is 1e-6 because that is the default starting value and your integration is not progressing past that first step.

I changed your IntegrateODE command to this:

                IntegrateODE/M=1/STOP={wave1,0}/E=1e-4 EquSystem, PP, Equat
That sets the error tolerance to 1e-4. This ran for several seconds, but still stopped with the step size too small message. Now it prints V_ODEStepSize=9.68244e-41.

Your equation parameter wave:
                Make/D/O PP={9.66184e26,  8.05153e27,  2.41546e20,  4.32e8,  7.168e-45, 5.33e-31}
has values ranging over many orders of magnitude. I think possibly one problem may be roundoff error. Digital computations don't really like huge orders of magnitude. Perhaps you could re-cast your system with normalized variables.

Even if the integration were to progress successfully, your stop wave is not set up correctly. It requires N columns, where N is the order of the system (6 in your system). It must have at least two rows- in row 0, 1 or -1 to request a stop when the solution is greater than or less than the value in row 1. Rows 2 and 3 are used to put stopping conditions on the derivatives.

Could you write out (or make a picture of) the equations you are solving?

Can you simplify the system and work up to the full system gradually? That is, solve a simpler problem first. Perhaps you have already done that?

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Thanks, Johnweeks!

You've helped me understand my problem.
I tried to simplify my system of equations, removed recombination (pw[4]*yw[0]*yw[1]) and substituted some constants. So, now there are not such big difference of magnitudes. But error is the same, how I can see the magnitude difference is still big. I'm not sure if it's possible to make system of equations with another parameters or to simplify more. But, yeah, when I made all constants (PP={...}) with one order, the code worked.

Do you know what could I do with my problem?

I've attached documents of my system of equations.

And other question. I cannot understand how to make stopWave with two rows. My stopWave: wave1={n2, n1, jn2, jp2, pot2, f2}. I see there is row 1. How can I make row 0? (={1,1,1,1,1,1})

Thank you!
More simple system of equations is also working. I've excepted equations for holes and substituted constants.
Testing.ipf (1.03 KB)
Anastasiya wrote:
And other question. I cannot understand how to make stopWave with two rows. My stopWave: wave1={n2, n1, jn2, jp2, pot2, f2}. I see there is row 1. How can I make row 0? (={1,1,1,1,1,1})

Make/O/D wave1={{1,n2},{1,n1},{1,jn2},{1,jp2},{1,pot2},{1,f2}}

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
I got a successful result with your second posted ipf! It dawned on me that the magnitudes of the error estimates would range over many orders of magnitude because the values in the solution range over many orders of magnitude. That means you need to set the scaling for the error to values that you expect from the solution. I changed your ipf with these lines:
        Make/D/O PP={9.66184*10^26, 9.66184e26,  8.05153e27,  2.41546e20,  4.32e8, 5.33e-8}
        Make/D/O Swave={1e25, 4e8,0.001,0.006,0.05,3e7}
        IntegrateODE/M=0/F=1/E=1e-6/S=Swave EquSystem, PP, Equat       

The values in Swave are simply more-or-less copied from the initial conditions. You might, in fact, just do exactly that: use the absolute values of your initial conditions.

After a couple of attempts, I also changed the method to Runge-Kutta. It's not the fastest method by any means, but it is more robust- it is forgiving of discontinuities and such.

There is still a problem: this line:
                Duplicate/O Equat $"Equat_V_"+num2str(v[i])
results in an Index Out of Range error. The value of i is left at 11 after the loop at the top of the function, and it should be no more than 10. I don't know what your intention here is, so I can't fix it myself.

I have one further question: the equations you posted include several terms like F(x), Jn(x), etc., that appear to be functions dependent on X, but your ipf doesn't include a dependence in the input "xx". Is that a simplification of the equations, or an oversight?

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
AnastasiyaSolution.png (5 KB)