Python

Type:section
Appearance:multiple

This section is used to define a “emissivity”-tensor field by means of a Python script. As JCMsuite comes with a Python interpreter an installation of Python is not required.

Note

Since Version 6.2.0 JCMsuite uses Python 3.10 as available from http://www.python.org. It further includes the NumPy-package, see http://www.scipy.org.

The Python script based tensor field definition is very flexible and general, since it is possible to define parameter-dependent expressions. These parameters may not only contain user-defined fixed values, but may also describe dependencies on other tensor fields.

To explain this in more detail, let us denote the “emissivity” - tensor field we want to define by \VField{e} (\pvec{x}, t), where \pvec{x} is the position vector and t is the time. The “emissivity” - tensor may depend on the values \TField{t}_1, \TField{t}_2, \dots, \TField{t}_n of other tensor fields at the same position (\pvec{x}, t):

\begin{eqnarray*}
\VField{e} (\pvec{x}, t) & = &  {\tt{python\_script}} \left( \pvec{x}, t, \TField{t}_1(\pvec{x}, t), \TField{t}_2(\pvec{x}, t), \dots, \TField{t}_n(\pvec{x}, t) \right)
\end{eqnarray*}

The Python script \tt{python\_script} is provided by the user. There are two options to do this:

  1. Inline definition of a python expression directly within the sources.jcm file, see section Expression.
  2. Reference to a function contained in a python module, see section Function.

The argument values \TField{t}_1, \TField{t}_2, \dots, \TField{t}_n as well as the positions (\pvec{x}, t) should be passed from JCMsolve to the python script when evaluating the tensor field. For being able to do this, the user has to inform JCMsolve which parameters are actually needed. In the words of a computer programming language the user has to specify the signature of the python script. This is done by filling the Parameter section.