Home Examples Screenshots User manual Bluesky logo
OghmaNano Simulate organic/Perovskite Solar Cells, OFETs, and OLEDs DOWNLOAD

Meshing

What is meshing?

Meshing is the process of dividing a continuous physical region into a set of discrete points that can be handled by a computer. For example, imagine heat flowing along a metal bar from a candle flame at one end to a block of ice at the other. In reality, temperature varies continuously along the bar, but a simulation cannot store infinitely many values. Instead, the bar is represented by a finite number of sample points (a mesh), and calculations are performed only at those locations (see ??). By working with a mesh, we convert an otherwise continuous problem into a discrete one that can be solved using numerical methods. This principle underlies finite-difference, finite-element, and other computational approaches widely used in physics and engineering.

An example of a continuous problem, showing heat conduction from a candle to an ice crystal, broken up (meshed) into a series of discrete points along the bar.
An example of a continuous problem broken up (or meshed) into a series of discrete points. In this illustration, heat flows along a bar from a candle to ice, with the temperature profile represented by discrete mesh points.

Different meshes for different problems

In OghmaNano, three core physical models are solved: the optical model (light absorption and propagation), the thermal model (heat generation and flow), and the electrical model (charge transport and recombination). Each of these processes typically occurs on very different length scales, so each requires its own mesh. For example:

Thermal ribbon in OghmaNano, showing the Thermal mesh button alongside model and temperature settings. Optical ribbon in OghmaNano, showing the Optical mesh button together with light source and simulation tools. Electrical ribbon in OghmaNano, showing the Electrical mesh button alongside solvers and interface tools.
The three ribbons of OghmaNano: thermal (top), optical (middle), and electrical (bottom). Each ribbon contains a dedicated mesh button used to define the mesh for that physical model.

In practice, this means different physical effects must be simulated on different length scales. Additionally, device structures often include very thin contact or interface layers just a few nanometers thick. Optically, such layers are far below the wavelength of light and can often be ignored, but electrically they are critical because they determine the current–voltage behavior of the device. To capture these effects, you would use a very fine electrical mesh in those regions, while the optical mesh can remain coarser and span over them.

OghmaNano automatically interpolates between meshes when coupling models. For example, if you define a thermal profile on the thermal mesh but the electrical solver requires local temperature values, they are transferred through interpolation. The same applies for optical quantities such as the carrier generation rate, which are interpolated from the optical mesh onto the electrical mesh as needed. As a user, you do not need to manually manage these transfers.

The three meshes of OghmaNano

OghmaNano provides three independent meshes — thermal, optical, and electrical — which can be defined separately depending on the problem being solved. Each mesh is accessed from its corresponding ribbon tab, as shown in Figure ??.

Electrical mesh

OghmaNano electrical mesh editor showing X and Y dimensions active for a 2D OFET simulation, with tables defining thickness, mesh points, and spacing, and plots visualizing the resulting mesh.
The electrical mesh editor with X and Y dimensions enabled for a 2D OFET simulation. Tables define thickness, number of mesh points, and growth factors, while the plots visualize the mesh distribution.

Clicking the Electrical mesh button in the Electrical ribbon opens the mesh editor window (Figure ??). At the top of this window are the X, Y, and Z buttons. These toggle which spatial dimensions are active in the simulation. For example, activating only Y enables a 1D simulation, while enabling X and Y together sets up a 2D simulation. In the example shown, both X and Y are active, so the mesh is configured for a 2D OFET simulation. The central tables function like spreadsheets and define the mesh structure for each active dimension. Their main columns are:

The resulting meshes are plotted in the graphs at the bottom of the window, giving immediate feedback on point spacing and distribution. The Import from layer editor button provides a shortcut for complex devices. It clears the Y-mesh and automatically imports all layers from the Layer Editor, assigning four mesh points per layer. This is especially useful for structures with many layers, such as laser diodes.

Optical mesh

OghmaNano optical mesh editor with X, Y, Z dimension toggles and a wavelength panel. The left panel defines spatial mesh thickness, points, and growth factors; the right panel defines start and stop wavelengths, step multiplier, and number of points. Colored plots below show mesh spacing and spectral sampling.
The optical mesh editor. The left panel defines spatial mesh points along the device thickness, while the right panel configures the spectral mesh by setting the wavelength range and resolution. The plots below visualize both the spatial mesh distribution and wavelength sampling.

The optical mesh editor (Figure ??) is similar in layout to the electrical mesh editor but includes an additional panel for defining the wavelength mesh. At the top of the window, the X, Y, and Z buttons toggle which spatial dimensions are active, while the λ (Wavelength) button enables the spectral grid.

The left-hand panel specifies the spatial discretization in nanometers, using the same columns as the electrical mesh (Thickness, Mesh points, Step multiply, and Left/Right). The right-hand panel defines the spectral range by setting the Start and Stop wavelengths, the number of points, and the step multiplier. These wavelength points are used consistently across all optical solvers, including ray tracing, FDTD, and transfer matrix simulations.

Thermal mesh

The thermal mesh editor (Figure ??) works in the same way as the electrical and optical mesh editors, with X, Y, and Z buttons to activate spatial dimensions. In addition, it includes a dedicated T (Temperature) mesh.

OghmaNano thermal mesh editor showing spatial mesh configuration on the left and temperature mesh configuration on the right. The table on the right defines the start and stop temperatures, number of points, and step multiplier; plots below visualize the distribution.
The thermal mesh editor. The left panel defines spatial discretization, while the right panel configures the temperature mesh by setting start and stop values, resolution, and step growth. The plots visualize the mesh distribution in both position and temperature space.

The temperature mesh is used whenever simulations need to account for temperature dependence, for example when enabling self-heating or when evaluating electrical properties across a temperature range. Before the simulation runs, OghmaNano pre-calculates and tabulates quantities such as carrier densities versus Fermi level and temperature, or Fermi–Dirac integrals. These tables allow the solver to quickly look up values during the run, rather than computing them repeatedly.

In most cases the thermal mesh is handled automatically, but advanced users may adjust the range and resolution to ensure sufficient accuracy for strongly temperature-dependent problems.

The electrical mesh in detail

Figure ?? illustrates how the electrical mesh is constructed. Notice that the mesh does not begin exactly at the device boundary, but rather starts half a mesh spacing inside. This ensures that the first computational node lies within the active simulation region, allowing boundary conditions (e.g. contacts) to be applied at well-defined positions just outside the mesh. The same convention is applied at the far edge of the device, so the mesh extends half a step beyond the final physical point. This offset arrangement provides two key advantages:

When do I need to worry about meshing in OghmaNano?

1D electrical mesh diagram showing evenly spaced grid points placed half a step inside the device boundaries.
A 1D schematic of the electrical mesh. Grid points are offset by half a step from the device boundaries, ensuring stable derivative calculations and consistent application of boundary conditions.

Electrical mesh

The Layer Editor splits a device into layers of different materials (see Section 3.1.3). Layers marked as active are those over which the electrical model is applied. For these layers, a finite-difference mesh must be defined. The mesh length must match the active layer length exactly—otherwise an error will occur. OghmaNano will usually generate a suitable mesh automatically, so for most simple devices you won’t need to think about it. However, when multiple active layers are present, or when you want to reduce the number of mesh points to speed up a simulation (or increase them for higher accuracy), you may need to manually configure the electrical mesh.

Optical mesh

The optical mesh controls both position and wavelength sampling. You may need to adjust it if you want to change the simulated wavelength range or refine how light interacts with different layers of the device. Increasing the number of mesh points improves optical accuracy but comes at the cost of longer simulation times.

Thermal mesh

The thermal mesh is only relevant when self-heating is enabled. In this case, it provides the resolution needed to model how temperature evolves across the device or how thermal effects couple to traps and recombination processes. Otherwise, it is handled automatically by OghmaNano.

Meshing tips

Should I be simulating in 1D, 2D, or 3D?

Choosing the correct dimensionality is one of the most important decisions in setting up a simulation. Always use the minimum number of dimensions required to capture the physics of interest—this saves time and computational resources.

Speed vs. accuracy

Adding more mesh points generally improves accuracy but slows down the simulation. Conversely, using fewer mesh points speeds things up but risks losing important physical detail. The key is to strike a balance: begin with a coarse mesh to test your setup, then refine it only as much as necessary to achieve stable and reliable results.

When setting up a device in OghmaNano, keep the following guidelines in mind: