solcore5 icon indicating copy to clipboard operation
solcore5 copied to clipboard

PDD based on mpmath

Open jmllorens opened this issue 3 years ago • 1 comments

Hi all,

I have recently read an article on the mpmath module. I haven't tested myself, but I have the impression that great progress has been done in performance. I was thinking about the possibility to substitute the Fortran PDD solver with a python based on mpmath. This could eventually be interesting for:

  • To solve some issues on the installation of Solcore
  • Increase the interaction between the PDD solver and the rest of Solcore
  • Make it easier to maintain
  • To introduce the possibility to further increase the precision.

Probably the first thing to do would be to profile PDD, identify the task with the heaviest load and compare a similar task with mpmath at the same precision as in Fortran to see what is the penalty in performance. Do you have any experience with mpmath? The idea of this post is to discuss this.

Best regards,

José.

jmllorens avatar Oct 08 '21 09:10 jmllorens

Hi José,

Many thanks for commenting on this.I have heard of that module but I have never used it. It looks really promising. From the points you mention, the ones that are more appealing to me are 2 and 3. At the moment, the PDD solver is a black box impossible to interact with and that no one wants to touch in case it breaks.

It is also a bit overkilling in most cases: the only reason it was coded in Fortran and, in particular, using quadruple precision is because the double precision that SciPy uses was not enough for QW solar cells. But normal - i.e. bulk - solar cells do not need that level of precision at all! (Well, the actual reason is having too many abrupt and very asymmetrical interfaces resulting in crazy band-profiles and pretty hard to calculate carrier concentrations.)

I think it will be really valuable to give a try at mpmath. Even with poorer performance that the current PDD solver (and I never optimised its performance, so chances are it is not particularly efficient anyway), I think it will be a step forward. The existing solver could be left as an optional dependency, being the other one the default option.

Now, coming down to the practicalities, in order for that to happen it is necessary someone with 1) the time, 2) the expertise and 3) a concrete reason for embarking into the full rewriting of the PDD module.

Let's keep the discussion going. Maybe @iclned or @phoebe-p might chip in.

Best wishes, Diego

dalonsoa avatar Oct 08 '21 13:10 dalonsoa

I'm going to close this issue due to inactivity, although @jmllorens if you are still interested in implementing this that would certainly be great! I have recently been looking into using FiPy to build a Python-based PDD solver, and communicated with one of the developers who has spent some time previously setting it up to solve the semiconductor drift-diffusion equations. The advantage of mpmath seems to be 64-bit precision, which is also the reason that the PDD was implemented in Fortran in the first place as Diego said to work for quantum wells, but they are quite a niche use case so if we could get a Python-based PDD solver working which has good enough performance for "normal" solar cells, that would already be a good improvement!

phoebe-p avatar Mar 09 '23 01:03 phoebe-p