src.pydasa.workflows.phenomena#
Module for AnalysisEngine to orchestrate dimensional analysis workflows in PyDASA.
This module provides the AnalysisEngine class serves as the main entry point and workflow for PyDASA’s dimensional analysis capabilities setting up the dimensional domain, solving the dimensional matrix, and generate coefficients.
- Classes:
AnalysisEngine: Main workflow class for dimensional analysis and coefficient generation.
IMPORTANT: Based on the theory from:
# H.Gorter, Dimensionalanalyse: Eine Theoririe der physikalischen Dimensionen mit Anwendungen
Classes#
AnalysisEngine class for orchestrating dimensional analysis workflows in PyDASA. |
Module Contents#
- class src.pydasa.workflows.phenomena.AnalysisEngine#
Bases:
pydasa.core.basic.Foundation,pydasa.workflows.basic.WorkflowBaseAnalysisEngine class for orchestrating dimensional analysis workflows in PyDASA.
Main entry point to solve the dimensional matrix and generate the dimensionless coefficients.
- Parameters:
Foundation (Foundation) – Inherits common validation logic.
WorkflowBase (WorkflowBase) – Inherits workflow basic functionalities.
- # From Foundation
_name (str): User-friendly name of the problem. description (str): Brief summary of the problem. _idx (int): Index/precedence of the problem. _sym (str): Symbol representation (LaTeX or alphanumeric). _alias (str): Python-compatible alias for use in code. _fwk (str): Frameworks context (PHYSICAL, COMPUTATION, SOFTWARE, CUSTOM).
- # From Workflows
_variables (Dict[str, Variable]): All variables in the model. _schema (Optional[Schema]): Dimensional framework schema. _coefficients (Dict[str, Coefficient]): All coefficients in the model. _results (Dict[str, Dict[str, Any]]): Consolidated results from workflow. _is_solved (bool): Flag indicating if the workflow has been solved.
- # For the Analysis Engine
_model (Optional[Matrix]): Dimensional matrix for analysis.
- _model: pydasa.dimensional.model.Matrix | None = None#
Dimensional matrix for Buckingham Pi analysis.
- property matrix: pydasa.dimensional.model.Matrix | None#
matrix Get the dimensional matrix.
- Returns:
Dimensional matrix.
- Return type:
Optional[Matrix]
- create_matrix(**kwargs)#
create_matrix() Create and configure dimensional matrix for the model.
- Parameters:
**kwargs – Optional keyword arguments to pass to Matrix constructor.
- Returns:
Configured dimensional matrix.
- Return type:
- Raises:
ValueError – If variables are not set.
TypeError – If schema is not set.
- solve()#
solve() Solve the dimensional matrix and generate coefficients.
Performs dimensional analysis using the Buckingham Pi theorem to generate dimensionless coefficients.
- Returns:
Dictionary of generated coefficients.
- Return type:
Dict[str, Coefficient]
- Raises:
ValueError – If matrix is not created.
RuntimeError – If solving fails.
- run_analysis()#
run_analysis() Execute complete dimensional analysis workflow. Convenience method that runs the entire workflow: create matrix and solve.
- Returns:
Dictionary with the Dimensional Analysis results with coefficient details in nested dictionaries.
- Return type:
Dict[str, Any]
- derive_coefficient(expr, symbol='', name='', description='', idx=-1)#
derive_coefficient() Derive a new coefficient from existing ones.
- Parameters:
expr (str) – LaTeX expression defining the new coefficient in terms of existing ones.
symbol (str, optional) – Symbol representation (LaTeX or alphanumeric) for the derived coefficient. Defaults to “” to keep the original (e.g., Pi_{0}).
name (str, optional) – User-friendly name for the derived coefficient. Defaults to “”.
description (str, optional) – Description of the derived coefficient. Defaults to “”.
idx (int, optional) – Index/precedence of the derived coefficient. Defaults to -1.
- Raises:
ValueError – If matrix is not created.
ValueError – If matrix is not solved.
ValueError – If the expression for the derived coefficient is invalid.
RuntimeError – If derivation fails.
- Returns:
The newly derived coefficient.
- Return type:
- calculate_coefficients(setpoints=None)#
calculate_coefficients() Calculate numerical values for all coefficients based on current variable setpoints.
- Parameters:
setpoints (Optional[Dict[str, float]], optional) – Dictionary of variable symbols and their numerical setpoint values. Defaults to None.
- Raises:
ValueError – If matrix is not created.
ValueError – If matrix is not solved.
- Returns:
Dictionary of coefficient symbols and their calculated numerical values.
- Return type:
- reset()#
reset() Reset the solver state, all the results, KEEPING only the input variables.
- Return type:
None
- clear()#
clear() Reset all attributes to default values.
Clears all solver properties to their initial state, INCLUDING variables.
- Return type:
None
- to_dict()#
to_dict() Convert solver state to dictionary.
- Returns:
Dictionary representation of solver state.
- Return type:
Dict[str, Any]