# PLaSK User Manual

#### Page Contents

- ThermoElectric3D Class
  - `ThermoElectric3D`
  - Methods
  - Attributes
    - Providers
    - Other
  - Descriptions
    - Method Details
      - `ThermoElectric3D.compute()`
      - `ThermoElectric3D.get_junction_currents()`
      - `ThermoElectric3D.get_temperature()`
      - `ThermoElectric3D.get_total_current()`
      - `ThermoElectric3D.get_vertical_voltage()`
      - `ThermoElectric3D.get_voltage()`
      - `ThermoElectric3D.initialize()`
      - `ThermoElectric3D.invalidate()`
      - `ThermoElectric3D.plot_junction_current()`
      - `ThermoElectric3D.plot_temperature()`
      - `ThermoElectric3D.plot_vertical_voltage()`
      - `ThermoElectric3D.plot_voltage()`
      - `ThermoElectric3D.reconnect()`
      - `ThermoElectric3D.save()`
    - Provider Details
      - `ThermoElectric3D.outConductivity`
      - `ThermoElectric3D.outCurrentDensity`
      - `ThermoElectric3D.outHeat`
      - `ThermoElectric3D.outHeatFlux`
      - `ThermoElectric3D.outTemperature`
      - `ThermoElectric3D.outThermalConductivity`
      - `ThermoElectric3D.outVoltage`
    - Attribute Details
      - `ThermoElectric3D.electrical`
      - `ThermoElectric3D.id`
      - `ThermoElectric3D.initialized`
      - `ThermoElectric3D.tfreq`
      - `ThermoElectric3D.thermal`

# ThermoElectric3D Class

class meta.shockley.ThermoElectric3D(name)

  Thermo-electric calculations solver without the optical part.

  This solver performs under-threshold thermo-electrical computations. It computes electric current flow and temperature distribution in a self- consistent loop until desired convergence is reached.

  The computations can be executed using compute method, after which the results may be save to the HDF5 file with save or presented visually using `plot_...` methods. If `save` parameter of the `compute()` method is True the fields are saved automatically after the computations. The file name is based on the name of the executed script with suffix denoting either the launch time or the identifier of a batch job if a batch system (like SLURM, OpenPBS, or SGE) is used.

## Methods

`compute`([save, invalidate, group]) | Run calculations.
`get_junction_currents`([refine, interpolation]) | Get current densities at the active regions.
`get_temperature`() | Get temperature on a thermal mesh.
`get_total_current`([nact]) | Get total current flowing through active region (mA)
`get_vertical_voltage`([at]) | Get computed voltage along the vertical axis.
`get_voltage`() | Get voltage on an electrical mesh.
`initialize`() | Initialize solver.
`invalidate`() | Set the solver back to uninitialized state.
`plot_junction_current`([refine, bounds, ...]) | Plot current density at the active region.
`plot_temperature`([geometry_color, ...]) | Plot computed temperature to the current axes.
`plot_vertical_voltage`([at]) | Plot computed voltage along the vertical axis.
`plot_voltage`([geometry_color, mesh_color, ...]) | Plot computed voltage to the current axes.
`reconnect`() | Reconnect all internal solvers.
`save`([filename, group]) | Save the computation results to the HDF5 file.

## Attributes

### Providers

`outConductivity` | Provider of the computed electrical conductivity [S/m].
`outCurrentDensity` | Provider of the computed current density [kA/cm²].
`outHeat` | Provider of the computed heat sources density [W/m³].
`outHeatFlux` | Provider of the computed heat flux [W/m²].
`outTemperature` | Provider of the computed temperature [K].
`outThermalConductivity` | Provider of the computed thermal conductivity [W/(m×K)].
`outVoltage` | Provider of the computed voltage [V].

### Other

`electrical` | `electrical.shockley.Shockley3D` solver used for electrical calculations.
`id` | Id of the solver object.
`initialized` | True if the solver has been initialized.
`tfreq` | Number of electrical iterations per single thermal step.
`thermal` | `thermal.static.Static3D` solver used for thermal calculations.

## Descriptions

### Method Details

ThermoElectric3D.compute(save=True, invalidate=True, group='ThermoElectric')

  Run calculations.

  In the beginning the solvers are invalidated and next, the thermo- electric algorithm is executed until both solvers converge to the value specified in their configuration in the maxerr property.

  Parameters:

    - save (bool or str) – If True the computed fields are saved to the HDF5 file named after the script name with the suffix denoting either the batch job id or the current time if no batch system is used. The filename can be overridden by setting this parameter as a string.

    - invalidate (bool) – If this flag is set, solvers are invalidated in the beginning of the computations.

    - group (str) – HDF5 group to save the data under.

ThermoElectric3D.get_junction_currents(refine=16, interpolation='linear')

  Get current densities at the active regions.

  Parameters:

    - refine (int) – Number of points in the plot between each two points in the computational mesh.

    - interpolation (str) – Interpolation used when retrieving current density.

  Returns:

    Dictionary of junction current density data.

      Keys are the junction number.

  Return type:

    dict

ThermoElectric3D.get_temperature()

  Get temperature on a thermal mesh.

ThermoElectric3D.get_total_current(nact=0)

  Get total current flowing through active region (mA)

ThermoElectric3D.get_vertical_voltage(at=0)

  Get computed voltage along the vertical axis.

  Parameters:

    at (float) – Horizontal position of the axis at which the voltage is plotted.

ThermoElectric3D.get_voltage()

  Get voltage on an electrical mesh.

ThermoElectric3D.initialize()

  Initialize solver.

  This method manually initialized the solver and sets `initialized` to True. Normally calling it is not necessary, as each solver automatically initializes itself when needed.

  Returns:

    solver `initialized` state prior to this method call.

  Return type:

    bool

ThermoElectric3D.invalidate()

  Set the solver back to uninitialized state.

  This method frees the memory allocated by the solver and sets `initialized` to False.

ThermoElectric3D.plot_junction_current(refine=16, bounds=True, interpolation='linear', label=None, **kwargs)

  Plot current density at the active region.

  Parameters:

    - refine (int) – Number of points in the plot between each two points in the computational mesh.

    - bounds (bool) – If True then the geometry objects boundaries are plotted.

    - interpolation (str) – Interpolation used when retrieving current density.

    - label (str or sequence) – Label for each junction. It can be a sequence of consecutive labels for each junction, or a string in which case the same label is used for each junction. If omitted automatic label is generated.

    - **kwargs – Keyword arguments passed to the plot function.

ThermoElectric3D.plot_temperature(geometry_color='0.75', mesh_color=None, geometry_alpha=0.35, mesh_alpha=0.15, geometry_lw=1.0, mesh_lw=1.0, **kwargs)

  Plot computed temperature to the current axes.

  Parameters:

    - geometry_color (str or `None`) – Matplotlib color specification for the geometry. If `None`, structure is not plotted.

    - mesh_color (str or `None`) – Matplotlib color specification for the mesh. If `None`, the mesh is not plotted.

    - geometry_alpha (float) – Geometry opacity (1 — fully opaque, 0 – invisible).

    - mesh_alpha (float) – Mesh opacity (1 — fully opaque, 0 – invisible).

    - geometry_lw (float) – Line width for geometry.

    - mesh_lw (float) – Line width for mesh.

    - **kwargs – Keyword arguments passed to the plot function.

  See also

  `plask.plot_field()` : Plot any field obtained from receivers

ThermoElectric3D.plot_vertical_voltage(at=0.0, **kwargs)

  Plot computed voltage along the vertical axis.

  Parameters:

    - at (float) – Horizontal position of the axis at which the voltage is plotted.

    - **kwargs – Keyword arguments passed to the plot function.

ThermoElectric3D.plot_voltage(geometry_color='0.75', mesh_color=None, geometry_alpha=0.35, mesh_alpha=0.15, geometry_lw=1.0, mesh_lw=1.0, **kwargs)

  Plot computed voltage to the current axes.

  Parameters:

    - geometry_color (str or `None`) – Matplotlib color specification for the geometry. If `None`, structure is not plotted.

    - mesh_color (str or `None`) – Matplotlib color specification for the mesh. If `None`, the mesh is not plotted.

    - geometry_alpha (float) – Geometry opacity (1 — fully opaque, 0 – invisible).

    - mesh_alpha (float) – Mesh opacity (1 — fully opaque, 0 – invisible).

    - geometry_lw (float) – Line width for geometry.

    - mesh_lw (float) – Line width for mesh.

    - **kwargs – Keyword arguments passed to the `plask.plot_field()`.

  See also

  `plask.plot_field()` : Plot any field obtained from receivers

ThermoElectric3D.reconnect()

  Reconnect all internal solvers.

  This method should be called if some of the internal solvers were changed manually.

ThermoElectric3D.save(filename=None, group='ThermoElectric')

  Save the computation results to the HDF5 file.

  Parameters:

    - filename (str) – The file name to save to. If omitted, the file name is generated automatically based on the script name with suffix denoting either the batch job id or the current time if no batch system is used.

    - group (str) – HDF5 group to save the data under.

### Provider Details

ThermoElectric3D.outConductivity(mesh, interpolation='default') = <property object>

  Provider of the computed electrical conductivity [S/m].

  Parameters:

    - mesh (mesh) – Target mesh to get the field at.

    - interpolation (str) – Requested interpolation method.

  Returns:

    Data with the electrical conductivity on the specified mesh [S/m].

  Example

  Connect the provider to a receiver in some other solver:

      >>> other_solver.inConductivity = solver.outConductivity

  Obtain the provided field:

      >>> solver.outConductivity(mesh)
      <plask.Data at 0x1234567>

  See also

  Provider class: `plask.flow.ConductivityProvider3D`

  Receciver class: `plask.flow.ConductivityReceiver3D`

ThermoElectric3D.outCurrentDensity(mesh, interpolation='default') = <property object>

  Provider of the computed current density [kA/cm²].

  Parameters:

    - mesh (mesh) – Target mesh to get the field at.

    - interpolation (str) – Requested interpolation method.

  Returns:

    Data with the current density on the specified mesh [kA/cm²].

  Example

  Connect the provider to a receiver in some other solver:

      >>> other_solver.inCurrentDensity = solver.outCurrentDensity

  Obtain the provided field:

      >>> solver.outCurrentDensity(mesh)
      <plask.Data at 0x1234567>

  See also

  Provider class: `plask.flow.CurrentDensityProvider3D`

  Receciver class: `plask.flow.CurrentDensityReceiver3D`

ThermoElectric3D.outHeat(mesh, interpolation='default') = <property object>

  Provider of the computed heat sources density [W/m³].

  Parameters:

    - mesh (mesh) – Target mesh to get the field at.

    - interpolation (str) – Requested interpolation method.

  Returns:

    Data with the heat sources density on the specified mesh [W/m³].

  Example

  Connect the provider to a receiver in some other solver:

      >>> other_solver.inHeat = solver.outHeat

  Obtain the provided field:

      >>> solver.outHeat(mesh)
      <plask.Data at 0x1234567>

  See also

  Provider class: `plask.flow.HeatProvider3D`

  Receciver class: `plask.flow.HeatReceiver3D`

ThermoElectric3D.outHeatFlux(mesh, interpolation='default') = <property object>

  Provider of the computed heat flux [W/m²].

  Parameters:

    - mesh (mesh) – Target mesh to get the field at.

    - interpolation (str) – Requested interpolation method.

  Returns:

    Data with the heat flux on the specified mesh [W/m²].

  Example

  Connect the provider to a receiver in some other solver:

      >>> other_solver.inHeatFlux = solver.outHeatFlux

  Obtain the provided field:

      >>> solver.outHeatFlux(mesh)
      <plask.Data at 0x1234567>

  See also

  Provider class: `plask.flow.HeatFluxProvider3D`

  Receciver class: `plask.flow.HeatFluxReceiver3D`

ThermoElectric3D.outTemperature(mesh, interpolation='default') = <property object>

  Provider of the computed temperature [K].

  Parameters:

    - mesh (mesh) – Target mesh to get the field at.

    - interpolation (str) – Requested interpolation method.

  Returns:

    Data with the temperature on the specified mesh [K].

  Example

  Connect the provider to a receiver in some other solver:

      >>> other_solver.inTemperature = solver.outTemperature

  Obtain the provided field:

      >>> solver.outTemperature(mesh)
      <plask.Data at 0x1234567>

  See also

  Provider class: `plask.flow.TemperatureProvider3D`

  Receciver class: `plask.flow.TemperatureReceiver3D`

ThermoElectric3D.outThermalConductivity(mesh, interpolation='default') = <property object>

  Provider of the computed thermal conductivity [W/(m×K)].

  Parameters:

    - mesh (mesh) – Target mesh to get the field at.

    - interpolation (str) – Requested interpolation method.

  Returns:

    Data with the thermal conductivity on the specified mesh [W/(m×K)].

  Example

  Connect the provider to a receiver in some other solver:

      >>> other_solver.inThermalConductivity = solver.outThermalConductivity

  Obtain the provided field:

      >>> solver.outThermalConductivity(mesh)
      <plask.Data at 0x1234567>

  See also

  Provider class: `plask.flow.ThermalConductivityProvider3D`

  Receciver class: `plask.flow.ThermalConductivityReceiver3D`

ThermoElectric3D.outVoltage(mesh, interpolation='default') = <property object>

  Provider of the computed voltage [V].

  Parameters:

    - mesh (mesh) – Target mesh to get the field at.

    - interpolation (str) – Requested interpolation method.

  Returns:

    Data with the voltage on the specified mesh [V].

  Example

  Connect the provider to a receiver in some other solver:

      >>> other_solver.inVoltage = solver.outVoltage

  Obtain the provided field:

      >>> solver.outVoltage(mesh)
      <plask.Data at 0x1234567>

  See also

  Provider class: `plask.flow.VoltageProvider3D`

  Receciver class: `plask.flow.VoltageReceiver3D`

### Attribute Details

ThermoElectric3D.electrical = Shockley3D()

  `electrical.shockley.Shockley3D` solver used for electrical calculations.

ThermoElectric3D.id = <property object>

  Id of the solver object. (read only)

  Example

      >>> mysolver.id
      mysolver:category.type

ThermoElectric3D.initialized = <property object>

  True if the solver has been initialized. (read only)

  Solvers usually get initialized at the beginning of the computations. You can clean the initialization state and free the memory by calling the `invalidate()` method.

ThermoElectric3D.tfreq = 6.0

  Number of electrical iterations per single thermal step.

  As temperature tends to converge faster, it is reasonable to repeat thermal solution less frequently.

ThermoElectric3D.thermal = Static3D()

  `thermal.static.Static3D` solver used for thermal calculations.