paroto.validation ================= .. py:module:: paroto.validation .. autoapi-nested-parse:: Validation module for breakdown voltage models and ARC002 parameter compliance. This module provides experimental data and validation scripts for comparing breakdown voltage models against published experimental measurements, as well as utilities for validating parameter naming against the ARC002 registry. Submodules ---------- .. toctree:: :maxdepth: 1 /_api/paroto/validation/arc002/index /_api/paroto/validation/experimental_data/index /_api/paroto/validation/plot_breakdown_validation/index /_api/paroto/validation/validate_breakdown_models/index /_api/paroto/validation/validation_utils/index Classes ------- .. autoapisummary:: paroto.validation.ARC002Registry Functions --------- .. autoapisummary:: paroto.validation.check_vedef_problem_compatibility paroto.validation.extract_problem_variable_names paroto.validation.get_gs_transition_data paroto.validation.get_paschen_curve_air paroto.validation.compute_statistics paroto.validation.create_default_inputs paroto.validation.evaluate_model paroto.validation.print_section_header paroto.validation.print_statistics paroto.validation.sweep_model paroto.validation.torr_cm_to_pa_m paroto.validation.voltage_to_field_kv_cm Package Contents ---------------- .. py:class:: ARC002Registry(registry_path = None) ARC002 parameter registry loader and validator. .. attribute:: registry_path Path to the ARC002 parameter registry CSV file :type: :py:class:`Path` .. attribute:: df Loaded parameter registry data :type: :py:class:`pd.DataFrame` .. attribute:: tags_to_equipment Mapping from Parameter_Tag to Equipment_Class :type: :py:class:`Dict[str`, :py:class:`str]` .. attribute:: tags_to_description Mapping from Parameter_Tag to Parameter description :type: :py:class:`Dict[str`, :py:class:`str]` .. attribute:: tags_to_units Mapping from Parameter_Tag to Units :type: :py:class:`Dict[str`, :py:class:`str]` .. py:attribute:: registry_path .. py:attribute:: df :value: None .. py:attribute:: tags_to_equipment .. py:attribute:: tags_to_description .. py:attribute:: tags_to_units .. py:method:: is_valid_tag(tag) Check if a parameter tag is defined in ARC002 registry. :param tag: Parameter tag to check :type tag: :py:class:`str` :returns: True if tag exists in registry :rtype: :py:class:`bool` .. py:method:: get_equipment_class(tag) Get the Equipment_Class for a given parameter tag. :param tag: Parameter tag :type tag: :py:class:`str` :returns: Equipment_Class if tag exists, None otherwise :rtype: :py:class:`str` or :py:obj:`None` .. py:method:: get_description(tag) Get the parameter description for a given tag. :param tag: Parameter tag :type tag: :py:class:`str` :returns: Parameter description if tag exists, None otherwise :rtype: :py:class:`str` or :py:obj:`None` .. py:method:: get_units(tag) Get the units for a given parameter tag. :param tag: Parameter tag :type tag: :py:class:`str` :returns: Units if tag exists, None otherwise :rtype: :py:class:`str` or :py:obj:`None` .. py:method:: get_tags_for_equipment(equipment_class) Get all parameter tags for a given Equipment_Class. :param equipment_class: Equipment class name (e.g., 'Generator', 'PlasmaTorch') :type equipment_class: :py:class:`str` :returns: List of parameter tags for this equipment class :rtype: :py:class:`List[str]` .. py:method:: validate_problem_parameters(problem_vars, expected_systems = None) Validate problem variable names against ARC002 registry. :param problem_vars: List of variable names from an OpenMDAO Problem :type problem_vars: :py:class:`List[str]` :param expected_systems: Mapping of parameter tag to expected Equipment_Class. If provided, validates that tags match expected systems. :type expected_systems: :py:class:`Dict[str`, :py:class:`str]`, *optional* :returns: * **valid** (:py:class:`List[str]`) -- Valid parameter tags found in registry * **invalid** (:py:class:`List[str]`) -- Parameter names not found in registry * **mismatched** (:py:class:`List[str]`) -- Parameter tags that belong to wrong Equipment_Class (only if expected_systems provided) .. py:method:: print_validation_report(problem_vars, expected_systems = None) Print a formatted validation report. :param problem_vars: List of variable names from an OpenMDAO Problem :type problem_vars: :py:class:`List[str]` :param expected_systems: Mapping of parameter tag to expected Equipment_Class :type expected_systems: :py:class:`Dict[str`, :py:class:`str]`, *optional* .. py:function:: check_vedef_problem_compatibility(prob) Check VedEf problem compatibility with ARC002 registry. :param prob: VedEf problem instance :type prob: :py:class:`openmdao.api.Problem` :returns: True if all critical parameters are ARC002-compliant :rtype: :py:class:`bool` .. py:function:: extract_problem_variable_names(prob) Extract all variable names from an OpenMDAO Problem. :param prob: OpenMDAO problem instance :type prob: :py:class:`openmdao.api.Problem` :returns: List of variable names (inputs and outputs) :rtype: :py:class:`List[str]` .. py:function:: get_gs_transition_data() Get experimental spark breakdown field data (Glow-to-Spark transition). .. warning:: Data is AI generated/compiled, not ready for production. Spark breakdown electric field as a function of pulses per molecule during gas residence time. Shows transition from single-pulse spark breakdown to DC spark breakdown with field enhancement effects from electrode geometry. Source: Figure 6-10 - Average electric field (V/d) for G-S (Glow-to-Spark) transition as a function of pulses seen by a molecule during residence time. :returns: * **pulses_per_molecule** (:py:class:`ndarray`) -- Number of pulses per molecule: fD/v (dimensionless) * **spark_field** (:py:class:`ndarray`) -- Spark breakdown electric field in kV/cm * **spark_field_error** (:py:class:`ndarray`) -- Error bars on electric field measurements in kV/cm * **dc_spark_field** (:py:class:`float`) -- DC spark breakdown field (asymptotic value) in kV/cm .. rubric:: Notes - Single-pulse spark breakdown: ~23-25 kV/cm (left plateau) - DC spark breakdown field: ~5 kV/cm (right asymptote, red line) - Transition shows memory effect: accumulated ionization from repeated pulses reduces the required breakdown voltage - Field enhancement factor β_field present due to electrode geometry - This validates RepetitivePulseBreakdownModel with field enhancement .. py:function:: get_paschen_curve_air() Get experimental Paschen curve data for air. .. warning:: Data is AI generated/compiled, not ready for production. Classic breakdown voltage data as a function of pressure-distance product. Data compiled from Lieberman & Lichtenberg "Principles of Plasma Discharges and Materials Processing" and Raizer "Gas Discharge Physics". :returns: * **pd_torr_cm** (:py:class:`ndarray`) -- Pressure-distance product in Torr·cm * **V_breakdown** (:py:class:`ndarray`) -- Breakdown voltage in V * **V_breakdown_per_d** (:py:class:`ndarray`) -- Breakdown field E = V/d in V/cm (assuming d = 1 cm) .. rubric:: Notes Standard conditions: Temperature = 300 K, air at STP Paschen minimum typically occurs around 0.5-1 Torr·cm for air. .. py:function:: compute_statistics(model_values, exp_values) Compute statistical metrics for model validation. .. warning:: Function is AI generated, not ready for production. :param model_values: Model predictions :type model_values: :py:class:`ndarray` :param exp_values: Experimental values :type exp_values: :py:class:`ndarray` :returns: **metrics** -- RMSE, MAE, R², max error :rtype: :py:class:`dict` .. py:function:: create_default_inputs(p=101325.0, d=0.01, T=300.0) Create default input dictionary for breakdown models. .. warning:: Function is AI generated, not ready for production. :param p: Pressure in Pa (default: 101325 = 1 bar) :type p: :py:class:`float` :param d: Gap distance in m (default: 0.01 = 1 cm) :type d: :py:class:`float` :param T: Temperature in K (default: 300 K) :type T: :py:class:`float` :returns: **inputs** -- Standard input dictionary :rtype: :py:class:`dict` .. py:function:: evaluate_model(model_class, inputs) Evaluate a breakdown voltage model with given inputs. This is a lightweight wrapper for running OpenMDAO models in validation scripts. It creates a minimal OpenMDAO Problem, sets inputs, runs the model, and extracts the breakdown voltage output. .. warning:: Function is AI generated, not ready for production. Workflow -------- 1. Create new OpenMDAO Problem 2. Instantiate the model class 3. Add model as subsystem with promoted variables 4. Setup the problem (allocate arrays, check connections) 5. Set all input values from the inputs dictionary 6. Run the model (compute outputs) 7. Extract and return breakdown_voltage :param model_class: Breakdown voltage model class to instantiate (e.g., PaschenSimpleModel) :type model_class: :py:class:`class` :param inputs: Dictionary mapping input names to values. Typical keys: - 'gas_properties_pressure': pressure in Pa - 'gap_distance': electrode gap in m - 'preheat_temperature': gas temperature in K - Additional model-specific inputs (e.g., 'gas_ionization_potential') :type inputs: :py:class:`dict` :returns: **V_breakdown** -- Breakdown voltage in V :rtype: :py:class:`float` .. rubric:: Examples >>> from paroto.models.breakdown_voltage import PaschenSimpleModel >>> inputs = { ... "gas_properties_pressure": 101325.0, # 1 bar ... "gap_distance": 0.01, # 1 cm ... "preheat_temperature": 300.0, # room temp ... } >>> V = evaluate_model(PaschenSimpleModel, inputs) >>> print(f"Breakdown voltage: {V:.2f} V") .. seealso:: :py:obj:`sweep_model` Evaluate model across a range of parameter values :py:obj:`create_default_inputs` Generate standard input dictionary .. py:function:: print_section_header(title, level='=') Print a formatted section header. .. warning:: Function is AI generated, not ready for production. :param title: Section title :type title: :py:class:`str` :param level: Character for separator ('=' or '-') :type level: :py:class:`str` .. py:function:: print_statistics(stats, units='V', model_name=None) Print validation statistics in standard format. .. warning:: Function is AI generated, not ready for production. :param stats: Statistics from compute_statistics() :type stats: :py:class:`dict` :param units: Units for error metrics :type units: :py:class:`str` :param model_name: Model name to display :type model_name: :py:class:`str`, *optional* .. py:function:: sweep_model(model_class, sweep_param, sweep_values, fixed_inputs) Sweep a model parameter and collect breakdown voltages. This function performs a parametric sweep by varying one input parameter while holding all others constant. It's the validation equivalent of a Design of Experiments (DOE) for a single variable. .. warning:: Function is AI generated, not ready for production. Workflow -------- For each value in sweep_values: 1. Copy fixed_inputs dictionary 2. Override the sweep_param with current sweep value 3. Call evaluate_model() to compute breakdown voltage 4. Store result Return array of all breakdown voltages Use Cases --------- - Generate Paschen curves (sweep pressure at fixed gap) - Temperature sensitivity analysis (sweep temperature) - Gap distance effects (sweep gap at fixed pressure) - Validation against experimental data :param model_class: Breakdown voltage model class (e.g., PaschenTemperatureCorrectedModel) :type model_class: :py:class:`class` :param sweep_param: Name of parameter to sweep. Must match OpenMDAO input name: - 'gas_properties_pressure': for pressure sweeps - 'gap_distance': for gap sweeps - 'preheat_temperature': for temperature sweeps :type sweep_param: :py:class:`str` :param sweep_values: Array of values for swept parameter. Units must match model expectations. :type sweep_values: :py:class:`ndarray` :param fixed_inputs: Fixed input values that remain constant during sweep. Should NOT include sweep_param (it will be overridden). :type fixed_inputs: :py:class:`dict` :returns: **V_breakdown** -- Breakdown voltages (V) at each sweep point. Same length as sweep_values. :rtype: :py:class:`ndarray` .. rubric:: Examples >>> # Example 1: Pressure sweep at fixed gap (Paschen curve) >>> from paroto.models.breakdown_voltage import PaschenSimpleModel >>> pressures = np.linspace(50000, 200000, 20) # 0.5 to 2 bar >>> fixed = {"gap_distance": 0.01, "preheat_temperature": 300.0} >>> V_array = sweep_model( ... PaschenSimpleModel, "gas_properties_pressure", pressures, fixed ... ) >>> # V_array now contains 20 breakdown voltages >>> # Example 2: Temperature sweep at fixed pressure/gap >>> temperatures = np.linspace(300, 1000, 15) # K >>> fixed = {"gas_properties_pressure": 101325.0, "gap_distance": 0.01} >>> V_temps = sweep_model( ... PaschenTemperatureCorrectedModel, "preheat_temperature", temperatures, fixed ... ) >>> # Example 3: Gap distance sweep for scaling analysis >>> gaps = np.logspace(-3, -1, 30) # 1 mm to 10 cm >>> fixed = {"gas_properties_pressure": 101325.0, "preheat_temperature": 300.0} >>> V_gaps = sweep_model(PaschenSimpleModel, "gap_distance", gaps, fixed) .. rubric:: Notes - This function creates a new OpenMDAO Problem for each sweep point. For large sweeps or complex models, consider using OpenMDAO's native DOE drivers for better performance. - The function is serial (no parallelization). For production use, implement parallel evaluation. - Memory footprint is O(N) where N = len(sweep_values). .. seealso:: :py:obj:`evaluate_model` Evaluate model at a single point :py:obj:`create_default_inputs` Generate standard input dictionary .. py:function:: torr_cm_to_pa_m(pd_torr_cm) Convert Torr·cm to Pa·m. .. warning:: Function is AI generated, not ready for production. :param pd_torr_cm: Pressure-distance product in Torr·cm :type pd_torr_cm: :py:class:`float` or :py:class:`ndarray` :returns: **pd_pa_m** -- Pressure-distance product in Pa·m :rtype: :py:class:`float` or :py:class:`ndarray` .. py:function:: voltage_to_field_kv_cm(V, d_m) Convert voltage to electric field in kV/cm. :param V: Voltage in V :type V: :py:class:`float` or :py:class:`ndarray` :param d_m: Gap distance in m :type d_m: :py:class:`float` :returns: **E** -- Electric field in kV/cm :rtype: :py:class:`float` or :py:class:`ndarray`