# Stopping criterion
Stopping criterion provides a mechanism to automatically terminate a simulation when a monitored field reaches a certain value. This is achieved by tracking the deviation of the field over a moving window of iterations. When the deviation falls below a defined tolerance, the simulation is considered converged and stops.
# Available Parameters
Parameter | Description |
---|---|
Output type | The type of output to be monitored (e.g., Probe, Surface Integral). |
(Output name) | The name of a specific, pre-defined output instance. This field appears after selecting an Output type. |
Output field | The specific scalar field within the selected output to monitor for convergence. |
Tolerance | The threshold for the moving deviation of the monitored field. |
Change window | The number of iterations over which to calculate the moving deviation of the monitored field. |
# Detailed Descriptions
# Output type
Specifies the category of output that contains the field to be monitored.
- Default: None
- Options:
Probe
Surface probe
Notes:
- The chosen output type must be configured in output section of the simulation setup.
- This determines which specific outputs are available in the next dropdown.
# Output name
Selects a specific, named output instance of the chosen "Output type" to monitor.
- Default: None
Notes:
- You must define an output (e.g., a
ProbeOutput
orSurfaceIntegralOutput
) before it can be selected here.- The list of available names is filtered based on the selected Output type.
# Output field
Field within the selected output whose convergence will be tracked.
- Default: None
- Example:
Cl
,Pressure
,MyVelocityVariable
Note:
- The selected field must be one of the
output_fields
defined in the selected output instance.
# Tolerance
Convergence threshold. The simulation stops when the moving deviation of the Output field is less than this value.
- Default:
0.01
- Example:
1e-4
Notes:
- This value is non-dimensional if the monitored field is a string-defined default field (e.g., 'Cl').
- If using a
UserVariable
for the output field, the dimensions of the tolerance must match the dimensions of the field.
# Change window
The number of data points used for the moving window to calculate the deviation of the monitored field.
- Default:
10
- Example:
20
Notes:
- The value must be an integer greater than or equal to 2.
- A larger window provides a more stable measure of convergence but may react slower to changes.
🐍 Python Example Usage
import flow360 as fl
fl.Fluid(
stopping_criterion=[
stop_on_lift_convergence = fl.Criterion(
name="StopOnLift",
monitor_output=fl.SurfaceIntegralOutput(
name="wing_forces",
entities=[surface_mesh['wing']],
output_fields=['Cf', 'Cl', 'Cd']
),
monitor_field='Cl',
tolerance=1e-5,
criterion_change_window=50
)
],
...
)