flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
test_input_validation Namespace Reference

Functions

 _box (cls)
 _fluid (cls, **bc)
 _scalar (cls)
 _vof (cls)
 _vof_open (cls)
 _phase_change (cls)
 _blocks (cls)
 _staggered_only (match)
 test_bad_value_raises_value_error_naming_the_parameter (cls, case, call, value, param)
 test_valid_value_is_accepted (cls, case, call, value, outcome)
 test_message_states_range_unit_and_value ()
 test_refused_value_leaves_the_setting_unchanged (cls)
 test_existing_cell_count_check_is_unchanged ()

Variables

 NAN
 INF
int N = 8
list CLASSES = [flow.Solver, flow.SolverColocated]
tuple _NO_SCENE = (RuntimeError, "set_scene first")
tuple _NO_WALL = (RuntimeError, "wetting wall")
list CASES
list _BAD = [(cls, c[0], c[1], b, c[4]) for cls in CLASSES for c in CASES for b in c[2]]
list _GOOD = [(cls, c[0], c[1], c[3], c[5]) for cls in CLASSES for c in CASES if c[3] is not None]

Detailed Description

Contract: the public setters refuse a NaN/Inf or physically inadmissible value with ValueError.

Validation lives in the binding (src/flow_bindings_checks.hpp, used from src/flow_bindings.cpp);
the message names the setter, the parameter, the admissible range with its dimension and the
offending value. Each validated argument is covered on both solvers twice: every bad value raises
ValueError naming the parameter, and one valid value is accepted (where a call needs a fixture
this file does not build -- a scene, a wetting wall -- the valid value is shown to pass validation
by the call reaching the C++ check behind it, which raises RuntimeError instead).

Where a sign or a 0 is a switch the check is "finite" only (set_velocity_residual_tolerance: < 0
follows the pressure rtol; set_contact_angle_dynamic sigma: <= 0 takes set_surface_tension's;
set_vof_block_assign every: 0 never re-assigns; set_mass_flux_uniform: the sign is the direction).

Run: PYTHONPATH=<build> python -m pytest -q tests/python/test_input_validation.py

Function Documentation

◆ _box()

test_input_validation._box ( cls)
protected

◆ _fluid()

test_input_validation._fluid ( cls,
** bc )
protected
A physical all-fluid box with properties and a geometry (what add_scalar / VoF need).

Definition at line 33 of file test_input_validation.py.

References _box().

Referenced by _scalar(), _vof(), and _vof_open().

◆ _scalar()

test_input_validation._scalar ( cls)
protected

Definition at line 45 of file test_input_validation.py.

References _fluid().

◆ _vof()

test_input_validation._vof ( cls)
protected

Definition at line 51 of file test_input_validation.py.

References _fluid().

Referenced by _blocks(), and _phase_change().

◆ _vof_open()

test_input_validation._vof_open ( cls)
protected
VoF with an inflow -x face and an outflow +x face.

Definition at line 57 of file test_input_validation.py.

References _fluid().

◆ _phase_change()

test_input_validation._phase_change ( cls)
protected
Phase change is staggered-only: SolverColocated gets VoF alone (its setter then refuses).

Definition at line 64 of file test_input_validation.py.

References _vof().

◆ _blocks()

test_input_validation._blocks ( cls)
protected

Definition at line 72 of file test_input_validation.py.

References _vof().

◆ _staggered_only()

test_input_validation._staggered_only ( match)
protected
Accepted on Solver; on SolverColocated past validation into the solver's refusal.

Definition at line 78 of file test_input_validation.py.

◆ test_bad_value_raises_value_error_naming_the_parameter()

test_input_validation.test_bad_value_raises_value_error_naming_the_parameter ( cls,
case,
call,
value,
param )

Definition at line 187 of file test_input_validation.py.

◆ test_valid_value_is_accepted()

test_input_validation.test_valid_value_is_accepted ( cls,
case,
call,
value,
outcome )

Definition at line 197 of file test_input_validation.py.

◆ test_message_states_range_unit_and_value()

test_input_validation.test_message_states_range_unit_and_value ( )

Definition at line 208 of file test_input_validation.py.

References _box().

◆ test_refused_value_leaves_the_setting_unchanged()

test_input_validation.test_refused_value_leaves_the_setting_unchanged ( cls)

Definition at line 225 of file test_input_validation.py.

References _box().

◆ test_existing_cell_count_check_is_unchanged()

test_input_validation.test_existing_cell_count_check_is_unchanged ( )
The cells check predates this file: RuntimeError, message unchanged.

Definition at line 237 of file test_input_validation.py.

Variable Documentation

◆ NAN

test_input_validation.NAN

Definition at line 24 of file test_input_validation.py.

◆ INF

test_input_validation.INF

Definition at line 24 of file test_input_validation.py.

◆ N

int test_input_validation.N = 8

Definition at line 25 of file test_input_validation.py.

◆ CLASSES

list test_input_validation.CLASSES = [flow.Solver, flow.SolverColocated]

Definition at line 26 of file test_input_validation.py.

◆ _NO_SCENE

tuple test_input_validation._NO_SCENE = (RuntimeError, "set_scene first")
protected

Definition at line 83 of file test_input_validation.py.

◆ _NO_WALL

tuple test_input_validation._NO_WALL = (RuntimeError, "wetting wall")
protected

Definition at line 84 of file test_input_validation.py.

◆ CASES

list test_input_validation.CASES

Definition at line 89 of file test_input_validation.py.

◆ _BAD

list test_input_validation._BAD = [(cls, c[0], c[1], b, c[4]) for cls in CLASSES for c in CASES for b in c[2]]
protected

Definition at line 181 of file test_input_validation.py.

◆ _GOOD

list test_input_validation._GOOD = [(cls, c[0], c[1], c[3], c[5]) for cls in CLASSES for c in CASES if c[3] is not None]
protected

Definition at line 182 of file test_input_validation.py.