Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
75 views198 pages

Understanding Oghma Nano

The document is a manual for OghmaNano, detailing its purpose, history, and roadmap, as well as providing guidance on installation and usage in simulations. It includes sections on various simulation modes, editors, and specific applications like solar cells and OLEDs. The document is copyrighted and requests not to be cited without proper reference.

Uploaded by

farhansusant29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views198 pages

Understanding Oghma Nano

The document is a manual for OghmaNano, detailing its purpose, history, and roadmap, as well as providing guidance on installation and usage in simulations. It includes sections on various simulation modes, editors, and specific applications like solar cells and OLEDs. The document is copyrighted and requests not to be cited without proper reference.

Uploaded by

farhansusant29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 198

Understanding OghmaNano

Roderick C. I. MacKenzie
Please do not cite this manual. Please see the section 1.6 on how to cite the model in your
work.

Front cover: A picture of a thermal power station in Ratcliffe-on-Soar Nottinghamshire


taken on a cold January afternoon in 2017. Most of the emissions you see in the image is water
from the cooling towers however the gasses rising form the tall thin chimney on the left hand
side of the image are the products of burning hydrocarbons which previously buried in the
ground for about 300 million years.
This document is Copyright Roderick C. I. MacKenzie and compiled on June 25, 2025. If
you have questions or comments please contact [email protected].
Contents

1 Introduction 1
1.1 What is OghmaNano? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Why OghmaNano? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 About this book/manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 What is the history of OghmaNano? . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 What is the roadmap for OghmaNano? . . . . . . . . . . . . . . . . . . . . . . . 4
1.6 Using OghmaNano in industrial/academic work . . . . . . . . . . . . . . . . . . 4
1.7 Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 Installing OghmaNano 6
2.1 Windows (if you have admin rights) . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Windows (No admin rights) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3 Getting started 8
3.1 Simulating a JV curve of a simple solar cell . . . . . . . . . . . . . . . . . . . . . 8
3.1.1 Making your first simulation . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.2 The output from your first simulation . . . . . . . . . . . . . . . . . . . . 10
3.1.3 Editing device layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.1.4 How do solar cells absorb light? . . . . . . . . . . . . . . . . . . . . . . . 14
3.1.5 Light inside solar cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.1.6 Parasitic elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.1.7 Solar cells in the dark . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1.8 The contact editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.1.9 Electrical parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4 Simulation modes and simulation editors 21


4.1 JV editor (Steady state simulation editor) . . . . . . . . . . . . . . . . . . . . . 24
4.1.1 Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.1.2 Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.1.3 sim info.dat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.1.4 Steady state electrical simulation . . . . . . . . . . . . . . . . . . . . . . 25
4.2 Time domain editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.3 Frequency domain editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.3.2 Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.3.3 Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.4 Suns-Voc editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.4.1 Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.5 Suns-Jsc editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.5.1 Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.6 Quantum efficiency editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
CONTENTS

4.6.1 Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.7 Scanning probe microscopy editor . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.8 Electrical equilibrium editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.9 Steady state photoluminencense editor . . . . . . . . . . . . . . . . . . . . . . . 38
4.10 Charge extraction editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.10.1 Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.11 Capacitance voltage editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.11.1 Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.12 Hardware editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.12.1 CPU/GPU configuration tab . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.12.2 Newton cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.12.3 Hardware benchmark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

5 2D Simulations - OFETs 45
5.0.1 The anatomy of a 2D simulation . . . . . . . . . . . . . . . . . . . . . . . 46
5.0.2 Electrical parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.0.3 Running a 2D simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
5.0.4 Meshing in 2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.0.5 Solving the drift diffusion equations over the entire device . . . . . . . . 50

6 2D simulation of bulk-heterojunctions 51

7 Organic Light Emitting Diodes (OLEDs) 52


7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
7.2 Optical outcoupling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7.3 Electrical simulations combined with optical transfer matrix calculations . . . . 54
7.4 Electrical simulations combined with ray tracing . . . . . . . . . . . . . . . . . . 56
7.5 The spectrum of the emitted light . . . . . . . . . . . . . . . . . . . . . . . . . . 56
7.6 RGB, XYZ, CIE 1931 xyz colour spaces . . . . . . . . . . . . . . . . . . . . . . 57

8 Meshing 60
8.1 What is meshing? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
8.2 Different meshes for different problems . . . . . . . . . . . . . . . . . . . . . . . 60
8.3 The three meshes of OghmaNano . . . . . . . . . . . . . . . . . . . . . . . . . . 61
8.3.1 Electrical mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
8.3.2 Optical mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
8.3.3 Thermal mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
8.4 The electrical mesh in detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
8.5 When do I need to worry about meshing in OghamNano? . . . . . . . . . . . . . 64
8.5.1 Electrical mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8.5.2 Optical mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8.5.3 Thermal mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8.6 Meshing tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.6.1 Should I be simulating in 1D, 2D or 3D? . . . . . . . . . . . . . . . . . . 65
8.6.2 Speed v.s. accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

9 Theory of drift diffusion modelling 66


9.1 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
9.2 Electrostatic potential . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
9.3 Free charge carrier statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
9.4 Carrier trapping and Shockley-Read-Hall recombination . . . . . . . . . . . . . . 67
CONTENTS

9.4.1 Equilibrium Shockley-Read-Hall recombination . . . . . . . . . . . . . . 68


9.4.2 Non-equilibrium carrier trapping and recombination using Shockley-Read-
Hall trap states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
9.5 Free-to-free carrier recombination . . . . . . . . . . . . . . . . . . . . . . . . . . 69
9.6 Auger recombination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
9.7 Charge carrier transport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
9.8 Perovskite mobile ion solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
9.9 Semiconductor interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
9.9.1 Direct tunnelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
9.9.2 Tunnelling organic-organic . . . . . . . . . . . . . . . . . . . . . . . . . . 71
9.9.3 Fowler–Nordheim tunnelling . . . . . . . . . . . . . . . . . . . . . . . . . 71
9.9.4 Thermionic emission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
9.9.5 Hopping conduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
9.9.6 Doping on the interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
9.10 Calculating the built in potential . . . . . . . . . . . . . . . . . . . . . . . . . . 72
9.10.1 Average free carrier mobility . . . . . . . . . . . . . . . . . . . . . . . . . 73
9.11 Configuring the electrical solver . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
9.11.1 Solver stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
9.12 The need for trap states in device organic models . . . . . . . . . . . . . . . . . 78
9.12.1 The physical and energetic structure of disordered materials. . . . . . . . 78
9.12.2 Trap states and charge density . . . . . . . . . . . . . . . . . . . . . . . . 79
9.12.3 Why you should not use Langevin recombination in device models . . . . 80
9.12.4 How one can make Langevin recombination work in device models . . . . 81
9.13 Thermal models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
9.13.1 Lattice thermal model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
9.13.2 Energy balance - hydrodynamic transport model . . . . . . . . . . . . . . 84

10 Optical models 85
10.1 Light sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
10.1.1 Local ground view factor . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
10.2 Transfer matrix model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
10.2.1 The user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
10.2.2 Output files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
10.2.3 Simulating optically thick layers (incoherent layers) . . . . . . . . . . . . 95
10.2.4 Theory of the transfer matrix method . . . . . . . . . . . . . . . . . . . . 97
10.2.5 Refractive index and absorption . . . . . . . . . . . . . . . . . . . . . . . 99
10.3 Optical mode solve 1D/2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
10.4 Finite Difference Time Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
10.4.1 Running an FDTD simulation . . . . . . . . . . . . . . . . . . . . . . . . 101
10.4.2 Manipulating objects in OghmaNano . . . . . . . . . . . . . . . . . . . . 103
10.4.3 Manipulating light sources in OghmaNano . . . . . . . . . . . . . . . . . 105
10.4.4 Theoretical background . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
10.4.5 Ray tracing model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

11 Simple circuit simulations 109


11.0.1 JV, IS, CV and other simulation modes . . . . . . . . . . . . . . . . . . . 112
11.0.2 Using the fitting/scan tools with circuit models . . . . . . . . . . . . . . 113

12 Large area device simulation 114


12.1 Designing contacts for large area devices . . . . . . . . . . . . . . . . . . . . . . 114
12.2 Simulating large area solar cells . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
CONTENTS

13 Modelling excitons/geminate recombination - organics only 120


13.1 Why you should not model excitons . . . . . . . . . . . . . . . . . . . . . . . . . 120
13.2 Modelling excitons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
13.3 Modeling excitions in a device . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
13.4 Modeling excitions in a unit cell . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

14 The oghma file format 122


14.1 the .oghma simulation file format . . . . . . . . . . . . . . . . . . . . . . . . . . 122
14.2 Qwerks of the OghmaNano json format . . . . . . . . . . . . . . . . . . . . . . . 122
14.3 Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
14.4 Forwards/backwards compatability of the file format . . . . . . . . . . . . . . . 125

15 Databases 126
15.1 Materials database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
15.1.1 Adding new materials - the hard way . . . . . . . . . . . . . . . . . . . . 128
15.1.2 Adding new materials - the easy way . . . . . . . . . . . . . . . . . . . . 129
15.1.3 But I have a data in nm/n/k format . . . . . . . . . . . . . . . . . . . . 132
15.2 Shape database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
15.2.1 The shape file format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
15.3 Filters database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
15.4 Backups of simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

16 Fitting experimental data 141


16.1 Key tips and tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
16.2 The main fitting window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
16.3 Setting the variables to fit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
16.4 Duplicating variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
16.5 Fit rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
16.6 Minimizer configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
16.6.1 Nelder-Mead (Simplex Downhill) . . . . . . . . . . . . . . . . . . . . . . 148
16.6.2 Newton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
16.6.3 Thermal Annealing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
16.6.4 Markov chain Monte Carlo (MCMC) . . . . . . . . . . . . . . . . . . . . 149
16.6.5 Hamiltonian Monte Carlo (HMC) . . . . . . . . . . . . . . . . . . . . . . 149
16.6.6 No-U-Turn Sampler (NUTS) . . . . . . . . . . . . . . . . . . . . . . . . . 149
16.7 How the fitting process works . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
16.8 Fitting without the GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

17 Automation and Scripting 152


17.1 The parameter scan window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
17.1.1 Changing one material parameter . . . . . . . . . . . . . . . . . . . . . . 153
17.1.2 Duplicating parameters - changing the thickness of the active layer . . . 155
17.1.3 Setting constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
17.1.4 The equivalent of loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
17.1.5 Limitations of the scan window . . . . . . . . . . . . . . . . . . . . . . . 157
17.2 Multiparameter device optimizer . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
17.2.1 Using the multi parameter optimizer . . . . . . . . . . . . . . . . . . . . 158
17.3 Python/MATLAB scripting of OghmaNano . . . . . . . . . . . . . . . . . . . . 161
17.4 Python scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
17.4.1 The native python way . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
17.4.2 PyOghma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
CONTENTS

17.4.3 MATLAB scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166


17.4.4 The built in calculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

18 Machine learning 169


18.1 Generating ML datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
18.1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
18.1.2 Generating a machine learning dataset . . . . . . . . . . . . . . . . . . . 170
18.1.3 Setting up machine learning algorithms to process the data . . . . . . . . 174

19 Output files 176


19.1 Snapshots directory - dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
19.2 Trap map directory - dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
19.3 Optical snapshots - dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
19.4 Cache - dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
19.5 Equilibrium directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
19.5.1 Optical simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
19.6 File formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
19.6.1 .dat files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
19.6.2 .csv files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
19.6.3 Binary .csv files - files which are not human readable . . . . . . . . . . . 180

20 Troubleshooting 181
20.1 Windows gives warms me the software is unsigned . . . . . . . . . . . . . . . . . 181
20.2 Why don’t I get a 3D view of the device . . . . . . . . . . . . . . . . . . . . . . 181

21 FAQ 183
21.1 Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
21.1.1 Should I trust the results of OghmaNano? . . . . . . . . . . . . . . . . . 183
21.1.2 Can I use the model to simulate my exotic* material system/contacts? . 183
21.2 Excited states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

22 Legal 185
22.1 License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
22.2 Copyright of the manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
22.3 Data privacy statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Chapter 1

Introduction

1.1 What is OghmaNano?


OghmaNano officially stands for Organic and hybrid Material Nano Simulation tool. Oghma
is also the name of the Gaelic God who’s appearance is described as ”sun-faced” or ”shin-
ing/radiant”, he is creditied with developing Ogham, the script in which Irish Gaelic was first
written. The creators of OghmaNano spent a lot of time making sure it can describe the light
and optical radiation correctly thus the name seems like a good fit. How you remember the
name is up to you.
OghmaNano was originally developed to be a general purpose model for simulating photo-
voltaic devices, including organic and perovskite cells. However, since its initial development
the model has expanded to simulate many other classes of optoelectronic devices including, Or-
ganic Light Emitting Diodes (OLEDs), Organic Field Effect Transistors (OFETs), large area
printed devices, optical filters, photonic crystals and many more. In general OghmaNano can
simulate any opto-electronic-device where electrons, photons (and also heat - phonons) interact.
The model has been downloaded by thousands of people across the globe (see figure 1.1) and is
used in many top universities and companies. Figure 1.2 shows some of the classes of devices
OghmaNano can simulate. Key features of OghmaNano are listed below:

ˆ Electrical models:
– 1/2D electrical drift-diffusion solver.
– Dynamic SRH traps needed for simulating disordered materials.
– Simple equivalent circuit model.
– Complex 3D circuit model for complex large area devices.
– Arbitrary user defined densities of trap states.
– Thermal model linked to the electrical models.
– Time domain, frequency domain and steady state solvers.

ˆ Optical models:
– Transfer matrix model for light
– FDTD models
– Ray tracing model
– 1/2D optical mode solvers for waveguide structures.
– Arbitrary light sources/filters.

ˆ Excited states/mobile ion:


– 1/2/3D Exciton solver.
– Excited singlet/triplet state solver.
– Mobile ions, doping and tunneling through interfaces.

1
2 CHAPTER 1. INTRODUCTION

ˆ Other/databases:

– Comprehensive materials databases.


– Ability to convert arbitrary shapes to 3D objects.
– Comprehensive 3D shape database.

1.2 Why OghmaNano?


By burning fossil fuels we are releasing ∼ 33.3
gigatonnes of CO2 per year [?] and thus hu-
manity is steadily changing the composition of
Earth’s atmosphere. Since 1960, CO2 in the at-
mosphere has risen by around 30% this in turn
is increasing average global temperatures[?] and
making our home planet Earth, a more difficult
place to live on. We therefore have two choices,
either cut emissions or face an existential crisis.
Thin film devices such as solar cells and OLEDs
offer a viable way to reduce our CO2 emissions,
either by providing low carbon electricity, or
Figure 1.1: A map of locations where Ogh-
providing an efficient way to use the energy once
maNano has been downloaded.
generated.
It is therefore important that technologies based on thin film devices continue to be devel-
oped and succeed. By developing and releasing OghmaNano, I hope, I am enabling scientists
throughout the world to understand these devices a little bit better, which I hope will contribute
in a very small way to solving our climate crisis.
Solar cells and OLEDs happen to come from a class of devices called diodes. This class of
devices has many uses including optical sensors, medical sensors, switches, rectifiers. Thus as
a pleasant side effect of OghmaNano the development of these devices is also being helped.

1.3 About this book/manual


This book is intended to be the definitive guide to simulating devices with OghmaNano. The
idea is that one can read this book and learn in a step-by-step way how to simulate many
modern opto-electronic devices with very limited prior knolage. However, not all aspects of
this book are yet finished. I therefore recommend you also watch the YouTube channel (and
subscribe! ;)) where I describe many of the features in more detail and give demonstrations on
the use of the model. I would suggest you treat the videos as lectures (and take notes) rather
than entertaining videos (well I hope they are entertaining too!). New releases are generally
announced on Twitter, which I also suggest you follow to make sure you are using an up-to
date version. I often release version every week, a version that is 6 months old is considered
very old indeed. Please read papers which were published from this model - do also read the
supplementary information (SI) to the papers, as I often write about the model in there. This
book starts off with explaining how to simulate organic solar cells. This is because organic
solar cells are the easiest class of device to simulate, it then moves onto Perovskite devices,
and OLEDs. More complex classes of devices follow. If you are new to simulation work or in
indeed OghmaNano, I suggest you start with the first chapters and work your way to the more
complex devices.
1.3. ABOUT THIS BOOK/MANUAL 3

Figure 1.2: a); Organic/Perovskite solar cell simulation; b) OFET transistor simulation; c)
Microlens simulation; d) Photonic waveguide simulation; e) light escaping structured films;
f) OLED simulation; g) Optical filter simulation; h) large area device modelling (hexogonal
contacts); i) Mapping carrier density in position/energy space; j) Building complex 3D meshes;
and k) resistance maps of large area devices.
4 CHAPTER 1. INTRODUCTION

1.4 What is the history of OghmaNano?


I started writing OghmaNano just after finishing my PhD in 2009 while taking a break for
academia and deciding what to do next. At that time it was a simple 1D drift-diffusion diode
model designed to simulate solar cells which did not take account of disorder. Over the next
14 or so years the model has been significantly expanded to model many classes of material
system and classes of devices. Since 2009 thousands of people have downloaded OghmaNano
and hundreds (the list is by definition always out of date) of people have published their own
papers using the model. If you publish with OghmaNano let me know and I will update the
list to include your paper.

1.5 What is the roadmap for OghmaNano?


The aim is to make OghmaNano a completely general opto-electronic model which can be
used by anyone to learn about and explore the world of novel opto-electronic devices. I want
OghmaNano to be an engine which people can use to push their own research forward and for
education. The exact road map on how to get there is not defined. As collaborators contact me
asking for new features I add them, what comes first depends on what people want.. I never
view OghmaNano as finished, and release improvements in small increments, therefore if you
discover and report a bug, check back in a week or so to see if it is fixed in the next version.
The same goes for this book, it evolves weekly as I write it. So if a section is missing, check
back next week it might be finished.

1.6 Using OghmaNano in industrial/academic work


You are free to use OghmaNano in industrial/academic work. In fact, I’m happy if you do so.
However, the following conditions apply:

1. If you use OghmaNano to generate results, then clearly say so in your work. This can be
as simple as one sentences saying: ”we used OghmaNano to perform the simulations”

2. If you publish a book, paper or thesis where OghmaNano has been used you must cite at
least three papers associated with the model. To find out which papers to cite, click on
the area indicated in red in figure 1.3 when using the model. PLEASE do not cite the
manual. I can’t include the manual in paper lists when applying for funding.

I ask you to do this because citations are an easy way to demonstrate that people are using
OghmaNano. Demonstrating use is key to finding money/people to continue the development
of OghmaNano. So by doing this you are guaranteeing the future of OghmaNano and its
continued availability for others. Thank you!

1.7 Bugs
I get quite a lot of feature requests from people wanting features added or for bugs to be fixed.
I really appreciate the feedback! However, I am currently employed at a UK University and
my time is split between teaching, research and admin. My performance in my job is measured
by the number of high impact papers I push out per year. I therefore have to prioritize
feature requests and bug fixes for people who would like to write a paper with me (i.e. my
collaborators).... Therefore if you would like:
1.7. BUGS 5

Figure 1.3: If you click on the area indicated by the red box, the model will tell you which
papers should be cited.

ˆ A bit of advice on how to do x or y with the model then please do feel free to shoot me a
mail, and I will do my best to get back to you. If you don’t hear back from me just send
the mail again.. I get loads of e-mails, and things get lost if I don’t answer quickly.

ˆ If you want to report a bug, then please do that, and I will do my best to fix it in the
next release. But I can’t promise when it will be fixed.

ˆ If you would like a features added or a steady stream of help (i.e. you are asking for my
time) then please consider inviting me to join in your work and collaborate on a joint
paper. I am happy to add whatever feature you want to the model, or fix what ever bug
you may have but in return I would ask for the inclusion of my name on the author list.
By doing this it makes it much easier for me to justify sinking time into your project.

If you don’t need help from me to use OghmaNano then please feel free to do what you
want with the results - no need to contact me, but do cite it correctly.
Chapter 2

Installing OghmaNano

2.1 Windows (if you have admin rights)


Go to the download page for OghmaNano at http://www.Ogham-Nano.com/windows.php and
download the latest version. Simply double click on it and say yes to all questions, it will then
install on your PC and an icon will appear in the start menu. I recommend you install it in
the default directory.
In general I release a new version every couple of weeks and it’s worth keeping your version
up-to-date. On modern versions of windows, windows will ask you if you want to install an
unsigned executable from an unknown author, and warn you that this could damage your
computer. The reason you get this message is because I have not cryptographically signed the
.exe file. I have not signed it because I do not own a private cryptographic key with which to
do this. To get such a key I would have to send my passport off to a key authority to prove
who I am and then pay them 500 pounds/year for the privilege of them validating who I am.
Needless to say, that I am not very excited about paying 500 pounds/year so you will just have
to click away the warnings from windows.

2.2 Windows (No admin rights)


If you don’t have admin rights to your computer it can be hard to install new software, Ogh-
maNano offers the option of running OghmaNano while not properly installed. Download
the zip file containing OghmaNano from https://www.Oghma-Nano.com/download_no_admin.
php. Once you have downloaded the zip archive, open the zip file and extract the folder pub
to c:\. Then rename the folder to be called c:\OghmaNano. Once you have done this run the
executable c:\OghamNano\OghmaNano.exe (see figure 2.1).

6
2.2. WINDOWS (NO ADMIN RIGHTS) 7

Figure 2.1: Running and installing OghmaNano. Double click on the OghmaNano icon to run
the model.
Chapter 3

Getting started

3.1 Simulating a JV curve of a simple solar cell


No matter which type of device you want to
simulate, if you are new to OghmaNano my ad-
vice is to start off with this organic solar cell
simulation. Organic solar cells are by far the
most simple class of device you can simulate,
and will let you understand the basics of the
package without having to deal with 2D effects,
perovskite ions of light emission. This chapter
will guide you through your first organic solar
cell and explain the nuts and bolts of running
simulations with OghmaNano. Once installed
OghmaNano appear on the start menu, click on
it to launch it. Once run, a window resembling Figure 3.1: The main OghmaNano simulation
that in figure 3.1 will appear. window.

3.1.1 Making your first simulation


Click on the new simulation button. This will bring up the new simulation window (see figure
3.2). From this window double click on the Organic Solar Cells icon. This will bring up a
sub menu of different types of Organic Solar cells (see figure 3.3). The majority of these device
simulations have been published in papers and calibrated to real organic solar cells. The oldest
is the (non-inverted) P3HT:PCBM device from 2012 [?] and the newest are the PM6:Y6 devices
from 2022 [?, ?]. Double click on the P3HT:PCBM simulation for this example and save the
new simulation to disk.
Once you have saved the simulation, the main OghmaNano simulation window will be
brought up (see figure 3.4). You can look around the structure of the solar cell, by dragging the
picture of the solar cell with your mouse. Try pressing on the buttons beneath the red square,
they will change the orientation to the xy, yz or xz plane. Notice the x,y,z origin marker in the
bottom left of the 3D window. The icon with four squares will give you an orthographic view
of the solar cell.
Click on the button called Run simulation, to run the simulation (hint it looks like a blue
play button and is located in the file one to the right of the ”Simulation type ribbon” ). The
function key F9 will also run the simulation. On slower computers it could take a while. Once
the simulation is done, click on the Output tab (see figure 3.1), there you will see a list of files
the simulation has written to disk.

8
3.1. SIMULATING A JV CURVE OF A SIMPLE SOLAR CELL 9

Figure 3.2: New simulation window, from Figure 3.3: The organic solar cell sub
here you can select different example sim- menu. There are quite a few examples of
ulations. It is often easier to start from a organic solar cells in this menu. The ma-
base simulation rather than build your own jority of simulations have been used to pro-
from scratch. duce papers [?, ?, ?].

What’s the best place to save your simulation?

OghmaNano dumps a lot of data to disk, I therefore recommend you save the simulation to
a local disk such as the C:\drive, a network drive or USB stick drive will be far too slow for
the simulation to run. I would also not save the simulation onto OneDrive or Dropbox as they
are also too slow and saving it there will generate a lot of network traffic. If you are a power
user doing a lot of fitting of experimental data I would also recommend (at your own risk(!))
disabling any extra antivirus software you have installed, as quite often the antivirus software
can’t keep up with the read/writes to disk.

Figure 3.4: The main OghmaNano simulation window with the xy, yz and xz buttons visible.
The play button is also visible which is used to run the simulation, the function key F9 can
also be used to run the simulation.
10 CHAPTER 3. GETTING STARTED

3.1.2 The output from your first simulation


After you have clicked on the Run Simulation button (or pressed the function key F9) to run
the simulation, the results from the simulation will have been written to disk. To view these
results click on the Output tab in the main window. There you will see the output from the
simulation, this is visible in figure 3.1

Figure 3.5: The Output tab this is just like windows file explorer, you can explore the simulation
directory tree.

Key files the simulation produces are listed in the table below:

File name Description


jv.dat Current v.s. voltage curve
charge.csv Voltage v.s. charge density curve
device.dat The 3D device model
f it data ∗ .inp Experimental data for this device.
k.csv Voltage v.s. Recombination constant k
ref lect.csv Optical reflection from device
transmit.csv Optical transition through device
snapshots Electrical snapshots see 19.1
optical snapshots Optical snapshots see 19.3
sim inf o.dat Calculated Voc , Jsc etc.. see 4.1.4
cache Cache see 19.4

Table 3.1: Files produced by the JV simulation

Try opening jv.dat. This is a plot of the voltage applied to the solar cell against the current
generated by the device. These curves are also sometimes called the characteristic diode curve,
we can tell a lot about the solar cell’s performance by looking at these curves. Hit the ’g’ key
to bring up a grid.
3.1. SIMULATING A JV CURVE OF A SIMPLE SOLAR CELL 11

Figure 3.6: The output tab

Now try opening up the file sim inf o.dat, this file displays information on the performance
of the solar cell, such as the Open Circuit Voltage (Voc - the maximum Voltage the solar cell can
produce when iluminated), efficiency (η - the efficiency of the cell) , and short circuit current
(Jsc - the maximum current the cell can produce when it is illuminated). Figure 3.6, shows
where you can find these values on the JV curve. The sim inf o.dat file contains a lot of other
parameters, these are described in detail in section 4.1.4.

Question 1: What is the Jsc , Voc and Fill Factor (FF) of this solar cell? How do these
number compare to a typical Silicon solar cell? (Use the internet to find typical values
for a Silicon solar cell.)
12 CHAPTER 3. GETTING STARTED

3.1.3 Editing device layers


Any device in OghmaNano consists of a se-
ries of layers (this is sometimes referred to as
the epitaxy - this is a term which comes from
inorganic semiconductors). The layer editor can
be accessed from the main simulation window,
under the device structure tab. This is visible
towards the top of figure 3.4, and the layer ed-
itor is visible in figure 3.7. Within the win-
dow is a table that describes the structure of
the device. The column thickness describes the
thickness of each layer. The P3HT:PCBM layer
is the layer of material which converts photons
into electrons and holes, this is commonly called
Figure 3.7: The layer editor window. the active layer.
An active layer thickness of 50nm is considered very thin for an organic solar cell, while an
active layer of 400nm is considered very thick (too thick for efficient device operation). Vary
the active layer between 50 nm and 400 nm, for each thickness record the device efficiency (I
suggest you perform the simulation for at least eight active layer widths).

More on the layer editor


The layer editor has the following columns:

ˆ Layer name: Is the English name describing the layer. You can call your layers what you
want (i.e. ITO, PEDOT, fred or bob) it has no physical meaning.

ˆ Thickness: Is the layer thickness given in meters.

ˆ Optical material: Specifies the n/k data which is used to describe the materials optical
properties. In the simulation the n/k data are taken from experimental values stored in
the optical database 15.1 and have nothing to do with the electrical material properties
such as effective band gap.

ˆ Layer type: Specifies to the simulation how the layer is treated when performing a simu-
lation. There are three types of layer

– active: This type of layer is electrically active and the drift diffusion solver will solve
the electrical equations in this layer type. See section 21.2. You can have as many
active layers as you like but they must be contiguous.
– contact: This tells the model that a layer is a contact and a voltage should be
applied, see section 3.1.8 for more details.
– other: Any layer which is not a contact or active.

Which layers should be active?


A common mistake people make when starting to simulate devices is to try to make all the layers
in their device active because their logic is: Current must be flowing through them so they must
be active right? However, in for example a solar cell only the BHJ or in a perovskite device
the perovskite layer will have both species of carriers (electrons+holes) and complex effects
such as photogeneration, recombination and carrier trapping. So in this layer it makes sense to
3.1. SIMULATING A JV CURVE OF A SIMPLE SOLAR CELL 13

solver the drift diffusion equations. Other layers which don’t have both species of carriers can
be treated simple parasitic resistances see section 3.1.6. I would only recommend setting other
layers of the device to active (such as the HTL/ETL) if you are trying to investigate effects
such as s-shaped JV curves or devices which clearly need multiple active layers such as OLEDs.
In general, try to minimize the number of active layers and always keep simulations as simple
as possible to explain the physical effects you see.

Task 2: Plot a graph (using excel or any other graphing tool), of device efficiency v.s.
thickness of the active layer. What is the optimum efficiency/thickness of the active
layer? Also plot graph Voc , Jsc and F F as a function of active layer thickness. Jsc is
generally speaking the maximum current a solar cell can generate, try to explain your
graph of J sc v.s. thickness, [Hint, the next section may help you answer this part of
the question.]
14 CHAPTER 3. GETTING STARTED

3.1.4 How do solar cells absorb light?


In this section we are going to learn how a solar cells interact with light. Firstly, let’s have
a look at the solar spectrum. Sunlight contains many wavelengths of light, from ultraviolet
light, though to visible light to infrared. The human eye can only see a small fraction of the
light emitted by the sun. OghmaNano stores a copy of the suns spectrum to perform the
simulations. Let’s have a look at this spectrum, to do this go to the Database tab, the choose
Optical database. This should, bring up a window as shown in figure 3.8

Figure 3.8: The optical database viewer

Double click on the icon called, AM1.5G, this should bring up a spectrum of the sun’s
spectrum. Have a look at where the peak of the spectrum is. Now close this window, and open
the spectrum called led. Where is the peak of this spectrum.

Figure 3.9: a: A plot of the entire solar spectrum. b: The image below shows the solar spectrum
at 392 nm (blue) to 692 nm (red) as observed with the Fourier Transform Spectrograph at Kitt
Peak National Observatory in 1981. R. Kurucz

Question 3: Describe the main differences between the light which comes from the
LED and the sun. Rather than referring to the various regions of the spectrum by
their wavelengths, refer to them using English words, such as inf rared, U ltraV iolet,
Red, and Green etc... you will find which wavelengths match to each color on the
internet. If you were designing a material for a solar cell, what wavelengths would.
3.1. SIMULATING A JV CURVE OF A SIMPLE SOLAR CELL 15

3.1.5 Light inside solar cells


As you will have seen from when you fist opened the simulation, the solar cells are often made
from many layers of different materials. Some of these materials, are designed to absorb light,
some are designed to conduct charge carriers out of the cell. The simulator has a database
of these materials, to look at the database, click on the Database tab, the click on Material
database. This should bring up a window as shown in figure 3.10, once this is open navigate
to the directory polymers, and double click on the material p3ht, in the new window click on
the tab Absorption (see figure 3.11). This plot shows how light is absorbed in the material as
a function of wavelength.

Figure 3.10: The materials database

Figure 3.11: Optical absorption of the light.

Question 4: What color of light does the polymer p3ht absorb best? Which material
in the polymers directory do you think will absorb the suns light best?
16 CHAPTER 3. GETTING STARTED

3.1.6 Parasitic elements


Many devices have parasitic shunt and series resistances associated with them. Shunt resis-
tances (Rs ) are caused by conduction straight through the device in thin novel devices this is
often caused by impurities in the material system. Parasitic series resistances (Rs ) are often
associated with the resistance of the contacts, the resistance of the HTL/ETL or any other
resistances which are not associated with the active layer. These resistance can be seen for a
typical solar cell in figure 3.12 also shown in the figure is the ideal diode of the device. These
resistances can be set in the parasitic component window shown in figure 3.13

Figure 3.13: The parasitic component edi-


Figure 3.12: Circuit model of a solar cell.
tor.
You can change the values of series and shunt resistance in OghmaNano, by going to the
Electrical tab and then clicking on the Parasitic components button. Due to the flat broad
contacts on a solar cell, there is often a capacitance associated with the device, this is important
for transient measurements and can be calculated with the equation:
ϵr ϵ0 A
C= (3.1)
d+∆
where A is the area of the device ϵ are the hyperactivities, and d is the thickness of the
device. Often for various reasons the measured capacitance of the device does not match what
one would expect from the above equation. Therefore the term ”Other layers” (∆) has been
added to the parasitic window to account for differences between measured capacitance and
layer measured layer thicknesses.

Task 5: In the optical tab you will find a control called Light intensity, this controls
the amount of light which falls on the device in Suns. Set it to zero so that the device
is in the dark. Then run two JV curve simulations, one with a shunt resistance of
1 Ohm m2 and one with a shunt resistance of 1x106 Ohm m2 (Hint you will have to
enter 1e6 in the text box). What happens to the dark JV curve? Now try running
the same same simulations again but in the light.
3.1. SIMULATING A JV CURVE OF A SIMPLE SOLAR CELL 17

3.1.7 Solar cells in the dark


So far, all the simulations we have run have been performed in the light. This is a logical, as
usually we are interested in solar cell performance only in the light. However, a lot of interesting
information can be gained about solar cells by studying their performance in the dark. We are
now going to turn off the light in the simulation. From the Optical tab set the Light intensity
(suns) drop down menu to 0.0 Suns, this can be seen in figure 3.14. The photons in the 3D
image should disappear as seen in figure 3.14.

Figure 3.14: Running OghmaNano in the


dark, the Light intensity drop-down menu Figure 3.15: A sketch of a typical dark JV
has been set to 0 Suns and the photons curve.
have disappeared from the image.
Now set the shunt resistance to 1M Ωm2 , and run a simulation. Plot the jv curve. It is
customary to plot jv curves on a x-linear y-log scale. To do this in the plot window, hit the
’l’ key to do this. The shape should resemble, the JV curve in figure 3.15. Certain solar cell
parameters affect different parts of the dark JV curve differently, the lower region is affected
very strongly by shunt resistance, the middle part is affected strongly by recombination, and
the upper part is strongly affected by the series resistance.

Question 6: What values of series and shunt resistance, would produce the best pos-
sible solar cell? Enter these values into the device simulator and copy and paste the
dark JV curve into your report.
18 CHAPTER 3. GETTING STARTED

3.1.8 The contact editor


The contact editor is used to configure the electrical contacts. Which layers act as contacts is
configured in the layer editor see section 3.1.3. The contact editor has the following fields:

Figure 3.16: The contact editor

ˆ Name: The name of the contact, this can be any English word. It has no physical meaning.

ˆ Top/Bottom: Sets if the contact is on the top, bottom or in 2D simulation left and right
of the device are also valid.

ˆ Applied voltage: Sets the applied voltage on the contact. You first have to select what
type of applied voltage you want:

– Ground: This will set the contact to zero volts i.e. ground. 0V is always taken as
ground.
– Constant bias: This will apply a constant bias to a contact. It can be set to zero,
and would then be equivalent to ground. In OFET simulations the voltage value
can be set to bias one contact to a desired constant voltage.
– Change: If a contact is set to ’Change’ this tells the simulation to apply a changing
voltage to this contact. For example if you are performing a JV sweep, the sweep
voltage will be applied to this contact. Similarly if you are doing an IS simulation
(TPV, TPC, ToF etc..) the voltage will be applied/measured to this contact.

ˆ Charge density: This sets the majority charge density on the contacts. The Fermi-offset
is calculated from the charge density. The model does not use Fermi-offset as an input,
it uses charge density.

ˆ Majority carrier: This sets the majority carrier density to electrons or holes.

ˆ Physical model: This selects if you have ohmic contacts or schottky contacts. I recommend
using ohmic contacts.

Task 7: For a good contact which results in a high efficiency device, the Fermi-offset
will be exactly 0 eV or very small. Firstly set the Fermi-offset to zero for both contacts,
and run a simulation. What efficiency cell do you get? Now set the Fermi-offset to
0.3eV what efficiency cell do you now have? Make a note of the charge densities on
the contacts which these Fermi-offsets produce.
3.1. SIMULATING A JV CURVE OF A SIMPLE SOLAR CELL 19

3.1.9 Electrical parameters


The electrical parameter editor enables you to change the electrical parameters associated with
the active layers. Here you can change mobilities, trap constants etc. If you set a layer to active
wihtin the layer editor it will apear within the electrical paramter editor. The toolbar at the
top of the window allows you to turn off and on various electrical mechanisms including:

ˆ Drift diffusion: This enabled drift diffusion within the layer. In most circumstances if a
layer is set to be active there is no reason why you would want to turn this option off.
The one example is in the insulating layer of an OFET.

ˆ Auger recombination: This switches on and off Auger recombination. See 9.6 for more
information.

ˆ Dynamic SRH traps: This is used to turn on and off dynamic SRH traps. See section
9.4 for more information. This option should be turned on when modeling disordered
semiconductors such as organic materials.

ˆ Equilibrium SRH traps: This can be used to introduce a single equilibrium trap level.
See section 9.4 for more information.

ˆ Excitons: This enables the exciton diffusion equation to be solved along with the electrical
equations. See section 13.2 for more information.

ˆ Excitons: This enables singlet and triplet states to be modelled.

Figure 3.17: Electrical parameter window

Task 8: The values of electron mobility dictate how easily charge can move in the
device. You can think of this value as akin to resistance or a sort of microscopic
resistance. Try try increasing the mobilities by two orders of magnitude and look
what happens to the light JV curve of the device and the efficiency, FF, Voc and Jsc
Do you think it is good to have a low or high value of mobility?
20 CHAPTER 3. GETTING STARTED

Task 9: Recombination is described later in detail but for now we can simply think of
it as how many electrons and holes meet each other in a given time. As stated above
there are various types of recombination which can happen in organic semiconductors,
but for now we will just consider the case when a free electron meets a free hole. This
is sometimes called bi-molecular recombination, the equation for this is given by:

R(x) = kn(x)p(x) (3.2)

Where n(x) is the density of electrons and p(x) is the density of holes, and k is a
rate constant. Before trying to understand this rate, firstly turn off the more complex
SRH recombination by clicking on the Dynamic SRH traps in figure 3.17. You will
notice lots of text boxes disappear. Then try changing the value of k which is set in
the text box called nf ree to pf ree Recombination rate constant, from 1e-15 to 1e-20 in
five steps. Run a simulation each time you change the value and make a graph of the
efficiency of the cell as you change the value.

How do I know what electrical parameters to use?


For traditional semiconductors that have been studied for years such as AlGaAs or InP the
values of charge carrier mobility, band gap, electron affinity (etc..) are well known and can
simply be looked up on sites such as this or in books such in Piprek’s [?] excellent book. These
materials are highly pure (99.999999999%) (the so-called ”eleven nines” purity). This means
that when one has a sample of such a semiconductor one knows exactly what one has in the hand
and what its physical properties will be. Organic semiconductors (also other novel materials
such as perovskites etc..) on the are typically only 99.9% on a good day, that is a whole eight
orders of magnitude less pure than their traditional counterparts. This means that when one
has a sample of such a material one is not exactly sure what material one has hold of so it’s
harder to know what the values of mobility etc will be.
Furthermore, traditional semiconductors are very ordered, this means that the atoms within
them pack in a regular lattice (think marbles packing in a biscuit tin) this again helps make
their electronic properties predictable. Novel semiconductors on the other hand are typically
much more disordered than their traditional counterparts and consist of a higgldy piggidly
collection of polymers/molecules (or perovskite domains etc..), and the exact structure of these
materials depends very much on how they were deposited. This means that due to fabrication
techniques/conditions varying between different labs, nominally the same material produced
by the same suppler but can behave very differently depending on when/who/where it was
deposited by.
So this brings us back to the question that started this section, what parameters should I
use for my novel device? Here are some tips:

ˆ Use the base simulations provided in OghmaNano, these simulations have either been
calibrated against real experimental devices or use very reasonable electrical parameters.

ˆ Look in the literature and try to get an idea of what values are sensible ranges for the
material systems you are looking at.

ˆ Find some experimental data and make sure the current voltage curves produced by the
model are within the same ball park as what you would expect experimentally, if they
are totally out then you might need to tweak your electrical paramters.

ˆ Fit the model to an experimental data set as was done in [?] and described in section 16
(This is however quite a hard thing to do though and not really recommended).
Chapter 4

Simulation modes and simulation


editors

OghmaNano uses a modular architecture that enables the core solver to perform a variety of
simulation types using . For example there is a plugin to perform steady state JV simulations,
another plugin to perform frequency domain simulations, and another to calculate the Quantum
Efficiency. They all leverage the same OghmaNano core solver but run it in a slightly different
way with custom inputs and outputs. A list of the plugins and what they do can be found
below:

ˆ Plugins for various types of experiment


– jv: To calculate steady state JV curves.
– suns jsc: Simulate suns v.s. Jsc curves.
– suns voc: Suns v.s. Voc simulations.
– eqe: Simulates EQE.
– cv: Capacitance voltage simulations.
– ce: To simulate charge extraction experiments.
– time domain: A time domain solver for transient simulations.
– fx domain: Simulate the frequency domain response of a device, both electrical and
optical excitation.
– pl ss: Calculate the PL spectrum at in steady state.
– mode: Used to solve optical modes in 1/2D waveguides.
– spm: Simulates scanning probe microscopy in 3D electrical simulations.
– equilibrium: Equilibrium electrical simulations.
– exciton: Exciton simulations.
– mesh gen: Generates meshes.

ˆ Optical solver plugins


– fdtd: Finite Difference Time Domain (FDTD) optical solver.
– optics: Optical transfer matrix solver for 1D structures
– light full: Optical transfer matrix solver.
– light qe: Calculates optical profile using the experimental quantum efficiency.
– light exp: Calculates optical profile assuming exponential propagation of light in 1D
structures.
– light flat: Calculates optical profile assuming flat optical profiles in the structure.
– light constant: Assumes user given values of generation rate in optical structures.
– light fromfile: Takes a generation rate from a file.

21
22 CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

Figure 4.1: Simulation editors use this toolbar to edit the various simulation conditions your
device will experience.

In the simulation editors ribbon (see Figure 4.1) you can see icons that represent each plugin,
these are the simulation editors. By clicking on an icon in this ribbon you will be able to edit
how the plugin performs the various simulations. For example in the JV simulation editor one
can change the start/stop voltages of a voltage sweep. The JV editor can be seen in Figure 4.2.
Within each simulation editor the user can define multiple so called experiments. This can be
seen in below in Figure 4.2 and Figure 4.3, where two JV scans have been defined within the
JV editor, one called JV curve - low voltage and another called JV curve - high voltage. One
has a start voltage of 0.02V and stop voltage of 1.0V, while the other has a start voltage of
1.0V and a stop voltage of 10V. This feature is most useful in more complex experiments such
as in time domain experiments where one may want to simulate multiple different voltage/light
ramps/pulses for one device. There is no limit to how many experiments can be defined for
each plugin.

Figure 4.2: An experiment set up in the JV Figure 4.3: An experiment set up in the JV
window for high voltage simulations. window for low voltage simulations.

Once an experiment has been defined an icon representing it will appear in the simulation
mode ribbon shown in figure 4.4. You can see in the figure an icon for JV curve low voltage and
JV curve high voltage that were defined in Figure 4.2 and 4.3. You can see in Figure 4.4 that
JV curve low voltage is depressed. This means that when the simulation is run this simulation
mode will be executed. If you select another simulation mode, then when the play button (or
F9) is pressed that simulation mode will be run. Only one simulation mode can be run at a
time.
23

Figure 4.4: Selecting a simulation mode, in this case the JV curve low voltage has been selected
so that when the user presses play that simulation mode will be run.
24 CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

4.1 JV editor (Steady state simulation editor)


If you click on the JV editor icon in figure 4.5, the JV editor window will open shown below in
figure 4.6.

Figure 4.5: Opening the JV editor from the simulation editor ribbon.

4.1.1 Inputs
This window can be used to configure steady state simulations. It does not matter if you are
running a current-voltage sweep on a solar cell or an OFET. This plugin will steadily ramp
the voltage from a start voltage to a stop voltage. The voltage will be applied to the contact
which has been set to Change in the contact editor (see section 3.1.8). You can set the start
voltage, stop voltage and step size. Use JV voltage step multiplayer to make the voltage step
grow each step. The default is 1.0, i.e. no growth. It can be helpful to set the step multiplyer
to a value larger than 1.0 if you want to speed up the simulation but it should not be increased
past about 1.05 or the simulation may strugle to converge.

Figure 4.6: The JV editor editor window, use this to configure steady state simulations.

4.1.2 Outputs
The files produced by the JV simulation mode are given in table 10.1. As well as these files, by
default OghmaNano will also write all internal simulation parameters to disk in the snapshots
4.1. JV EDITOR (STEADY STATE SIMULATION EDITOR) 25

directory. This includes band structure, potential, carrier distributions, generation rates etc..
this equates to about 50 files per voltage step. You can read more about this in the simulation
snapshots section, see 19.1. This can considerably slow down the simulation, the user can
therefore decide how much is written to disk by using the Output verbosity to disk option this
can be set to; Key results, which will result in only key files being written to disk;Nothing,
which will result in no results being written to disk; Write everything to disk which will result
in a all possible information being written to disk and Write everything to disk every nth step,
which will only out comprehensive internal simulation write data every nth step.

File name Description


jv.dat Current voltage curve
charge.dat voltage charge density
k.csv Recombination constant k
sim inf o.dat Calculated Voc , Jsc etc.. see 4.1.4

Table 4.1: Files produced by the JV simulation

4.1.3 sim info.dat


This is a json file containing all key simulation metrics such as Jsc , Voc , and example sim info.dat
file is given below:

4.1.4 Steady state electrical simulation


In steady state electrical simulations such as performing a JV scan the sim info.dat outputs
the following parameters.
26

Symbol JSON token Meaning Units Equ. Ref


FF ff Fill factor au
PCE pce PCE percent
Pmax P max Power at Pmax
Voc V oc Voc
vocR voc R Recombination rate at Pmax
jvvoc jv voc
jvpmax jv pmax
vocnt voc nt Trapped electron carrier densiyt at Vo c
vocpt voc pt Trapped hole carrier density at Vo c
vocnf voc nf Free electron carrier densiyt at Vo c
vocpf voc pf Free hole carrier density at Vo c
Jsc J sc Jsc Am−2
jvjsc jv jsc Average charge density at Jsc m−3
jvvbi jv vbi Built in voltage V
jvgen jv gen Average generation rate
vocnp voc np
jpmax j pmax Current at Pmax Am−2
vpmax v pmax Voltage at Pmax V

Symbol JSON token Meaning Units Equ. Ref


µjsc mu jsc Avg. mobility at Jsc m2 V −1 s−1
µgeom
jsc mu geom jsc Geom. avg. mobility @ Jsc m2 V −1 s−1
micro
µgeom
jsc mu geom micro jsc Geom. avg. mobility @ Jsc m2 V −1 s−1
µvoc mu voc Average mobility @ Voc m2 V −1 s−1 p
µgeom
voc mu geom voc Geom. avg. mobility @ Voc m2 V −1 s−1 ⟨µ ⟩⟨µ ⟩
avg √ e h
µgeom
voc mu geom micro voc Geom. avg. mobility @ Voc m2 V −1 s−1 ⟨ mue µh ⟩
e
µpmax mu e pmax Avg. electron mobility @ Pmax m2 V −1 s−1
µhpmax mu h pmax Avg. hole mobility @ Pmax m2 V −1 s−1 p
µgeom
pmax mu geom pmax Geom. avg. mobility @ Pmax m2 V −1 s−1 ⟨µ ⟩⟨µ ⟩
micro √ e h
µgeom
pmax mu geom micro pmax Geom. avg. mobility @ Pmax m2 V −1 s−1 ⟨ mue µh ⟩
pmax
CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

µ mu pmax Avg. mobility @ Pmax m2 V −1 s−1


Symbol JSON token Meaning Units Equ. Ref
τvoc tau voc Recom. time at Voc s R = (n − n0)/τ [?]
τpmax tau pmax Recom. time at Pmax s R = (n − n0)/τ [?]
all
τvoc tau all voc Recomb. time at Voc s R = (n)/τ [?]
all
τpmax tau all pmax Recomb. time at Pmax s R = (n)/τ [?]
thetasrh theta srh θSRH Collection coefficient at Pmax y au p.100 5.2a[?],[?]
thetasrh theta srh θSRH Collection coefficient at Pmax au p.100 5.2a[?],[?]
4.1. JV EDITOR (STEADY STATE SIMULATION EDITOR)
27
28 CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

4.2 Time domain editor


Related YouTube videos:

Simulating optoelectronic sensors made from polymers.

The time domain editor can be used to configure time domain simulations, this is shown in
Figure 4.7. You can see, as described in the previous section that one simulation editor can be
used to edit multiple experiments. The panel on the left shows the editor being used to edit
a CELIV simulation while the panel on the right shows the editor being used to edit a TPC
simulation. The new, delete and clone buttons in the top of the window can be used to make
new simulation modes. The table in the bottom of the window can be used to setup the time
domain mesh, apply voltages or light pulses.

Figure 4.7: The time domain editor showing the user editing the duration of light/voltage
pulses.

Figure 4.8 shows different tabs in of the time domain editor. The image on the left shows
the circuit diagram used to model the CELIV experiment. The diode on the left represents the
drift diffusion simulation while the other components represent various parasitic components.
After the diode from the left next comes a capacitor used to model the charge on the plates of
the device, then a shunt resistance and then the series resistance. The final resistor on the right
represents the external resistance of the measuring equipment, this is by default set to zero but
worth checking. The drop down menu on the top left of the image above the circuit diagram
says load type, this can change the load the circuit from what is shown in the picture, to a
perfect diode where no parasitic components are shown to a device at open circuit which would
be used to simulate Transient Photo Voltage measurements. The right hand figure shows the
configuration options of the time domain window. Again notice the Output verbosity to disk
option as described in the previous section, you will see this again and again in OghmaNano.
4.2. TIME DOMAIN EDITOR 29

Figure 4.8: Configuring the time domain editor: Left the circuit diagram used by the time
domain window and right simulation options.
30 CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

4.3 Frequency domain editor


Related YouTube videos:

Simulating impedance spectroscopy (IS) in solar cells.

4.3.1 Overview
The frequency plugin allows you to simulate the frequency domain response of the device. Using
this tool one can perform impedance spectroscopy, as well as optically excited measurements
such as Intensity Modulated Photo Spectroscopy (IMPS), Intensity Modulated Voltage Spec-
troscopy (IMVS). The domain editor allows you to configure frequency domain simulations.
This is shown below in Figures 4.9 and 4.10. On the left hand side is the frequency domain
mesh editor this is used to define which frequencies will be simulated. Figure 4.10 shows the
circuit tab of the frequency domain window, this sets the electrical configuration of the simula-
tion. One can either simulate an ideal diode (this is the fastest type of simulation to perform),
a diode with parasitic components or a diode in open circuit. An ideal diode would be used for
IMPS simulations while the open circuit model would be used for IMVS simulations. Pick the
circuit depending on what conditions you want to simulate. If you want examples of frequency
domain simulation look in the new simulation window under Organic Solar cells, some of the
PM6:Y6 devices have examples of frequency domain simulations already set up.

Figure 4.9: The frequency domain editor win- Figure 4.10: A circuit set up for frequency do-
dow main simulations.

Large signal or small signal

There are two ways to simulate frequency domain simulations in a device model, a large signal
approach or a small signal approach. The small signal approach assumes the problem we
are looking at varies linearly around a DC point, this may or may not be true depending on
the conditions one is looking at. This method is however computationally fast. The second
approach is to use a large signal approach and rather than simulating linear variation around
a set point one simulates the time domain response of the device in full for each wavelength of
interest. This method is cope better non-linear systems and one does not need to worry if one
is in the large or small signal regime but is slower. OghmaNano uses the large signal approach.
4.3. FREQUENCY DOMAIN EDITOR 31

File name Description


Vexternal The external voltage applied to the cell
Simulation type Leave this as Large signal.
Load resistor External load resistor, this should be usually
set to zero.
FX domain mesh points The number of time steps used to simulate
each cycle
Cycles to simulate The number of complete periods of any given
frequency that are simulated
Excite with How the device is excited, either optically or
electrically.
Measure What is measured, current or voltage.
Modulation depth How deep is the DC voltage/current modu-
lated
Periods to fit The number of frequency domain cycles that
are fit to extract phase angle
Output verbosity to disk How much data is dumped to disk (described
in other sections)
Output verbosity to screen How much data is shown on the creen (de-
scribed in other sections)

Table 4.2: Files produced by the time domain simulation

4.3.2 Inputs
In Figure 4.11 the Configure tab of the frequency domain window can be seen. This decides
exactly how the simulation will perform. These are described below in table 4.2

4.3.3 Outputs

File name Description


real imag.csv Re(i(fx)) v.s. Im(i(fx))
fx imag.csv fx v.s. Im(i(fx))
fx real.csv fx v.s. Re(i(fx))
fx abs.csv fx v.s. |i(f x)|
fx phi.csv fx v.s. ̸ i(f x)
fx C.csv fx v.s. Capacitance
fx R.csv fx v.s. Resistance

Table 4.3: Files produced by the time domain simulation


32 CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

Figure 4.11: Configuring a frequency domain simulation


4.4. SUNS-VOC EDITOR 33

4.4 Suns-Voc editor


The Suns-Voc plugin can be used to calculate how open circuit voltage changes as a function
of light intensity. This can be useful for understanding tail slope and disorder in devices. A
picture of the suns-voc editor window can be seen below in figure 4.12. The window can be
used to set the start and stop light intensity. The Suns-Voc applies the voltage to the contact
that is labelled Change.

Figure 4.12: The suns-voc editor window

4.4.1 Outputs

File name Description


suns voc.csv Suns v.s. Voc curve
suns Q.csv Suns v.s. Charge density
suns mu.csv Suns v.s. average charge carrier mobility
suns tau.csv Suns v.s. recombination constant tau
Q Qtau.csv Charge density v.s. recombination constant tau
Q mu.csv Charge density v.s. charge carrier mobility
Q kbi.csv Charge density v.s. recombination prefactor kbi
Q trap filling.csv Charge density v.s. fraction of filled traps
V mu.csv Voc v.s. average charge carrier mobility

Table 4.4: Files produced by the Suns-Voc simulation


34 CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

4.5 Suns-Jsc editor


The Jsc editor can be used to configure suns-Jsc simulations. It enables you to set the start
light intensity, stop light intensity and how big the steps are. This is shown in figure 4.13.

Figure 4.13: The JV curve editor window

4.5.1 Outputs

File name Description


suns jsc.csv Suns v.s. Jsc curve
suns mu.csv Suns v.s. average charge carrier mobility

Table 4.5: Files produced by the Suns-Jsc simulation


4.6. QUANTUM EFFICIENCY EDITOR 35

4.6 Quantum efficiency editor


The quantum efficiency editor simulates both EQE and IQE. The configuration window can be
used to set the voltage at which EQE and IQE are performed.

Figure 4.14: The quantum efficiency editor window

4.6.1 Outputs

File name Description


eqe.csv Wavelength v.s. EQE
E eqe.csv Photon energy v.s. EQE
E eqe norm.csv Photon energy v.s. Normalized EQE
iqe.csv Wavelength v.s. IQE
E iqe.csv Photon energy v.s. IQE
lam Gn.csv Wavelength v.s. Average charge carrier generation rate

Table 4.6: Files produced by the Suns-Jsc simulation


36 CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

4.7 Scanning probe microscopy editor


When simulating a 3D structure such as a large area contact one often wants to map the resis-
tance between an x,z point on the surface of the device and the charge extraction contact. This
tool is used to apply voltages systematically over z,x regions to map out voltage or resistance
profiles in space. This tool is usually used with either full 2/3D drift diffusion simulations or
the 3D large area electrical circuit model. There is more about this tool in Section 12.

Figure 4.15: The scanning probe microscopy editor


4.8. ELECTRICAL EQUILIBRIUM EDITOR 37

4.8 Electrical equilibrium editor


Sometimes when studding a device, it is not necessary to simulate an entire JV curve. One
may for example just for example be interested in the band structure at 0V in the dark. The
Electrical equilibrium allows the user to setup simulations that only simulate the device at
equilibrium (0V applied bias in the dark).

Figure 4.16: Electrical equilibrium editor


38 CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

4.9 Steady state photoluminencense editor


This tool is used to generate photoluminencense spectra at a desired voltage, either short circuit
or open circuit.

Figure 4.17: Steady state photoluminencense editor


4.10. CHARGE EXTRACTION EDITOR 39

4.10 Charge extraction editor


This is the charge extraction editor, it allows
one to simulate charge extraction transients. A
charge extraction experiment is performed to
find out how much charge is in a disordered de-
vice. For this type of experiment one runs the
device at a set voltage and light intensity say
1V @ 1Sun. Then one turns off the light and
shorts the cell through a resistor and integrates
the total current outputted by the cell to get
the charge that was in the cell when it was op-
erating. Typically the cell is shorted through
the the 50 Ohm termination of an oscilloscope
so that by measuring the voltage transient and
applying V=IR one can calculate the current
and thus total charge. Figure 4.18: Charge extraction editor
This type of measurement is important in disordered devices when one wants to find out
how much charge is in the trap states. It is important to note that the experiment does not
extract all the charge in the device, it only extracts the difference between charge at operating
conditions and 0V @ 0 Suns. The background charge due to injection from the contacts/doping
is still left in the device. There is also error loss in the CE experiment due to recombination
annihilating charge before it has left the device.

4.10.1 Outputs

File name Description


time i.csv Time v.s. extraction current for a single CE experiment
time v.csv Time v.s. voltage for a single CE experiment
suns Q ce.dat Suns v.s. extracted charge including effects of recombination
v np.dat Voltage c.s. extracted charge including the effects of recombination
suns np.dat Suns c.s. extracted charge including the effects of recombination
v np ideal.dat Voltage v.s. extracted charge not including the effects of recombination
suns np ideal.dat Suns v.s. extracted charge not including the effects of recombination

Table 4.7: Files produced by the charge extraction simulation


40 CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

4.11 Capacitance voltage editor


Experimentally capacitance voltage (CV) measurements are a useful way to determine doping
within a device. In OghmaNano CV measurements use a cut down version of frequency domain
simulation tool described above.

Figure 4.19: The capacitance voltage editor

4.11.1 Outputs

File name Description


real imag.dat Re(i(fx)) v.s. Im(i(fx))
fx real.dat fx v.s. Re(i(fx))
fx imag.dat fx v.s. Im(i(fx))
cv.dat fx v.s. Capacitance
cv2.dat fx v.s. 1/Capacitance2

Table 4.8: Files produced by the CV simulation


4.12. HARDWARE EDITOR 41

4.12 Hardware editor


All computer programs including OghmaNano run on physical computing hardware. There are
may combinations of hardware that can be in any computer, some computes have a large number
of CPU cores while others only have one. Likewise computers come with differing amounts of
memory, hard disk space and GPUs. To help the user get the best out of OghmaNano, there is a
hardware editor where the user can configure how OghmaNano behaves on any given computer.
This can be accessed through the simulation tab window see Figure 4.20.

Figure 4.20: Opening the hardware editor.

If you click on this it will bring up the hardware editor window which can be seen in Figure
4.21

Figure 4.21: The hardware editor window

The hardware window is comprised of various tabs which enable the user to edit the con-
figuration and also benchmark your device.

4.12.1 CPU/GPU configuration tab


This tab is used to configure how OghmaNano interacts with the GPU and CPU it is described
in the table below. As described in other parts of this manual in detail there are two parts
to OghmaNano there is oghma core.exe which is the computational back end and there is
oghma gui.exe which is the graphical user interface, how both these parts of the model behave
can be fine tuned here.
ˆ Number of threads used by the backend: This is the maximum number of threads Ogh-
maNano oghma core.exe can use. This dictates; the number of simultaneous fits that can
42 CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

be run; the maximum number of optimization simulations that can be run at the same
time; the maximum number of threads that are used for FDTD simulations; maximum
number of of DoS cache files can generated at the same time; number of frequency domain
points that can be run at the same time.
ˆ Maximum number of core instances: This sets the maximum number of oghma core.exe
instances that can be started by the GUI. If one is running a parameter scan then this will
control the maximum number of simultaneous simulations that can be performed at the
same time. If the values of Number of threads used by the backend has been set to 4 and
one is performing an FDTD simulation, then one sets Maximum number of core instances
to 8, then the GUI will spawn 8 instances of oghma core.exe each using 4 threads, thus
32 CPU cores will be needed.
ˆ Stall time: Sometimes when running OghmaNano on a supercomputer unattended it can
stop running, possibly because of an IO error or network error. This option can be used
to set the maximum length of a single simulation. By single simulation I mean a single
JV curve, single time domain simulation or single frequency domain simulation, but not a
whole fit which will involve running thousands if individual simulations.). So with a value
of 2000 seconds the solver will exit, if for example a single JV simulation takes longer
than 2000 seconds. In reality any individual simulation should take only a few seconds,
so this option acts as a hard backstop if something has gone very wrong.
ˆ Max fit run time: This is the maximum time oghma core.exe can reside in memory. If
any simulation or fit takes longer than this value it will be terminated, again this is a
backstop to prevent simulations running forever. The default value is 4 days.
ˆ Steel CPUs: Sometimes when running OghmaNano on a shared PC one will set a sim-
ulation running when another user is using a significant number of cores. After a while
the other user’s simulations will finish running leaving the computer with idling CPUs.
If this option is set to True, then OghmaNano will monitor the number of free CPUs and
if more become available it will use them.
ˆ Min CPUs: Used with the option above Steel CPUs to set the minimum number of CPUs
that will be used.
ˆ Store DoS on disk: OghmaNano stores lookup tables on disk to speed up simulations, if
this option is set to false these lookup tables will not be stored.
ˆ OpenCL GPU acceleration: This enables or disables GPU acceleration, this is used mainly
during the FDTD simulations.
ˆ GPU name: Selects the GPU to use.

4.12.2 Newton cache


When running simulations with a significant number of ODEs, such as 1D devices with a lot
of trap states and a lot of spatial points, or when running 2D OFET simulations each voltage
step can take a while to compute. This is because the solver must solve each voltage step using
Newton’s method until it converges. For each each solver step the Jacobian must be built,
the matrix inverted multiplied by the residuals and updates to all solver variables calculated.
This can take a significant amount of time per step (2000ms). An approach to side step this
approach is to store previously calculated answers on disk and then when the user asks the
solver to calculated an already calculated problem the answer can be recalled rather than
recalculated. This is very useful in OLED design where one is trying to optimise the optical
structure of the device but leaves the electrical structure unchanged. One can run new optical
simulations with already pre-calcualted electrical solutions. Configuration options are displayed
in the table below.
4.12. HARDWARE EDITOR 43

There is an overhead to using the Newton Cache, so I would only recommend it when solving
the electrical problem is very slow indeed. Technically the Newton cache works by taking the
MD5 sum of the Fermi-levels and the potentials to generate a hash of the electrical problem.
This is then compared to what exists on disk. If a precalculated answer is found, the Fermi-
levels/potentials are updated to the values found on disk. The cache is stored in oghma local
cache, each pre solvedsolution is stored as a new binary file. Each simulation run generates an
index file where all MD5 sums from that simulation are stored. Once the cache becomes full
OghmaNano deletes simulation results in batches based on the index files.

Figure 4.22: The Newton cache editor

ˆ Maximum cache size: Sets the maximum size of the cache in Mb. I would recommend
around 1Gb.
ˆ Minimum disk free: Sets the minimum amount of disk space needed to use the cache, this
option is designe dto prevent the cache filling the disk I would set it to around 5Gb.
ˆ Number of simulations to keep: This will set the maximum number of simulation runs to
keep, I would set it to between 20 and 100.
ˆ Enable cache: This enables or disables the Newton Cache, the default and recommended
option is False.

4.12.3 Hardware benchmark


In the top left of hardware window 4.22 there is a button called Hardware benchmark. If this is
clicked then OghmaNano will benchmark your hardware, the result of such a benchmark can be
seen in 4.23. This runs benchmarks your CPUs ability to calculate sin,exp and allocate/deal-
locate memory in blocks. It displays how long it took to do a few thousand operations as well
as an R (aka Roderick) value. This is defined as R=Time taken to do the calculation on your
PC /The time take to do the calculation on my PC. Thus smaller values mean your PC is faster
than mine. My PC is a Intel(R) Core(TM) i7-4900MQ CPU @ 2.80GHz in a 2017 Lenovo
thinkpad. So most modern computers should be faster. If you have good CPU performance
but your simulations are running slower than my YouTube videos then this is invariably due
44 CHAPTER 4. SIMULATION MODES AND SIMULATION EDITORS

to bad IO speed, caused by virus killers, storing the simulations on OneDrive, using networked
drives, using slow USB storage etc.

Figure 4.23: Running a hardware benchmark


Chapter 5

2D Simulations - OFETs

Tutorial on OFET simulation.

OghmaNano contains a 2D electrical solver that can be used for simulating OFETs and other
2D structures. To perform 2D simulations use the default OFET simulation in OghmaNano as
a starting point. You can do this by double clicking on OFET simulation in the new simulation
window (see figure ??).

Note: The 2D electrical solver is a separate plug in to the 1D solver, if you select the
default OFET simulation OghmaNano as a starting point for your own 2D simulations
OghmaNano will be all set up to do 2D electrical simulations. If you try to convert a
1D simulation such as a solar cell to a 2D simulation (not recommended) please read
section 9.11 on how to select the correct solver.

To make a new OFET simulation, click on the new simulation button. In the new simula-
tion window and select the OFET simulations (see figure 5.1). Double clicking on this will
bring up the OFET sub menu, where other types of OFETs are also stored. There is one
example with a top contacts, one with side contacts and one which is at low temperature. For
this capter we will be looking at the (standard) top contact OFET (Figure ??), double click
on this and save the new simulation to disk.

Figure 5.1: Setlect the OFET submenu to main Figure 5.2: Select the OFET top contact for
a new OFET simulation this example.

45
46 CHAPTER 5. 2D SIMULATIONS - OFETS

5.0.1 The anatomy of a 2D simulation

Figure 5.3: The default ofet simulation.

The OFET structure shown in Figure 5.3 has three contacts, a gate, source and a drain. The
source and drain are shown on the top of the simulation as gold bars, a semiconductor layer is
shown in blue and an insulating later shown in red. The gate contact is visible at the bottom
of the structure. This layered structure is defined in layer editor, see figure 5.4. The layer
editor has been described in detail in section 3.1.3. It can be seen that the top and bottom
layers have been set to contact and the insulator (PMMA) and semiconducting layer have been
set to active. This means that the electrical model will only consider the semiconductor and
insulator layers and the contacts will be used as boundary conditions. As this structure is not
emitting light the Optical material column has no impact on the simulation results so it has
been arbitrary materials.

Figure 5.4: The layers of an OFET device


47

The contacts are defined in the contact editor shown in Figure 5.5. The contact editor has
been described in detail in section 3.1.8, however because this is a 2D simulation another two
extra columns have appeared. They are start and width. These define the start position of the
contact on the x-axis and width which describes the width of the contact on the x-axis. The
source starts at 0 m and extends to 5µm, the drain starts at 75 µm and extends to 5µm, while
the gate starts at 0 m and extends to cover the entire width of the device which is 80 µm. If you
are unsure which is the x-axis, the origin marker is visible at the bottom of figure 5.3. Notice
also that under the column Applied Voltage, the source is marked Ground this means that
0V will be applied to the ground, the gate is marked change meaning that our voltage ramp
as defined in the JV editor will be applied to this contact, and the drain is marked constant
bias with a voltage of 15V, this means that a constant voltage of 15V will be applied to this
contact. And thus we are scanning the gate contact while applying a constant voltage between
the source and the drain.

Figure 5.5: Editing the contacts on a 2D device.

5.0.2 Electrical parameters

Disabling drift diffusion in the insulator layer

The electrical parameters for both the semiconductor and the insulator can be seen in Figure
5.6, these can be accessed through the Electrical parameter editor. The Electrical parameter
editor is described in detail in section 3.1.9. The left image shows the parameters for the
semiconducting layer while the right figure shows the parameters for PMMA. If you look in the
top left of both windows you will see a button called Enable Drift Diff. which stands for Enable
Drift Diffusion. When this is depressed the drift diffusion equations will be solved within the
layer which take into account charge movement. When this is not depressed only Poisson’s
equation will be solved in the layer and the movement of charge ignored. If you notice this
button is depressed in the Semiconductor layer and not depressed in the PMMA insulator.
This means that the drift-diffusion equations will be solved in the semiconductor and not in
the PMMA. The reason for doing this is that charge does not conduct in the PMMA so there
is no point in solving the drift-diffusion equations in that layer. Another approach would be to
solve the drift-diffusion equations in both layers and just set the mobility in the PMMA to be
very low but this will result in slower computational times and is less numerically stable, there
is more on this approach below.
48 CHAPTER 5. 2D SIMULATIONS - OFETS

Figure 5.6: Electrical parameters for both the semiconductor (left) and the insulator (right)

5.0.3 Running a 2D simulation


2D simulations are run in the same way as 1D simulations, simply click on the play button, see
figure 5.7.

Figure 5.7: Running an OFET simulation

The simulation will take longer than it’s 1D counterparts simply because there will be
more equations to solve. If you have set a contact at a high starting voltage the solver will
initially ramp the contact voltage in a stepwise way until the desired voltage is achieved before
the desired voltage sweep is applied to the active contact. After the simulation has run the
following files will be produced showing the current density from each contact.

File name Description


contact iv0.dat Current voltage current curve for contact 0
contact iv1.dat Current voltage current curve for contact 1
contact iv2.dat Current voltage current curve for contact 2
contact jv0.dat Current density voltage current curve for contact 0
contact jv1.dat Current density voltage current curve for contact 1
contact jv2.dat Current density voltage current curve for contact 2
snapshots Simulation snapshots

Table 5.1: Files produced by the steady state OFET simulation

Contacts in OghmaNano are labelled from 0 to N in the order they are defined in the contact
editor (see Figure 5.5), so in this case Contact 0 will be the source, contact 1 will be the gate
and contact 2 will be the drain. You can see the result of running the simulation in Figure 5.8.
49

Figure 5.8: Results from a 2D OFET simulation the JV curves for each contact are shown
along with a view of the the electron current density in the x direction (bottom right).

5.0.4 Meshing in 2D
Computational speed, traps and meshing
You will notice that in this example the SRH trapping/escape equations are solved in the semi-
conductor layer, you can see this as the SRH trap button is depressed. Trapping is often needed
to reproduce experimental results. If you scroll down the parameters list in the Semiconductor
layer you will see that it has 8 trap states. However,it is worth taking a moment to consider
the computational load of introducing trap states. If our 2D device has Nx mesh points in the
x direction and Ny mesh points in the y direction then and we are solving Poisson’s equation,
the electron drift diffusion equation and the hole drift diffusion equation then we will be solving
3 ∗ Nx ∗ Ny equations in total. If we now introduce 8 trap states for electrons and 8 trap states
for holes we will then be solving 3 ∗ Nx ∗ Ny + 8 ∗ 2 ∗ Nx ∗ Ny equations. So if you want a speedy
simulation or are just trying something out it is worth trying to reduce the number of mesh
points, and also reduce the number of trap states and/or turn traps off in the first instance.

Adjusting the mesh


The electrical mesh editor can be accessed through the electrical ribbon in the main window.
The mesh editor is shown in Figure 5.9, here the x and y mesh can be adjusted. The number
50 CHAPTER 5. 2D SIMULATIONS - OFETS

of mesh points directly affects the speed of the computation, as a general rule try to minimize
the number of mesh points you use. I would recommend defining one electrical mesh to cover
the Semiconductor layer and one to cover the insulator layer.

Figure 5.9: Meshing

5.0.5 Solving the drift diffusion equations over the entire device
Sometimes you may want to solve the drift diffusion equations over the entire device this could
be because you have a poor insulator on the gate contact, it is very uncommon to want to do
this but if you want to follow the steps below. Using doing this is not recommended.

ˆ Mobility: Set the mobility of the insulator to a value of 1x10−12 − 1x10−15 m2 /(V s) to
limit current flow into the region. However, the value should not be set too low (see
section 9.11.1) or the solver may become numerically unstable.

ˆ Effective density of states: Keep these the same for both layers, just to keep things simple.

ˆ Number of trap states: This must the same in both layers, the density of the states and
the Urbach energy can change though.

ˆ Eg and Xi: Although it is tempting to simply enter the experimental values for Xi and
Eg for both the insulator and the semiconductor, one has to be careful in doing this as
some insulators (SiO2 ) have very big band gaps which mean the number of carriers get
very small and make the simulation unstable (read section 9.11.1 for an explanation). If
you want to simulate a jump in the band gap into an insulator, my is to make the jump
significantly bigger than 3/2kT = 25meV which is the average kinetic energy of a charge
carrier. If the gap is between 0.5 − 1.0V charge carriers will have problems penetrating
the barrier and there is no need to simulate bigger steps.
Chapter 6

2D simulation of bulk-heterojunctions

Simulating 2D BHJ structures in OghmaNano

To be written but there is an example simulation in the new simulation window.

51
Chapter 7

Organic Light Emitting Diodes


(OLEDs)

Simulating OLEDs with multiple emission layers

Simulating OLED structures using ray tracing and drift diffusion

7.1 Introduction
Organic Light Emitting Diodes (OLEDs) are a widely used technology with applications in
displays and sensing. The devices operate by charge being injected through the contacts which
results in electro luminescence. The following chapter describes how to simulate these devices
using OghmaNano. There are various OLED examples which can be accessed from the OLED
section of the New simulation window a (Figure 7.1).

Figure 7.1: a) The new simulation window; b) OLED example simulations.

OLED simulations use a combination of the drift-diffusion models described elsewhere in


this book combined with optical models to simulate the propagation of light out of the device.
The Transfer matrix method and ray tracing can be used to model the escape of light from
OLEDs within OghmaNano. The transfer matrix method is useful when one wishes understand
how light behaves when propagating normal to the surface of smoothed layer structures such

52
7.2. OPTICAL OUTCOUPLING 53

as in well defined evaporated OLEDs, while the ray tracing method is used when wishing to
simulate light escaping from rough surfaces or structures with micro-lenses embedded.

7.2 Optical outcoupling


The most simple OLED simulation based on the transfer matrix method can be accessed by
double clicking on the OLED example simulation (see Figure 7.1b). This will bring up the
window shown in Figure 7.2a. In the Optical ribbon you will find a button called Optical
outcoupling. This tool allows the user to select which if the Transfer matrix method or the ray
tracing method is used. If this window is opened a window resembling that shown in Figure
7.2b will be displayed. By clicking Run in this window, the probability of emission as a function
of position and wavelength will be calculated this will be displayed in the Escape probability
tab. By clicking on Ray trace and then clicking on the run button again, the simulation will be
repeated using the ray tracing method, the results form such a simulation are shown in Figure
7.3. Note that the outcoupling efficiency for ray tracing is lower than that predicted by the
transfer matrix as the transfer matrix method assumes propagation normal to the interfaces
while ray tracing allows rays to travel in all directions some of which will never leave the device.

Figure 7.2: a) The OLED simulation; b) The results of an outcoupling simulation.

Figure 7.3: a) Outcoupling calculated using ray the tracing method


54 CHAPTER 7. ORGANIC LIGHT EMITTING DIODES (OLEDS)

7.3 Electrical simulations combined with optical transfer


matrix calculations

Make a new simulation based on the OLED example as described above. Now run a full
simulation by clicking on the Run simulation button in the main window. This will run a full
optical and electrical OLED simulation one after the other. First an optical simulation will
be performed to calculate what the probability of an emitted photon escaping the device will
be at each electrical mesh point. Then a full Drift Diffusion simulation will be performed and
the optical emission at each mesh point calculated form the recombination. The results will be
shown in the Output tab of the main window. The key files written to disk are described in
table 7.1, examples of these files can be seen in Figures 7.5.

Figure 7.4: a) Out coupling calculated using ray the tracing method; b)

File name Description


iv.csv Current v.s. voltage
jv.csv Current density v.s. voltage
jl.csv Current density v.s. optical output power density
k.csv Averaged recombination rate constant v.s. voltage
v eqe.csv Voltage v.s. EQE
vl.csv Voltage v.s. optical output power density
Snapshots Snapshots of the electrical device parameters for each simulation step

Table 7.1: Key files produced by the OLED simulation.


7.3. ELECTRICAL SIMULATIONS COMBINED WITH OPTICAL TRANSFER MATRIX CALCULATI

Figure 7.5: Example of the output from the OLED simulations of OghamNano

In the snapshots directory you will find detailed electrical output from the model for each
simulation step see Figure 7.6. Also in that directory you will find a file entitled eqe.csv.
This contains the calculated EQE spectrum as a function of voltage. The EQE spectrum will
change as the voltage changes because each point in the cavity of the device will have a different
probability of outcoupling each wavelength of light to the world. As the carrier distribution in
the device changes recombination will happen at different points and thus the overall spectrum
as observed from outside the device will change. Use the slider to see how the spectrum changes
as a function of voltage.

Figure 7.6: The EQE spectrum calculated from the device in OghmaNano as a function of
wavelength. The graph will change as applied voltage changes. To explore this use the slider
in the window scroll over the results for various voltages
56 CHAPTER 7. ORGANIC LIGHT EMITTING DIODES (OLEDS)

7.4 Electrical simulations combined with ray tracing


Ray tracing allows the user to tackle more complex optical problems such as when the device
has rough surfaces, it also allows the user to examine rays that don’t propagate normally to the
interfaces. Two example ray tracing simulations are included AFM ray trace demo and OLED
ray trace, these can be seen in Figure 7.7a and the results of AFM ray trace demo can be seen
in Figure 7.7b note the rough surface of the OLED in this example.

Figure 7.7: a) The new simulation window; b) An example of an OLED ray trace simulation
though a rough surface.

7.5 The spectrum of the emitted light


Just as the electrical parameters can be set for each layer in the device so can the emission
spectra. This is done in the emission parameters window (see Figure 7.8), which can be opened
using the Emission parameters button in the Device structure tab of the main window (see
Figure ??). The emitted light spectrum can come from one of two sources. The first source is
an experimental emission spectra which can be selected by changing the value of Experimental
emission spectra in 7.8. There are many spectra available in the materials data base but you
can also add your own (see the section on databases). By turning the option Use experimental
emission spectra to off, one can use a numerically calculate emission spectra rather than an
experimental one. The calculated emission spectra is calculated using Fermi’s Golden rule from
the carrier population and the DoS. This is only recommended for advanced users most users
who are interested in OLED design should use .
If you have selected ray tracing in as the method to be used for outcoupling then for each
layer one can select in what direction the rays are emitted. This is under the ray tracing heading
visible in Figure 7.8. The values define emission in terms of spherical coordinates theta and
phi. One can define the start and stop angles as well as the number of points use for both theta
and phi. This enables one to study light escape as a function of angle. It is also worth noting
for devices with flat surfaces one only needs to vary phi or theta but not both due to symmetry
considerations.
The option emit from will tell the ray tracer how to choose the position of the sources for
each ray. The option visible in the window is At the Center of each emission layer. If this
option is selected the model will pick an emission point in the middle of each layer to start the
ray tracing from, this is a good option if fast computational times are desired. Another option
7.6. RGB, XYZ, CIE 1931 XYZ COLOUR SPACES 57

is At each electrical mesh point, this will run the ray tracer at each electrical mesh point to
accurately calculate emission probabilities, this can be slower although the decrease in speed
can be mitigated against by increasing the number of threads the ray tracer runs on.

Figure 7.8: a) Using an experimental emission spectra; b) Calculating an emission spectra from
the electrical density of states.

7.6 RGB, XYZ, CIE 1931 xyz colour spaces

When designing OLED structures it is often important to understand how color of the emitted
light changes as a function of viewing angle. When OghmaNano runs a ray tracing simulation
it emits the files in table 7.2 which describe how the color of light changes as a function of
viewing angle. These files are also visible in 7.9 as the colored colorspace icons.

File name Description


theta RGB.csv RGB values v.s. viewing angle
theta x.csv CIE 1931 x v.s. viewing angle
theta y.csv CIE 1931 y v.s. viewing angle
theta z.csv CIE 1931 z v.s. viewing angle
theta X.csv CIE 1931 X v.s. viewing angle
theta Y.csv CIE 1931 Y v.s. viewing angle
theta Z.csv CIE 1931 Z v.s. viewing angle

Table 7.2: Files describing the change of color with viewing angle.
58 CHAPTER 7. ORGANIC LIGHT EMITTING DIODES (OLEDS)

Figure 7.9: The output of a simulation showing the files described in table 7.2. These files are
represented by the color space icons.
7.6. RGB, XYZ, CIE 1931 XYZ COLOUR SPACES 59

Figure 7.10: Examples of color space output from OghamNano as a function of viewing angle;
a) theta x.csv; b) theta y.csv; c) theta z.csv; and thetar gb.csv
Chapter 8

Meshing

8.1 What is meshing?


Meshing is the process of taking a continuous problem space, say a bar along which heat
is conducted form a candle to a block of ice and turning this into a discrete computational
problem. This usually involves picking a series of points along this space and using these to
represent the entire problem (see Figure 8.1). The reason we need to break a region up into
points to model it is because computers have finite memory and can not model a continuum
very easily. If you want more details why and how this is done search for basic finite difference
tutorials on the web.

Figure 8.1: An example of a continuous problem broken up (or meshed) into a series of discrete
points.

8.2 Different meshes for different problems


In simple terms OghmaNano solves three physical models, the optical model describing light, the
thermal model describing thermal effects and the electrical model describing electrical effects.
The physical effects from each of these three models often happen on different length scales so
need different meshes. For example:

ˆ Electrically interesting effects may only happen in the active layer of a solar cell (100 nm
thick), so it is only worth solving the drift diffusion equations in this layer, however light
interacts with all layers in the cell (1 µm thick) so the optical problem should be solved
over the entire device. This means light should be modelled covering the whole device
but electrical effects only in the active layer.

ˆ A Quantum Well laser diode used for cutting steel may generate a lot of heat in it’s
Quantum Well (30 nm thick) and waveguide layers (1 µm) thick but heat will escape
from device through a heat sink which may be a 1 cm thick block of copper. This means
electrical effects should be modelled within the device on (1 µm) scale the but thermal
effects should be modelled on the cm scale.

60
8.3. THE THREE MESHES OF OGHMANANO 61

Thus different effects need to be simulated on different length scales. Furthermore, you
electrical device structure may have some very thin layers such as contact layers or interface
layers which are only a few nanometres thick. Optically these layers are far below the wavelength
of light so you don’t need to worry about them from the optical perspective, but electrically
they are very important as they define the current voltage characteristics of the device. Thus
you would want to use a very fine electrical mesh over the layer to make sure they were modelled
accurately from the electrical stand point but you could use a very wide optical mesh that skips
the layers.
In general OghamNano interpolates between the three meshes, so for example if you set up
an thermal profile using a temperature mesh, and the temperature values are needed in the
electrical problem the values are transferred through interpolation. You don’t need to worry
about this as a user. The same is true for the optical simulation values of Generation rate etc.
are interpolated between from the optical mesh to the electrical mesh as needed.

8.3 The three meshes of OghmaNano


The thermal, optical and electrical ribbons are shown below in Figure 8.2, it can be seen that
in each of these ribbons is a a mesh button, where the thermal, optical and electrical meshes
can be defined.

Figure 8.2: The thermal, electrical and optical ribbons.

8.3.1 Electrical mesh


If you click on the electrical mesh button in the electrical ribbon of the main window a window
looking like Figure 8.3 will appear. The buttons marked 1D, 2D and 3D at the top of the
window in Figure 8.3 can be used to toggle the simulation between 1D, 2D and 3D modes. In
this example the mesh is set up for a 2D OFET simulation, so y and x are depressed. Note,
if you want to do 2D or 3D simulations you are best off using a default 2D simulation, such
as the OFET simulation. This is because to do 2D/3D simulations, a special newton solver
configuration will be needed. The tables that looks like a spreadsheet is used to configure the
mesh. The columns thickness and mesh points, determine the thickness of the mesh layer and
the number of points on the mesh layer. The column, step multiply by how much to grow each
step. For the second row of the x mesh the step multiplier is set to 1.1 which means the distance
between the points will grow by 10% each mesh point. The buttons marked left/right, defines
on which side the mesh layer is generated from. The resulting meshes are plotted in the graphs
at the bottom of the window.
62 CHAPTER 8. MESHING

Figure 8.3: The electrical mesh editor showing the mesh for a 2D OFET simulation.

The button called Import from layer editor clears the y-electrical mesh and imports all the
layers from the layer editor giving them four mesh points each. This is useful when setting up
complex structures with many layers such as laser diodes.

8.3.2 Optical mesh


The optical mesh window is shown below in Figure 8.4, this is more or less identical to the
electrical mesh window except it also has a panel to configure which wavelengths are simulated
in a simulation. These wavelengths are used in ray tracing, FTDT simulations and transfer
matrix simulations. In any simulation where a wavelength range is defined this mesh will be
used.

Figure 8.4: The optical mesh editor showing the number of points in position space and the
number of wavelength points used for the optical simulations.
8.4. THE ELECTRICAL MESH IN DETAIL 63

8.3.3 Thermal mesh

This will generally be handled automaticity for you. And you will only need to consider the
thermal mesh when you turn on self heating in the device. Some parameters such as

8.4 The electrical mesh in detail

A picture of the electrical mesh is given below 8.5 note the mesh does not start at zero but half
a mesh point into the device.

Figure 8.5: A 1D diagram of the mesh


64 CHAPTER 8. MESHING

8.5 When do I need to worry about meshing in Ogham-


Nano?

8.5.1 Electrical mesh

You will already know that the layer editor is used to split the device up into layers of different
materials (See section 3.1.3). Some of these layers will have the layer type active. An active
layer is a layer over which the electrical model will be applied. The electrical model needs a
finite difference mesh to to be setup over the active layer for it to work. The length of the mesh
and the length of the active layer must be exactly the same or you will get an error. OghmaNano
will try to do this for you in most cases, so generally speaking for simple problems you will not
have to think about meshing. However if one starts adding multiple active layers you may have
to define your own mesh. Other times when you will need to worry about meshing is when you
are interested in cutting down the number of mesh points used to speed your simulation up
or when you want to make your simulation more accurate by increasing the number of mesh
points.

8.5.2 Optical mesh

You will need to play with the optical mesh if you want to change the wavelength range over
which light is simulated in the device. You will also want to change the number of points in
position space in this mesh if you want more accurate (more mesh points) or faster (more mesh
points) optical simulations.

8.5.3 Thermal mesh

If you want to do simulations with trap states with self heating turned on you will need to
define a thermal mesh, otherwise this will be taken care of for you.
8.6. MESHING TIPS 65

8.6 Meshing tips


8.6.1 Should I be simulating in 1D, 2D or 3D?
When deciding if you should perform 1D, 2D or 3D, simulations, consider the dimensionality
of your problem. For example if you consider a solar cell, it is only a few micros thick, and
there is rapid variation in the structure, charge densities, mobilities, and doping as a function
of depth (y). However, the structure will not vary very in the lateral (xz) plane. Therefore, in
general to capture all interesting effects present within a solar cell one only needs a 1D model.
If one now considers OFETs, there is both vertical an lateral current flow, therefore one can
not get away with a 1D model any more, as one must simulate both vertical current flow, and
current between the source and the drain, thus one needs a 2D simulation. As the number of
dimensions increases, computation speed will decrease, therefore my general advice is to use
the minimum number of dimensions possible to solve your problem.
In short try to make your simulation as simple as possible as it will save you time and effort.
Generally the following geometries could be used for various types of devices:

Device type Number of dimentions


Solarcells 1D
Opticalf ilter 1D
OF ET 2D

Table 8.1: How many dimensions should I use to simulate my device.

8.6.2 Speed v.s. accuracy


When setting up your device in OghmaNano you should try to:

ˆ Minimize the number of mesh points to improve computation speed but not go so low
that accuracy is sacrificed.

ˆ Realise that more mesh points does not necessarily mean a more accurate simulation.
Especially in the electrical model the equations are discretized as not to lineally interpolate
between mesh points, instead the actual differential equations are solved as boundary
value problems between the mesh points. This means you can sometimes get away with
surprisingly few mesh points (very fast simulations) and still get quite nice results.

ˆ Don’t be afraid to really reduce the number of mesh points when testing out fitting or
trying to understand device performance. This will give you a very fast simulation. You
can always go back later and add more mesh points.
Chapter 9

Theory of drift diffusion modelling

9.1 Outline
OghmaNano’s electrical model is a 1D/2D drift-diffusion model (like many others) however
the special thing about OghmaNano which makes it very good for disordered materials (Think
organics, perovskites and a-Si) is that it goes to the trouble of explicitly solving the Shockley-
Read-Hall equations as a function of energy and position space. This enables one to model
effects such as mobility/recombination rates changing as a function of carrier population and
enables one to correctly model transients as one does not have to assume all the carriers in the
trap states have reached equilibrium. Things such as ToF transients, CELIV transients etc..
can be modelled with ease. Of course can be used for more ordered materials as well, you then
just need to turn the traps off.

9.2 Electrostatic potential


The conduction band/valance band (or LUMO/HOMO in organic semiconductor speak) are
defined as

ELU M O = −χ − qϕ (9.1)

EHOM O = −χ − Eg − qϕ (9.2)
To obtain the internal potential distribution within the device Poisson’s equation is solved,

∇ · ϵ0 ϵr ∇ = q(nf + nt − pf − pt − Nad + −Nion + a), (9.3)


where nf , nt are the carrier densities of free and trapped electrons; pf and pt are the carrier
densities of the free and trapped holes; and Nad is the doping density. Nion is the background
density of perovskite ions and a is the density of mobile ions.

9.3 Free charge carrier statistics


For free carriers the model can either use Maxwell-Boltzmann statistics i.e.
 
Fn − Ec
nl = Nc exp (9.4)
kT

66
9.4. CARRIER TRAPPING AND SHOCKLEY-READ-HALL RECOMBINATION 67

 
Ev − Fp
pl = Nv exp (9.5)
kT
or full Fermi-dirac statistics i.e.
Z ∞
nf ree (Ef , T ) = ρ(E)f (E, Ef , T )dE (9.6)
Emin
Z ∞
pf ree (Ef , T ) = ρ(E)f (E, Ef , T )dE (9.7)
Emin

where
1
f (E) = (9.8)
1+ eE−Ef /kT
When using FD statistics free carriers are assumed to move in a parabolic band:
√  ∗ 3/2
E 2m
ρ(E)3D = (9.9)
4π 2 h̄2
The average energy of the carriers is defined as
R∞
Eρ(E)f (E, Ef , T )dE
W̄ (Ef , T ) = REmin
∞ (9.10)
Emin
ρ(E)f (E, Ef , T )dE

9.4 Carrier trapping and Shockley-Read-Hall recombi-


nation
The model provides two methods to account for carrier trapping and recombination via trap
states. The first by equation 9.11, this assumes that the trapped carrier distribution has
reached equilibrium. It also assumes there are relatively few trapped charge carriers compared
the the number of free carriers, and thus the trapped charges do not significantly change the
electrostatic potential. These assumptions are valid when the material is very ordered (i.e.
GaAs) or at a push in steady state for some moderately disordered material systems. However
if you wish to simulate transient or frequency domain experiments, then you can no longer use
9.11. Instead, one must use a non-equilibrium SRH approach which does not assume trapped
carriers have reached equilibrium. Unlike many other models, OghmaNano has such a non-
equilibrium SRH model built in this is described in section 9.4.2. In fact, it is turned on by
default so when using OghmaNano you have to go out of your way to turn on equation 9.11.
To understand the importance of such a dynamic solver, consider the following example:
You are performing a transient photocurrent experiment (TPC). You photo-excite your device
with a laser, carriers very quickly become trapped during the first 1-2µs after photoexcitation,
as time passes, the carriers gradually de-trap from deeper and deeper trap states and produce
the long photocurrent transient [?]. These transients can often extend out to over 1 second
after photo-excitation. Current at the start of the transient originates from shallow traps while
current at the end of the transient originates from carriers from very deep trap levels. To
simulate this one has to be able to account for the gradual emptying of trap states firstly
starting at the shallow traps, then progressing to deeper and deeper trap states. Were one to
assume all trap states were in equilibrium one would not be able to simulate this process.
So in summary, although many others have used 9.11 to model disordered devices in time
DON’T you results won’t make sense. If you want to simulate anything but steady state in an
68 CHAPTER 9. THEORY OF DRIFT DIFFUSION MODELLING

Figure 9.1: Trap filling in both energy and position space as the solar cell is taken from a
negative bias Carrier trapping, de-trapping, and recombination

ordered device turn ON the non-equilibrium solver.

9.4.1 Equilibrium Shockley-Read-Hall recombination


For some very ordered material systems where there are not many trap states it is enough to
describe SRH trap states using the equation:
np − n0 ∗ p0
RSRH = (9.11)
τp (n + n1 ) + τn (p + p1 )
where RSRH is the rate of SRH recombination, n, p are the density of free charge carriers
n0 , p0 , are the equilibrium density of charge carriers, τn,p are the SRH life times and n1 and p1
are the trapped electron and hole densities when the Fermi-level matches the trap state energy.
This can be turned on in the electrical parameter editor.

9.4.2 Non-equilibrium carrier trapping and recombination using Shockley-


Read-Hall trap states
To describe charge becoming trapping into trap states and recombination associated with those
states the model uses Shockley-Read-Hall (SRH) theory. A 0D depiction of this SRH recom-
bination and trapping is shown in figure 9.1, the free electron and hole carrier distributions
are labeled as n free and p free respectively. The trapped carrier populations are denoted with
n trap and p trap , they are depicted with filled red and blue boxes. SRH theory describes
the rates at which electrons and holes become captured and escape from the carrier traps. If
one considers a single electron trap, the change in population of this trap can be described
by four carrier capture and escape rates as depicted in figure 9.1. The rate rec describes the
rate at which electrons become captured into the electron trap, ree is the rate which electrons
can escape from the trap back to the free electron population, rhc is the rate at which free
holes get trapped and rhe is the rate at which holes escape back to the free hole population.
Recombination is described by holes becoming captured into electron space slice through our
1D traps. Analogous processes are also defined for the hole traps.
For each trap level the carrier balance 9.12 is solved, giving each trap level an independent
quasi-Fermi level. Each point in position space can be allocated between 10 and 160 independent
trap states. The rates of each process rec , ree , rhc , and rhe are give in table 9.1.
δnt
= rec − ree − rhc + rhe (9.12)
∂t
9.5. FREE-TO-FREE CARRIER RECOMBINATION 69

Mechanism Symbol Description


Electron capture rate rec nvth σn Nt (1 − f )
Electron escape rate ree en Nt f
Hole capture rate rhc pvth σp Nt f
Hole escape rate rhe ep Nt (1 − f )

Table 9.1: Shockley-Read-Hall trap capture and emission rates, where f is the fermi-Dirac
occupation function and Nt is the trap density of a single carrier trap.

The escape probabilities are given by:


 
Et − Ec
en = vth σn Nc exp (9.13)
kT
and
 
Ev − Et
ep = vth σp Nv exp (9.14)
kT
where σn,p are the trap cross sections, vth is the thermal emission velocity of the carriers, and
Nc,v are the effective density of states for free electrons or holes. The distribution of trapped
states (DoS) is defined between the mobility edges as

ρe/h (E) = N e/h exp(E/Eue/h ) (9.15)


where , Ne/h is the density of trap states at the LUMO or HOMO band edge in states/eV
e/h
and where EU is slope energy of the density of states.
The value of Nt for any given trap level is calculated by averaging the DoS function over
the energy (∆E ) which a trap occupies:
R E+∆E/2
E−∆E/2
ρe EdE
Nt (E) = (9.16)
∆E
The occupation function is given by the equation,
1
f (Et , Ft ) = Et −Ft (9.17)
e kT +1
Where, Et is the trap level, and Ft is the Fermi-Level of the trap. The carrier escape rates for
electrons and holes are given by

9.5 Free-to-free carrier recombination


A free-carrier-to-free-carrier recombination (bi-molecular) pathway is also included. Free-to-free
recombination is described using equation 9.18

Rf ree = kr (nf pf − n0 p0 ) (9.18)


in some situations where one is trying to fit rate equations to the model it can be useful to
have equation 9.18 written in another form,
λ+1
Rf ree = kr (nf pf − n0 p0 ) 2 (9.19)
70 CHAPTER 9. THEORY OF DRIFT DIFFUSION MODELLING

this can be turned on using the option called Enable λ power in free to free recombination.
in the configure window of the Electrical parameter editor.
Free to free recombination is equivalent to Langevin recombination. However, most organic
solar cells have a great deal of trap states and an ideality factor greater than 1.0 suggesting
that free-to-free recombination is not the dominant mechanism. See section 9.12 for a general
discussion on the need for trap states and why generally Langevin recombination should not
be used in organic solar device models.

9.6 Auger recombination


Auger recombination is as

RAU = (CnAU n + CpAU p)(np − n0 p0 ) (9.20)


where CnAU and CpAU are the Auger coefficient of electrons and holes in m6 s−1 . This can be
set in the electrical paramter editor.

9.7 Charge carrier transport


To describe charge carrier transport, the bi-polar drift-diffusion equations are solved in position
space for electrons,
Jn = qµe nf ∇Ec + qDn ∇nf , (9.21)
and holes,
Jp = qµh pf ∇Ev − qDp ∇pf . (9.22)
Conservation of charge carriers is forced by solving the charge carrier continuity equations
for both electrons,
∂n
∇Jn = q(R − G + ), (9.23)
∂t
and holes
∂p
∇Jp = −q(R − G + ). (9.24)
∂t
where R and G are the net recombination and generation rates per unit volume respectively.

9.8 Perovskite mobile ion solver


The mobile ion solver is implemented after the work of Calado [?]

Ja = qµa af ∇Ev − qDa ∇af . (9.25)

∂a
∇Ja = −q . (9.26)
∂t

9.9 Semiconductor interfaces


The equations below came from section 4.16.3.1 ”Possible Conduction Mechanisms” of in the
chapter ”Electronic Properties of Alkanethiol Molecular Junctions: Conduction Mechanisms,
Metal–Molecule Contacts, and Inelastic Transport” in the book, Comprehensive Nanoscience
and Technology. They are referenced to Sze SM (1981) Physics of Semiconductor Devices.
9.9. SEMICONDUCTOR INTERFACES 71

9.9.1 Direct tunnelling



eq 2d p
J = A(n − n )V exp − 2mqϕ (9.27)

A is a constant, V is the applied bias, and ϕ is the barrier height calculated from the band
structure, m is the mass of an electron, and d is the thickness of the barrier. In the model this
is implemented as:  p 
J = A(n − neq )V exp −B ϕ (9.28)

9.9.2 Tunnelling organic-organic


This is not classical tunnelling, but assumes the carriers can drift into trap states at the inter-
face, it is really only applicable for organics.
Tunnelling of holes through hetrojunction interfaces are is give by

Jp = qTh ((p1 − peq eq


1 ) − (p0 − p0 )), (9.29)

and for electrons

Jn = −qTe ((n1 − neq eq


1 ) − (n0 − n0 )). (9.30)
Where Th and Te represent the rate constants of the tunnelling. This can be configured in
the interfaces editor.

9.9.3 Fowler–Nordheim tunnelling


√ 3/2
!
q4d 2mϕ
J = A(n − neq )V 2 exp − (9.31)
3qh̄V
Not yet implemented but could be on request. A is a constant, V is the applied bias, and ϕ is
the barrier height calculated from the band structure, m is the mass of an electron, and d is
the thickness of the barrier. In the model this is implemented as:

Bϕ3/2
 
eq 2
J = A(n − n )V exp − (9.32)
V

9.9.4 Thermionic emission


p !
qϕ − q qV /4πϵd
J = A(n − neq )T 2 exp − (9.33)
kT

Not yet implemented but could be on request. A is a constant, V is the applied bias, and ϕ
is the barrier height calculated from the band structure, m is the mass of an electron, and d is
the thickness of the barrier. In the model this is implemented as:
√ !
qϕ − B V
J = A(n − neq )T 2 exp − (9.34)
kT
72 CHAPTER 9. THEORY OF DRIFT DIFFUSION MODELLING

9.9.5 Hopping conduction


Not yet implemented but could be on request.
 
eq qϕ
J = A(n − n )V exp − (9.35)
kT

9.9.6 Doping on the interface


Using the interface editor, layers of doping measuring one mesh point thick can be added to
either side of the interface. This is useful for OFET simulations where interface charge is
important to the turn on voltage.

9.10 Calculating the built in potential


The first step to performing a device simulation, is to calculate the built in potential of the
device. To do this we must know the following things:

ˆ The majority carrier concentrations on the contacts n and p.

ˆ The effective densities of states NLU M O and NHOM O .

ˆ The effective band gap Eg

Figure 9.2: Band structure of device in equilibrium.

The left hand side of the device is given a reference potential of 0 V. See figure 9.2. We can
then write the energy of the LUMO and HOMO on the left hand side of the device as:

ELU M O = −χ (9.36)

EHOM O = −χ − Eg (9.37)
For the left hand side of the device, we can use Maxwell-Boltzmann statistics to calculate
the equilibrium Fermi-level (Fi ).
 
EHOM O − Fp
pl = Nv exp (9.38)
kT
9.10. CALCULATING THE BUILT IN POTENTIAL 73

We can then calculate the minority carrier concentration on the left hand side using Fi
 
Fn − ELU M O
nl = Nc exp (9.39)
kT
The Fermi-level must be flat across the entire device because it is in equilibrium. However
we know there is a built in potential, we can therefore write the potential of the conduction
and valance band on the right hand side of the device in terms of phi to take account of the
built in potential.

ELU M O = −χ − qϕ (9.40)

EHOM O = −χ − Eg − qϕ (9.41)
we can now calculate the potential using
 
Fn − ELU M O
nr = Nc exp (9.42)
kT
equation 9.40.
The minority concentration on the right hand side can now also be calculated using.
 
Ev − FHOM O
pr = Nv exp (9.43)
kT
The result of this calculation is that we now know the built in potential and minority carrier
concentrations on both sides of the device. Note, infinite recombination velocity on the contacts
is assumed. I have not included finite recombination velocities in the model simply because
they would add four more fitting parameters and in my experience I have never needed to use
them to fit any experimental data I have come across.
Once this calculation has been performed, we can estimate the potential profile between the
left and right hand side of the device, using a linear approximation. From this the charge carrier
densities across the device can be guessed. The guess for potential and carrier densities, is then
used to prime the main Newton solver. Where the real value are calculated. The Newton solver
is described in the next section.

9.10.1 Average free carrier mobility


In this model there are two types of electrons (holes), free electrons (holes) and trapped electrons
(holes). Free electrons (holes) have a finite mobility of µ0e (µ0h ) and trapped electrons (holes)
can not move at all and have a mobility of zero. To calculate the average mobility we take the
ratio of free to trapped carriers and multiply it by the free carrier mobility.:

µ0e nf ree
µe (n) = (9.44)
nf ree + ntrap
Thus if all carriers were free, the average mobility would be µ0e and if all carriers were
trapped the average mobility would be 0. It should be noted that only µ0e (µ0h ) are used in the
model for computation and µe (n) is an output parameter.
The value of µ0e (µ0h ) is an input parameter to the model. This can be edited in the electrical
parameter editor. The value of µe (n), and µh (p) are output parameters from the model. The
value of µe (n), and µh (p) change as a function of position, within the device, as the number
of both free and trapped charge carriers change as a function of position. The values of µe (x),
and µh (x) can be found in mu n f t.dat and mu p f t.dat within the snapshots directory. The
74 CHAPTER 9. THEORY OF DRIFT DIFFUSION MODELLING

spatially averaged value of mobility, as a function of time or voltage can be found in the files
dynamic mue.dat or dynamic muh.dat within the dynamic directory.
Were one to try to measure mobility using a technique such as CELIV or ToF, one would
expect to get a value closer to µe (n) or µh (p) rather than closer to µ0e or µ0h . It should be
noted however, that measuring mobility in disordered materials is a difficult thing to do, and
one will get a different experimental value of mobility depending upon which experimental
measurement method one uses, furthermore, mobility will change depending upon the charge
density profile within the device, and thus upon the applied voltage and light intensity. To
better understand this, try for example doing a CELIV simulation, and plotting µe (n) as a
function of time (Voltage). You will see that mobility reduces as the negative voltage ramp
is applied, this is because carriers are being sucked out of the device. Then try extracting
the mobility from the transient using the CELIV equation for extracting mobility. Firstly, the
CELIV equation will give you one value of mobility, which is a simplification of reality as the
value really changes during the application of the voltage ramp. Secondly, the value you get
from the equation will almost certainly not match either µ0e or any value of µe (n). This simply
highlights, the difficult of measuring a value of mobility for a disordered semiconductor and
that really when we quote a value of mobility for a disordered material, it really only makes
sense to quote a value measured under the conditions a material will be used. For example, for
a solar cell, values of µe (n) and µh (n), would be most useful to know under 1 Sun at the Pmax
point on a JV curve.
9.11. CONFIGURING THE ELECTRICAL SOLVER 75

9.11 Configuring the electrical solver


Behind OghmaNano are a series of non-linear solvers that solve the electrical equations in a
highly efficient way. These can be configured by going to the electrical tab. There you will see
the Drift diffusion button, to the left of that is an arrow. If you click on this it will bring up a
window which allows you to configure the ”Newton solver”. The options are described below.
Related YouTube videos:

How to optimize simulations in OghmaNano so they run faster

ˆ Max Electrical iterations (first step): The maximum number of steps the solver can after
it’s cold started onto a new problem. This is usually at 0V in the dark. The solver usually
takes more steps on it’s first go.
ˆ Electrical clamp (first step): This is a number by which the maximum newton step is
clamped to. 0.1 will make the solver very stable but very slow, 4.0 will make the solver
very fast but unstable. A recommended value of 1.0 is suggested for normal problems. If
you are solving for high doping or other unusual conditions it can be worth reducing the
step. Likewise if you want the solver to be fast and you know the problem is easy set the
value to 2.0 or higher. For the first step, I would consider setting this value to be slightly
lower than for the subsequent steps.
ˆ Desired solver error (first step): This is the desired error, smaller is more accurate and
slower. I would generally not accept answers above 1x10−5
ˆ Max Electrical iterations: Maximum number of electrical iterations on all but the first
step.
ˆ Electrical clamp: Electrical clamp (first step): This is a number by which the maximum
newton step is clamped to. 0.1 will make the solver very stable but very slow, 4.0 will
make the solver very fast but unstable. A recommended value of 1.0 is suggested for
normal problems. If you are solving for high doping or other unusual conditions it can
be worth reducing the step. Likewise if you want the solver to be fast and you know the
problem is easy set the value to 2.0 or higher.
ˆ Desired solver error: This is the desired error, smaller is more accurate and slower. I
would generally not accept answers above 1x10−5
ˆ Newton solver clever exit: If the solver starts bouncing in the noise then assume we can’t
get a better answer and quit.
ˆ Newton minimum iterations: Don’t allow the solver to quit before doing this number of
steps. Often the error in the first few steps of the solution can be below ”Desired solver
error”, thus the solver can quit before finding the true answer.
ˆ Solve Kirchhoff’s current law in Newton solver: Solve Kirchhoff’s current law in the main
Newton Jacobian.
ˆ Matrix solver: This selects the matrix solver to use.

ˆ Newton solver to use:

– none: No electrical solver is selected, this is used when only solving optical or thermal
problems.
76 CHAPTER 9. THEORY OF DRIFT DIFFUSION MODELLING

– newton: The standard 1D Newton solver.


– newton 2D: The standard 2D Newton solver.
– newton norm: The standard 1D Newton solver but with Slotboom normalization.
This is handy when solving systems with large difference in density between minority
and majority carrier density.
– poisson 2d: A 2D Poisson solver with no drift diffusion equations.

ˆ Complex matrix solver:

ˆ Slotboom T0: Slotboom variable for the newton norm solver.

ˆ Slotboom D0: Slotboom variable for the newton norm solver.

ˆ Slotboom n0: Slotboom variable for the newton norm solver.

ˆ Use newton cache (experimental): Cache large problems to disk - experimental.

ˆ Quit on convergence problem: Quit on convergence problem. Quite often

ˆ Quit on inverted Fermi-level:

ˆ Solver output verbosity:

9.11.1 Solver stability


Avoiding very big and very small numbers
Try opening up MATLAB (Octave if you are on Linux) and typing in the following equation
((1e − 1 + 1e1) − 1e1)/1e − 1. Before pressing enter, try to evaluate it in your head. the 1e1
and the −1e1 cancel leaving 1e−11e−1
which equates to 1. Now try replacing the powers to 1 with
to the 19, so type in ((1e − 19 + 1e19) − 1e19)/1e − 19, again evaluate this in your head. Again ,
1e−19
1e19 and the −1e19 cancel leaving 1e−19 which equates to 1 Now let the computer evaluate the
expression. In fact this time the computer does not give you 1 but gives you 0. Double check
that you typed it in correctly... you did so what is happening. Why is the computer giving
me an answer which is 100% wrong. The answer is easy, computers have a limited precision.
This means that they can only store a limited number of decimal places. On a modern PC it’s
about 15 decimal places. After this the computer starts ignoring the numbers. So when we
added (1e − 19 + 1e19) the computer could not keep track of the decimal places so it assumed
that the answer was exactly 1.000000000000000e19 and not 1.0000000000000000001e19, then
when we subtracted −1e19 from the answer the computer gave us zero instead of 1e − 19. The
1e − 19 was lost in the precision.
All computers are affected by this no matter how powerful they are, this has important
implications when solving device equations. If you have too big a spread of numbers in your
simulation (matrix/Jacobian) the computer won’t be able to solve it easily. So if you have
very low values of mobility say 1e − 19 and very big values say 1e5 the computer wills start to
have problems solving the electrical problem. There fore generally try to reduce the spread of
parameters in you model. This is important when simulating insulators.

Avoid zeros
Zeros are bad because they cause divide by zero errors. So don’t have zero mobilities, carrier
cross sections, tail slopes or densities of states. It’s fine to have zero recombination constants
though.
9.11. CONFIGURING THE ELECTRICAL SOLVER 77

Very big steps in the band gap


Big steps in the band gap will produce very small and very large carrier densities - see Avoiding
very big and very small numbers above.
78 CHAPTER 9. THEORY OF DRIFT DIFFUSION MODELLING

9.12 The need for trap states in device organic models

Related YouTube videos:

Please stop simulating disordered semiconductors without trap states.

This section explains why trap states need to be considered when simulating disordered
materials such as polymer/small molecule devices. It also touches on why using full SRH
recombination/trapping model is so important to get physically meaningful results from a
device model.

9.12.1 The physical and energetic structure of disordered materials.

Traditional inorganic semiconductor such as crystalline Si or GaAs are highly ordered and
are almost completely pure it is not uncommon to get a material that is nine nines pure or,
99.9999999% pure. Organic semiconductors on the other hand are very really quite dirty with
purities often around 99.9% which is six orders of magnitude more dirty than their inorganic
counterparts, thus they have around a million times more impurities than their inorganic coun-
terparts. Added to this inorganic semiconductors are highly ordered with a regular crystalline
structure one can think of them as marbles packed on a solitaire board (see Figure 9.3), while
organic semiconductors are a floppy mess of molecules which one can think of more as spaghetti
bolognese with the spaghetti representing the polymers and the bolognese representing small
molecules (see Figure 9.4).

Figure 9.3: Left) Marbles in an ordered arrangement on a solitaire board [?]; Right) Silicon
atoms ordered within a material[?] Both systems are highly ordered.
9.12. THE NEED FOR TRAP STATES IN DEVICE ORGANIC MODELS 79

Figure 9.4: Left) A plate of spaghetti [?]; Right) A polymer packing like spaghetti. Both
systems are highly disordered.

So on one hand we have an organic material that is messy and highly disordered, and on
the other hand we have a material such as silicon that is highly pure and very ordered. This
physical differences results in a very different energetic landscape for the two materials. In the
ordered material semiconductor electrons/holes can travel freely in the conduction and valance
bands. If an electric field is applied they only experience a small resistive force. Such a band
structure is shown in Figure 9.5a. In the organic material the picture is very different, due to
the disorder and impurities the band structure is full trap states. There are so many trap states
that the carriers no longer move freely but hop between the trap states after being thermally
excited, such a band structure is shown in shown in Figure 9.5b. Thus there are two very
different charge transport mechanisms in these two materials.

Figure 9.5: a) The band structure of an ordered semiconductor such as GaAs; b) The band
structure of an disordered material such as PM6:Y6 or P3HT:PCBM.

9.12.2 Trap states and charge density


[This section needs improving/editing but the sketch of what it should say is there:] Figure
9.6 sketches out the distribution of states for Figure 9.5. On the left of the image is a ordered
semiconductor with a parabolic band structure. The Fermi distribution of electrons is coloured
in purple. The right hand side image shows a disordered semiconductor with an exponential
density of trap states going into the band gap (sometimes a Gaussian DoS is used). It can be
80 CHAPTER 9. THEORY OF DRIFT DIFFUSION MODELLING

seen that the DoS and the distribution/energetic position of charge carriers are is very different
between the two types of semiconductor.

Figure 9.6: a) The band structure of an ordered semiconductor such as GaAs; b) The band
structure of an disordered material such as PM6:Y6 or P3HT:PCBM.

The total charge density at any place in the device can be described by an integration of
the Fermi-Dirac function, and the DoS ρ.
Z ∞
n(Ef , T ) = ρ(E)f (E, Ef )dE (9.45)
Emin

Where Ef is the Fermi level. Clearly ρ will be very different for an ordered and a disordered
semiconductor. Thus the dependence of n(Ef , T ) on Ef and thus applied voltage will very
depending on what ρ is chosen for the device. In practical terms this means that a disordered
device will have a lot more traps closer to the Fermi level and thus for any given voltage it
will contain one or two orders of magnitude more charge than an ordered device, this can be
observed in Charge Extraction experiments. So if one ignores trap states when modelling a
disordered device then the function n(V oltage) will be wrong.
If n(V oltage) is not correct then the recombination rate will be wrong for any given voltage:

R = kr n(V oltage)p(V oltage) (9.46)


Furthermore if nf ree (Ef , T ) is wrong the mobility will also have an incorrect dependence on
voltage:

µ0e nf ree
µe (n) = (9.47)
nf ree + ntrap
So if your DoS is wrong (i.e. no traps). Then you have no chance of reproducing a JV curve
correctly. Summary: OghmaNano was written specifically to simulate disordered devices where
trap states are play a large role in transport and recombination. Examples of such materials are
PM6:Y6 and P3HT:PCBM. OghmaNano includes traps correctly, make sure what ever model
you are using also includes traps or it will be wrong.

9.12.3 Why you should not use Langevin recombination in device


models
Langevin recombination is defined as,
9.12. THE NEED FOR TRAP STATES IN DEVICE ORGANIC MODELS 81

(µe + µh )
Rf ree = qkr np (9.48)
2ϵ0 ϵr
where Rf ree is the recombination rate, kr is the Langevin reduction factor and all other
symbols have their usual meaning. In general Langevin recombination is a bad way to describe
recombination in OPV devices. There were some older papers from the early 2010s using this
mechanisum but the models could not self consistently describe dark and light JV curves. This
is because the mechanism assumes Brownian motion of electrons and holes and that charge
carriers of opposite polarity will recombine when they get close enough to fall into each others
electrostatic field. This picture assumes the charge carriers are free and completely neglects
the influence of trap states. It was often found that the Langevin equation could not reproduce
the experimental results and predicted recombination rates far higher than were experimental
observed. To account for this a Langevin reduction factor kr was often introduced into the
equation, and a lot of effort went into measuring kr . This need for a reduction factor pointed
at some deeper issues with the equation.
If we look at the equation for Langevin recombination we can immediately see some issues
with it. The first thing we notice is that Rf ree can only ever change as the square of the charge
density (n p), but we know from experiment Rf ree can is often a higher order than 2 e.g. (np)1.5 .
Furthermore we can see two mobility terms, however we know from the discussion from above
that mobility is a function of carrier density. So the fact that it has the wrong dependence on
carrier density and needs a reduction factor points at the mechanism on which it is based being
incorrect, and using it will always be like trying to get a square peg in a round hole.

9.12.4 How one can make Langevin recombination work in device


models
So they key problems with Langevin recombination are a wrong dependence on carrier density
and the need for a reduction factor. It is possible to make Langevin recombination ’work’ by
making the charge carrier mobilities a function of carrier density as was done in [?]:

(αµe (n) + βµh (n))ntot ptot


Rf ree = qkr (9.49)
2ϵ0 ϵr
then by defining a mobility edge and assuming any carrier below the mobility edge could
not move and any carrier above it could. One could define the averaged electron/hole mobility
as:

µ0e nf ree
µe (n) = (9.50)
nf ree + ntrap
and

µ0h pf ree
µh (n) = (9.51)
pf ree + ptrap
and if one assumes the density of free charge carriers is much smaller than the density of
trapped charge carriers one can arrive at

(αµ0e nf ree ptrap + βµh pf ree ntrap )


R(n, p) = qkr (9.52)
2ϵ0 ϵr
Thus by making the mobility carrier density dependent we arrive at an expression for
Langeving recombination that’s dependent upon the density of free and trapped carriers (i.e.
nf ree ptrap and pf ree ntrap ). This is in principle the same as SRH recombination (i.e. a process
82 CHAPTER 9. THEORY OF DRIFT DIFFUSION MODELLING

involving free electrons (holes) recombining with trapped holes (electrons)). This was a nice
simple approach and it worked quite well in the steady state. However, to make this all work
we have to assume all electrons (holes) at any given position in space had a single quasi-Fermi
level, which meant they were all in equilibrium with each other. For this to be true, all electrons
(holes) would have to be able to exchange energy with all other electrons (holes) at that position
in space and have an infinite charge carrier thermalization velocity. This is an OK assumption
in steady state when electrons (holes) had time to exchange energy, however once we start
thinking about things happening in time domain, it becomes harder to justify because there
are so many trap states in the device it is unlikely that charge carriers will be able to act as
one equilibrated gas with one quasi-Fermi level. On the other hand the SRH mechanism does
not make this assumption, so it is a better description of recombination/trapping.
9.13. THERMAL MODELS 83

9.13 Thermal models


There are three options for thermal simulation in OghmaNano; 1) A constant temperature
through the device. This is recommended for most simulation and is set at 300K by default;
2) a lattice thermal solver 9.13.1, this solves the heat equation throughout the device taking
into account self heating. This is useful for simulating devices which get hot through their
operation; 3) A hydrodynamic thermal 9.13.2 solver which does not assume the electron, hole
and lattice temperatures are equal. This is useful for simulating heat flow over heterojunctions
or where carriers do not have time to relax to the lattice temperature.
The drift diffusion equations given in 9.21 and 9.25 are only valid in isothermal conditions.
The full transport equations as derived from the BTE [?] are given by

2 2 ∇m∗e
Jn = µe n∇Ec + µe n∇W̄ + W̄ µe ∇n − µe nW̄ (9.53)
3 3 m∗e
2 2 ∇m∗h
Jp = µh p∇Ev − µh p∇W̄ − W̄ µh ∇p + µp pW̄ (9.54)
3 3 m∗h
where W̄ is the average kinetic energy of the free carriers as given by 9.10. If the average
energy is assumed to be 3/2kT, 9.53 and 9.54, return to the standard drift diffusion equations.
Note the full form of these equations is required when not using MB statistics.
The thermal model can be configured in the thermal ribbon 9.7. Usually the thermal model
is turned off and a constant temperature (300K) is assumed across the device. If you wish to
adjust this temperature click on the ”Set temperature icon”. The thermal model can be turned
on by clicking on the candle to the on the far left of the thermal ribbon, so that a flame appears.
Various heating sources can be enabled or disabled by depressing the buttons to the right of
the ribbon. Boundary conditions can be set in the ”Boundary Conditions” window, thermal
constants of the material layers can be changed in the ”Thermal parameters window”.

Figure 9.7: Thermal

9.13.1 Lattice thermal model


When solving only the lattice heat equation heat transfer and generation is given by

0 = ∇κl ∇TL + Hj + Hr + Hoptical + Hshunt (9.55)


where joule heating (Hj ) is give by

∇Ec ∇Eh
Hj = Jn + Jh , (9.56)
q q
recombination heating (Hr ) is given by,

Hr = R(Ec − Ev ) (9.57)

optical absorption heating is given by,


84 CHAPTER 9. THEORY OF DRIFT DIFFUSION MODELLING

Hoptical (9.58)
and heating due to the shunt resistance is given by
Jshunt Vapplied
Hshunt = . (9.59)
d
The thickness of the device is given by d. Note shunt heating is only in there to conserve
energy conservation.

9.13.2 Energy balance - hydrodynamic transport model


If you turn on the electrical and hole thermal model, then the heat source term will be replaced
by
!
3kb Tn − Tl Tp − Tl
H= n( ) + p( ) + R(Ec − Ev ) (9.60)
2 τe τh
and the energy transport equation for electrons
dTn 5 kb Tn
Sn = −κn − Jn (9.61)
dx 2 q
and holes,
dTp 5 kb Tp
Sp = −κp + Jp (9.62)
dx 2 q
will be solved.
The energy balance equations will also be solved for electrons,
!
dSn 1 dEc 3kb Tn − Tl
= Jn − RTn + n( ) (9.63)
dx q dx 2 τe
and for holes
!
dSp 1 dEv 3kb Tp − Tl
= Jp − RTp + n( ) (9.64)
dx q dx 2 τe
The thermal conductivity of the electron gas is given by
!
5 kb 2
κn = + cn Tn µn n (9.65)
2 q
and for holes as,
!
5 kb 2
κp = + cp Tp µp p (9.66)
2 q
Chapter 10

Optical models

10.1 Light sources


In OghmaNano light comes from light sources. Light sources defined in the light source editor
this can be found in the Optical ribbon of the main window see figure 10.1.

Figure 10.1: Opening the light source editor.

The light source editor is shown below in Figure 10.2. Each light source consists of of
illumination spectra and optical filters. In this way you can define a light source to emit
AM1.5G but then filter out various components of the spectrum. This enables one to simulate
for example a device under AM1.5G spectra but behind a thick glass contact that takes sunlight
below 300 nm. Light sources can be combined in the Light source tab, so for example one could
combine AM1.5G and light given off by a fluorescent tube. Each spectrum is multiplied by a
multiplier defined in the multiplier column this defines the relative intensity of the light sources.
In the filters tab you can define the optical filters. They can be enabled or disabled using
the Enable switch, you can select the material which will act as a filter, and decide how much
the filter attenuates in dB.
The configure tab of each filter can be used to select where the light comes from, options
are:

1. Top: Light will come form the top of the device. (y0) This is usually used with the
transfer matrix solver. See the bottom left of figure 10.3.

2. Bottom: Light will come from the bottom of the device. (y1) This is usually used with
the transfer matrix solver. See the bottom right of figure 10.3.

3. xyz: The light can come from an xyz position in the simulation space this used for FDTD
simulations or ray tracing simulations. This can be seen in to bottom right of figure 10.3.

Stop and start wavelengths can also be set in the configure tab.

85
86 CHAPTER 10. OPTICAL MODELS

10.1.1 Local ground view factor

The local ground view factor which is given as [?]

 
2 θt 1 − cos(θt )
Fground = sin = (10.1)
2 2

can be set in the configure tab.

Figure 10.2: Left: Building an optical spectrum; Right modifying the light sources with optical
filters.
10.1. LIGHT SOURCES 87

Figure 10.3: Top left: The configure panel of the light source editor; Top right: Illuminate from
set to ”xyz”; bottom left: Illuminate from set to ”top”; bottom right: Illuminate from set to
”bottom”.
88 CHAPTER 10. OPTICAL MODELS

10.2 Transfer matrix model


In general the transfer matrix method is good for simulating sandwich type structures where
light is incident normal to the surface of a device. Examples of such devices are solar cells,
optical filters or sensors. This method is good for understanding optical absorption, reflection
and transition in these structures. There are other more complex methods which can accomplish
the same task such as FDTD, however general speaking the transfer matrix model will be orders
of magnitude faster than these methods.

10.2.1 The user interface


The transfer matrix simulation tool can be reached from the Optical ribbon in the main window
by selecting Transfer matrix. If you click Run optical simulation (see 10.4) the distribution of
light within the structure will be calculated as a function of position and wavelength. You can
see from the top of the figure that there are various simulation modes. The full transfer matrix
method is selected by selecting Transfer matrix, this will do full optical simulation. The other
buttons represent other simplified approximations to the transfer matrix method that allow the
user to explore more simple charge carrier generation profiles. From the left the push buttons
in Figure 10.4 represent the following optical models:

ˆ Transfer matrix: This is a full transfer matrix simulation that takes into account multiple
reflections from the interfaces and optical loss within the structure. This is in effect solving
the wave equation in 1D and is an accurate (and recommended) optical model to use. See
section 10.2.4. If you are unsure which model to pick, pick this one.

ˆ Exponential profile: This is a very simple optical model that assumes light decays expo-
nentially according to the relation
I = I0 e−αx (10.2)
between layers and and assumes light is transmitted between layers according to the
formula:
n1 − n0
T = 1.0 − (10.3)
n1 + n0
No reflection is accounted for.

ˆ Flat profile: The flat profile assumes light is constant within layers and only decreases at
material interfaces according to equation 10.3. One might want to use this model when
trying to understand the charge carrier dynamics in a device but wants to remove the
effects of a non-uniform charge generation generation profile.

ˆ From file: This can be used to import generation profiles from a file. It us generally used
to import the results of more complex optical simulations such as those from external
FDTD solvers.

ˆ Constant value: If you click on the arrow to the right of the simulation button you will
be able to set the charge carrier generation rate within each layer by hand. Again this is
generally used when trying to understand charge carrier dynamics or device performance
without to consider a complex optical profile. This would allow one to plot graphs of
charge generation rate v.s. Voc etc..
10.2. TRANSFER MATRIX MODEL 89

Figure 10.4: This is the Transfer matrix optical simulation window, here you can view the
photon density and the rate of photon absorption in the device. The play button will run the
simulation, exactly which flavour of transfer matrix simulation is run will depend on which
push button you select from ribbon.

The optical simulation window has various tabs which can be used to explore how light
interacts with the device. These can be seen in figure 10.5. The the top left image shows the
photon density within the device, the image on the right shows the total photon density within
the layers of the device. Notice how the reflection of the light of various layers causes interference
patterns. The image on the bottom left shows the configuration of the optical model. A key
parameter that can be seen in this window is the Photon efficiency, this parameter determines
how many electron-hole pairs each photon that is absorbed within the active layer generates.
In organic devices it accounts for geminate recombination, in other types of devices it should
be set close to 1.0. Bottom right shows the same figure as in the top right of the figure, except
by right clicking and playing with the menu options the figure has been converted into band
diagram. This can be useful for generating band diagram figures for papers.
90 CHAPTER 10. OPTICAL MODELS

Figure 10.5: Various views of the optical simulation window

Running the transfer matrix simulation


As described above, the transfer matrix simulation can be run by directly clicking on the play
button. However when running an electrical simulation the optical model is run automaticity
without any user interaction. The only difference between the two ways of calling the optical
simulation is that when the user directly calls the optical model more output files are written to
disk, however when the optical simulation is run as part of an electrical simulation the number
of files and output are limited as to not slow the electrical simulation.
10.2. TRANSFER MATRIX MODEL 91

10.2.2 Output files

After having run an optical simulation an overview of the results can be seen in the optical
simulation window (Figure 10.4) as described above. However more in depth information can
be obtained from the Output tab of the main window as shown in Figure 10.6.

Figure 10.6: The output tab shows the output from the transfer matrix simulation. Usually
the optical output and optical snapshots files are only generated when the optical simulation
is run directly and not as part of another simulation.

In Figure 10.6 you can see two icons one called Optical output and the other called opti-
cal snapshots (in the figure it reads ”ptica output” due to the text being hidden). If you double
click on Optical output it will bring up figure 10.4. If you double click on optical snapshots it
will bring up Figure 10.7. The optical snapshot window allows the user to view photon density,
absorbed photons and electric field of the light. The information is displayed per wavelength
so a detailed overview of device performance can be gained.
92 CHAPTER 10. OPTICAL MODELS

Figure 10.7: The optical snapshots window. This allows the user to view, Electric

The optical snapshots directory in depth

The optical snapshots folder was described above and when accessed through the graphical
interface allows the user to access photon density, absorbed photons and electric field of the
light as a function of wavelength. However, it is simply a normal directory and the user can
access it through a file explorer. If you open the directory using a tool such as windows explorer
you will see something comparable to what is shown on the left of Figure 10.8. You can see
folders numbered from 0 to 12 each folder represents a simulated wavelength. If you open a
directory, say number 0, you will be presented with the files shown in the right hand of figure
10.8. These files contain the following information:

File name Description


alpha.csv y-position v.s. absorption @ given wavelength
data.json json file containing wavelength value
En.csv y-position (m) v.s. Electric field with -ve component (V/m) @ given wavelength
Ep.csv y-position (m) v.s. Electric field with +ve component (V/m) @ given wavelength
G.csv y-position (m) v.s. Generation rate (m−3 s−1 )
n.csv y-position (m) v.s. Real part of the refractive index n (au) @ given wavelength
photons.csv y-position (m) v.s. photon density (m−3 ) @ given wavelength
photons abs.csv y-position (m) v.s. photons absorbed (m−3 s−1 ) @ given wavelength

Table 10.1: Files produced by the JV simulation


10.2. TRANSFER MATRIX MODEL 93

Figure 10.8: Various views of the optical simulation window

These files are simply plain text, if you open one it will look like 10.9. The first line of this
file contains some information about the content of the file to help with plotting. The second
line tells the user what the x and y axis contain then the following lines contain the data.

Figure 10.9: The content of photons abs.csv.

The optical output folder in depth

While the optical snapshots directory allows data to be plotted per simulated wavelength, the
optical output gives 2D maps of wavelength v.s. position for various simulation parameters.
The content of the directory is shown in figure 10.10.
94 CHAPTER 10. OPTICAL MODELS

Figure 10.10: The content of optical output directory

The files shown in Figure 10.10 are described in table 10.2.

File name Description Plot type


data.json Miscellaneous simulation information in json format 1D
G y.csv y-position (m) v.s. Charge generation rate (m−3 s−1 ) 2D
G zxy.csv zxy-position (m) v.s. Charge generation rate (m−3 s−1 ) 2D
Htot zxy.csv zxy-position (m) v.s. Optical heat generation (W m−3 ) 2D
light src id xxx.csv wavelength (m) v.s. Light intensity from source (W/m) 2D
photons abs yl.csv wavelength (m) v.s. y-position (m) v.s. photons absorbed (m−3 s−1 ) 2D
photons yl.csv wavelength (m) v.s. y-position (m) v.s. Photon density (m−3 s−1 ) 2D
photons yl norm.csv wavelength (m) v.s. y-position (m) v.s. Normalized photons (au) 2D
reflect.csv wavelength (m) v.s. Light reflected from the stack 1D
transmit.csv wavelength (m) v.s. Transmitted though the stack 1D

Table 10.2: Files produced by the JV simulation


10.2. TRANSFER MATRIX MODEL 95

10.2.3 Simulating optically thick layers (incoherent layers)


Typical optoelectronic devices have layer thicknesses between 10 nm and 100 nm. However
often these devices are deposited on top of substrates that are between 10 mm and 1 cm thick
and often one wants to not only simulate the device but also the impact of the substrate. Thus
to perform this type of simulation one will need a simulation tool that covers length scales from
the nm top the meter scale. There are three problems with doing this:

ˆ Problem 1: Simulating different length scales: Computers don’t like doing maths with
numbers that are very big and small very often this results in large computational/round-
ing errors, there is more on this in secton 9.11.1.

ˆ Problem 2: The wavelength of light: The wavelength of light is far smaller than 1 cm
thus to get sensible answers out of the simulation one will need a very large number of
mesh points correctly represent the constructive/negative interference of the light within
the layer.

ˆ Problem 3: The light will not be coherent: The transfer matrix model assumes light
comes from a single direction at 90 degrees to the interface and there are no defects in
the material. For a thick layer this will not be true.

To get around these issues OghmaNano uses two strategies. The first is to give the user the
option to only consider absorption and neglect phase changes within a layer, to form a so called
incoherent layer (this solves problem 2 and 3). This can be selected from the layer editor in the
main window see Figure 10.11. Notice in the column entitled Solve optical problem, the first
two layers (air and glass) have Yes - k selected, and the other layers have Yes - n/k selected.
This means that in layers with Yes - n/k phase changes of the light will be considered but
in the layers marked Yes - k only attenuation losses will be accounted for and thus it can be
thought of as an incoherent layer.

Figure 10.11: The layer editor showing both coherent layers and incoherent layers

To get around the problem of having to simulate different length scales (problem 1) Ogh-
maNano allows the user to set an effective optical depth for any layer. So one can for example
setup a layer in the layer editor of width 100 nm, but set it’s effective depth to a much larger
96 CHAPTER 10. OPTICAL MODELS

value such as 1 m. This works by multiplying the absorption coefficient of the layer by the
ratio:

Lef f ective
αef f ective (λ) = α(λ) (10.4)
Lsimulation

Where αef f ective is the effective absorption used in the simulation, α is the true value of
absorption for the material, Lef f ective is the effective layer thickness (say 1 m or 1 km), and
Lsimulation is the thickness of the layer in the simulation window. Not only does this approach
reduce numerical issues (problem 1) but it also allows the user to plot meaningful graphs of
the simulation results, without most of the plot taken up by the substrate and the device only
appearing as a tiny slither on the edge of the graph.

If you want to use this feature, then set up a device structure as shown in 10.11 then in the
transfer matrix window click the Optical Thickness button (top right of Figure 10.12). Then
the window 10.13 will appear. In this window you can set the effective optical thickness of any
layer. In this case we have set the glass to be 1 meter thick.

Figure 10.13: The effective optical thickness


window, you can see that for this structure the
optical thickness of glass has been set to 1 me-
Figure 10.12: Opening the effective optical ter.
thickness window.
10.2. TRANSFER MATRIX MODEL 97

10.2.4 Theory of the transfer matrix method


On the left of the interface the electric field is given by

E1 = E1+ e−jk1 z + E1− ejk1 z (10.5)


and on the right hand side of the interface the electric field is given by

E2 = E2+ e−jk2 z + E2− ejk2 z (10.6)

Maxwel’s equations give us the relationship between the electric and magnetic fields for a
plane wave.

∇ × E = −jωµH (10.7)
which simplifies to:
∂E
= −jωµH (10.8)
∂z
Applying equation 10.8 to equations 10.5-10.6, we can get the magnetic field on the left of
the interface
−jµωH1y = −jk1 E1+ e−jk1 z + jk1 E1− ejk1 z (10.9)
and on the right of the interface

−jµωH2y = −jk2 E2+ e−jk2 z + jk2 E2− ejk2 z . (10.10)

Tidying up gives,
k + −jk1 z k − jk1 z
H1y = E1 e − E e (10.11)
ωµ ωµ 1
k + −jk2 z k − jk2 z
H2y = E2 e − E e (10.12)
ωµ ωµ 2

Boundary conditions
We now apply the electric and magnetic boundary conditions[?]

n × (E2 − E1 ) = 0 (10.13)

n × (H2 − H1 ) = 0 (10.14)
We let the interface be at z=0, which gives,

(E2+ + E2− ) − (E1+ + E1− ) = 0 (10.15)

and
k1 + k2
(E2 − E2− ) − (E1+ − E1− ) =0 (10.16)
ωµ ωµ
. The wavevector is given by
2ω ωn
k== (10.17)
λ c
. We can therefore write the magnetic boundary condition as

n2 (E2+ − E2− ) − n1 (E1+ − E1− ) = 0 (10.18)


98 CHAPTER 10. OPTICAL MODELS

Forward propagating wave

Rearrange equation, 10.18 to give,


n2 +
E1− = E1+ − (E2 − E2− ) (10.19)
n1
Inserting in equation 10.15, gives
n2 +
E2+ + E2− = E1+ + E1+ − (E − E2− ) (10.20)
n1 2

n2 +
2E1+ = E2+ + E2− + (E2 − E2− ) (10.21)
n1
n1 n1 − n2
2E1+ = E2+ + E2− (10.22)
n1 + n2 n1 + n2

Backwards propagating wave

Rearrange equation, 10.18 to give,


n2 +
E1+ = E1− + (E2 − E2− ) (10.23)
n1
Inserting in equation 10.15, gives
n2 +
E2+ + E2− = E1− + (E2 − E2− ) + E1− (10.24)
n1

n2 +
2E1− = E2+ + E2− − (E − E2− ) (10.25)
n1 2
n1 n1 − n2
2E1− = E2+ + E2− (10.26)
n1 + n2 n1 + n2
Which is the same result as obtained in [?].
These equations become:

E1− t12 = E2+ r12 + E2− (10.27)


and
E1+ t12 = E2+ + E2− r12 (10.28)
Accounting for propagation we can write. Note the change in sign between [?] and this
work, this is because of how I have defined my wave equation.

E1+ t12 = E2+ eζ2 d1 + E2− r12 e−ζ2 d1 (10.29)

and

E1− t12 = E2+ r12 eζ2 d1 + E2− e−ζ2 d1 (10.30)


where

ζ= n̄ (10.31)
λ
For a device with non reflecting back contacts:
10.2. TRANSFER MATRIX MODEL 99
  +
eζd r01 e−ζd

0 0 0 0 0 0 E1
ζd −ζd +
 
−t12 e 0 0 0 r12 e 0 0   E t01 E external
 ζd −ζd
  2+ 
 0
 −t 23 e 0 0 0 r23 e 0  E3  
   0 

ζd −ζd   + 
 0 0 −t34 e 0 0 0 r34 e  E4    0 
 ζd1 −ζd − = 
 0
 r 12 e 0 0 −t 12 e 0 0  E1  
  −  0 

ζd −ζd
 0 0 r23 e 0 0 −t23 e 0  E2  
   0 
−ζd   − 
 ζd
 0 0 0 r34 e 0 0 −t34 e E3 0
0 0 0 0 0 0 0 −t45 E4−

10.2.5 Refractive index and absorption


−2π(n+jκ) 2πκz j(−2π(n+jκ)
E(z, t) = Re(E0 ej(−kz+ωt) ) = Re(E0 ej( λ
z+ωt)
)=e λ Re(E0 e λ
z+ωt
) (10.32)
And because the intensity is proportional to the square of the electric field the absorption
coefficient becomes
2πκz
e−αx = e λ (10.33)

4πκ
α=− (10.34)
λ0
100 CHAPTER 10. OPTICAL MODELS

10.3 Optical mode solve 1D/2D


Related YouTube videos:

Tutorial on calculating TE/TM modes in slab waveguides

Text to be added later.


10.4. FINITE DIFFERENCE TIME DOMAIN 101

10.4 Finite Difference Time Domain


Finite Difference Time Domain (FDTD) is a very computationally intensive way to simulate
the propagation of electromagnetic radiation. It solves full on Maxwell’s equations in time
domain making no assumptions. This approach has only been possible in the last few years
with the increase in computing power.
Food for thought: Before using FDTD, you should be aware that in many cases when
simulating a device, using FDTD is like using a sledge hammer to crack a nut. For example
when simulating a standard solar cell, one could use FDTD, this would involve simulating
a wave front entering the cell through the top contact in time domain and waiting until the
optical field reaches steady state then calculating how much light is being absorbed. This would
require thousands of time domain simulation steps per wavelength. However usually one is not
interested in the time evolution of light in a solar cell as sunlight varies very slowly indeed, so
one is better off not using a steady state method but other methods which assume light has
already reached steady state, such as the transfer matrix method discussed above.
Never the less, FDTD is an import method, and can be used to design and understand
complex devices.
Related YouTube videos:

Generating photonic crystal structures for FDTD simulation

Tutorial on simulating photonic crystal waveguides using FDTD

10.4.1 Running an FDTD simulation


There is a demo FDTD simulation in the new simulations window. To open this click on new
simulation in the file ribbon of the main window. The window in figure 10.14 will appear.
Double click on the ”Photonic-xtal FDTD” simulation to open it. Save the simulation on your
local hard disk, don’t save it on a remote disk, USB disk or OneDrive they will be too slow to
run the simulation.

Figure 10.14: The new simulation window


102 CHAPTER 10. OPTICAL MODELS

Once you have opened the simulation you should get a window which appears figure 10.15.
If you click on the play button the FDTD simulation will run, it will take around 30 seconds
to run.

Figure 10.15: The initial FDTD simulation window. Use the slider to look at the results in
time domain, and the drop down menu to select which field you are going to look at.

After the simulation has run click on the Output tab and 10.16 you will see the FDTD
snapshots folder, this can be seen in figure 10.16. If you double click on this the FDTD
snapshots window will appear which is shown in figure 10.17. This window will allow you to
step through the simulations. If you click in the files to plot box, you will be able to select
which field you plot. You will be able to select the Ey, Ex or Ez fields. In this case select the
Ey field. Then use the slider bar to step through the field as a function of time.

Figure 10.16: The output tab after having run an FDTD simulation, the key output is the
Snapshots folder where the fields are stored.
10.4. FINITE DIFFERENCE TIME DOMAIN 103

Figure 10.17: The FDTD snapshots window.

10.4.2 Manipulating objects in OghmaNano

Now close the snapshot viewer and go back to the main simulation window and select the
Device tab. On the left of the window, you will see four buttons xy, yz, xz and for little square
boxes this can be seen in figure 10.18. Try clicking them to see what happens to the view of
the device. After you have had a play select the xz option, so that the screen looks like the left
hand side of 10.19. If you left click on the lenses, you will notice that you will be able to move
them around. Try to move the lenses back in the device so that your device looks more like the
right hand side of figure 10.18. If you hold shift down while dragging an object you can rotate
it on the spot.

If you right click on the lenses and select Edit you will be able to bring up the object Editor.
This shows the user all the object properties, this is visible in figure 10.20. Try changing the
object type from convex lens to concave lens by clicking the edit button and rerunning the
simulation. If you want to add your own shapes to the shape data base see section 15.2. Using
this window you can also change the material which is used in the FDTD simulation, the color
of the object as well as its position or rotational angle.

The shape enabled button enables you to turn off the shape if you don’t want it in the
simulation. If this shape were also electrically active you could also use this window to configure
the electrical parameters.
104 CHAPTER 10. OPTICAL MODELS

Figure 10.18: Changing the object view in OghmaNano

Figure 10.19: An example of moving objects in the simulation window.


10.4. FINITE DIFFERENCE TIME DOMAIN 105

Figure 10.20: The object viewer. This window is brought up by right clicking on an object and
selecting Edit.

10.4.3 Manipulating light sources in OghmaNano


Also visible in figure 10.19 is the light source given by the green arrow. Try moving this more
forward in the device.

10.4.4 Theoretical background


References for this section are [?]. This section of the manual aims to describe the FDTD code
in full with verbose derivations to help understanding/pick up errors.
Ampere’s law is given as [?]

x̂ ŷ ẑ
∂E ∂ ∂ ∂
σE + ϵ =∇×H = ∂x ∂y ∂z (10.35)
∂t
Hx Hy Hz
106 CHAPTER 10. OPTICAL MODELS

which can be expanded as

∂Ex ∂Hz ∂Hy


σEx + ϵ = − (10.36)
∂t ∂y ∂z

∂Ey ∂Hz ∂Hx


σEy + ϵ =− + (10.37)
∂t ∂x ∂z

∂Ez ∂Hy ∂Hx


σEz + ϵ = − (10.38)
∂t ∂x ∂y

For the case ∂y
=0

∂Ex ∂Hy
σEx + ϵ =−
∂t ∂z
∂Ey ∂Hz ∂Hx
σEy + ϵ =− + (10.39)
∂t ∂x ∂z
∂Ez ∂Hy
σEz + ϵ =
∂t ∂x

for Ex
∂Ex ∂Hy
σEx + ϵ =−
∂t ∂z
t+ 12 1 t+ 12
E t+1 [] + Ext [] E t+1 [] − Ext [] Hy [2] − Hy [− 21 ]
σ x +ϵ x =−
2 ∆t ∆z
t+ 12 1 t+ 12
E t+1 [] E t+1 [] Hy [2] − Hy [− 12 ] Ext [] E t []
σ x +ϵ x =− −σ +ϵ x
2 ∆t ∆z 2 ∆t
t+ 12 1 t+ 12 (10.40)
E t+1 [] E t+1 [] Hy [2] − Hy [− 12 ] Ext [] E t []
σ x +ϵ x =− −σ +ϵ x
2 ∆t ∆z 2 ∆t
t+ 12 1 t+ 21
σ∆t + 2ϵ t+1 Hy [2] − Hy Ext [] [− 12 ]
E t []
Ex [] = − +ϵ x −σ
2∆t  ∆z 2  ∆t
t+ 12 1 t+ 21
Hy [ 2 ] − Hy [− 12 ] E t [] E t [] 2∆t
Ext+1 [] = − −σ x +ϵ x 
∆z 2 ∆t σ∆t + 2ϵ

for Ey

∂Ey ∂Hz ∂Hx


σEy + ϵ =− +
∂t ∂x ∂z
t+ 21 1 t+ 12 t+ 12 1 t+ 12
Eyt+1 [] + Eyt [] Eyt+1 [] − Eyt [] Hz [2] − Hz [− 12 ] Hx [2] − Hx [− 12 ]
σ +ϵ =− +
2 ∆t ∆x ∆z
t+ 1 t+ 1 t+ 1 t+ 1
Eyt+1 [] Eyt+1 [] Hz 2 [ 12 ] − Hz 2 [− 12 ] Hx 2 [ 12 ] − Hx 2 [− 12 ] Eyt [] Eyt []
σ +ϵ =− + −σ +ϵ
2  ∆t 1 ∆x ∆z 2 ∆t
t+ 2 1 t+ 21 t+ 1
t+ 1
Hz [ 2 ] − Hz [− 12 ] Hx 2 [ 12 ] − Hx 2 [− 12 ] Eyt [] Eyt []
Eyt+1 [] = − + −σ +ϵ  2∆t
∆x ∆z 2 ∆t σ∆t + 2ϵ
(10.41)
10.4. FINITE DIFFERENCE TIME DOMAIN 107

for Ez
∂Ez ∂Hy
σEz + ϵ =
∂t ∂x
t+ 12 1 t+ 12
E t+1 [] + Ezt [] E t+1 [] − Ezt [] Hy [2] − Hy [− 12 ]
σ z +ϵ z =
2 ∆t ∆x
t+ 1 t+ 1 (10.42)
E t+1 [] E t+1 [] Hy 2 [ 12 ] − Hy 2 [− 21 ] E t [] E t []
σ z +ϵ z = −σ z +ϵ z
2  ∆t1 ∆x 2 ∆t
t+ 2 1 t+ 21
Hy [ 2 ] − Hy [− 12 ] E t [] E t [] 2∆t
Ezt+1 [] =  −σ z +ϵ z 
∆x 2 ∆t σ∆t + 2ϵ

Faraday’s law is given as [?]

x̂ ŷ ẑ
∂H ∂ ∂ ∂
−σm H − µ =∇×E = ∂x ∂y ∂z (10.43)
∂t
Ex Ey Ez

which can be expanded to give:

∂Hx ∂Ez ∂Ey


−σm Hx − µ = − (10.44)
∂t ∂y ∂z

∂Hy ∂Ez ∂Ex


−σm Hy − µ =− + (10.45)
∂t ∂x ∂z

∂Hz ∂Ey ∂Ex


−σm Hz − µ = − (10.46)
∂t ∂x ∂y

With σm = 0 and ∂y
=0

 
∂Hx 1 ∂Ey
=
∂t µ ∂z
 
∂Hy 1 ∂Ez ∂Ex
= − (10.47)
∂t µ ∂x ∂z
 
∂Hz 1 ∂Ey
=−
∂t µ ∂x

which discretizing gives

 
t+ 21 1 t+ 12
1 Ey [2] − Ey [− 12 ]
Hxt+1 =  ∆t + Hxt []
µ ∆z
 
t+ 21 1 t+ 12 1 t+ 12 1 t+ 12 1
1 Ez [ 2 ] − Ez [− 2 ] Ex [ 2 ] − Ex [− 2 ] 
Hyt+1 =  − ∆t + Hyt [] (10.48)
µ ∆x ∆z
 
t+ 21 1 t+ 12 1
1 Ey [ 2 ] − Ey [− 2 ]
Hzt+1 = −  ∆t + Hxz []
µ ∆x
108 CHAPTER 10. OPTICAL MODELS

10.4.5 Ray tracing model


Add text.
Chapter 11

Simple circuit simulations

OghmaNano was primarally designed as a tool to perform detailed device simulations, however
sometimes one does not need a full device simulation to understand what is happening in your
device. On some occasions a simple circuit model comprising of resistors, capacitors, and ideal
diodes will do. For these occasions OghmaNano includes an electrical circuit solver. The circuit
solver is a drop in replacement for the drift diffusion solver in that the voltages applied to it
are defined in exactly defined in exactly the same way, the experimental modes such as time
domain, frequency domain and EQE all work with the circuit solver. Furthermore, the transfer
matrix model which is used to calculate how much light is absorbed in each layer can connected
to the diodes, thus enabling photocurrent to be correctly simulated. There are a few examples
if circuit simulations in the mode, these can be found in the Simple Diode Model folder of the
new simulation folder (see figure 11.1.).

Figure 11.1: Selecting the Simple circuit simu- Figure 11.2: Selecting the example that gener-
lation example ates the JV curve
With in this folder there are a few example circuit simulations (see Figure 11.2).
If one opens the OPV PM6:Y6 JV curve one will get a simulation that looks just like other
simulations in OghmaNano (see Figure 11.2), however this simulation has another tab called
circuit diagram in the main window, if one clicks it one should see a circuit diagram as show
in Figure 11.4. This is the circuit diagram editor. On the left is a toolbar, from the top the
toolbar provides the following functionality:
ˆ Resistor: This adds a resistor to the circuit.
ˆ Capacitor: This adds a capacitor to the circuit.
qV
ˆ Diode: This adds a standard diode to the circuit of form i(t, V ) = I0 (e nkT − 1) − Ilight ,
Ilight is taken from the optical simulations.

109
110 CHAPTER 11. SIMPLE CIRCUIT SIMULATIONS

I0 ∗V m
ˆ Non-linear element: This adds a non-linear circuit element of form i(t, V ) = V0 +d

ˆ Wire: A perfect wire with no parasitic parameters.

ˆ Earth: This acts as a ground set at 0V.

ˆ Battery: This applies the voltage to the circuit. The voltage is taken from the contact
marked change in the contact editor.

ˆ Pointer: This ise used to select and edit circuit elements.

ˆ Brush: This is used to delete circuit elements.

Figure 11.4: The circuit tab of the example


Figure 11.3: The usual interface opens when the
showing the circuit diagram used to simulate
circuit simulation is selected.
the device.
By clicking on any circuit element with any tool apart from the brush, you can change the
values of the components as seen in Figure 11.5, and zoomed in Figure 11.6. Figure 11.6 shows
the configuration window for the diode component. From the top the options are:

ˆ Component: This can be used to change what component the circuit element represents.

ˆ Name: This is an human readable name given to the circuit element, you can call it what
you want.

ˆ Ideality factor: The diode ideality factor n.

ˆ I0: Saturation current in the diode equation.

ˆ Layer: This is the layer that the diode represents, the light current will be calculated
from the generation in this layer.
111

Figure 11.7: The output of circuit simulation window is exactly as it would be for standard
drift diffusion simulations.

Figure 11.6: A zoomed in view of the diode com-


Figure 11.5: Editing the component values of a
ponent editor. Access this menu by clicking on
diode.
a component.
After you have run the simulation by clicking the play button or by pressing F9, simulation
output will be visible in the output tab as usual. All the files you would expect from the usual
drift diffusion simulations will be generated. One extra output that is generated in the circuit
simulation is the Net list this is visible in Figure 11.8, when you double click on this it brings
up the Net list window which is visible in Figure 11.8, this shows the voltage over and current
through every component in the circuit. You can use the slider to step through the simulation
steps, these will be time or voltage steps. The net list is only generated when the simulation
output is set to Write everything to disk in the simulation editor.
112 CHAPTER 11. SIMPLE CIRCUIT SIMULATIONS

Figure 11.8: The net list, showing the voltages over components and currents through compo-
nents.

11.0.1 JV, IS, CV and other simulation modes

As mentioned above the circuit simulator is compatible all simulation modes in OghmaNano,
by switching the simulation mode to Impedance Spectroscopy one can simulate the frequency
response of the circuit (see Figure 11.9), the result of which can be seen in Figure 11.10 where
the file real imag.csv has been plotted.

Figure 11.9: Changing the simulation mode to impedance spectroscopy.


113

Figure 11.10: An impedance spectroscopy simulation performed using the above circuit. To do
this just change the simulation mode to IS.

11.0.2 Using the fitting/scan tools with circuit models


The circuit models are exposed in the json tree just like the drift diffusion material paramters
and therefore you can also use the fitting and scan tools to either fit the data to experiment or
to scan through circuit values.
Chapter 12

Large area device simulation

OghmaNano primarily focuses on drift diffusion modelling of small area device such as solar cells
and OFETs. Drift and diffusion simulations are good at describing the microscopic operation
of devices. They allow you to understand how carriers, potential and recombination interact
on the nanometer scale. However, sometimes one wants to simulate large area devices such
as printed substrates spanning over many square centimetres. For this type of simulation one
needs to use less detailed and more efficient circuit models, this section describes how to do
that.

Related YouTube videos:

Tutorial on designing large area contacts for flexible electronics

Understanding Printed Hexagonal Contacts for Large Area Solar Cells

12.1 Designing contacts for large area devices

A common problem is designing large area contacts for solar cells. This paper [?] gives an
overview of such a problem. To start designing large area contacts open the new simulation
window in the file ribbon, and select the Large area hexagonal contact simulation (see figure
12.1). Once you have opened it you should get a window which looks like figure 12.2. This
simulation consists for a hexagonal solver contact printed on top of a PEDOT substrate. We
are going to find out how the resistance of this contact varies as a function of position.

114
12.1. DESIGNING CONTACTS FOR LARGE AREA DEVICES 115

Figure 12.1: Selecting the large area contact simulation


116 CHAPTER 12. LARGE AREA DEVICE SIMULATION

Figure 12.2: A 3D image of the contact printed contact.

The next step in the simulation is to build a network of resistors which approximates the
shape of the contact. To do this select the Circuit diagram tab and then click the refresh
button. This will build a resistor network of the shape shown in the device structure tab, see
figure 12.3. Here you can zoom in and examine the individual resistors, each line represents a
resistor.
12.1. DESIGNING CONTACTS FOR LARGE AREA DEVICES 117

Figure 12.3: Building the 3D circuit mesh of the contact structure.

Once this is built we can run a full simulation and calculate the resistance between the
bottom of the PEDOT:PSS layer (bottom of the green layer in figure 12.2) and the extracting
silver contact (far left yellow strip on the top of figure 12.2). Run the simulation by clicking on
the play button in the file ribbon.

Figure 12.4: A 1D diagram of the mesh


118 CHAPTER 12. LARGE AREA DEVICE SIMULATION

The simulation may take a while to run, once it has finished you can open the output files in
the Output tab, see figure ??. If you open the file called spm R.dat it will show you a resistance
map of the structure which can be seen in figure 12.5. Other output files are listed below in
table 12.1.

Figure 12.5: A 2D resistance plot across the surface of the device.

File name Description


spm R.dat 2D plot of resistance
spm R x.dat A resistance plot down the centre of the device.

Table 12.1: Files produced by the SPM simulaton.


12.2. SIMULATING LARGE AREA SOLAR CELLS 119

Figure 12.6: A 1D resistance plot taken through the centre of the device.

The scanning probe microscopy editor can be found in the Simulation Editors ribbon in the
main window. This can be used to select if one scans the entire device or only section of it.
The editor can be seen in figure 12.7

Figure 12.7: The output files from the simulation.

12.2 Simulating large area solar cells


Chapter 13

Modelling excitons/geminate
recombination - organics only

13.1 Why you should not model excitons


There are a number of models to calculate the number of geminate pairs which get converted to
free charge carriers the Onsager-Braun model for example will give you the exciton dissociation
efficiency. There are other models which will enable you to calculate the distribution of excitons
in a device as a function of position. However, these models will generally require a number
of parameters which are often not reliably known for a material system. Such parameters
include exciton life-time, diffusion length and dissociation rate. So although it’s possible (and
interesting) to write a model to simulate geminate recombination, one is usually better off
simply introducing a photon efficiency factor ηphoton . This number ranges between 0.0 and 1.0
and is multiplied by the number of photons absorbed at any point in the device to account for
geminate recombination losses.

G = Gabs · ηphoton (13.1)


where G is the charge carrier generation rate in m−3 s−1 in equations 13.1 and 9.26.
This factor can be obtained to a reasonable degree by comparing the difference between
the simulated and experimental Jsc . This parameter can set in the configuration section of the
optical simulation window. So therefore my advice is that in most cases you should not be
modelling excitons explicitly but rather using the ’photon efficiency factor’. If you really want
to model excitons read on..

13.2 Modelling excitons


So if you have read section 13.1 and still think you want to model excitons this section will
explain how to do it. Gvpdm includes an exciton solver. This sits between the optical model
and electrical model. If the exciton model is turned off then generation is simply the number
of photons absorbed at any point in the device multiplied by the photon efficiency factor see
equation 13.1. If the exciton model is turned on then optical absorption will feed straight into
the exciton diffusion equation.

∂X
= ∇ · D∇X + Goptical − kdis X − kF RET X − kP L X − αX 2 . (13.2)
∂t
where X is the exciton density as a function of position, D is the diffusion constant, Goptical
exciton generation rate. This value is taken straight from the optical model. The constant kdis

120
13.3. MODELING EXCITIONS IN A DEVICE 121

is exciton dissociation rate to free charge carriers. When the exciton model is switched on G in
equations equals kdis X. kF RET is the Föster resonance energy transfer, kP L X is the radiative
loss and α is an exciton-exciton annihilation rate constant. The diffusion term is defined as

L2
D= (13.3)
τ
Where L is exciton diffusion length and τ is the exciton lifetime.

13.3 Modeling excitions in a device


13.4 Modeling excitions in a unit cell
Chapter 14

The oghma file format

14.1 the .oghma simulation file format


In OghamNano simulations are saved in a directory containing a sim.oghma file. All the pa-
rameters specifying the device and simulations are stored in the sim.oghma file. If you rename
the file so to be called sim.zip you will be able to open it in windows explorer or your favourite
zip viewer. Inside the .oghma file you will find another file called sim.json. You can view this
file in any text editor but the file is quite long so I recommend you use firefox as it has a
very nice built in json viewer. Json is a simple way of storing text and configuration infor-
mation first developed for Java. Json is a standard way to store and transmit data much like
XML. You can see examples here: https://json.org/example.html or below in code listing 1.
You can see the json file is structured using
a series of brackets, double quotes and com-
mas. If you make a copy of sim.json outside 1 {
the .oghma archive, then rename the sim.zip 2 "color_of_dog": "brown",
back to sim.oghma, OghmaNano will ignore the 3 "dog_age": 5,
sim.json file within the sim.oghma archive and 4 "dogs_toys": {
revert to the plain text file stored in the sim- 5 "rabbit": "True",
ulation directory. This feature can be useful 6 "stick": "False"
for automation of simulations as you can sim- 7 }
ply edit the sim.json file using your favourite 8
programming language without having to learn 9 }
about reading and writing zip files. If you open
the sim.json file in firefox it will look like 14.2.
Also have a look at the file in notepad to get a Figure 14.1: A simple JSON example
sense of what is in it.
You can see that the json file has various headings, key headings are listed below in table
14.1. If you wish to programmatically drive OghmaNano you can simply use one of the many
available json editors most languages have them freely available.

14.2 Qwerks of the OghmaNano json format


ˆ The OghmaNano json file does not support standard json lists e.g. [”Red”, ”Green”,
”Blue”]. If there is a list of items, it is defined by firstly declaring the variable segments,
with the number of items in the list so for example ”segments”,0 . Each item in the list
is then stored under, ”segment0”, ”segment1” etc... This format enables OghmaNano to
allocate the memory for reading in the structures before doing the reading. This can be

122
14.2. QWERKS OF THE OGHMANANO JSON FORMAT 123

Figure 14.2: An example sim.json file opened in Firefox.


124 CHAPTER 14. THE OGHMA FILE FORMAT

Heading Description
sim General simulation information
jv JV curve configuration
dump Defines how much information is written to disk
math Math configuration for the solver
light Optical transfer matrix configuration
light sources Configuration of light sources
epitaxy Defines the structure of the device
thermal Thermal configuration
thermal boundary Thermal boundary config.
exciton Exciton config
exciton boundary Exciton boundary config.
ray Ray tracing config.
suns voc Suns-Voc
suns jsc Suns-Jsc
ce Charge Extraction config.
transfer matrix Light transfer matrix config
pl ss PL in steady state
eqe EQE config.
fdtd FDTD config.
fits Fitting config.
mesh Electrical mesh config.
time domain Time domain config.
fx domain FX-domain config
cv CV config.
parasitic Parasitic components
spm Scanning Probe Microscopy config.
hard limit Setting hard limits for sim params.
perovskite Perovskite solver config.
electrical solver Electrical solver config.
spctral2 SPCTRAL2
lasers fs Lasers
circuit Circuit solver config.
gl OpenGL config
world Defines the world box

Table 14.1: Key headings/sections in the sim.json file.


14.3. ENCODING 125

seen in figure 14.2 where there is a list with 1 segment.

ˆ Many items in the json file will be given an ID number which is a 16 digit hex code, this
can be used to uniquely reference the item. An ID number can also be seen in figure 14.2.
These ID numbers are generated at random but every ID number must be unique. ID
numbers enable objects for example epitaxy layers to be identified uniquely even if they
have the same name.

14.3 Encoding
The .json files read/written by OghamNano are always stored in UTF-8 format. OghmaNano
can not handle UTF-16 or any other text encoding standards. Nowadays windows notepad
and most other apps default to UTF-8, so if you don’t know what these text storage formats
are it probably does not matter. This will only rear it’s head if you start programmatically
generating .oghma files in a language such as C++ and are using a language such as Chinese
or Russian with non Latin characters in it’s alphabet.

14.4 Forwards/backwards compatability of the file for-


mat
Significant effort is made to make sure new versions of OghmaNano can read files generated in
older versions. However, older versions of OghmaNano may not be able to read files generated
on newer versions. Every time the user opens a sim.oghma file using the GUI the file format
is checked and if it differs to that being used in the current version the file is updated and
written back to disk. If you are using OghmaNano in a headless configuration by calling
oghma core.exe directly, then when sim.oghma files from old versions of the model, before
running oghma core.exe, make sure you have opened it in the GUI first to make sure the file
is in the correct format.
Chapter 15

Databases

There are a series of databases used to define material parameters, shapes and solar spectra
etc... These are described within this section. From the graphical user interface they can be
accessed from the database ribbon, see figure 15.1.

Figure 15.1: The database ribbon

There are two copies of these databases, one copy in the install directory of OghmaNano
C:\Program Files\OghmaNano\ and one in your home directory in a folder called oghma local.
When the model starts for the first time it copies the read only materials database from, to the
oghma local folder in your home directory. If you delete the copy of the materials database in
the oghma local folder it will get copied back next time you start the model, this way you can
always revert to the original databases if you damage the copy in oghma local.
The structure of the databases are simple, they are a series of directories with one directory
dedicated to each material or spectra etc.. E.g. there will be one directory called Ag in the
optical database which defines silver, and another directory in the spectra database called
am1.5g which defines the solar spectrum. Within each directory there is a data.json file which
defines basic material properties of the material such as what it is and what icon to use for it.
There may be a couple of .bib files that contain reference information for the object in bibtex
format. The rest of the key information will be stored in human readable .csv files. These files
can be opend in notepad or any text editor. The one exception is that in the shape database
some large files are stored in a binary format.

126
15.1. MATERIALS DATABASE 127

15.1 Materials database

Related YouTube videos:

A tutorial on adding new materials to OghmaNano

This database primarily contains n/k data and PL emission spectra. However it also con-
tains some electrical information and some thermal information. Each subdirectory within the
materials database identifies the material name. In each sub directory there are two key files
alpha.csv and n.csv, these files are standard text files can be opened with any text editor such
as wordpad. Alpha.csv contains the absorption coefficient of the material while n.csv contains
the the refractive index. The first column of the file contains the wavelength in m (not cm
or nm), and the second column of the file contains the absorption coefficient in m−1 (for al-
pha.csv) and the real part of the refractive index (i.e. n) in au (for n.csv). The data.json
defines the material color and any known electrical or thermal data. If the material is used in
emissive optical simulations the emission spectra of the material will be stored in a file called
emission.csv. An example material directory, in this case Alq3 can be seen in figure 15.2, a
description of these files can be found in 15.1.

Figure 15.2: An example of a materials database item for Alq3.

File name Description


data.json json file infomration about the material (LUMO/HOMO levels etc..)
alpha.csv wavelength (m) v.s. absorption (m−1 )
n.csv wavelength (m) v.s. refractive index (au)
emission.csv ∗seebelow wavelength (m) v.s. PL emission (au)
mat.bib Bibtex file containing references

Table 15.1: A summary of the files making up each material in the materials database. *The
file emssion.csv is not needed unless the material forms part of an emissive layer of an OLED
or other such light emitting device.
128 CHAPTER 15. DATABASES

15.1.1 Adding new materials - the hard way


If you wish to add materials to the database which do not come as standard with the model you
can do it in the following way: Simply copy an existing material directory (say oghma local\materials\oxieds
to a new directory (say oghma local\materials\oxieds\mynewmaterial). Then replace alpha.csv
and n.csv with your data for the new material. You can ignore the data.json file, although if
you know the energy levels you can add the values in the file.
If you don’t have data to hand for your material, but you do have a paper containing the
data, you use the program Engauge Digitizer, written by Mark Mitchell https://github.
com/markummitchell/engauge-digitizer to export data from publications. After you have
finished updating the new material directory, whenever a new simulation is generated the new
material files will automatically be copied into the active simulation directory ready for use.
15.1. MATERIALS DATABASE 129

15.1.2 Adding new materials - the easy way


To add a new material go to the database ribbon and click on Materials database as shown in
figure 15.3.

Figure 15.3: Opening the materials database

Then click add material in the top right of the window, this will bring up a dialogue box
which will ask you to give a name for your new material, this is visible in figure 15.5. In this
case we called the material my new material.

Figure 15.5: Type the name of the new material

Figure 15.4: Select Add material


Once you have clicked OK the new material will appear see Figure 15.6, open it by double click-
ing on it. This will bring up an empty material window with no data. See Figure 15.7.

Figure 15.7: The new material without any data

Figure 15.6: Open the new material


To import data to the material use the Import data from file button situated on the top
left of the material window see Figure 15.7 this will bring up the import data wizard which is
shown in Figure 15.8. To use this wizard follow these steps:
130 CHAPTER 15. DATABASES

Figure 15.8: The data importer window

a) Open a file you want to import. The file can only be a text file or a csv file.
b) Once the file has been loaded it will be visible in the text box on the left.
c) Select the units of the x-axis of the original file.
d) Select the units of the y-axis of the original file.
e) The file should appear converted into SI units on the right hand text box.
f) If you have happy with the conversion click import data and the data will be saved.

This process can be seen in 15.8, once done the imported data will appear in the material as
shown on the top left of 15.9. In this example absorption data was imported, for the material
to be used in a simulation the refractive index (real part) will also need to be imported.
15.1. MATERIALS DATABASE 131

Figure 15.9: Clockwise from the top left; The imported absorption spectra; The basic material
parameters; The electrical parameters; and the Thermal parameters.
132 CHAPTER 15. DATABASES

15.1.3 But I have a data in nm/n/k format


Usually OghamNano only accepts data input in SI units and usually only accepts input in one
format. This is to reduce the overall number of lines of code and reduce maintenance. However,
I have been asked to make the model accept data of format: wavelength (nm), refractive index
(au), k (au), as shown in Figure 15.10. OghmaNano will be able to read this file if you simply
copy it into your home directory\oghma local\materials and give it a file extension .nk, so for
example ito.nk. Where your home directory is simply your Windows home directory. It is
usually located on the C:\Users on a home PC but the location can change if you are on a
corporate PC. Once you have dragged the file into your home directory\oghma local\materials
it will appear as a material in the model. See Figure 15.11. You can see that the .nk file in Figure
15.11 is greyed out, this is because it is a non standard OghamNano file, that OghmaNano can
read but not edit.

Figure 15.10: An example of wavelength/n/k data.

Figure 15.11: An example of a .nk file containing wavelength/n/k data in the materials
database. You can see it is greyed out denoting that the file is not in native OghmaNano
format.
15.2. SHAPE DATABASE 133

15.2 Shape database

All physical objects within a simulation are shapes. For example the following things are all
shapes; a layer of a solar cell; a layer of an OLED; a lens; a complex photonic crystal structure;
contact stripe on an OFET; the complex hexagonal contact on a large area device (see figure
1.2 for more examples). These shapes are defined using triangular meshes for example a box
which is used to define layers of solar cells, and layers of LEDs is defined using 12 triangles,
two for each side. This box structure can be seen in figure 15.12.

Figure 15.12: the box shape.

Shapes are stored in the shape database, this can be accessed via the database ribbon and
clicking on the Shapes icon, see figure 15.13. By clicking on the shape database icon the shape
database window can be brought up see figure 15.14.

Figure 15.13: Opening the shape database


134 CHAPTER 15. DATABASES

Figure 15.14: The shape database window

Try opening some of the shapes and have a look at them. You will get a window much like
that shown in figure 15.15. Figure 15.15 shows a honeycomb contact structure of a solar cell.
On the left of the window is the 3D shape, and on the right of the window is the 2D image
which was used to generate it. Overlaid on the 2D image is a zx projection of the 3D mesh.
The process of generating a shape involves first defining a 2D png image which you want to
turn into a shape, in this case the 2D image is a series of hexagons and a bar at the top. This
image is then converted into a triangular mesh using a discretization algorithm.
15.2. SHAPE DATABASE 135

Figure 15.15: An example of a shape generated from a 2D png image. The 3D shape repre-
senting a hexagonal contact from a solar cell is on the left of the figure while the original 2D
image is on the right.

Now try opening the shape morphology/1 and you should see a window such as the one
shown in figure 15.16, in the file ribbon find the icon which says show mesh. Try toggling it
of and on, you will see the 2D mesh become hidden and then visible again. This example is
a simulated bulk heterojunction morphology, but you can turn any 2D image into a shape by
using the load new image button in the file ribbon. Try opening the mesh editor by clicking on
Edit Mesh the file ribbon, you should get a window looking like figure 15.17. This configure
window has three main options x-triangles, y-triangles and method. The values in x-triangles,
y-triangles determine the maximum number of triangles used to discretize the image on the x
and y axis. Try reducing the numbers to 40 then click on Build mesh in the file ribbon.
136 CHAPTER 15. DATABASES

Figure 15.16: Clockwise from the top left; The imported absorption sepctrum; The basic
material parameters; The electrical parameters; and the Thermal parameters.

You will see that the number of triangles used to describe the image reduce. The more
triangles that are used to describe the shape the more accurately the shape can be reproduced,
however the more triangles are used the more memory a shape will take up and the slower
simulations will run. There is always a trade off between number of triangles used to discretize
a shape. Try going back to the Edit Mesh window and set method to no reduce and then click
on Build mesh from the file menu again. You will see that the complex triangular mesh as
been replaced by a periodic triangular mesh, which is more accurate but requires the full 70x70
triangles. The difference between the no reduce and Node reduce options are that no reduce
simply uses a regular mesh to describe and object and Node reduce starts off with a regular
mesh then uses a node reduction algorithm to minimize the number of triangles used in the
mesh.

Figure 15.17: The mesh editor window, accessed via the file ribbon.

As well as loading images from file, the shape editor can generate it’s own images for
standard objects used in science, the 2D image ribbon is visible in the right hand panel of
figure 15.16. There are options to generate lenses, honeycomb structures and photonic crystals.
15.2. SHAPE DATABASE 137

Each button has a drop down menu to the right of it which can be used to configure exactly
what shape is generated.
The final ribbon to be discussed is the Filters ribbon. This is used to change loaded images,
try turning on and off the threshold function. This applies a threshold to an image so that
RGB values above a given value are set to white and those below are set to black. There are
also other functions such as Blur, and Boundary which can be used to blur and image and
apply boundaries to an image.

Figure 15.18: The shape database

15.2.1 The shape file format


A shape has to be a fully enclosed volume, if you use the built in shape discretizer this will be
done for you automaticity. However if you are building shapes by hand you will have to enforce
this condition. Each shape directory contains the following files

File name Description


data.json Holds the configuration for the shape file
image original.png backup of the imported image
image out.png The final processed image
image.png The imported image which may be modified.
shape.inp The discretized 3D structure.

Table 15.2: The files within a shape directory

The png files are of images in various states of modification. The data.json file stores the
configuration of the shape editor and the shape.inp file contains the 3D structure of the object.
An example of a shape.inp file is shown below in 15.19. The file format has been written so that
gnuplot can open it using the splot command without any modification. As such each triangle
is comprised of four z,x,y points (lines 21-24), the first three lines define the triangle, and the
forth line is a repeat of the first line so that gnuplot can plot the triangle nicely. The number
138 CHAPTER 15. DATABASES

of triangles in the file is defined on line 18 using the #y command. The exact magnitudes of
the z,x,y values do not matter because as soon as the shape is loaded all values are normalized
so that the minimum point of the shape sits at 0,0,0 and the maximum point from the origin
sits at 1,1,1. When being inserted into a scene, the shape is then again renormalized to the
desired size of the object in the device.

Figure 15.19: An example of the shape.inp file.


15.3. FILTERS DATABASE 139

15.3 Filters database


This contains optical filters.
140 CHAPTER 15. DATABASES

15.4 Backups of simulations


Very often when running a simulation you want to make a copy of it before continuing to play
with the parameters. To do this click on the backup simulation button in the database ribbon
(see figure 15.1), this will bring up the backup window, see figure 15.20. If you click on the
”New backup” icon on the top right of the window, a backup will be made of your current
simulation. And an icon representing the backup will appear in the backup window. To restore
the backup double click on the icon representing your stored simulation. Note this backup
is only stored in the your local simulation directory, and is more of a checkpoint than a real
backup.... so make sure you have other copies of your simulation if it is very important to you..

Figure 15.20: Backing up a simulation


Chapter 16

Fitting experimental data

Related YouTube videos:

Advanced topics in fitting of JV curves to experimental data using OghmaNano.

Fitting transient photocurrent (TPC) and light JV curves using OghmaNano

Fitting the light JV curve of an ultra large area (2.5meter x 1cm) OPV device using OghmaNano

In the same way you can fit the diode equation to a dark curve of a solar cell to extract the
ideality factor, OghmaNano can be fit to experimental data using the fitting function. Fitting
is a good way to extract physical parameters from a device such as mobility, destiny of trap
states etc. The advantage of fitting a complex model such as OghmaNano to data rather than
simplistic analytical equations is that far more detailed information can be extracted and a
better physical picture of the underlying physics obtained. This section gives an overview of
the fitting tools in OghamNano.

16.1 Key tips and tricks


ˆ Generally speaking fitting is tricky process requiring a lot of patience and manual fine
tuning to get it to work. Don’t expect to click a button and for it to just work. You will
have to work to get nice fits.
ˆ If the fit is not working something may be wrong with the physical assumptions you have
made with your device. The model will only fit physically reasonable data so if something
is off by and order of magnitude go back and think again about what you are asking the
model to do. For example if you just can’t get Jsc to match on a solar cell, could it be
that your material just just not absorbing enough photons to get your desired Jsc value?
ˆ Different data sets provide different types of information. For example the dark JV curve
of a solar cell provides information about the shunt resistance, the series resistance, and
some information about mobility and recombination/tale states. However, the light JV
curve provides almost no information about the shunt resistance so don’t expect a fit
to the light JV curve to provide accurate estimates of Rshunt . Alway think about what
information is contained within your data before interpreting the numbers extracted from
a fit.
ˆ The fitting works process by: 1) Running a simulation; 2) Calculating the difference
between the numerical and experimental results; 3) tweaking the simulation parameters

141
142 CHAPTER 16. FITTING EXPERIMENTAL DATA

; 4) rerunning the simulation and seeing if the difference between the experiment and
simulation has reduced; 5) If the error has reduced the change of parameter is accepted
and the process repeated with a different parameter. This process continues hundreds or
thousands of times until an acceptable fit has been achieved. Therefore, to do a fit the
model must be run thousands of times, this means that for a fit to arrive at an answer
quickly, the individual simulation when run alone must be fast. So for example if your
simulation has 1000 mesh points, when fitting try reducing this to 10. Or if you have 1000
time steps try reducing this to 100. Every speed up in the base simulation will result in
a speed up in the fitting process.

ˆ Writing files to disk is the slowest part of any computational process. Even modern SSDs
are about 30 times slower than main memory for example the maximum write speed to
an SSD is 456 MB/s where as the bandwidth of a PC3-12800 memory module is 12,800
MB/s. When you save your files on USB drives, network storage drives, or even worse
the internet aka OneDrive or Dropbox, read write speeds again drop massively. Therefore
if you want your simulation to run fast save it on a local hard disk which is ideally and
SSD and not a mechanical drive and not being mirrored over the network.

ˆ As stated above writing files to disk is slow, therefore try to minimize the number of
files your simulation kicks out. Turn off things such as snapshots, optical output and the
dynamic folder. You can check if your simulation is dumping a lot of files by opening
your simulation directory in windows explorer and counting the files. A simulation set to
write very little to disk should have about 50 files in it. If your simulation directory has
hundreds of files in it then you need to find out why.

ˆ Although you can fit with the GUI, it can be slow. I personally tend to set up fits in the
GUI but run them from the command line. There is a section on how to do this below.

ˆ Fitting writes quite a lot of files to disk. Virus killers can slow down the fitting significantly
as they scan all the data files before they are written to disk.

16.2 The main fitting window

An example of how to fit the model to experimental data is included in the demo simulations
provided with OghmaNano. In this example a simple drift diffusion model is fit to some
experimental data. If you click on the New simulation icon in the File ribbon, this will bring
the new simulation window as seen in Figure 16.1a. Double click on the Scripting and fitting
icon, this will display the menu that can be seen in Figure 16.1b. From this menu double
click on the Fitting and parameter extraction example.(see 16.1a). If you open this simulation
you will be presented with the window shown in Figure (see 16.2), this is a simple solar cell
simulation. It should be noted that the fitting engine can be used to fit any simulation to any
data set.
16.2. THE MAIN FITTING WINDOW 143

Figure 16.1: a) The example fitting simulation can be found in the Scripting and fitting folder
b) The fitting example is called Fitting and parameter extraction example.

Figure 16.2: The main fitting window.

Figure 16.3: The fitting window can be accessed through the Automation ribbon, using the Fit
to experiment icon.

From the Automation ribbon in the simulation (Figure 16.3), click on the Fit to experiment
icon. This will bring up the fitting window (see figure 16.4). The icons in the ribbon of the
fitting window perform the following tasks:
ˆ New experiment: Currently the window is only displaying one set of experimental data
in this case a light JV curve. Using the New experiment button one can add other data
sets such as a dark JV curve to the fit. The more sets of data you fit against the more
accurate your extracted parameters will be but the harder the fit will be to perform and
the slower it will run.
144 CHAPTER 16. FITTING EXPERIMENTAL DATA

ˆ Delete experiment: This will remove a data set from the fit.

ˆ Clone experiment: This will clone the current data set to a new data set.

ˆ Rename experiment: This will rename the data set.

ˆ Export data: This will export the fit to a zip file.

ˆ Import data: This will import experimental data. The import wizard is explained else-
where.

ˆ Configure: This is used to configure the fitting variables, this is explained in detail below.

ˆ One iteration data: This will run the fit just once to see how close to the experimental
data it is. It is highly recommended to use this function and change the parameters by
hand to get a closish fit before running the automated fit.

ˆ Run fit: This will run the automated fitting algorithm. It will run forever, you have to
press the button again to stop it.

ˆ Fit this data set: This enables or disables the fitting of the data set currently being
viewed.

Figure 16.4: The main fitting window.

If you click the one fit button, the fit window will update and will look like 16.5a. You
can now see the difference between the experimental and simulated curves. The green line
represents the difference between the two curves, it is called the error function. It represents
the mathematical difference between the simulated and experimental data. If you now click
Run fit to start the fitting process, you should see the curves gradually start to get closer and
the error function decrease in value. Now click on the Fit progress tab, this plots the error
function as a function of fit iterations. Watch as the error drops off. It should start looking
16.3. SETTING THE VARIABLES TO FIT 145

like figure 16.5b. This process should take about 30 seconds, if it takes longer read section 16.1
above.

Figure 16.5: a) The result of clicking the one fit button. b) The error function dropping during
a simulation.

16.3 Setting the variables to fit


In figure 16.4, there is a Configure icon. If you click on this it will open the Fit variable window.
This window is used to configure the fitting variables. The tab entitled Fit variables defines the
variables we will fit. The more variables you fit at the same time the longer the fit will take.
Try to minimize the number of variables you are fitting. A good tip is to start of fitting with
symmetric parameters then only move to asymmetric parameters, once the fit becomes good.
(see figure 16.6). You can see from Figure 16.6, that there are 7 columns to the fit window,
they have the following functions:

ˆ Enabled: This enables or disables the fitting of that variable.

ˆ Variable: This describes the path of the variable to be fit in English.

ˆ Min: This is the minimum value the variable can take.

ˆ Max: This is the maximum value the variable can take.

ˆ Error function: If the variable strays out of the min-max range, this number will be added
onto the total fitting error. This idea is this scares the algorithm back into the allowed
range.

ˆ Log scale: This determines if the variable is fit on a log scale. For parameters which range
over many orders of magnitude it is often useful to make sure the algorithm can explore
the entire range.

ˆ Variable (json): This is usually hidden, but represents the full path of the parameter to
be fit in json format, it is this and not the English path that is used by the back end.
The English path is generated for humans and can indeed not be correct as long as the
json path is correct.
146 CHAPTER 16. FITTING EXPERIMENTAL DATA

Figure 16.6: Defining the variables to fit and their ranges.

16.4 Duplicating variables


The Fit Variable Window includes a tab called Duplicate Variables, which allows one parameter
to be copied onto another. In this example, we assume the device is symmetric, meaning we
only fit the electron parameter as a variable. However, we use the Duplicate Variables tool to
copy the newly fitted electron parameters onto the hole parameters. This approach enables us
to vary electron mobility during the fitting process while ensuring that hole mobility maintains
the same value at each step. (See Figure 16.7.)
If you examine the window closely, you will notice a column labeled ”Function y=f(x)”,
where the default value is set to ”x”. This function defines how the source variable is trans-
formed into the destination variable yy. For example, setting it to ”2*x” would double the
source variable each time it is copied. The available mathematical operations are detailed in
Table ??.

Figure 16.7: Defining which variables are duplicated to other variables.


16.5. FIT RULES 147

16.5 Fit rules


Also in the Fit variable window is a tab called Fit rules. This is used to enforce rules onto
the fit, using mathematical expressions. For example one can force one parameter to always be
bigger than another.

16.6 Minimizer configuration


Also in the Fit configure window is a tab called Configure minimizer. This configures the fitting
algorithm that is used for the fit. Fitting algorithms are an entire research field in themselves.
OghmaNano implements a few key algorithms to do the fitting. These are listed below. The
algorithm used can be selected from the Fitting method drop down box.

Figure 16.8: a) Configuring the simplex downhill minimizer b) Configuring the thermal anneal-
ing minimizer.

There are in general two types of fitting algorithms. The first class of algorithms are gradient
decent type, these attempt to effectively roll a ball down a hill to find the best fit. This class of
algorithm can be divided into two sub types, ones which require the gradient to be calculated
and those that do not. Calculating the gradient is computationally expensive and prone to
errors with complex models. Therefore, generally more reliable fitting with methods that do
not require the gradient to be explicitly calculate is usually more robust (in my exprience).
The second class of algorithm are statistical methods, these methods have the advantage that
the user does not only get a fit of the model to the data but a statistical distribution telling
him/her how probable (and unique) the fit is. These methods therefore often require longer
run times than down hill methods.

Method Downhill Gradient Statistical Comment


Nelder-Mead x Robust, slow, reliable
Newton x x Fragile, sometimes fast
Thermal Annealing x Surprisingly good
MCMC x ?
HMC x ?

Figure 16.9: Fitting methods implemented in OghamNano


148 CHAPTER 16. FITTING EXPERIMENTAL DATA

16.6.1 Nelder-Mead (Simplex Downhill)


The simplex downhill algorithm is the most often used fitting method in OghmaNano, all papers
published until 2024 used this method. More can be read about how the algroytham works
here: https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method. This minimizer has
the following options:

ˆ Stall steps: If fit error does not improve in this number of steps then the fit is considered
stalled and therefore stopped.

ˆ Disable reset at level: This will stop the fit restarting if fit error drops to below this level.

ˆ Fit define convergence: This is the level of error at which the fit will stop.

ˆ Start simplex step multiplication: This defines the size of the first fitting step, a smaller
value will mean the fitting algorithm will only change the initial numbers a bit, while a
large number will change the initial numbers a lot. If you want your fit to explore the
parameter space widely set this value to be greater than 1.0. If you want your fit to more
or less stay around where your initial parameters are set this value to be less than 1.0. A
value of 2.0 is considered big, a value of 0.1 is considered small.

ˆ Enable snapshots during fit: By default snapshots are turned off during fitting as they
produce a lot of disk access to allow them the be dumped to disk set this on.

ˆ Simplex reset steps: This sets after how many steps the simplex algorithm is reset. Re-
setting the algorithm can push the answer away from the solution, but it can also pop
the solver out of a valley if it has become trapped and allow better convergence.

The advantage of this method is that it effectively looks for an answer by rolling a ball down
hill. It also does not need to take gradients of the problem, which can be beneficial in complex
problem spaces.

16.6.2 Newton
Newton’s method is included for completeness. In my experience it is quite unstable when used
with fitting. This is a gradient method, thus requires derivatives to be calculated. This can
make the fitting process unstable, but the advantage is that it can be faster than Nelder-Mead
in some circumstances for some classes of problem.

16.6.3 Thermal Annealing


This is a classical thermal annealing algorithm. The algorithm will only explore the parameter
space defined by the allowed limits of the fit variables, thus to use this efficiently it is key to set
these limits correctly. I have found this method to be surprisingly good and often faster than
Nelder-Mead, however the final results are often not as polished as those for Nelder-Mead.

ˆ Dump every n steps: Writes the output to disk every n steps

ˆ Cooling constant: Defines how quickly the problem cools, the cooling takes the form of
e−k(Tstart −Tstop ) , where Tstart is 300K and Tstop is 0K.

ˆ Annealing steps: Defines the number of steps taken to get from Tstart to Tstop .
16.7. HOW THE FITTING PROCESS WORKS 149

16.6.4 Markov chain Monte Carlo (MCMC)

This method is under development.

16.6.5 Hamiltonian Monte Carlo (HMC)

This method is under development.

16.6.6 No-U-Turn Sampler (NUTS)

This method is under development.

16.7 How the fitting process works

When you click the ”Run fit” button, OghmaNano makes a new directory inside the simulation
directory called ”sim” this is the directory in which the fitting process takes place. Inside
this directory OghmaNano will make one new directory for each data set you are trying to
fit, it will populate each directory with the sim.json (and sim.oghma) files from your main
simulation directory. At this point the sim.json files in all the directories are identical. Then
using the contents of the fit ”fit patch” (see figure 16.10) the content of each sim.json file will
be updated, this process is called patching the simulation files. This process enables you to
adjust parameters in each simulation directory to match the data set you are trying to fit. For
example you might want one data set to have optical/light/Psun set 1.0 and another to be set
to 0.0 to enable fitting of a 1 sun JV curve and a dark JV curve. After patching each directory,
the fitting process then commences. During this process fitting variables in the sim.json files
in the ”sim” directory are updated. During the fit the algorithm will often produce fits which
are worse than the current best effort, and only sometimes produce fits which are better than
the current best effort. Only when a better fit is obtained will the sim.json file be updated in
the main simulation directory and the curves in the GUI also updated.
150 CHAPTER 16. FITTING EXPERIMENTAL DATA

Figure 16.10: The fit patch applied to each data set.

16.8 Fitting without the GUI


The GUI is a very easy and efficient way to setup a fit. However, it takes considerable CPU
time to update the user interface as the fit runs and this therefore slows the fitting process.
Therefore if you are doing lots of fitting or fitting difficult problems, fitting without the GUI
can be faster. This section covers how to fit from the Windows command line:

1. First set up your simulation you want to fit in the usual way using the GUI. Run a single
iteration of the fit to make sure it looks right. Then close the GUI.

2. Next we need to tell Windows where it can find OghmaNano, usually it has been in-
stalled in C:\Program files x86 \OghmaNano . If you open this directory you will see
lots of files. But the two key ones are oghma.exe and oghma core.exe. The file oghma.exe
is the GUI, oghma core.exe is the core solver, these are completely independent pro-
grams. The core solver can be run without the GUI. To tell windows where these files
are we need to add C:\Program files x86 \OghmaNano to the windows path. This can
be done by following these https://docs.microsoft.com/en-us/previous-versions/
16.8. FITTING WITHOUT THE GUI 151

office/developer/sharepoint-2010/ee537574(v=office.14) instructions. These in-


structions are for a modern version of Windows, but on your system things may be in
slightly different places. On most versions of windows the process is more or less the
same, if you get stuck google ”adding a path to window”.

3. Click on the start menu and type ”cmd” and enter to bring up a Windows terminal.
Type:

oghma_core.exe --help

Note it is a double dash before help not a single dash.


This should bring up some help for OghmaNano. If it does them we have successfully
told windows where oghma core.exe lives. If you get an error, try step 2 again (and/or
restart your computer).

4. Now that windows knows where oghma core.exe lives, we can navigate to our simulation
directory. Use cd to navigate to the directory where your simulation you want to fit is
saved.

5. First run the command oghma core.exe to see if your simulation runs OK. If it does not
then recheck your simulation file.

6. Now run a single fit by typing:

oghma_core.exe --1fit

Inspect the results in the ”sim” directory, use your favourite plotting program to compare
the results to the experimental data. Note the experimental data is stored in fit data(0-
1).inp.

7. If everything went well with the above step, you can run a real fit by typing:

oghma_core.exe --fit

Again those are double dashes before the fit command. Ctrl+C will terminate the fit.
You can check the progress of convergence by plotting fitlog.csv.
Chapter 17

Automation and Scripting

Often a user will have set up a simulation structure to represent a real world device but will
then ask the question: What happens to my solar cell efficiency as I change the mobility of the
active layer? Or what happens to the wavelength of my laser output as I change the thickness
of the Quantum Well. To answer these type of questions one must change one or more material
parameters over a range of values and then examine the simulation results. Clearly this could
be done by hand but there are better ways to automate this process.
There are three main ways to automate OghamNano simulations:

1. The first method is using the parameter scan window, this is described below in sec-
tion 17.1. The parameter scan window allows a user to vary a parameter (or multiple
paramters) in steps using the graphical user interface. No knowledge of coding is required
for this approach. The parameter scan window is useful if one wants to quickly examine
how a parameter influences the results and the scenario you are examining is not very
complex. The scan window fits most users’s needs most of the time.

2. For more fine grained control over how the parameters are varied the next method is
to use Python scripting, this is described in section 17.4. Python scripting allws the
user ultimate flexibility in adjusting all simulation parameters and running simulations,
Python is widely available which makes this approach very attractive.

3. The third way is through MATLAB scripting, this is described in section 17.4.3. The
advantage of MATLAB scripting is that lots of people can code in MATLAB so makes
automating OghmaNano very accessable. The downside of using MATLAB is that it is
quite expensive and not all people have access to it. An alternative to MATLAB would
be Octave however at the time of writing it does not have a json reader/writer.

Or option 4: All the above methods rely on the same principles: The OghmaNano simulation
save file is systematic edited and the back end of the software oghma core.exe run on the
sim.oghma file to generate new results. Key to understanding how scripting works is to realize
that the sim.oghma is simply a zip file (See 14.1) with a json file (sim.json) inside it, and if one
can edit the json file (using any language you want ActionScript, C, C++, C#, Cold Fusion,
Java, Lisp, Perl, Objective-C, OCAML, PHP, Python, Ruby etc... ) the you can automate
OghmaNano.

152
17.1. THE PARAMETER SCAN WINDOW 153

17.1 The parameter scan window


Related YouTube videos:

Using the parameter scan tool in OghmaNano

The most straight forward way to systemati-


cally vary a simulation parameter is to use the
scan window. In this example we are going
to systematic change the mobility of the ac-
tive layer of a PM6:Y6 solar cell, you can find Figure 17.1: Step 1: Select the Parameter scan
this example in the example simulations un- tool, to bring up the parameter scan window.
der Scripting and fitting/Scan demo (PMY:Y6
OPV). Once you have located this simulation
and opened it, you then need to bring up the
parameter scan window, this can be done by
clicking on the Parameter scan icon in the Au-
tomation ribbon (see Figure 17.1). Then make
a new scan by clicking on the new scan button
(1) (In the example simulation this has already
been done for you). Open the new scan by dou-
ble clicking on the icon representing the scan
(2), see figure 17.2. This will bring up the scan
window, see figure 17.3. Figure 17.2: Step 2: Make a new parameter
scan, then double click on it to open it.

17.1.1 Changing one material parameter


Once the scan window has opened, make a new scan line by clicking on the the plus icon (1) in
figure 17.3, then select this line so that it is highlighted (2), then click on the three dots (3) to
select which parameter you want to scan. Again if you are using the example simulation this
will already have been done for you.

Figure 17.3: Step 3: Add a ’scan line’ to the scan.


154 CHAPTER 17. AUTOMATION AND SCRIPTING

In this example we will be selecting the elec-


tron mobility of a PM6:Y6 solar cell. Do this
by navigating to epitaxy→ PM6:Y6→ Drift
diffusion→ Electron mobility y. Highlight the
parameter and then click OK. This should then
appear in the scan line. The meaning of
epitaxy→ PM6:Y6→ Drift diffusion→Electron
mobility y will now be explained below:

ˆ epitaxy: All parameters in the .oghma file


are exposed via the parameter selection
window see 17.4. This file is a tree struc-
ture, see 14.1. The device structure is de-
fined under the heading epitaxy.

ˆ PM6:Y6: Under epitaxy each layer of the


device is given by its name. The active
layer in this device is called PM6:Y6, if
your active layer was called Perovskite
or P3HT:PCBM you would have selected Figure 17.4: Step 5: Select the parameter you
this instead. want to scan in the parameter selection win-
dow, in this case we are selecting epitaxy→
ˆ Drift diffusion: All electrical parameters PM6:Y6→ Drift diffusion→ Electron mobility
are stored under the sub heading drift dif- y.
fusion.

ˆ Electron mobility y: One can define asymmetric mobilities in the z,x and y direction -
this is useful for OFET simulations. However by default the model assumes a symmetric
mobility which is the same in all directions. This value is defined by Electron mobility y.

Next enter the values of mobility which you want to scan over in this case we will be entering
1e-5 1-6 1e-7 1e-8 1e-9 (see figure 17.5 1) then click run scan (see figure 17.5 2). OghmaNano
will run one simulation on each core of your computer until all the simulations are finished.

Figure 17.5: Step 6: Enter the input values of mobility (or other values) you want to scan over
(1). Then run the simulations.

To view the simulation results click on the output tab this will bring up the simulation
outputs, see figure 17.6. You can see that a directory has been created for each variable that
we scanned over so 1e-5, 1e-6, 1e-7, 1e-8 and 1e-9. If you look inside each directory it will be an
exact copy of the base simulation directory. If you double click on the files with multi-colored
JV curves, see the red box in figure 17.6. OghmaNano will automaticity plot all the curves
from each simulation in one graph, see figure 17.7.
17.1. THE PARAMETER SCAN WINDOW 155

Figure 17.6: Step 7: The output tab showing the five simulation directories and the multicolored
plot files.

Figure 17.7: Step 8: The result of the mobility scan.

17.1.2 Duplicating parameters - changing the thickness of the active


layer
Very often one wants to change a parameter, then set another parameter equal to the parameter
which was changed. An example of this is one may want to change electron and hole mobilities
together when simulating a device with symmetric mobilities. This can be done using the
duplicate function of the scan window as seen in figure 17.8. In this example we tackle a
slightly more tricky problem than changing mobilities together we are going to change the
physical width of the active layer and at the same time adjust the electrical mesh to make it
match. As discussed in section 8 the width of the active layer must always match the width of
the electrical mesh. When you change the layer width by hand in the layer editor OghmaNano
updates the width of the electrical mesh for you. But when scripting the model it won’t do
156 CHAPTER 17. AUTOMATION AND SCRIPTING

this update for you. Therefore in the example below we are going to set the width of the active
layer by scanning over:
epitaxy→PM6:Y6→dy of the object

Then we are going to add another line under and under parameter to scan select

mesh→mesh y→segment0→len

and set it to

epitaxy→PM6:Y6→dy of the object

under the operation dropdown box. You will see the word duplicate appear under values.

If you now run the simulation ”epitaxy→PM6:Y6→dy of the object” will be changed and
”mesh→mesh y→segment0→len” will follow it.

Figure 17.8: Duplicating material paramters.

Side note: Device with multiple active layers


The sum of the active layer thickness (as defined in the layer editor) MUST equal the electrical
mesh thickness (more about the mesh in section 8). If for example one had three active layers
TiO2 (100 nm)/Perovskite (200 nm)/Spiro (100 nm) with a total width of 400 nm. The total
mesh length must be 400 nm as well. Therefore were one want to change the thickness of the
perovskite layer as in 17.8 one would have to break the electrical mesh up into three sections
and make sure you were updating the mesh segment referring to the perovskite layer alone.

17.1.3 Setting constants


Often when running a parameter scan one wants to set a constant value, this can be done using
the ”constant” option in the Operations dropdown menu. See figure 17.9

Figure 17.9: The result of the mobility scan.


17.1. THE PARAMETER SCAN WINDOW 157

17.1.4 The equivalent of loops


Often when scanning over a parameter range one may want to simulate so many parameters
that it is not practical to type them in. In this case OghmaNano has the equivalent of a loop.
So for example if one wanted to change a value from 100 to 400 in steps of 1, one could type

[100 400 1]

Listing 1: The equivalent of loops in OghmaNano, this is often quicker than typing parameters
in by hand.

17.1.5 Limitations of the scan window


Although the scan window is convenient in that it provides a quick way to scan simulation
parameters, it is by nature rather limited in terms of flexibility. If you want to do complex
scans were multiple parameters are changed or to programmatically collect data from each
simulation then you can use the or matlab interfaces to OghmaNano. These are described in
the latter sections.
158 CHAPTER 17. AUTOMATION AND SCRIPTING

17.2 Multiparameter device optimizer


Related YouTube videos:

Optimizing the layer structure of a Perovskite solar cell

Optimizing an OPV device for maximum photon harvesting.

Searching for the optimum layer structure in an organic solar cell.

Very often when optimizing a device an engineer or scientists will be want to know what
the optimum structure of a device is. For example a perovskite solar cell is made up of multiple
layers, but what is the optimum thickness of each layer? If the perovskite layer is made really
thick then lots of light will be absorbed but the down side of this is that it will take longer for
charge carriers to escape the device so recombination will be high. Conversely if the layer is
made really thin very few carriers will have a chance to recombine as they will not spend long
in the device but the downside is that not many photons will be absorbed in the first place as
the layer is thin. If one then also considers that light will reflect multiple times of interfaces
in the device setting up standing wave pattens, this will further complicate the optimization
problem as one will need to optimize not only the thickness of the perovskite layer but also
the thicknesses of all other layers at the same time. To solve this multi-parameter optimization
problem one can use the Fast optimizer within the scan window.

17.2.1 Using the multi parameter optimizer


In the new simulation window under the sub-topic Scripting and fitting there are several ex-
amples of multi-parameter optimizers:

ˆ Electrical layer optimizer: This will vary the layer thickness of two active layers of an
organic solar cell simulation and plot the PEC/FF/Voc as a function of these layer thick-
nesses.

ˆ Optical layer optimizer (perovskite): This will vary the thickness of two layers in a per-
ovskite solar cell and plot the current generated by each layer within the device.

ˆ Optical layer optimizer (OPV): This will vary the thickness of two layers in a perovskite
solar cell and plot the current generated by each layer within the device.

In this text we will be using the Optical layer optimizer (perovskite), if you open this
simulation and navigate to the scan window, you will see a scan already set up called optimizer.
If you open it you will get a window shown in figure 17.10. This scan window looks just like
the scan windows described in the previous section, however the key difference is that the Fast
optimizer button is depressed. When this button is depressed scan results are not written to
disk, instead the key simulation parameters are tabulated and saved to disk at the end of the
simulation. Notice that in this example we are varying the thickness (dy) of the Perovskite
layer between 300nm and 500 nm in steps of 10 nm and the thickness (dy) TiO2 layer from 100
nm to 300 nm also in steps of 10 nm. Try running the simulation, the using windows explorer
17.2. MULTIPARAMETER DEVICE OPTIMIZER 159

Figure 17.10: The scan window with the optimizer button depressed ready to run a device layer
optimization.

navigate to your simulation directory, then open the folder called optimize and in there you
will find a csv file called optimizer output.csv. If you open this with Excel or LibreOffice, it
will look like figure 17.11.
If you examine figure 17.11 carefully you can see the first two columns are labelled epi-
taxy.layer2.dy and epitaxy.layer1.dy . These are the layer thicknesses we decided to change in
the scan window. For every subsequent layer in the device there are two columns, labelled lay-
erX/light frac photon generation and layerX/J. These refer to the fraction of the light absorbed
with in the layer and the maximum current this layer would produce if all the light absorbed
within the layer were turned into current. Clearly if light is absorbed within the active layer
it has a good chance of being turned into current, however if light is absorbed within the back
metallic contact then there is little chance of that light being turned into electrical current.
If you use the sorting tools included within Excel/LibreOffice you can figure out which device
structures produce the most current.
160 CHAPTER 17. AUTOMATION AND SCRIPTING

Figure 17.11: The file your simulation directory/optimizer/optimizer output.csv


opened in LibreOffice (You can use Excel).
17.3. PYTHON/MATLAB SCRIPTING OF OGHMANANO 161

17.3 Python/MATLAB scripting of OghmaNano

Scripting offers a more powerful way to interact with gvpdm. Rather than using the graphical
user interface, you can use your favourite programming language to interact with OghmaNano.
This gives you the option to drive simulations in a far more powerful way than can be done
using the graphical interface alone. Below I give examples of using MATLAB and python to
drive OghmaNano, but you can use any language you want which has a json reader/writer.
Pearl and Java are two languages which spring to mind.
Before you begin scripting OghmaNano you need to tell windows where OghmaNano is
installed, the default OghmaNano will be installed to C:\Program files x86 \OghmaNano, in
there you will see in this directory there are two windows executables, one called oghma.exe,
this is the graphical user interface, and a second .exe, called oghma core.exe. You can run
oghma core.exe from the command line without oghma.exe. You simply need to navigate to
a directory containing a sim.oghma folder and call oghma core.exe, this can be done from the
windows command line, matlab, python or any other scripting language. However, before you
can do this on windows, you need to add C:\Program files x86 \OghmaNano to your windows
path so that windows knows where OghmaNano is installed. An example of how to do this
on a modern version of windows is given in the link https://docs.microsoft.com/en-us/
previous-versions/office/developer/sharepoint-2010/ee537574(v=office.14)
Every new version of windows seems to move the configuration options around, so you may
have to find instructions for your version of windows.

17.4 Python scripting

Related YouTube videos:

Python scripting perovskite solar cell simulation

There are two ways to interact with .oghmafiles via python, using native python commands
or by using the OghmaNano class structures, examples of both are given below.

17.4.1 The native python way

As described in section 14.1, .oghmafiles are simply json files zipped up in an archive. If you
extract the sim.json file form the sim.oghmafile you can use Python’s json reading/writing code
to edit the .json config file directly, this is a quick and dirty approach which will work. You
can then use the os.system call to run oghma core to execute OghmaNano.
For example were one to want to change the mobility of the 1st device layer to 1.0 and then
run a simulation you would use the code listed in listing 2.
162 CHAPTER 17. AUTOMATION AND SCRIPTING

import json
import os
import sys

f=open('sim.json') #open the sim.json file


lines=f.readlines()
f.close()
lines="".join(lines) #convert the text to a python json object
data = json.loads(lines)

#Edit a value (use firefox as a json viewer


# to help you figure out which value to edit)
# this time we are editing the mobility of layer 1
data['epitaxy']['layer1']['shape_dos']['mue_y']=1.0

#convert the json object back to a string


jstr = json.dumps(data, sort_keys=False, indent='\t')

#write it back to disk


f=open('sim.json',"w")
f.write(jstr)
f.close()

#run the simulation using oghma_core


os.system("oghma_core.exe")

Listing 2: Manipulating a sim.json file with python and running a OghmaNano simulation.

If the simulation in sim.json is setup to run a JV curve, then a file called sim data.dat will
be written to the simulation directory containing paramters such as PCE, fill factor, Jsc and
Voc . This again is a raw json file, to read this file in using python and write out the value of
Vo c to a second file use the code given in listing 3.

f=open('sim_info.dat')
lines=f.readlines()
f.close()
lines="".join(lines)
data = json.loads(lines)

f=open('out.dat',"a")
f.write(str(data["Voc"])+"\n");
f.close()

Listing 3: Reading in a sim data.dat file using Python’s native json reader.
17.4. PYTHON SCRIPTING 163

17.4.2 PyOghma

One can get a long way by manipulating the OghmaNano json files directly with python as
described in 17.4.1. However, using this approach it is not possible (very easy) to run multiple
simulations at the same time. And as most modern CPUs have 8 or more cores it seems a
waste not to be running multiple simulations when generating large data sets. Furthermore,
manipulating json files in Python is not very intuitive and not very python like. For this
reason Cai Williams has written an API called PyOghma which can be used to manipulate
OghmaNano json files and also run simulations. This is a stand alone project to OhgmaNano,
so direct any questions about this to him!

PyOghma is available on GitHub and also via pip:

python -m pip install PyOghma

An example of using PyOghma is given below 4:


164 CHAPTER 17. AUTOMATION AND SCRIPTING

import PyOghma as po

Oghma = po.OghmaNano()
Results = po.Results()

source_simulation = "\exapmle\pm6y6\"

Oghma.set_source_simulation(source_simulation)

experiment_name = 'NewExperiment'

Oghma.set_experiment_name(experiment_name)

mobility = 1e-5
trap_desnsity = 1e-18
trapping_crosssection = 1e-20
recombination_crosssection = 1e-20
urbach_energy = 40e-3
temperature = 300
intensity = 0.5

experiment_name = 'NewExperiment' + str(1)


Oghma.clone('NewExperiment0')

Oghma.Optical.Light.set_light_Intensity(intensity)
Oghma.Optical.Light.update()

Oghma.Thermal.set_temperature(temperature)
Oghma.Thermal.update()

Oghma.Epitaxy.load_existing()
Oghma.Epitaxy.pm6y6.dos.mobility('both', mobility)
Oghma.Epitaxy.pm6y6.dos.trap_density('both', trap_desnsity)
Oghma.Epitaxy.pm6y6.dos.trapping_rate('both', 'free to trap',..
trapping_crosssection)
Oghma.Epitaxy.pm6y6.dos.trapping_rate('both', 'trap to free',..
recombination_crosssection)
Oghma.Epitaxy.pm6y6.dos.urbach_energy('both', urbach_energy)
Oghma.Epitaxy.update()

Oghma.add_job(experiment_name)
Oghma.run_jobs()

Listing 4: Using PyOghma to run a simulation.

In this example PyOghma is imported as po, and a source OghmaNano json file is manipu-
lated by changing the values of mobility, trap density, trapping rate and Urbach Energy. The
17.4. PYTHON SCRIPTING 165

original file is cloned with the line:

Oghma.clone('NewExperiment0')

Then at the end of the code the following two lines. The first of which adds the job to the
job list in PyOghma. And the second line tells PyOghma to execute all the jobs. If there were
more than one job PyOghma would execute multiple jobs across all CPUs, until they were all
finished. If for example one wanted to run simulations with different values of mobility, one
would add each simulation to the jobs list, then call run jobs once to run the jobs across all
cores in an efficient way.

Oghma.add_job(experiment_name)
Oghma.run_jobs()

More information about PyOghma is available on the GitHub page.


166 CHAPTER 17. AUTOMATION AND SCRIPTING

17.4.3 MATLAB scripting


As described in section 14.1 OghmaNano simulations are stored in .json files zipped up in-
side a zip archive. Matlab has both a zip decompressor and a json decoder. Therefore it
is straight forward to edit and read and edit .oghma files in MATLAB. You can then use
MATLAB to perform quite complex parameter scans. The example script below in listing
5 demonstrates how to run multiple simulations with mobilities ranging from 1e-7 to 1e-
5 m2 V −1 s−1 ). The script starts off by unzipping the sim.json file, if you already have ex-
tracted your sim.json file from the sim.oghma file you don’t need these lines. The code then
reads in sim.json using the MATLAB json decoder jsondecode. A new directory is made
which corresponds to the mobility value, the sim.oghma file copied into that directory. Then
json data.epitaxy.layer0.shape dos.muey is set to the desired value of mobility and the sim-
ulation saved using jsonencode and f open, f printf, f close. The system call is then used to
run oghma core.exe to perform the simulation. Out put parameters such as Jsc are stored in
sim data.dat again in json format, see section 4.1.4, although this is not done in this simple
script.
17.4. PYTHON SCRIPTING 167

if exist("sim.oghma", 'file')==false
sprintf("No sim.oghma file found"); %Check if we have a sim.oghma file
end

if exist("sim.json", 'file')==false
unzip("sim.oghma") %if we don't have a sim.json file
%try to extract it
end

A = fileread("sim.json"); %Read the json file.


json_data=jsondecode(A); %Decode the json file

mobility=1e-7 %Start mobility


origonal_path=pwd %working with the current dir
base_dir="mobility_scan" %output directory name
while(mobility<1e-5)
dir_name=sprintf("%e",mobility);
full_path=fullfile(origonal_path,base_dir,dir_name) %join paths
mkdir(full_path) %make the dir
cd(full_path) %cd to the dir

%Update the json mobility


json_data.epitaxy.layer0.shape_dos.mue_y=mobility %Change mobility
%of layer0

copyfile(fullfile(origonal_path,"sim.oghma"),\\
fullfile(origonal_path,base_dir,dir_name,"sim.oghma"))

%now write the json file back to disk


out=jsonencode(json_data);
json_data
fid = fopen("sim.json",'w');
fprintf(fid, '%s', out);
fclose(fid);

%run oghma - This won't work if you have not added the oghma
%install directory to your windows paths
system("oghma_core.exe")

%Multiply mobility by 10
mobility=mobility*10;
end

%Move back to the original dir


cd(origonal_path)

Listing 5: An example of how to call OghmaNano from MATLAB


168 CHAPTER 17. AUTOMATION AND SCRIPTING

17.4.4 The built in calculator


OghmaNano has a built-in calculator that can be used to perform simple mathematical oper-
ations. This functionality is useful for setting up fitting procedures and defining equations in
various parts of the code. The calculator is based on Reverse Polish Notation (RPN).

Supported Operations

Operation Operator Example


Exponentiation ˆ 2 ˆ3 = 8
Multiplication ∗ 2∗3=6
Division / 6/2 = 3
Addition + 2+3=5
Subtraction − 5−3=2
Greater than > 5 > 3 is 1
Less than < 2 < 5 is 1
Greater than or equal >= 5 >= 5 is 1
Less than or equal <= 3 <= 4 is 1

Table 17.1: Arithmetic and Comparison Operators

Supported Functions

Function Name Function Example


Sine sin sin(π/2) = 1
Cosine cos cos(0) = 1
Absolute Value abs abs(−3) = 3
Positive Value pos pos(−3) = 0, pos(3) = 3
Logarithm (base 10) log log(100) = 2
Exponential exp exp(2) = e2
Square Root sqrt sqrt(9) = 3
Minimum min min(2, 3) = 2
Maximum max max(2, 3) = 3
Random rand rand(a, b) generates a random number between a and b
Log-random randlog randlog(a, b) generates a log-random number between a and b

Table 17.2: Supported Functions


Chapter 18

Machine learning

This chapter overs generating machine learning datasets using OghmaNano. Typically you
would generate these datasets then use external software such as https://www.tensorflow.org
to perform the learning/prediction.

18.1 Generating ML datasets

18.1.1 Introduction

One will often want to extract physical device parameters form a set of data using modelling.
For example you may have a set of JV curves and what to extract the charge carrier mobility
and recombination rate for that device. The traditional way of doing this would be to fit a
model such as OghmaNano to the data set (This is described in section 16). The drawback of
this approach is that it can take a significant amount of time to fit one data set, furthermore
when one has multiple data sets the challenge can be significant. The fitting process is complex
and requires someone who is an expert in simulation with a lot of patience to perform it. This
is the reason why fitting of device models to experimental data is only performed by a small
subset of the community.
A more modern approach to this problem is to use machine learning. With this approach
rather than trying to fit a single JV curve, one will set up a simulation representing the device
structure. However, rather than fitting the individual electrical parameters to the data set, one
will generate many thousands copies of that one device but with randomly chosen electrical
parameters. Each one of these devices is referred to as a virtual device. A simulation program
such as OghmaNano will then be used to generate JV curves for each of these virtual devices.
Thus the user will have JV curves and the corresponding electrical parameters for each virtual
device. This data set can then be used to train a machine learning model to predict the electrical
parameters from JV curves. Thus, OghmaNano is acting as a forward transform, transforming
electrical parameters to simulated experimental data, then the machine learning is acting as
the reverse transform that can reverse the simulation process. Once trained this model can
then be used to extract material paramters from real devices.
Advantages of this approach is that once the machine learning algorithm is trained it can
extract material parameters within seconds from a device and the user does not need to be
an expert at simulation to use the trained network. However, for this method to work is key
to generate a large data set on which to train the machine learning models. This process is
described in the following pages.

169
170 CHAPTER 18. MACHINE LEARNING

Figure 18.1: The main simulation window showing the Automation ribbon, within this ribbon
the Machine learning icon can be seen.

18.1.2 Generating a machine learning dataset


This section assumes you have correctly configured your device layer structure in the layer
editor. However, if you want to start with a preconfigured simulation you will be able to find
this example in the New Simulation window under the ML Example. Figure 18.1 shows the
main window for a configured device, in the automation ribbon you will see a Machine learning
icon which looks like a round blue circle. If you click on this then it will open the main machine
learning window show in Figure 18.2.
The main purpose of this window is to build large data sets for training machine learning
algorithms. The data set we are generating is called example. The first tab that you can see
open is called Simulations. In this tab one defines the simulations you want performed for each
virtual device. In this case we will simulate a dark curve and 9 light curves varying between
0.0001 Suns and 1.0 Suns. The simulations can be disabled by setting Enabled to off. If one
clicks on the the Edit button for the line light 0.0001 in the Patch column, the Patch window
shown in Figure 18.3 will appear.
The purpose of the Patch window is to change parameters in the virtual simulation. For
example in our case we which to simulate a dark JV curve and nine different light intensities,
therefore for each of these simulation the light intensity must be correctly adjusted. If one opens
the patch window for light 0.0001, you will see that the simulation variable optical/light/Psun
which controls the light intensity is set to 0.0001. If one opens the patch window for dark,
one will see that the value of optical/light/Psun is set to 0.0. In this way using the same base
simulation multiple experiments under different conditions can be simulated.
If one now clicks on the Edit button in the Vectors column for the line light 0.0001 in Figure
18.2 the vectors window will appear, this is shown in Figure 18.4.
The vectors window is used to define what data is extracted from the finished simulation to
act as a machine learning input vector. In this case we are extracting data points between -2.0
and 1.4 V from the file jv.dat, which contains the current voltage curve. If one were simulating
a time domain measurement one may wish to extract various time points from the time i.csv
file or any other appropriate file. The number of points chosen to form the vector is arbitrary
and up to the user. A longer input vector will make the machine learning process slower, but
potentially capture more features of the JV curve.
The next step is to set up which variables one wishes to randomize, this is done in the
Random variables tab of the main machine learning window. The window has five columns;
the first column (Enabled) dictates if the random variable is used; the second column (Variable)
18.1. GENERATING ML DATASETS 171

Figure 18.2: The main machine learning window.

Figure 18.3: The simulation patch window, this window is used to change a value in a sub
simulation, in this example we are changing the light intensity.

Figure 18.4: The vectors window, this window defines what data is extracted from the simula-
tion as a machine learning vector.
172 CHAPTER 18. MACHINE LEARNING

Figure 18.5: The random variables that are used for the machine learning.

sets which variable is changed; the third column (Min) sets the minimum allowed value of the
random value; the forth column (Max) sets the maximum allowed value of the random value;
and the final column (Random function) dictates if the random variable should be chosen on
a log or linear scale. Log scales are recommended for variables which span multiple orders
of magnitude while linear scales are recommended if the variable spans around an order of
magnitude. A log distribution will ensure that an evenly distributed span of numbers are
chosen across the range when viewed on a log scale. An example of a linear parameter would
be Urbach energy as it typically would vary from 30 to 150 meV and example of a log variable
would be trap density as it typically can vary from 1 × 1015 m−3 − 1 × 1025 m−3 .
Once the simulation has been set up, is is now time to consider how many virtual devices
with randomized parameters one wishes to generate. If the Settings window is opened, see
Figure 18.6 one can configure how many virtual devices are generated. This is controlled with
two parameters, Simulations per archive (Nsim ) and Number of archives (Narc ). These two
numbers multiplied together gives you the total number of virtual devices generated. The
generated simulation results are saved in zip files called archives, each archive will contain Nsim
simulations. So in the example seen here, we will generate Nsim ∗ Narc 3000 virtual devices
stored across 100 zip files. It is important to note that for our example each virtual device
will contain one dark JV curve simulation and 9 light simulations. Thus the number of files
generated can quickly grow quite large. To prevent this being a problem the simulations are
run in batches, with Nsim simulations being first generated then run by OghmaNano, then
stored in a zip archive until Narc archives are generated. In this way if the generation process is
interrupted and one only looses the content of the archive currently being generated. Breaking
up the data set like this also makes it easier to copy the files and more immune to corruption.
Data generation will run across all CPU cores on your machine while archive generation will
18.1. GENERATING ML DATASETS 173

Figure 18.6: Configuring the data generator.

Figure 18.7: Left: The content of the Example directory; Right inside archive0.zip

only run on one core.


If now the Run generator button is pressed in the main Machine learning window Figure
18.2, OghamNano will start generating the simulations. After it is done, a directory called
example will appear in your simulation directory, see the left of Figure 18.7. [Note to save
time in this example Simulations per archive was set to 10 and Number of archives was set
to 3]. The errors.dat file will contain any errors produced during the simulation. If one opens
archive0.zip one will see the right of Figure 18.7.
Each of these directories is named with a random 16 digit hexadecimal number, each direc-
tory contains an entire set of simulations for one virtual device. So in our case each directory will
contain one dark simulation and nine light simulations. The content of one of these directories
is shown in the left of Figure 18.8. If one opens one of these files one can see Figure 18.8 right,
one can see that it contains a full OghamNano simulation. There is sim.json file there and also
the jv.dat file which contains the JV curve generated during the simulation. This directory
contains some extra data including optical outputs and a cache file. It is recommended to try
to minimize all output when generating these files otherwise the total size on disk becomes very
large, this can be done by turning all the output verbosity options to produce minimal output.
In the above example we only have three archives but in a normal simulation run one would
have up to 200 archives each with 200 simulations in each. Once the simulations have been
performed one needs to convert these raw OghmaNano simulations into a vectors file for the
machine learning algorithm. If one clicks on the Build vectors icon in the main machine learning
174 CHAPTER 18. MACHINE LEARNING

Figure 18.8: Left: The content of the Example directory; Right inside archive0.zip

window 18.2, OghamNano will open each virtual simulation and compile the it to a vectors file.
The vectors file can be seen in Figure 18.9.
This vectors file is a json file containing all the data needed for training a machine learning
algorithm. Each virtual device in the data set will have a section in the file. So for example in
this figure we are looking at the section relating to device 2cbd08c0fd7eb406 (line 3), we can
see under the heading params what electrical parameters were randomly chosen for this device.
Followed by the vectors representing the dark JV curve (line 19) and the light JV curve at
0.0001 Suns (line 22). These values in this example are in Am−2 , however they will always be
the same as the file from which they are extracted. So in this case jv.dat contains Volts v.s.
Am−2 therefore the values of the vector are Am−2 . After this key device parameters such as
PCE are dumped. There will be one entry in this file for each virtual device generated. Once
you have this file, you can feed it into the machine learning algorithm of your choice. Some
users report that it is easier to feed this data into tensor flow if it is first converted into a CSV
file, this can be done using the standard Python libraries.

18.1.3 Setting up machine learning algorithms to process the data


The above section describes how to generate machine learning data sets. Setting up the
algorithm it’s self is a large topic on it’s own. However there are many good examples at
https://www.tensorflow.org/.
18.1. GENERATING ML DATASETS 175

Figure 18.9: The final vectors file in json format. This file can be fed into machine learning
model as a training set.
Chapter 19

Output files

In general writing to disk is slow on even the most modern of computers with an SSD. The
seek speed of mechanical disks has increased little of their history. Thus often writing the
output data to the hard disk is the most time consuming part of any simulation. By default
OghmaNanowrites all output files to disk this is so the new user can get a feel for what output
OghmaNanocan provide. However to speed up simulations you should limit how much data is
written to disk. The simulation editor windows (steady state,time domain etc..) offer options
to decide how much data you want to dump to disk. This is shown in figure 19.1

[H]
Figure 19.1: Selecting which output files are written to disk.

The option ”Output verbosity to disk” can be toggled between ”None” and ”write everything
to disk”. When ”None” is selected nothing is outputted to disk at all - even simulation results
are not written. When ”write everything to disk” is selected the simulation dumps everything
to disk, so JV curves and all internal variables of the solver are written to disk so that the user
can examine how carrier densities, fermi-levels, potentials etc.. change during the course of
the simulation (see section 19.1). The second option below ”Output verbosity to disk” called
”dump trap distribution” will write out the distribution of traps in energy and position space.

176
19.1. SNAPSHOTS DIRECTORY - DIR 177

See section 19.2.

19.1 Snapshots directory - dir

The snapshots directory (see figure 19.2) allows the user to plot all internal solver parameters.
For example figure 19.3 where the snapshots tool is being used to plot the conduction band,
valance band and quasi Fermi-levels as a function of voltage. The slider can be used to view
different voltages.

Figure 19.2: The file viewer showing the snapshots and trap map directory
178 CHAPTER 19. OUTPUT FILES

Figure 19.3: Using the snapshots tool to view the conduction band, valance band and quasi
Fermi-levels

19.2 Trap map directory - dir

The trap map directory contains the distribution and density of carriers in the traps as a
function of position and energetic depth. An example is given in figure 19.4
19.3. OPTICAL SNAPSHOTS - DIR 179

Figure 19.4: Plotting the position and energy dependence of carriers using the trap map tool

19.3 Optical snapshots - dir


Contains results of the optical simulations.

19.4 Cache - dir


Getting a computer to do math is on the whole a slow thing to do. It’s much faster to
precalculate results then store the answers in a look up table. This can speed up calculations
significantly. The cahce dir stores the results of such precalculations, you can delete if you want
it OghmaNanowill just remake it when it runs.

19.5 Equilibrium directory


Before the solver starts any simulation it solves the device equations in the dark with 0V applied
bias. The result of this calculation are placed in this directory. The practical reason for doing
this is that Newton’s method only works if you give it a reasonable starting guess for any given
problem. Thus to start the solver, we guess the carrier densities at 0V in the dark, we then
use Newton’s method to calculate the exact carrier density profiles at 0V in the dark (results
are stored in the equilibrium directory), then from this point we can work our way to other
solutions say at +1V in the light.[?]
180 CHAPTER 19. OUTPUT FILES

19.5.1 Optical simulation


JSON token Meaning Units Ref
Jphoto Photo current density Am−2
Iphoto Photo current A

19.6 File formats


Almost all input and output files associated with OghmaNanoare human readable, meaning
that they are straight up text files. All output files can be directly plotted in gnuplot/excel as
can the input files. Output files are currently called .dat, but they are simply text files. All
configuration files are in json format so can be edit directly or by using the python json library.

19.6.1 .dat files


This type of file is a straight text file which can be imported into excel or any other plotting
program. It contains two columns of data x and y. There is also a preamble in the file containing
information such as units etc.. OghmaNanois moving from .dat files to .csv files.

19.6.2 .csv files


This is a straight csv file as you would expect which can be imported into any text editor. The
first line of the file is a json string containing information such as units etc. You can ignore
this. The second line of the file describes the x/y data in a human readable form then the rest
of the file contains the data.

19.6.3 Binary .csv files - files which are not human readable
In some cases it is not practical to dump text files. Examples are when dealing with 3D
structures. In this case OghmaNanowill dump the same json header as used in the csv file but
then dump a series of C floats representing the data.
Chapter 20

Troubleshooting

20.1 Windows gives warms me the software is unsigned

20.2 Why don’t I get a 3D view of the device

If your simulation window looks like figure 20.2 and not like figure 20.1. It means either you do
not have any 3D acceleration hardware on your computer, or you do not have the drivers for it
installed. If you have an ATI/Nvidia/Intel graphics card check that the drivers are installed.
Currently, not having working 3D hardware will not affect your ability to perform simulations.
This is not a OghmaNanobug it’s a driver/hardware issue on your computer.

Figure 20.1: OghmaNanowith working 3D acceleration hardware.

181
182 CHAPTER 20. TROUBLESHOOTING

Figure 20.2: OghmaNanowith no 3D acceleration hardware.


Chapter 21

FAQ

21.1 Section
21.1.1 Should I trust the results of OghmaNano?
Yes! The model it’s self has been verified against experiment [there are over 20 publications
doing this, in steady state, time domain (us-fs time scales), and fx-domain]. The basic drift-
diffusion solver was cross checked and compared against other drift diffusion models, and the
accuracy compared down to 6-9 dp. While the optical model has been compared to analytical
solutions of Maxwell’s equations. The SRH model has also been compared against analytical
models. If the answers you are getting out of OghmaNano are odd, then I would suggest to
take a look at the input parameters. If your efficienceis are high, try increasing the number
of trap states, the recombination cross sections or reducing the e/h mobilites. Finally, I would
also recommend always running the latest version, and keeping an eye on the twitter stream
for bug announcements.

21.1.2 Can I use the model to simulate my exotic* material sys-


tem/contacts?
The short answer is yes. The model is an effective medium model, meaning that it does not
simulate the details of the medium, rather it approximates the medium with a set of electrical
parameters. For example, when simulating an organic solar cell, it does not simulate every
detail of the BHJ, rather it just assumes an effective mobility, density of states, recombination
cross sections, trapping cross sections and so on... So if you can find electrical parameters to
aproximate your material system (or guess them), there is nothing stopping you using Ogh-
maNano to simulate any exotic device/material. The same goes for the contacts, the model
simulates the contacts simply as a charge density. So if you have fancy graphene contacts which
inject lots of charge, use a high majority carrier density on the contacts. Where as if you have
some dirty old ITO contacts may be drop the majority carrier density a bit.

183
184

21.2 Excited states


This is a new feautre and is not yet finished. I am writing the equations as I implment them in the solver.
dNS 1 1 7
= Rf ree + κT T NT2 − (κS + κISC )Ns − ( κSS NS − κST NT )NS (21.1)
dt 4 4 4
dNt 3 3
= Rf ree + κISC NS + κSS NS2 (21.2)
dt 4 4
dNSD κF RET 1 7
= (NDOP − NSD − NT D )Ns + κT T D NT2 D − ( κSSD NSD + κST D NT D )NSD (21.3)
dt NDOP 4 4
CHAPTER 21. FAQ
Chapter 22

Legal

22.1 License
OghmaNanocomprises of three independent components, OghmaNanogui, OghmaNanocore and
OghmaNanodata. In general everything is under the MIT license except the Python GUI which
I have released under GPL v2.0. Details can be found here.

22.2 Copyright of the manual


This manual is released under CC-BY license.

185
186 CHAPTER 22. LEGAL

22.3 Data privacy statement


In some versions of OghmaNano it will ask you to register before using it. In these versions it
asks for your name, title, company that you work for and what you intend on using OghmaNano
for. This data is then transmitted to the OghmaNano server where it is securely stored. The
reason I ask for this information is to be able generate accurate usage information. Having
accurate information helps when requesting grants from funding bodies. It’s much easier to
ask a funding body for money if you can prove you actually have users and your software is a
benefit to society. Periodicity OghmaNano will also contact the OghmaNano server to see if
there are any software updates. By using OghmaNano you agree for the above to happen.
Bibliography

[1] Z. Liu, Z. Deng, S. J. Davis, C. Giron, and P. Ciais. Nature Reviews Earth & Environment,
Mar 2022.

[2] S. Manabe and R. T. Wetherald. Journal of Atmospheric Sciences, 1967, 24 3 241 – 259.

[3] R. C. MacKenzie, C. G. Shuttle, M. L. Chabinyc, and J. Nelson. Advanced Energy Mate-


rials, 2012, 2 6 662–669.

[4] L. Zhu, M. Zhang, J. Xu, C. Li, J. Yan, G. Zhou, W. Zhong, T. Hao, J. Song, X. Xue,
et al. Nature Materials, 2022, 21 6 656–663.

[5] C. Wopke, C. Gohler, M. Saladina, X. Du, L. Nian, C. Greve, C. Zhu, K. M. Yallum, Y. J.


Hofstetter, D. Becker-Koch, et al. NATURE COMMUNICATIONS, 2022, 13 1 .

[6] J. Piprek. Semiconductor optoelectronic devices: introduction to physics and simulation.


Elsevier, 2013.

[7] B. C. O’Regan, J. R. Durrant, P. M. Sommeling, and N. J. Bakker. The Journal of Physical


Chemistry C, 2007, 111 37 14001–14010.

[8] P. Kaienburg. 2019.

[9] P. Kaienburg, U. Rau, and T. Kirchartz. Phys. Rev. Applied, Aug 2016, 6 024001.

[10] R. C. MacKenzie, C. G. Shuttle, G. F. Dibb, N. Treat, E. von Hauff, M. J. Robb, C. J.


Hawker, M. L. Chabinyc, and J. Nelson. The Journal of Physical Chemistry C, 2013, 117
24 12407–12414.

[11] P. Calado, A. M. Telford, D. Bryant, X. Li, J. Nelson, B. C. O’Regan, and P. R. Barnes.


Nature communications, 2016, 7 1 1–10.

[12] Photolitherland. From Wikipedia, see html link in bib file for full info.

[13] B. Mills. From Wikipedia, see html link in bib file for full info.

[14] I. Vighetto. From Wikipedia, see html link in bib file for full info.

[15] R. C. MacKenzie, T. Kirchartz, G. F. Dibb, and J. Nelson. The Journal of Physical


Chemistry C, 2011, 115 19 9806–9813.

[16] E. M. Azoff. Solid State Electronics, September 1987, 30 9 913–917.

[17] F. NÉRY and J. Matos. Proceedings of the 14th European Colloquium on Theoretical and
Quantitative Geography, page 23.

[18] T. Zhan, X. Shi, Y. Dai, X. Liu, and J. Zi. Journal of Physics: Condensed Matter, 2013,
25 21 215301.

187
188 BIBLIOGRAPHY

[19] P. Peumans, A. Yakimov, and S. R. Forrest. Journal of Applied Physics, 2003, 93 7


3693–3723.

[20] J. Schneider. Understanding the Finite-Difference Time-Domain Method. 2010.

[21] S. Solak, S. Shishegaran, A. C. Hübler, and R. C. MacKenzie. Solar RRL, 2021, 5 12


2100787.
Index

plugins, 21
python, 157

189
190 INDEX

Use the power of device simulation to understand your experimental data from thin film
devices such as Organic Solar cells, sensors, OFET, OLEDs, Perovskite solar cells, and many
more. Unlike may other models OghmaNanois purpose built from the ground up for simulating
thin film devices made from disordered materials. Downloaded more than 25,000 times with over
200 papers published using the model, OghmaNanohas become one of they key device modelling
tools used by the scientific community developing the next generation of opto-electronic devices.
This book written by the author of OghmaNanoexplains will take you from a standing start
to being able to confidently simulate your own devices. Learn how to simulate, Organic solar
cells, Organic Field Effect Transistors, Perovskite solar cells, Organic LEDs, Large area printed
devices and many more..

You might also like