3.6 Automatic stopping for transient simulations
For transient simulations, it can be useful to stop the simulation early once the system stops evolving, i.e. when the changes in the internal variables become very small. This is particularly helpful when simulations are expected to reach equilibrium or a stabilised state, but the time required to do so is unknown. Continuing the simulation beyond this point wastes computational resources.
To address this, \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} ZimT}}\) includes an automatic stopping criterion for transient simulations. The user can enable this feature using the \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} Track}}\) column of the \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} tVGFile}}\). If the column \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} Track}}\) is set to 0, the simulation will run as normal (so no automatic stopping is applied). However, by setting this column to 1 for a particular point in time (i.e. a row) will make \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} ZimT}}\) set the current state (all internal variables such as \(n\), \(p\), \(V_{\mathrm{int}}\), \(J_{\mathrm{int}}\), …) as a reference state (type TState). If at a subsequent time, \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} Track}}\) is set to either 2 or 3, then this state will be compared with the reference state. If they are sufficiently close, then a counter (\(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} CountStatic}}\)) is increased. Once \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} CountStatic}}\) reaches a predefined threshold (\(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} MinCountStatic}}\)), the simulation is terminated early. If the change is not sufficiently small, the current state becomes the new reference state and \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} CountStatic}}\) is reset to 0. This process continues until either the simulation reaches the end of the specified time points or the system is deemed to have reached equilibrium. Figure ?? lists shows what the different values of \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} Track}}\) do.
The criterion for determining whether two states are sufficiently similar follows the same logic as the convergence criterion used in the main iteration loop (see section 2.9). If \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} convVar}}\) = 1, the relative change in the carrier densities must be smaller than \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} tolDens}}\). If \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} convVar}}\) = 2, the absolute error in the current must be smaller than the minimum of \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} tolCurr}}\) and \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} errJ}}\). If \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} convVar}}\) = 3, either of these conditions must be satisfied. If \(\mathtt{\require{color}{\color[rgb]{0.000000000000000,0.500000000000000,0.500000000000000} convVar}}\) = 4, both conditions must be satisfied.
If the system has stabilised, the simulation is terminated with exit code 2, instead of the usual exit code 0. This allows users to easily identify simulations that were stopped early due to reaching equilibrium or a stabilised state.
It is worth noting that the tracked time points do not have to be consecutive. For example, when simulating a light pulse with a given frequency, one can track only the time points immediately before the next pulse starts. This makes it possible to check whether the system has reached equilibrium before the next pulse begins, without tracking all intermediate time steps.