|
flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
|
Input validation of the peclet.flow Python binding (src/flow_bindings.cpp only). More...
#include <array>#include <cmath>#include <cstddef>#include <cstdint>#include <cstdio>#include <optional>#include <stdexcept>#include <string>#include <vector>Go to the source code of this file.
Namespaces | |
| namespace | peclet |
| namespace | peclet::flow |
| namespace | peclet::flow::binding_checks |
Functions | |
| std::string | peclet::flow::binding_checks::num (double v) |
| void | peclet::flow::binding_checks::require (bool ok, const char *who, const std::string &name, const std::string &rule, double v) |
| void | peclet::flow::binding_checks::finite (const char *who, const std::string &name, double v, const char *dim) |
| void | peclet::flow::binding_checks::positive (const char *who, const std::string &name, double v, const char *dim) |
| void | peclet::flow::binding_checks::nonneg (const char *who, const std::string &name, double v, const char *dim) |
| void | peclet::flow::binding_checks::fraction (const char *who, const std::string &name, double v) |
| A volume fraction or a dimensionless coefficient bounded by one: [0, 1]. | |
| void | peclet::flow::binding_checks::count (const char *who, const std::string &name, std::int64_t v, std::int64_t lo) |
| A count (cells, levels, iterations): an integer >= lo. | |
| std::string | peclet::flow::binding_checks::component (const char *name, std::size_t i) |
| Per-component forms for a triple or a quaternion: the parameter is named name[i]. | |
| template<class T, std::size_t N> | |
| void | peclet::flow::binding_checks::finiteEach (const char *who, const char *name, const std::array< T, N > &a, const char *dim) |
| void | peclet::flow::binding_checks::finiteEach (const char *who, const char *name, const std::vector< double > &a, const char *dim) |
| template<class T, std::size_t N> | |
| void | peclet::flow::binding_checks::countEach (const char *who, const char *name, const std::array< T, N > &a, std::int64_t lo) |
| void | peclet::flow::binding_checks::instanceMotion (const std::array< double, 3 > &lin, const std::array< double, 3 > &ang, const std::optional< std::array< double, 3 > > ¢er) |
| set_instance_motion: finite velocities and, when given, a finite rotation center. | |
| void | peclet::flow::binding_checks::instanceTransform (const std::array< double, 3 > &t, const std::array< double, 4 > &q) |
| set_instance_transform: a finite translation and a finite quaternion. | |
| void | peclet::flow::binding_checks::vofSeeds (const std::optional< std::vector< std::array< double, 4 > > > &seeds) |
| enable_vof_blocks: each seed sphere (cx, cy, cz, radius) in cell units, global indices. | |
| void | peclet::flow::binding_checks::propertyTable (const std::vector< double > &x, const std::vector< double > &y) |
| set_property_table: finite abscissae and values. | |
| void | peclet::flow::binding_checks::globalDims (const char *who, int gnx, int gny, int gnz) |
| init_mpi / the global grid: at least one cell per axis. | |
| void | peclet::flow::binding_checks::scalarArgs (double diffusivity, const std::optional< int > &iters) |
| add_scalar: a non-negative diffusivity and, when given, at least one sweep. | |
| template<class S> | |
| void | peclet::flow::binding_checks::initCells (S *self, int nx, int ny, int nz) |
| Solver(nx, ny, nz): at least one cell per axis (a negative count asked Kokkos for 16 EiB). | |
| template<class S> | |
| void | peclet::flow::binding_checks::initPhysical (S *self, std::array< long, 3 > cells, std::optional< std::array< double, 3 > > extent, std::array< double, 3 > origin, std::optional< std::array< long, 3 > > global_cells) |
| Solver(cells, extent=None, origin=(0, 0, 0), global_cells=None). | |
| template<class S> | |
| void | peclet::flow::binding_checks::setRho (S &s, double rho) |
| template<class S> | |
| void | peclet::flow::binding_checks::setMu (S &s, double mu) |
| mu = 0 is admitted: the inviscid limit (scripts/pressure_h_independence.py and others use it). | |
| template<class S> | |
| void | peclet::flow::binding_checks::setDt (S &s, double dt) |
| template<class S> | |
| void | peclet::flow::binding_checks::setVelocityResidualTolerance (S &s, double rtol) |
| rtol < 0 follows the pressure solver's rtol and 0 is the legacy criterion: finite only. | |
| template<class S> | |
| void | peclet::flow::binding_checks::setBackflowStabilization (S &s, double beta) |
| template<class S> | |
| void | peclet::flow::binding_checks::setPressureSolverParams (S &s, int iters) |
| template<class S> | |
| void | peclet::flow::binding_checks::setPressureMultigrid (S &s, bool, int levels) |
| levels = 0 is the automatic depth. | |
| void | peclet::flow::binding_checks::krylovArgs (const char *who, int max_iter, double rtol) |
| The three pressure drivers share the cap/tolerance pair: >= 1 iteration, rtol >= 0 (0 runs to the cap). | |
| template<class S> | |
| void | peclet::flow::binding_checks::setPressureChebyshev (S &s, bool on, int max_iter, double rtol) |
| template<class S> | |
| void | peclet::flow::binding_checks::setPressurePcg (S &s, bool on, int max_iter, double rtol) |
| template<class S> | |
| void | peclet::flow::binding_checks::setPressureFcg (S &s, bool on, int max_iter, double rtol) |
| template<class S> | |
| void | peclet::flow::binding_checks::setVelocityMultigrid (S &s, bool on, int levels, int vcycles) |
| The solver used to clamp levels and vcycles below 1 up to 1 silently. | |
| template<class S> | |
| void | peclet::flow::binding_checks::setBodyForce (S &s, std::array< double, 3 > force) |
| template<class S> | |
| void | peclet::flow::binding_checks::setVofCflLimit (S &s, double value) |
| template<class S> | |
| void | peclet::flow::binding_checks::setCapillaryCfl (S &s, double factor) |
| template<class S> | |
| void | peclet::flow::binding_checks::setMassFluxUniform (S &s, double mdot) |
| The sign is the direction (positive = evaporation): finite only. | |
| template<class S> | |
| void | peclet::flow::binding_checks::setPropertyTable (S &s, const std::string &target, const std::string &field, const std::vector< double > &x, const std::vector< double > &y) |
Input validation of the peclet.flow Python binding (src/flow_bindings.cpp only).
The C++ solver API (flow_ibm.hpp) trusts its caller; the public setters refuse a NaN/Inf or a physically inadmissible value at the binding, as ValueError (std::invalid_argument), before it reaches the solver. A valid value takes exactly the path it took before. The message names the setter, the parameter, the admissible range with its dimension (flow computes in the caller's consistent units, or in cells without an extent) and the offending value.
Two kinds of entries: the check helpers (finite, positive, ...), called from the binding's own lambdas, and the CHECKED SETTERS (setRho<S>, ...), free functions bound in place of a member pointer or a lambda: they keep the Python parameter names, defaults and return type, and keep the validation branches out of bind_solver. Binding-only: no solver header includes this.
Definition in file flow_bindings_checks.hpp.