stPyFunc

stPyFunc

Works with VSimBase, VSimEM, VSimPD, VSimPA, and VSimVE licenses.

Function defined by a Python script, which is contained in a separate file. The parameter name is used to point to this file.

stPyFunc Parameters

name (string)

Name of the function.

Example stPyFunc Block

Python block in a Python file with same name as the input file.

def imagAmp(x, y, z, t):
   if NDIM == 1:
      return 0.0
   elif NDIM == 2:
      return gausBeam2D(LIGHTSPEED * (t - T_WAIST), x - X_WAIST, y).imag
   else:
      return gausBeam3D(LIGHTSPEED * (t - T_WAIST), x - X_WAIST, y, z).imag

Block in Vorpal referencing the Python function defined in the Python file.

<InitialCondition ImagA>
  lowerBounds = [ 0  0  0]
  upperBounds = [NX NY NZ]
  kind = variable
  components = [1]
  <STFunc component1>
    kind = stPyFunc
    name = imagAmp
  </STFunc>
</InitialCondition>