Welcome to the Online ChemAppPy Examples page. This page gives you the opportunity to learn how ChemAppPy works and to play around with some of its functions, without having to download or install it.
The examples use ChemAppPy Light. Please note that these examples are for demonstration purposes only and are based on the examples found in the ChemAppPy installation folder.
Below are a few examples of things you can do or view with ChemAppPy. To run one of the examples, simply click the blue Run button underneath the code block. Your results will appear in the block underneath. The code blocks are interactive, which means you can change the parameter values like temperature and composition.
If you have an error in your code, the result block will indicate where in the script the error is. If you struggle to fix an error, simply reload the page to get the original example back.
displaying a thermochemical data file
The first step when performing a thermochemical equilibrium calculation in ChemAppPy is to load the data file (.dat or .cst). ChemAppPy Light can only open .dat files. ChemAppPy Developer edition can open both .dat and .cst files. The data file contains all the information that ChemAppPy requires to carry out its calculations. This example will show you how to load a thermochemical data file and display its contents. You may change 'cosi.dat' in line 6 to any of the following:
N.B. These example data files are distributed with ChemAppPy.
Single equilibrium calculation
This example shows you how to perform a single point equilibrium calculation with an Fe-C system. This example calculates the equilibrium for 500 kg of cementite with 1 kg of graphite at 1600 °C. The set_IA_pc function sets the incoming amount of a phase constituent. The result will show you how much liquid has formed at equilibrium. You may change the input parameters in line 19 to 24 to see how the results change. For instance you can play around with the temperature (T_equilib) value to see the impact on liquid formation.
If you feel comfortable with this example, you may change the the data file to any of the data files mentioned in the previous example. Try the following:
Change fec.dat to pbsn.dat
Change the equilibrium temperature (T_equilib) in line 20 to 200
Replace line 27 with caec.set_IA_sc('Pb', 600)
Replace line 28 with caec.set_IA_sc('Sn', 400)
Re-run the calculation
This example shows you how to use the StreamCalculator class from the ChemAppPy tools module. The important part to take note of is line 33 to 45 where the stream compositions and initial conditions are set. In line 73, the values for the amount of reductant used and cristobalite at equilibrium are extracted from the result set. Line 75 displays it in table format.
If you are curious to see what a single result object looks like, you can uncomment line 79 that prints the first result object to the output screen.