Python¶
Type: | section |
---|---|
Appearance: | multiple |
This section is used to define a “magnetic current density”-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 “magnetic current density” - tensor field we want to define by where is the position vector and is the time. The “magnetic current density” - tensor may depend on the values of other tensor fields at the same position :
The Python script is provided by the user. There are two options to do this:
- Inline definition of a python expression directly within the
sources.jcm
file, see section Expression.- Reference to a function contained in a python module, see section Function.
The argument values as well as the positions 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.