Variable Descriptors#

The ansys.units.variable_descriptor subpackage defines interfaces and implementations for representing physical quantities in a product-agnostic, unit-aware way. These descriptors serve as the foundation for communicating quantity metadata across Ansys systems and external APIs.

Overview#

A VariableDescriptor encapsulates information about a physical quantity, such as:

  • Its name (for example, VELOCITY, FORCE)

  • Its associated dimensionality (via QuantityDimensions)

  • Optional metadata for display, categorization, or mapping to domain-specific naming schemes

These descriptors are immutable and hashable, making them suitable as keys in mappings and registries.

The subpackage also defines conversion strategies that translate between VariableDescriptor objects and external string representations (such as Fluent variable names).

Main Classes#

VariableDescriptor#

class ansys.units.variable_descriptor.variable_descriptor.VariableDescriptor(name: str, dimension: Dimensions)#

Bases: object

Defines a physical quantity variable descriptor.

dimension: Dimensions#
name: str#

Represents a single named physical quantity, including its dimensional signature.

VariableCatalog#

class ansys.units.variable_descriptor.variable_descriptor.VariableCatalog#

Bases: object

A catalog of variable descriptors.

ABSOLUTE_PRESSURE = VariableDescriptor(name='absolute_pressure', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
ABSORBANCE = VariableDescriptor(name='absorbance', dimension={})#
ABSORBED_DOSE_RATE = VariableDescriptor(name='absorbed_dose_rate', dimension={'LENGTH': 2.0, 'TIME': -3.0})#
ACCELERATION = VariableDescriptor(name='acceleration', dimension={'LENGTH': 1.0, 'TIME': -2.0})#
ACCELERATION_MAGNITUDE = VariableDescriptor(name='acceleration_magnitude', dimension={'LENGTH': 1.0, 'TIME': -2.0})#
ACCELERATION_X = VariableDescriptor(name='acceleration_x', dimension={'LENGTH': 1.0, 'TIME': -2.0})#
ACCELERATION_Y = VariableDescriptor(name='acceleration_y', dimension={'LENGTH': 1.0, 'TIME': -2.0})#
ACCELERATION_Z = VariableDescriptor(name='acceleration_z', dimension={'LENGTH': 1.0, 'TIME': -2.0})#
ACOUSTICAL_ABSORPTION = VariableDescriptor(name='acoustical_absorption', dimension={})#
ACTION = VariableDescriptor(name='action', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -1.0})#
ANGLE = VariableDescriptor(name='angle', dimension={'ANGLE': 1.0})#
ANGULAR_ACCELERATION = VariableDescriptor(name='angular_acceleration', dimension={'TIME': -2.0})#
ANGULAR_MOMENTUM = VariableDescriptor(name='angular_momentum', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -1.0})#
ANGULAR_MOMENTUM_MAGNITUDE = VariableDescriptor(name='angular_momentum_magnitude', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -1.0})#
ANGULAR_MOMENTUM_X = VariableDescriptor(name='angular_momentum_x', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -1.0})#
ANGULAR_MOMENTUM_Y = VariableDescriptor(name='angular_momentum_y', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -1.0})#
ANGULAR_MOMENTUM_Z = VariableDescriptor(name='angular_momentum_z', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -1.0})#
ANGULAR_VELOCITY = VariableDescriptor(name='angular_velocity', dimension={'TIME': -1.0})#
AREA = VariableDescriptor(name='area', dimension={'LENGTH': 2.0})#
AREA_DENSITY = VariableDescriptor(name='area_density', dimension={'MASS': 1.0, 'LENGTH': -2.0})#
ATOMIC_MASS = VariableDescriptor(name='atomic_mass', dimension={'MASS': 1.0})#
ATOMIC_NUMBER = VariableDescriptor(name='atomic_number', dimension={})#
ATTENUATION_COEFFICIENT = VariableDescriptor(name='attenuation_coefficient', dimension={'LENGTH': -1.0})#
AXIAL_VELOCITY = VariableDescriptor(name='axial_velocity', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
BIREFRINGENCE = VariableDescriptor(name='birefringence', dimension={})#
BULK_MODULUS = VariableDescriptor(name='bulk_modulus', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
CAPACITANCE = VariableDescriptor(name='capacitance', dimension={'MASS': -1.0, 'LENGTH': -2.0, 'TIME': 4.0, 'CURRENT': 2.0})#
CATALYTIC_EFFICIENCY = VariableDescriptor(name='catalytic_efficiency', dimension={'LENGTH': 3.0, 'CHEMICAL_AMOUNT': -1.0, 'TIME': -1.0})#
CELL_REYNOLDS_NUMBER = VariableDescriptor(name='cell_reynolds_number', dimension={})#
CHEMICAL_AMOUNT = VariableDescriptor(name='chemical_amount', dimension={'CHEMICAL_AMOUNT': 1.0})#
COEFFICIENT_OF_RESTITUTION = VariableDescriptor(name='coefficient_of_restitution', dimension={})#
COLOR = VariableDescriptor(name='color', dimension={})#
COMPRESSIBILITY = VariableDescriptor(name='compressibility', dimension={'MASS': -1.0, 'LENGTH': 1.0, 'TIME': 2.0})#
COMPRESSIVE_STRENGTH = VariableDescriptor(name='compressive_strength', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
CONVECTIVE_COURANT_NUMBER = VariableDescriptor(name='convective_courant_number', dimension={})#
CORROSION_RESISTANCE = VariableDescriptor(name='corrosion_resistance', dimension={})#
CREEP = VariableDescriptor(name='creep', dimension={'TIME': -1.0})#
CURIE_TEMPERATURE = VariableDescriptor(name='curie_temperature', dimension={'TEMPERATURE': 1.0})#
CURRENT = VariableDescriptor(name='current', dimension={'CURRENT': 1.0})#
DENSITY = VariableDescriptor(name='density', dimension={'MASS': 1.0, 'LENGTH': -3.0})#
DIAMAGNETISM = VariableDescriptor(name='diamagnetism', dimension={})#
DIELECTRIC_CONSTANT = VariableDescriptor(name='dielectric_constant', dimension={})#
DIELECTRIC_STRENGTH = VariableDescriptor(name='dielectric_strength', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -3.0, 'CURRENT': -1.0})#
DUCTILITY = VariableDescriptor(name='ductility', dimension={})#
DURABILITY = VariableDescriptor(name='durability', dimension={})#
DYNAMIC_PRESSURE = VariableDescriptor(name='dynamic_pressure', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
DYNAMIC_VISCOSITY = VariableDescriptor(name='dynamic_viscosity', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -1.0})#
EFFECTIVE_PRANDTL_NUMBER = VariableDescriptor(name='effective_prandtl_number', dimension={})#
EFFECTIVE_THERMAL_CONDUCTIVITY = VariableDescriptor(name='effective_thermal_conductivity', dimension={'LENGTH': 1.0, 'MASS': 1.0, 'TIME': -3.0, 'TEMPERATURE': -1.0})#
EFFECTIVE_VISCOSITY = VariableDescriptor(name='effective_viscosity', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -1.0})#
ELASTICITY = VariableDescriptor(name='elasticity', dimension={})#
ELECTRICAL_CAPACITANCE = VariableDescriptor(name='electrical_capacitance', dimension={'MASS': -1.0, 'LENGTH': -2.0, 'TIME': 4.0, 'CURRENT': 2.0})#
ELECTRICAL_CONDUCTANCE = VariableDescriptor(name='electrical_conductance', dimension={'MASS': -1.0, 'LENGTH': -2.0, 'TIME': 3.0, 'CURRENT': 2.0})#
ELECTRICAL_CONDUCTIVITY = VariableDescriptor(name='electrical_conductivity', dimension={'MASS': -1.0, 'LENGTH': -3.0, 'TIME': 3.0, 'CURRENT': 2.0})#
ELECTRICAL_IMPEDANCE = VariableDescriptor(name='electrical_impedance', dimension={'MASS': 1.0, 'LENGTH': 2.0, 'TIME': -3.0, 'CURRENT': -2.0})#
ELECTRICAL_INDUCTANCE = VariableDescriptor(name='electrical_inductance', dimension={'MASS': 1.0, 'LENGTH': 2.0, 'TIME': -2.0, 'CURRENT': -2.0})#
ELECTRICAL_POTENTIAL = VariableDescriptor(name='electrical_potential', dimension={'MASS': 1.0, 'LENGTH': 2.0, 'TIME': -3.0, 'CURRENT': -1.0})#
ELECTRICAL_REACTANCE = VariableDescriptor(name='electrical_reactance', dimension={'MASS': 1.0, 'LENGTH': 2.0, 'TIME': -3.0, 'CURRENT': -2.0})#
ELECTRICAL_RESISTANCE = VariableDescriptor(name='electrical_resistance', dimension={'MASS': 1.0, 'LENGTH': 2.0, 'TIME': -3.0, 'CURRENT': -2.0})#
ELECTRICAL_RESISTIVITY = VariableDescriptor(name='electrical_resistivity', dimension={'MASS': 1.0, 'LENGTH': 3.0, 'TIME': -3.0, 'CURRENT': -2.0})#
ELECTRIC_CHARGE = VariableDescriptor(name='electric_charge', dimension={'TIME': 1.0, 'CURRENT': 1.0})#
ELECTRIC_SUSCEPTIBILITY = VariableDescriptor(name='electric_susceptibility', dimension={})#
ELECTROCALORIC_COEFFICIENT = VariableDescriptor(name='electrocaloric_coefficient', dimension={'TEMPERATURE': 1.0, 'MASS': -1.0, 'LENGTH': -2.0, 'TIME': 3.0, 'CURRENT': 1.0})#
ELECTROSTRICTION = VariableDescriptor(name='electrostriction', dimension={})#
ELECTRO_OPTIC_EFFECT = VariableDescriptor(name='electro_optic_effect', dimension={})#
EMISSIVITY = VariableDescriptor(name='emissivity', dimension={})#
ENERGY = VariableDescriptor(name='energy', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0})#
ENERGY_DENSITY = VariableDescriptor(name='energy_density', dimension={'LENGTH': -1.0, 'MASS': 1.0, 'TIME': -2.0})#
ENERGY_FLUX_DENSITY = VariableDescriptor(name='energy_flux_density', dimension={'MASS': 1.0, 'TIME': -3.0})#
ENTHALPY = VariableDescriptor(name='enthalpy', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0})#
ENTROPY = VariableDescriptor(name='entropy', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0, 'TEMPERATURE': -1.0})#
FATIGUE_LIMIT = VariableDescriptor(name='fatigue_limit', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
FLEXURAL_MODULUS = VariableDescriptor(name='flexural_modulus', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
FLEXURAL_STRENGTH = VariableDescriptor(name='flexural_strength', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
FORCE = VariableDescriptor(name='force', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -2.0})#
FORCE_MAGNITUDE = VariableDescriptor(name='force_magnitude', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -2.0})#
FORCE_X = VariableDescriptor(name='force_x', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -2.0})#
FORCE_Y = VariableDescriptor(name='force_y', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -2.0})#
FORCE_Z = VariableDescriptor(name='force_z', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -2.0})#
FRACTURE_TOUGHNESS = VariableDescriptor(name='fracture_toughness', dimension={'MASS': 1.0, 'TIME': -2.0})#
FREQUENCY = VariableDescriptor(name='frequency', dimension={'TIME': -1.0})#
FREQUENCY_DRIFT = VariableDescriptor(name='frequency_drift', dimension={'TIME': -2.0})#
FRICTION_COEFFICIENT = VariableDescriptor(name='friction_coefficient', dimension={})#
FUEL_EFFICIENCY = VariableDescriptor(name='fuel_efficiency', dimension={'LENGTH': -2.0})#
HALF_LIFE = VariableDescriptor(name='half_life', dimension={'TIME': 1.0})#
HALL_COEFFICIENT = VariableDescriptor(name='hall_coefficient', dimension={'LENGTH': 3.0, 'CURRENT': -1.0, 'TIME': -1.0})#
HARDNESS = VariableDescriptor(name='hardness', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
HEAT_CAPACITY = VariableDescriptor(name='heat_capacity', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0, 'TEMPERATURE': -1.0})#
HEAT_FLUX_DENSITY = VariableDescriptor(name='heat_flux_density', dimension={'MASS': 1.0, 'TIME': -3.0})#
HEAT_OF_VAPORIZATION = VariableDescriptor(name='heat_of_vaporization', dimension={'LENGTH': 2.0, 'TIME': -2.0})#
HYGROSCOPY = VariableDescriptor(name='hygroscopy', dimension={})#
HYSTERESIS = VariableDescriptor(name='hysteresis', dimension={})#
ILLUMINANCE = VariableDescriptor(name='illuminance', dimension={'LIGHT': 1.0, 'SOLID_ANGLE': 1.0, 'LENGTH': -2.0})#
INTERNAL_ENERGY = VariableDescriptor(name='internal_energy', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0})#
JERK = VariableDescriptor(name='jerk', dimension={'LENGTH': 1.0, 'TIME': -3.0})#
KINEMATIC_VISCOSITY = VariableDescriptor(name='kinematic_viscosity', dimension={'LENGTH': 2.0, 'TIME': -1.0})#
LENGTH = VariableDescriptor(name='length', dimension={'LENGTH': 1.0})#
LIGHT = VariableDescriptor(name='light', dimension={'LIGHT': 1.0})#
LINEAR_MASS_DENSITY = VariableDescriptor(name='linear_mass_density', dimension={'MASS': 1.0, 'LENGTH': -1.0})#
LUMINANCE = VariableDescriptor(name='luminance', dimension={'LIGHT': 1.0, 'LENGTH': -2.0})#
LUMINOSITY = VariableDescriptor(name='luminosity', dimension={'LIGHT': 1.0, 'SOLID_ANGLE': 1.0})#
LUMINOUS_EXPOSURE = VariableDescriptor(name='luminous_exposure', dimension={'LIGHT': 1.0, 'SOLID_ANGLE': 1.0, 'LENGTH': -2.0, 'TIME': 1.0})#
LUMINOUS_FLUX = VariableDescriptor(name='luminous_flux', dimension={'LIGHT': 1.0, 'SOLID_ANGLE': 1.0})#
MAGNETIC_FLUX = VariableDescriptor(name='magnetic_flux', dimension={'MASS': 1.0, 'LENGTH': 2.0, 'TIME': -2.0, 'CURRENT': -1.0})#
MAGNETIC_INDUCTION = VariableDescriptor(name='magnetic_induction', dimension={'MASS': 1.0, 'TIME': -2.0, 'CURRENT': -1.0})#
MAGNETIC_PERMEABILITY = VariableDescriptor(name='magnetic_permeability', dimension={'LENGTH': 1.0, 'MASS': 1.0, 'TIME': -2.0, 'CURRENT': -2.0})#
MAGNETIC_VECTOR_POTENTIAL = VariableDescriptor(name='magnetic_vector_potential', dimension={'LENGTH': 1.0, 'MASS': 1.0, 'TIME': -2.0, 'CURRENT': -1.0})#
MAGNETOCALORIC_COEFFICIENT = VariableDescriptor(name='magnetocaloric_coefficient', dimension={'TEMPERATURE': 1.0, 'MASS': -1.0, 'TIME': 2.0, 'CURRENT': 1.0})#
MAGNETOELECTRIC_POLARIZABILITY = VariableDescriptor(name='magnetoelectric_polarizability', dimension={'LENGTH': -1.0, 'TIME': -1.0})#
MAGNETORESISTANCE = VariableDescriptor(name='magnetoresistance', dimension={})#
MAGNETOSTRICTION = VariableDescriptor(name='magnetostriction', dimension={})#
MAGNETOTHERMOELECTRIC_POWER = VariableDescriptor(name='magnetothermoelectric_power', dimension={'LENGTH': 2.0, 'TIME': -1.0, 'TEMPERATURE': -1.0})#
MALLEABILITY = VariableDescriptor(name='malleability', dimension={})#
MASS = VariableDescriptor(name='mass', dimension={'MASS': 1.0})#
MASS_CONTROL = VariableDescriptor(name='mass_control', dimension={'MASS': 1.0, 'TIME': -3.0})#
MASS_DIFFUSIVITY = VariableDescriptor(name='mass_diffusivity', dimension={'LENGTH': 2.0, 'TIME': -1.0})#
MASS_FLOW_RATE = VariableDescriptor(name='mass_flow_rate', dimension={'MASS': 1.0, 'TIME': -1.0})#
MAXIMUM_ENERGY_PRODUCT = VariableDescriptor(name='maximum_energy_product', dimension={'LENGTH': -1.0, 'MASS': 1.0, 'TIME': -2.0})#
MELTING_POINT = VariableDescriptor(name='melting_point', dimension={'TEMPERATURE': 1.0})#
MESH_VELOCITY = VariableDescriptor(name='mesh_velocity', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
MESH_VELOCITY_MAGNITUDE = VariableDescriptor(name='mesh_velocity_magnitude', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
MESH_VELOCITY_X = VariableDescriptor(name='mesh_velocity_x', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
MESH_VELOCITY_Y = VariableDescriptor(name='mesh_velocity_y', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
MESH_VELOCITY_Z = VariableDescriptor(name='mesh_velocity_z', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
MOLALITY = VariableDescriptor(name='molality', dimension={'CHEMICAL_AMOUNT': 1.0, 'MASS': -1.0})#
MOLARITY = VariableDescriptor(name='molarity', dimension={'CHEMICAL_AMOUNT': 1.0, 'LENGTH': -3.0})#
MOLAR_ENERGY = VariableDescriptor(name='molar_energy', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0, 'CHEMICAL_AMOUNT': -1.0})#
MOLAR_ENTROPY = VariableDescriptor(name='molar_entropy', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0, 'TEMPERATURE': -1.0, 'CHEMICAL_AMOUNT': -1.0})#
MOLAR_HEAT_CAPACITY = VariableDescriptor(name='molar_heat_capacity', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0, 'TEMPERATURE': -1.0, 'CHEMICAL_AMOUNT': -1.0})#
MOLAR_MASS = VariableDescriptor(name='molar_mass', dimension={'MASS': 1.0, 'CHEMICAL_AMOUNT': -1.0})#
MOLAR_VOLUME = VariableDescriptor(name='molar_volume', dimension={'LENGTH': 3.0, 'CHEMICAL_AMOUNT': -1.0})#
MOMENTUM = VariableDescriptor(name='momentum', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -1.0})#
MOMENTUM_MAGNITUDE = VariableDescriptor(name='momentum_magnitude', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -1.0})#
MOMENTUM_X = VariableDescriptor(name='momentum_x', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -1.0})#
MOMENTUM_Y = VariableDescriptor(name='momentum_y', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -1.0})#
MOMENTUM_Z = VariableDescriptor(name='momentum_z', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -1.0})#
MOMENT_OF_INERTIA = VariableDescriptor(name='moment_of_inertia', dimension={'MASS': 1.0, 'LENGTH': 2.0})#
NERNST_COEFFICIENT = VariableDescriptor(name='nernst_coefficient', dimension={'LENGTH': 2.0, 'TIME': -1.0, 'TEMPERATURE': -1.0})#
NEUTRON_CROSS_SECTION = VariableDescriptor(name='neutron_cross_section', dimension={'LENGTH': 2.0})#
NORMALIZED_Q_CRITERION = VariableDescriptor(name='normalized_q_criterion', dimension={})#
OPTICAL_ACTIVITY = VariableDescriptor(name='optical_activity', dimension={'LENGTH': 1.0, 'MASS': -1.0})#
PERMEABILITY = VariableDescriptor(name='permeability', dimension={'LENGTH': 1.0, 'MASS': 1.0, 'TIME': -2.0, 'CURRENT': -2.0})#
PERMITTIVITY = VariableDescriptor(name='permittivity', dimension={'MASS': -1.0, 'LENGTH': -3.0, 'TIME': 4.0, 'CURRENT': 2.0})#
PH = VariableDescriptor(name='ph', dimension={})#
PHOTOELASTICITY = VariableDescriptor(name='photoelasticity', dimension={'MASS': -1.0, 'LENGTH': 1.0, 'TIME': 2.0})#
PHOTOSENSITIVITY = VariableDescriptor(name='photosensitivity', dimension={})#
PIEZOELECTRIC_CONSTANTS = VariableDescriptor(name='piezoelectric_constants', dimension={'LENGTH': 2.0, 'TIME': -1.0, 'CURRENT': -1.0})#
PIEZOMAGNETISM = VariableDescriptor(name='piezomagnetism', dimension={'CURRENT': -1.0, 'LENGTH': 1.0})#
PLASTICITY = VariableDescriptor(name='plasticity', dimension={})#
POISSON_RATIO = VariableDescriptor(name='poisson_ratio', dimension={})#
POSITION = VariableDescriptor(name='position', dimension={'LENGTH': 1.0})#
POSITION_MAGNITUDE = VariableDescriptor(name='position_magnitude', dimension={'LENGTH': 1.0})#
POSITION_X = VariableDescriptor(name='position_x', dimension={'LENGTH': 1.0})#
POSITION_Y = VariableDescriptor(name='position_y', dimension={'LENGTH': 1.0})#
POSITION_Z = VariableDescriptor(name='position_z', dimension={'LENGTH': 1.0})#
POWER = VariableDescriptor(name='power', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -3.0})#
PRANDTL_NUMBER = VariableDescriptor(name='prandtl_number', dimension={})#
PRESSURE = VariableDescriptor(name='pressure', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
PRESSURE_COEFFICIENT = VariableDescriptor(name='pressure_coefficient', dimension={})#
PRODUCTION_OF_TURBULENT_KINETIC_ENERGY = VariableDescriptor(name='production_of_turbulent_kinetic_energy', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -3.0})#
PYROELECTRICITY = VariableDescriptor(name='pyroelectricity', dimension={'CURRENT': 1.0, 'LENGTH': -2.0, 'TEMPERATURE': -1.0})#
PYROMAGNETIC_COEFFICIENT = VariableDescriptor(name='pyromagnetic_coefficient', dimension={'MASS': 1.0, 'TIME': -2.0, 'CURRENT': -1.0, 'TEMPERATURE': -1.0})#
Q_CRITERION = VariableDescriptor(name='q_criterion', dimension={'TIME': -2.0})#
RADIAL_VELOCITY = VariableDescriptor(name='radial_velocity', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
RADIANCE = VariableDescriptor(name='radiance', dimension={'MASS': 1.0, 'TIME': -3.0, 'SOLID_ANGLE': -1.0})#
RADIANT_EXPOSURE = VariableDescriptor(name='radiant_exposure', dimension={'MASS': 1.0, 'TIME': -2.0})#
RADIANT_INTENSITY = VariableDescriptor(name='radiant_intensity', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -3.0, 'SOLID_ANGLE': -1.0})#
REACTIVITY = VariableDescriptor(name='reactivity', dimension={})#
REFLECTIVITY = VariableDescriptor(name='reflectivity', dimension={})#
REFRACTIVE_INDEX = VariableDescriptor(name='refractive_index', dimension={})#
RELATIVE_ATOMIC_MASS = VariableDescriptor(name='relative_atomic_mass', dimension={})#
RESILIENCE = VariableDescriptor(name='resilience', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
SCATTERING = VariableDescriptor(name='scattering', dimension={})#
SEEBECK_COEFFICIENT = VariableDescriptor(name='seebeck_coefficient', dimension={'MASS': 1.0, 'LENGTH': 2.0, 'TIME': -3.0, 'CURRENT': -1.0, 'TEMPERATURE': -1.0})#
SHEAR_MODULUS = VariableDescriptor(name='shear_modulus', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
SHEAR_STRENGTH = VariableDescriptor(name='shear_strength', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
SKIN_FRICTION_COEFFICIENT = VariableDescriptor(name='skin_friction_coefficient', dimension={})#
SLIP = VariableDescriptor(name='slip', dimension={})#
SNAP = VariableDescriptor(name='snap', dimension={'LENGTH': 1.0, 'TIME': -4.0})#
SOLID_ANGLE = VariableDescriptor(name='solid_angle', dimension={'SOLID_ANGLE': 1.0})#
SOUND_REFLECTION = VariableDescriptor(name='sound_reflection', dimension={})#
SOUND_TRANSFER = VariableDescriptor(name='sound_transfer', dimension={})#
SPECIFIC_ACTIVITY = VariableDescriptor(name='specific_activity', dimension={'MASS': -1.0, 'TIME': -1.0})#
SPECIFIC_ANGULAR_MOMENTUM = VariableDescriptor(name='specific_angular_momentum', dimension={'LENGTH': 2.0, 'TIME': -1.0})#
SPECIFIC_DISSIPATION_RATE = VariableDescriptor(name='specific_dissipation_rate', dimension={'TIME': -1.0})#
SPECIFIC_ENERGY = VariableDescriptor(name='specific_energy', dimension={'LENGTH': 2.0, 'TIME': -2.0})#
SPECIFIC_ENTHALPY = VariableDescriptor(name='specific_enthalpy', dimension={'LENGTH': 2.0, 'TIME': -2.0})#
SPECIFIC_ENTROPY = VariableDescriptor(name='specific_entropy', dimension={'LENGTH': 2.0, 'TIME': -2.0, 'TEMPERATURE': -1.0})#
SPECIFIC_HEAT_CAPACITY = VariableDescriptor(name='specific_heat_capacity', dimension={'LENGTH': 2.0, 'TIME': -2.0, 'TEMPERATURE': -1.0})#
SPECIFIC_INTERNAL_ENERGY = VariableDescriptor(name='specific_internal_energy', dimension={'LENGTH': 2.0, 'TIME': -2.0})#
SPECIFIC_INTERNAL_SURFACE_AREA = VariableDescriptor(name='specific_internal_surface_area', dimension={'LENGTH': -1.0})#
SPECIFIC_MODULUS = VariableDescriptor(name='specific_modulus', dimension={'LENGTH': 2.0, 'TIME': -2.0})#
SPECIFIC_STRENGTH = VariableDescriptor(name='specific_strength', dimension={'LENGTH': 2.0, 'TIME': -2.0})#
SPECIFIC_TOTAL_ENERGY = VariableDescriptor(name='specific_total_energy', dimension={'LENGTH': 2.0, 'TIME': -2.0})#
SPECIFIC_TOTAL_ENTHALPY = VariableDescriptor(name='specific_total_enthalpy', dimension={'LENGTH': 2.0, 'TIME': -2.0})#
SPECIFIC_VOLUME = VariableDescriptor(name='specific_volume', dimension={'LENGTH': 3.0, 'MASS': -1.0})#
SPECIFIC_WEIGHT = VariableDescriptor(name='specific_weight', dimension={'MASS': 1.0, 'LENGTH': -2.0, 'TIME': -2.0})#
SPECTRAL_INTENSITY = VariableDescriptor(name='spectral_intensity', dimension={'LENGTH': 1.0, 'MASS': 1.0, 'TIME': -3.0, 'SOLID_ANGLE': -1.0})#
SPECTRAL_IRRADIANCE = VariableDescriptor(name='spectral_irradiance', dimension={'LENGTH': -1.0, 'MASS': 1.0, 'TIME': -3.0})#
SPECTRAL_POWER = VariableDescriptor(name='spectral_power', dimension={'LENGTH': 1.0, 'MASS': 1.0, 'TIME': -3.0})#
SPEED_OF_SOUND = VariableDescriptor(name='speed_of_sound', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
SPIN_HALL_EFFECT = VariableDescriptor(name='spin_hall_effect', dimension={'MASS': 1.0, 'LENGTH': 2.0, 'TIME': -3.0, 'CURRENT': -2.0})#
STANDARD_ATOMIC_WEIGHT = VariableDescriptor(name='standard_atomic_weight', dimension={})#
STATIC_PRESSURE = VariableDescriptor(name='static_pressure', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
STRAIN_RATE = VariableDescriptor(name='strain_rate', dimension={'TIME': -1.0})#
STRESS = VariableDescriptor(name='stress', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
SURFACE_ENERGY = VariableDescriptor(name='surface_energy', dimension={'MASS': 1.0, 'TIME': -2.0})#
SURFACE_HEAT_FLUX = VariableDescriptor(name='surface_heat_flux', dimension={'MASS': 1.0, 'TIME': -3.0})#
SURFACE_HEAT_TRANSFER_COEFFICIENT = VariableDescriptor(name='surface_heat_transfer_coefficient', dimension={'MASS': 1.0, 'TIME': -3.0, 'TEMPERATURE': -1.0})#
SURFACE_NUSSELT_NUMBER = VariableDescriptor(name='surface_nusselt_number', dimension={})#
SURFACE_ROUGHNESS = VariableDescriptor(name='surface_roughness', dimension={'LENGTH': 1.0})#
SURFACE_STANTON_NUMBER = VariableDescriptor(name='surface_stanton_number', dimension={})#
SURFACE_TENSION = VariableDescriptor(name='surface_tension', dimension={'MASS': 1.0, 'TIME': -2.0})#
TANGENTIAL_VELOCITY = VariableDescriptor(name='tangential_velocity', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
TEMPERATURE = VariableDescriptor(name='temperature', dimension={'TEMPERATURE': 1.0})#
TEMPERATURE_DIFFERENCE = VariableDescriptor(name='temperature_difference', dimension={'TEMPERATURE_DIFFERENCE': 1.0})#
TEMPERATURE_GRADIENT = VariableDescriptor(name='temperature_gradient', dimension={'TEMPERATURE': 1.0, 'LENGTH': -1.0})#
TENSILE_STRENGTH = VariableDescriptor(name='tensile_strength', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
THERMAL_CONDUCTIVITY = VariableDescriptor(name='thermal_conductivity', dimension={'LENGTH': 1.0, 'MASS': 1.0, 'TIME': -3.0, 'TEMPERATURE': -1.0})#
THERMAL_DIFFUSIVITY = VariableDescriptor(name='thermal_diffusivity', dimension={'LENGTH': 2.0, 'TIME': -1.0})#
THERMAL_EXPANSION_COEFFICIENT = VariableDescriptor(name='thermal_expansion_coefficient', dimension={'TEMPERATURE': -1.0})#
THERMAL_RESISTANCE = VariableDescriptor(name='thermal_resistance', dimension={'TEMPERATURE': 1.0, 'LENGTH': -2.0, 'MASS': -1.0, 'TIME': 3.0})#
THIRD_ORDER_ELASTICITY = VariableDescriptor(name='third_order_elasticity', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
TIME = VariableDescriptor(name='time', dimension={'TIME': 1.0})#
TORQUE = VariableDescriptor(name='torque', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0})#
TORQUE_MAGNITUDE = VariableDescriptor(name='torque_magnitude', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0})#
TORQUE_X = VariableDescriptor(name='torque_x', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0})#
TORQUE_Y = VariableDescriptor(name='torque_y', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0})#
TORQUE_Z = VariableDescriptor(name='torque_z', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0})#
TOTAL_ENERGY = VariableDescriptor(name='total_energy', dimension={'LENGTH': 2.0, 'MASS': 1.0, 'TIME': -2.0})#
TOTAL_PRESSURE = VariableDescriptor(name='total_pressure', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
TOTAL_TEMPERATURE = VariableDescriptor(name='total_temperature', dimension={'TEMPERATURE': 1.0})#
TOUGHNESS = VariableDescriptor(name='toughness', dimension={'LENGTH': -1.0, 'MASS': 1.0, 'TIME': -2.0})#
TRANSMITTANCE = VariableDescriptor(name='transmittance', dimension={})#
TURBULENT_DISSIPATION_RATE = VariableDescriptor(name='turbulent_dissipation_rate', dimension={'LENGTH': 2.0, 'TIME': 3.0})#
TURBULENT_INTENSITY = VariableDescriptor(name='turbulent_intensity', dimension={})#
TURBULENT_KINETIC_ENERGY = VariableDescriptor(name='turbulent_kinetic_energy', dimension={'LENGTH': 2.0, 'TIME': -2.0})#
TURBULENT_REYNOLDS_NUMBER = VariableDescriptor(name='turbulent_reynolds_number', dimension={})#
TURBULENT_VISCOSITY = VariableDescriptor(name='turbulent_viscosity', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -1.0})#
TURBULENT_VISCOSITY_RATIO = VariableDescriptor(name='turbulent_viscosity_ratio', dimension={})#
VAPOR_PRESSURE = VariableDescriptor(name='vapor_pressure', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
VELOCITY = VariableDescriptor(name='velocity', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
VELOCITY_MAGNITUDE = VariableDescriptor(name='velocity_magnitude', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
VELOCITY_X = VariableDescriptor(name='velocity_x', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
VELOCITY_Y = VariableDescriptor(name='velocity_y', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
VELOCITY_Z = VariableDescriptor(name='velocity_z', dimension={'LENGTH': 1.0, 'TIME': -1.0})#
VISCOSITY = VariableDescriptor(name='viscosity', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -1.0})#
VOLUME = VariableDescriptor(name='volume', dimension={'LENGTH': 3.0})#
VOLUMETRIC_FLOW = VariableDescriptor(name='volumetric_flow', dimension={'LENGTH': 3.0, 'TIME': -1.0})#
VORTICITY = VariableDescriptor(name='vorticity', dimension={'TIME': -1.0})#
VORTICITY_MAGNITUDE = VariableDescriptor(name='vorticity_magnitude', dimension={'TIME': -1.0})#
VORTICITY_X = VariableDescriptor(name='vorticity_x', dimension={'TIME': -1.0})#
VORTICITY_Y = VariableDescriptor(name='vorticity_y', dimension={'TIME': -1.0})#
VORTICITY_Z = VariableDescriptor(name='vorticity_z', dimension={'TIME': -1.0})#
WALL_ADJACENT_HEAT_TRANSFER_COEFFICIENT = VariableDescriptor(name='wall_adjacent_heat_transfer_coefficient', dimension={'MASS': 1.0, 'TIME': -3.0, 'TEMPERATURE': -1.0})#
WALL_ADJACENT_TEMPERATURE = VariableDescriptor(name='wall_adjacent_temperature', dimension={'TEMPERATURE': 1.0})#
WALL_SHEAR_STRESS = VariableDescriptor(name='wall_shear_stress', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
WALL_SHEAR_STRESS_MAGNITUDE = VariableDescriptor(name='wall_shear_stress_magnitude', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
WALL_SHEAR_STRESS_X = VariableDescriptor(name='wall_shear_stress_x', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
WALL_SHEAR_STRESS_Y = VariableDescriptor(name='wall_shear_stress_y', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
WALL_SHEAR_STRESS_Z = VariableDescriptor(name='wall_shear_stress_z', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
WALL_TEMPERATURE = VariableDescriptor(name='wall_temperature', dimension={'TEMPERATURE': 1.0})#
WALL_TEMPERATURE_THIN = VariableDescriptor(name='wall_temperature_thin', dimension={'TEMPERATURE': 1.0})#
WALL_Y_PLUS = VariableDescriptor(name='wall_y_plus', dimension={})#
WALL_Y_STAR = VariableDescriptor(name='wall_y_star', dimension={})#
WAVENUMBER = VariableDescriptor(name='wavenumber', dimension={'LENGTH': -1.0})#
YANK = VariableDescriptor(name='yank', dimension={'MASS': 1.0, 'LENGTH': 1.0, 'TIME': -3.0})#
YIELD_STRENGTH = VariableDescriptor(name='yield_strength', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
YOUNG_MODULUS = VariableDescriptor(name='young_modulus', dimension={'MASS': 1.0, 'LENGTH': -1.0, 'TIME': -2.0})#
classmethod add(variable: str, dimension: Dimensions, subcategory: str | None = None) None#

Add a variable to the catalog.

Parameters:
variablestr

The name of the variable (must be uppercase).

dimensionDimensions

The dimension of the variable.

subcategory: str|None

The optional subcategory for the variable.

Raises:
ValueError

The variable name is not uppercase or already exists.

classmethod all() dict[str, list[VariableDescriptor]]#

Return all defined VariableDescriptor objects, organized by subcategory.

Returns:
dict[str, list[VariableDescriptor]]

A dictionary where keys are subcategory names (or “main” for the top-level catalog) and values are lists of VariableDescriptor instances.

class fluent#

Bases: object

Dictionary of variable descriptors for fluent-related quantities.

DENSITY_ALL = VariableDescriptor(name='density_all', dimension={'MASS': 1.0, 'LENGTH': -3.0})#
DVELOCITY_DX = VariableDescriptor(name='dvelocity_dx', dimension={'TIME': -1.0})#
DVELOCITY_DX_MAGNITUDE = VariableDescriptor(name='dvelocity_dx_magnitude', dimension={'TIME': -1.0})#
DVELOCITY_DX_X = VariableDescriptor(name='dvelocity_dx_x', dimension={'TIME': -1.0})#
DVELOCITY_DX_Y = VariableDescriptor(name='dvelocity_dx_y', dimension={'TIME': -1.0})#
DVELOCITY_DX_Z = VariableDescriptor(name='dvelocity_dx_z', dimension={'TIME': -1.0})#
DVELOCITY_DY = VariableDescriptor(name='dvelocity_dy', dimension={'TIME': -1.0})#
DVELOCITY_DY_MAGNITUDE = VariableDescriptor(name='dvelocity_dy_magnitude', dimension={'TIME': -1.0})#
DVELOCITY_DY_X = VariableDescriptor(name='dvelocity_dy_x', dimension={'TIME': -1.0})#
DVELOCITY_DY_Y = VariableDescriptor(name='dvelocity_dy_y', dimension={'TIME': -1.0})#
DVELOCITY_DY_Z = VariableDescriptor(name='dvelocity_dy_z', dimension={'TIME': -1.0})#
DVELOCITY_DZ = VariableDescriptor(name='dvelocity_dz', dimension={'TIME': -1.0})#
DVELOCITY_DZ_MAGNITUDE = VariableDescriptor(name='dvelocity_dz_magnitude', dimension={'TIME': -1.0})#
DVELOCITY_DZ_X = VariableDescriptor(name='dvelocity_dz_x', dimension={'TIME': -1.0})#
DVELOCITY_DZ_Y = VariableDescriptor(name='dvelocity_dz_y', dimension={'TIME': -1.0})#
DVELOCITY_DZ_Z = VariableDescriptor(name='dvelocity_dz_z', dimension={'TIME': -1.0})#
HELICITY = VariableDescriptor(name='helicity', dimension={'LENGTH': 1.0, 'TIME': -2.0})#
LAMBDA_2_CRITERION = VariableDescriptor(name='lambda_2_criterion', dimension={'TIME': -2.0})#
MASS_IMBALANCE = VariableDescriptor(name='mass_imbalance', dimension={'MASS': 1.0, 'TIME': -1.0})#
PRESSURE_HESSIAN_INDICATOR = VariableDescriptor(name='pressure_hessian_indicator', dimension={})#
TOTAL_ENTHALPY_DEVIATION = VariableDescriptor(name='total_enthalpy_deviation', dimension={'LENGTH': 2.0, 'TIME': -2.0})#
VELOCITY_ANGLE = VariableDescriptor(name='velocity_angle', dimension={'ANGLE': 1.0})#
Y_PLUS_BASED_HEAT_TRANSFER_COEFFICIENT = VariableDescriptor(name='y_plus_based_heat_transfer_coefficient', dimension={'MASS': 1.0, 'TIME': -3.0, 'TEMPERATURE': -1.0})#
class mesh#

Bases: object

Dictionary of variable descriptors for mesh-related quantities.

ACTIVE_CELL_PARTITION = VariableDescriptor(name='active_cell_partition', dimension={})#
ANISOTROPIC_ADAPTION_CELLS = VariableDescriptor(name='anisotropic_adaption_cells', dimension={})#
BOUNDARY_CELL_DISTANCE = VariableDescriptor(name='boundary_cell_distance', dimension={})#
BOUNDARY_LAYER_CELLS = VariableDescriptor(name='boundary_layer_cells', dimension={})#
BOUNDARY_NORMAL_DISTANCE = VariableDescriptor(name='boundary_normal_distance', dimension={})#
BOUNDARY_VOLUME_DISTANCE = VariableDescriptor(name='boundary_volume_distance', dimension={})#
CELL_ELEMENT_TYPE = VariableDescriptor(name='cell_element_type', dimension={})#
CELL_EQUIANGLE_SKEW = VariableDescriptor(name='cell_equiangle_skew', dimension={})#
CELL_EQUIVOLUME_SKEW = VariableDescriptor(name='cell_equivolume_skew', dimension={})#
CELL_ID = VariableDescriptor(name='cell_id', dimension={})#
CELL_PARENT_INDEX = VariableDescriptor(name='cell_parent_index', dimension={})#
CELL_REFINE_LEVEL = VariableDescriptor(name='cell_refine_level', dimension={})#
CELL_VOLUME = VariableDescriptor(name='cell_volume', dimension={'LENGTH': 3.0})#
CELL_VOLUME_CHANGE = VariableDescriptor(name='cell_volume_change', dimension={})#
CELL_WEIGHT = VariableDescriptor(name='cell_weight', dimension={})#
CELL_ZONE_INDEX = VariableDescriptor(name='cell_zone_index', dimension={})#
CELL_ZONE_TYPE = VariableDescriptor(name='cell_zone_type', dimension={})#
ELEMENT_ASPECT_RATIO = VariableDescriptor(name='element_aspect_ratio', dimension={})#
ELEMENT_WALL_DISTANCE = VariableDescriptor(name='element_wall_distance', dimension={'LENGTH': 1.0})#
FACE_AREA_MAGNITUDE = VariableDescriptor(name='face_area_magnitude', dimension={'LENGTH': 2.0})#
FACE_HANDEDNESS = VariableDescriptor(name='face_handedness', dimension={})#
INTERFACE_OVERLAP_FRACTION = VariableDescriptor(name='interface_overlap_fraction', dimension={})#
MARK_POOR_ELEMENTS = VariableDescriptor(name='mark_poor_elements', dimension={})#
PARTITION_NEIGHBOURS = VariableDescriptor(name='partition_neighbours', dimension={})#
SMOOTHED_CELL_REFINE_LEVEL = VariableDescriptor(name='smoothed_cell_refine_level', dimension={})#
STORED_CELL_PARTITIION = VariableDescriptor(name='stored_cell_partitiion', dimension={})#
X_FACE_AREA = VariableDescriptor(name='x_face_area', dimension={'LENGTH': 2.0})#
Y_FACE_AREA = VariableDescriptor(name='y_face_area', dimension={'LENGTH': 2.0})#
Z_FACE_AREA = VariableDescriptor(name='z_face_area', dimension={'LENGTH': 2.0})#

A registry of predefined VariableDescriptor instances for commonly used quantities. These are typically accessed directly by name, such as VariableCatalog.``PRESSURE``.

ConversionStrategy#

class ansys.units.variable_descriptor.strategy.ConversionStrategy#

Bases: ABC

Abstract base class for VariableDescriptor conversion strategies.

This class defines the interface for all conversion strategies. Derived classes must implement the methods defined here to handle the conversion of VariableDescriptor objects to and from their string representations, as well as to check if a VariableDescriptor is supported.

abstract supports(variable: VariableDescriptor) bool#

Check if the given VariableDescriptor is supported by the strategy.

Parameters:
variableVariableDescriptor

The VariableDescriptor to check.

Returns:
bool

True if the VariableDescriptor is supported, False otherwise.

Raises:
NotImplementedError

If the method is not implemented in a derived class.

abstract to_string(variable: VariableDescriptor | str | None) str | None#

Convert a VariableDescriptor to its string representation.

Parameters:
variableVariableDescriptor | str

The VariableDescriptor to convert, or a string representation.

Returns:
str

The string representation of the VariableDescriptor.

Raises:
NotImplementedError

If the method is not implemented in a derived class.

abstract to_variable_descriptor(variable: VariableDescriptor | str) VariableDescriptor#

Convert a string to its corresponding VariableDescriptor.

Parameters:
variableVariableDescriptor | str

The string representation to convert, or a VariableDescriptor.

Returns:
VariableDescriptor

The corresponding VariableDescriptor instance.

Raises:
NotImplementedError

If the method is not implemented in a derived class.

An abstract base class for strategies that convert VariableDescriptor objects to and from external string representations.

MappingConversionStrategy#

class ansys.units.variable_descriptor.strategy.MappingConversionStrategy#

Bases: ConversionStrategy

Intermediate base class for implementing VariableDescriptor conversion strategies.

This class simplifies the creation of concrete strategy classes by providing default implementations for common methods. Classes inheriting from this base class only need to define a _mapping dictionary that maps VariableDescriptor instances to their corresponding string representations.

Attributes:
_reverse_mappingdict

Get the reverse mapping of _mapping.

Methods

to_string(variable: VariableDescriptor | str) -> str

Converts a VariableDescriptor to its string representation. Raises a ValueError if the variable is not supported.

to_variable_descriptor(variable: VariableDescriptor | str) -> VariableDescriptor

Converts a string to its corresponding VariableDescriptor.

supports(variable: VariableDescriptor) -> bool

Checks if the given VariableDescriptor is supported by the strategy.

Raises:
ValueError

If a VariableDescriptor is not supported during conversion to a string.

supports(variable: VariableDescriptor) bool#

Check if the given VariableDescriptor is supported by the strategy.

Parameters:
variableVariableDescriptor

The VariableDescriptor to check.

Returns:
bool

True if the VariableDescriptor is supported, False otherwise.

to_string(variable: VariableDescriptor | str | None) str | None#

Convert a VariableDescriptor to its string representation.

If the input is already a string, it is returned as-is. If the input is a VariableDescriptor and is supported by the strategy, its string representation is returned. Otherwise, a ValueError is raised.

Parameters:
variableVariableDescriptor | str

The VariableDescriptor to convert, or a string representation.

Returns:
str

The string representation of the VariableDescriptor.

Raises:
ValueError

If the VariableDescriptor is not supported by the strategy.

to_variable_descriptor(variable: VariableDescriptor | str) VariableDescriptor#

Convert a string to its corresponding VariableDescriptor.

If the input is already a VariableDescriptor, it is returned as-is. Otherwise, the string is converted to a VariableDescriptor using the reverse mapping.

Parameters:
variableVariableDescriptor | str

The string representation to convert, or a VariableDescriptor.

Returns:
VariableDescriptor

The corresponding VariableDescriptor instance, or None if the string is not found in the reverse mapping.

A reusable base class for implementing conversion strategies based on a simple mapping dictionary. Useful for integrating with systems like Fluent, CFX, or external APIs.

Example#

This example demonstrates converting a descriptor to a Fluent-style variable name using a custom strategy.

from ansys.units.variable_descriptor import VariableCatalog
from ansys.fluent.core.variable_strategies import FluentSVarNamingStrategy

descriptor = VariableCatalog.VELOCITY
strategy = FluentSVarNamingStrategy()

print(strategy.to_string(descriptor))  # for example, "SV_VELOCITY"

You can also define your own mappings for custom naming schemes by subclassing MappingConversionStrategy.

Use Cases#

  • Abstracting physical quantities from product-specific naming

  • Providing consistent and validated input/output definitions

  • Bridging Ansys APIs, user interfaces, and internal computation frameworks