PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
 
Loading...
Searching...
No Matches
Data Structures | Namespaces | Functions | Variables
source_expressions.py File Reference

The source expression language on the Python side: its functions and variables, validation, constant substitution, region lowering and NumPy evaluation. More...

Go to the source code of this file.

Data Structures

class  picurv_cli.source_expressions._LogicalRewriter
 Rewrite logical operators and chained comparisons into array operations. More...
 

Namespaces

namespace  picurv_cli
 
namespace  picurv_cli.source_expressions
 

Functions

None picurv_cli.source_expressions.validate_expression (str expression, names=EULERIAN_EXPRESSION_NAMES, random=False)
 Reject anything outside the expression language the runtime also evaluates.
 
int picurv_cli.source_expressions._series_bound (node)
 The integer a series bound denotes: an integer literal, possibly negated.
 
None picurv_cli.source_expressions._check_expression_node (node, names, indices, random)
 Check one node of a parsed expression, with the series indices enclosing it in scope.
 
None picurv_cli.source_expressions._validate_expression (str expression)
 Reject Eulerian expression syntax outside the supported language.
 
 picurv_cli.source_expressions._solver_only (str name)
 A stand-in for a function only the runtime evaluates.
 
 picurv_cli.source_expressions.evaluate_values (str expression, dict values)
 Evaluate an already validated expression over named arrays or scalars.
 
str picurv_cli.source_expressions._number_text (value, dict params, str where)
 Render one numeric region parameter, which may name a declared parameter.
 
str picurv_cli.source_expressions._region_distance (dict region, dict params, str where)
 Signed distance to a region's boundary, negative inside, as expression text.
 
str picurv_cli.source_expressions._substitute_params (str expression, dict params)
 Replace declared parameter names in an expression by their values.
 
 picurv_cli.source_expressions._validate_at (str expression, names, bool random, str where)
 Validate an expression written in a configuration value, naming where it is.
 
str picurv_cli.source_expressions.lower_value (spec, names=PARTICLE_EXPRESSION_NAMES, random=True, where="value")
 Turn a field value - number, expression, or structured regions - into one expression.
 

Variables

dict picurv_cli.source_expressions.ALLOWED_FUNCTIONS
 
dict picurv_cli.source_expressions.FUNCTION_ARITY
 
tuple picurv_cli.source_expressions.SOLVER_ONLY_FUNCTIONS = ("besselj", "bessely", "ber", "bei")
 
int picurv_cli.source_expressions.MAX_SERIES_TERMS = 1000000
 
int picurv_cli.source_expressions.MAX_SERIES_DEPTH = 4
 
tuple picurv_cli.source_expressions.RANDOM_FUNCTIONS = ("uniform", "normal")
 
 picurv_cli.source_expressions.EULERIAN_EXPRESSION_NAMES = frozenset({"x", "y", "z", "xi", "eta", "zeta", "i", "j", "k"})
 
 picurv_cli.source_expressions.PARTICLE_EXPRESSION_NAMES = frozenset({"x", "y", "z", "t", "xi", "eta", "zeta", "L_xi", "L_eta", "L_zeta", "pid"})
 
 picurv_cli.source_expressions.ALLOWED_NAMES = set(ALLOWED_FUNCTIONS) | EULERIAN_EXPRESSION_NAMES | {"pi"}
 
 picurv_cli.source_expressions._DECIMAL_LITERAL = re.compile(r"^(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$")
 
tuple picurv_cli.source_expressions.ALLOWED_AST_NODES
 
tuple picurv_cli.source_expressions.REGION_SHAPES = ("half_space", "slab", "box", "ball", "cylinder")
 
dict picurv_cli.source_expressions.EDGE_PROFILES
 
dict picurv_cli.source_expressions._REGION_KEYS
 
tuple picurv_cli.source_expressions._AXES = ("x", "y", "z")
 

Detailed Description

The source expression language on the Python side: its functions and variables, validation, constant substitution, region lowering and NumPy evaluation.

The CLI checks every source with it before a run; generators/ic.gen evaluates one with it. The solver evaluates the same language in src/expression.c, and tests/test_expression_language.py holds the two to one conformance fixture.

Definition in file source_expressions.py.