pyopensn.fieldfunc.FieldFunctionInterpolationVolume
- class pyopensn.fieldfunc.FieldFunctionInterpolationVolume
Volume based interpolation function.
Configure the logical volume and operation, assign a field function, then call
Execute().Execute()rebuilds the cell set from the current configuration before evaluating the field.Wrapper of
opensn::FieldFunctionInterpolationVolume.- AddFieldFunction(self: pyopensn.fieldfunc.FieldFunctionInterpolation, ff: pyopensn.fieldfunc.FieldFunction) None
Add a field function to this interpolator.
Current point/line/volume interpolators support exactly one field function. This method only succeeds when no field function is currently assigned. It raises an error if one is already present. Use
SetFieldFunctionto replace the current one orClearFieldFunctionsto remove it first.Changing the assigned field function affects subsequent
Execute()calls; no separate initialization step is required.
- ClearFieldFunctions(self: pyopensn.fieldfunc.FieldFunctionInterpolation) None
Remove all field functions from this interpolator.
Execute()will raise an error until a new field function is assigned.
- Execute(self: pyopensn.fieldfunc.FieldFunctionInterpolation) None
Execute the field function interpolator using the current configuration.
This method rebuilds any required internal interpolation state each time it is called. No separate
Initialize()step is required.
- ExportToCSV(self: pyopensn.fieldfunc.FieldFunctionInterpolation, base_name: str) None
Export field function interpolation to CSV files.
- Parameters:
base_name (str) – Base name of the exported CSVs.
- GetValue(self: pyopensn.fieldfunc.FieldFunctionInterpolationVolume) float
Return the most recently computed interpolation value.
Call
Execute()after changing the logical volume, operation, operation function, or field function to refresh the stored result.
- SetFieldFunction(self: pyopensn.fieldfunc.FieldFunctionInterpolation, ff: pyopensn.fieldfunc.FieldFunction) None
Replace the current field function with
ff.Unlike
AddFieldFunction, this method does not require the interpolator to be empty first.The next call to
Execute()uses this field function.
- SetLogicalVolume(self: pyopensn.fieldfunc.FieldFunctionInterpolationVolume, lv: pyopensn.logvol.LogicalVolume) None
Set logical volume.
- SetOperationFunction(self: pyopensn.fieldfunc.FieldFunctionInterpolationVolume, function: Callable[[float, int], float]) None
Set the field function operation type to a custom scalar material function.
- Parameters:
function (Callable[[float, int], float]) – A scalar material function that takes the field function value (float) and the block id (int) as parameters and returns a double.
- SetOperationType(self: pyopensn.fieldfunc.FieldFunctionInterpolationVolume, op_type: str) None
Set operation type.
- Parameters:
op_type ({'sum', 'avg', 'max', 'min', 'sum_func', 'avg_func', 'max_func', 'min_func'}) – Operation type.
- __init__(self: pyopensn.fieldfunc.FieldFunctionInterpolationVolume) None
Default constructor.