- stPyFunc
stPyFunc
Works with all 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. The stPyFunc can pass optional arguments given by arg1 and arg2 in the example below.
def imagAmp(x:float, y:float, z:float, t:float,args=None):
if(args != None):
ARG1: float = args[0]
ARG2: float = args[1]
if NDIM == 1:
return 0.0
elif NDIM == 2:
return f(ARG1,ARG2)*gausBeam2D(LIGHTSPEED * (t - T_WAIST), x - X_WAIST, y).imag
else:
return f(ARG1,ARG2)*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
pyArgs=[ arg1 arg2]
</STFunc>
</InitialCondition>