### Install the built wheel Source: https://github.com/ansys/pychemkin/blob/main/doc/source/getting-started.rst Install the wheel from the dist directory after building. ```console python -m pip install dist\ansys_chemkin_core-*.whl ``` -------------------------------- ### Build a wheel from source Source: https://github.com/ansys/pychemkin/blob/main/doc/source/getting-started.rst Install the build frontend and run it from the repository root to build a wheel and source distribution. ```console python -m pip install build python -m build ``` -------------------------------- ### Install PyChemkin from source for development Source: https://github.com/ansys/pychemkin/blob/main/doc/source/getting-started.rst Run these commands from the repository root to install the current source tree for development. ```console python -m pip install --upgrade pip python -m pip install -e . ``` -------------------------------- ### Install PyChemkin from PyPI Source: https://github.com/ansys/pychemkin/blob/main/doc/source/getting-started.rst Install the published PyChemkin package from PyPI using pip. ```console python -m pip install ansys-chemkin-core ``` -------------------------------- ### Verify PyChemkin installation Source: https://github.com/ansys/pychemkin/blob/main/doc/source/getting-started.rst Start Python and import the package to verify installation. The import initializes the native Chemkin library and reports versions. ```pycon >>> import ansys.chemkin.core ``` -------------------------------- ### Install documentation dependencies Source: https://github.com/ansys/pychemkin/blob/main/CONTRIBUTING.md Installs the documentation dependencies for PyChemkin. Run this before building the documentation. ```bash pip install -e .[doc] ``` -------------------------------- ### Install PyChemkin documentation dependencies Source: https://github.com/ansys/pychemkin/blob/main/doc/source/contributing.rst Installs the documentation dependencies for PyChemkin. Run this before building the documentation. ```bash pip install -e .doc ``` -------------------------------- ### Compute mixture density with PyChemkin Source: https://github.com/ansys/pychemkin/blob/main/doc/source/user-guide.rst This example demonstrates how to instantiate a chemistry set, preprocess it, define a mixture with specific conditions, and calculate its density. ```python import os # import PyChemkin import ansys.chemkin.core as chemkin # create a chemistry set for the GRI 3.0 mechanism in the data directory mech_dir = os.path.join(chemkin.ansys_dir, "reaction", "data") # set up mechanism file names mech_file = os.path.join(mech_dir, "grimech30_chem.inp") therm_file = os.path.join(mech_dir, "grimech30_thermo.dat") tran_file = os.path.join(mech_dir, "grimech30_transport.dat") # instantiate a chemistry set named 'GasMech' GasMech = chemkin.Chemistry( chem=mech_file, therm=therm_file, tran=tran_file, label="GRI 3.0" ) # preprocess the chemistry set status = GasMech.preprocess() # check preprocess status if status != 0: # failed print(f"Preprocessing: Error encountered. Code = {status:d}.") print(f"See the summary file {GasMech.summaryfile} for details.") exit() # create a mixture named 'air' based on the 'GasMech' chemistry set air = chemkin.Mixture(GasMech) # set 'air' condition # mixture pressure in [dynes/cm2] air.pressure = 1.0 * chemkin.P_ATM # mixture temperature in [K] air.temperature = 300.0 # mixture composition in mole fractions air.X = [("O2", 0.21), ("N2", 0.79)] # print(f"Pressure = {air.pressure/chemkin.P_ATM} [atm].") print(f"Temperature = {air.temperature} [K].") # print the 'air' composition in mass fractions air.list_composition(mode="mass") # get 'air' mixture density [g/cm3] print(f"Mixture density = {air.RHO} [g/cm3].") ``` -------------------------------- ### Install PyChemkin test dependencies Source: https://github.com/ansys/pychemkin/blob/main/doc/source/contributing.rst Installs the test dependencies for PyChemkin. Run this before running the tests. ```bash pip install - .tests ``` -------------------------------- ### Install test dependencies Source: https://github.com/ansys/pychemkin/blob/main/CONTRIBUTING.md Installs the test dependencies for PyChemkin. Run this before running the test suite. ```bash pip install -e .[tests] ``` -------------------------------- ### Set ANSYSxxx_DIR environment variable on Windows Source: https://github.com/ansys/pychemkin/blob/main/doc/source/getting-started.rst Define the ANSYSxxx_DIR environment variable to select a specific Chemkin installation. Replace xxx with the release number and set the value to the installation's ANSYS directory. ```powershell $env:ANSYS261_DIR = "C:\Program Files\ANSYS Inc\v261\ANSYS" ``` -------------------------------- ### Install and run pre-commit for style checking Source: https://github.com/ansys/pychemkin/blob/main/doc/source/contributing.rst Installs pre-commit and runs it on all files to check code style. Use this to ensure your code meets PyChemkin's PEP 8 standards. ```bash pip install pre-commit pre-commit run --all-files ``` -------------------------------- ### Install pre-commit as a Git hook Source: https://github.com/ansys/pychemkin/blob/main/doc/source/contributing.rst Installs pre-commit as a Git hook so style checks run automatically on commit. ```bash pre-commit install ``` -------------------------------- ### Clone and install PyChemkin in development mode Source: https://github.com/ansys/pychemkin/blob/main/doc/source/contributing.rst Clones the PyChemkin repository and installs the latest release in development mode. Run these commands from a terminal. ```bash git clone https://github.com/ansys/pychemkin/ cd pychemkin python -m pip install --upgrade pip pip install -e . ``` -------------------------------- ### Build HTML documentation on Linux or Windows Source: https://github.com/ansys/pychemkin/blob/main/CONTRIBUTING.md Builds the HTML documentation. Navigate to the doc directory, then run the appropriate command for your operating system: 'make html' on Linux or './make.bat html' on Windows. The output is placed in docs/_build/html. ```bash cd doc # On linux make html # On windows ./make.bat html ``` -------------------------------- ### Build PyChemkin documentation on Windows Source: https://github.com/ansys/pychemkin/blob/main/doc/source/contributing.rst Builds the HTML documentation on Windows. First change to the doc directory, then run make.bat html. The output is placed in docs/_build/html. ```bash cd doc ``` ```bash ./make.bat html ``` -------------------------------- ### Build PyChemkin documentation on Linux Source: https://github.com/ansys/pychemkin/blob/main/doc/source/contributing.rst Builds the HTML documentation on Linux. First change to the doc directory, then run make html. The output is placed in docs/_build/html. ```bash cd doc ``` ```bash make html ``` -------------------------------- ### Define species composition with a recipe list Source: https://github.com/ansys/pychemkin/wiki/Mixture_Stream Use this composition recipe list to specify species fractions by name instead of by index. The list contains (species, fraction) tuples, where the species names must match those in the Chemistry Set. ```python [("O2", 0.21), ("N2", 0.79)] ``` -------------------------------- ### Reconstruct lognormal soot distribution with PDF Source: https://github.com/ansys/pychemkin/wiki/Diffusion_Flame_Soot Configures the PDF object with soot material properties and reconstructs a lognormal particle size distribution from the three moments. Uses core_wt=12.0, bulk_density=1.8, class_min=32.0, and mode='volume'. ```python soot_pdf = PDF(core_wt=12.0, bulk_density=1.8) soot_pdf.set_moments(m0, m1, m2, class_min=32.0) diameter, number_density = soot_pdf.get_lognormal_pdf( samples=1000, limit=0.001, mode="volume" ) ``` -------------------------------- ### Run PyChemkin tests with pytest Source: https://github.com/ansys/pychemkin/blob/main/doc/source/contributing.rst Runs the PyChemkin test suite from the repository root directory. ```bash pytest ``` -------------------------------- ### Extract soot profiles from solution group Source: https://github.com/ansys/pychemkin/wiki/Diffusion_Flame_Soot Retrieves the distance coordinate, soot volume fraction, and pyrene precursor (A4) from a solution group. Uses the ChemkinSolutionImporter's get_group_object and get_variable_array methods. ```python group = ck_solution.get_group_object(solution_groups[0]) distance = group.get_variable_array("Distance").to_numpy( dtype=float, copy=False ) volume_fraction = group.get_variable_array( "Particle_volume_fraction" ).to_numpy(dtype=float, copy=False) pyrene = group.get_variable_array("A4").to_numpy( dtype=float, copy=False ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.