# Minimal Simulation This tutorial builds and analyses a small regeneratively cooled nitrous-oxide/ethanol rocket engine. It is intended to introduce the principal Pyskyfire objects and the normal workflow for a thrust-chamber thermal analysis. This tutorial is focused on showcasing Pyskyfire capabilities, and is not focused on engine design. The complete, runnable source is maintained in [`examples/minimal/minimal_sim.py`](https://github.com/ask-hovik/pyskyfire/blob/main/examples/minimal/minimal_sim.py). ## Prerequisites Install Pyskyfire into your current environemnt, then run: ```console python examples/minimal/minimal_sim.py ``` The script builds a thrust chamber, and then runs a regenerative cooling analysis. It then postprocesses the results, giving you a few options to view the generated data: Either as standalone html graphs, or as a compiled report output as `minimal_report.html`. ## What you will build The example uses a 5 kN engine with a 20 bar chamber pressure, an area ratio of 10, nitrous oxide as oxidizer, and ethanol as both fuel and coolant. It uses a single, helical, square-channel cooling circuit running from nozzle exit to chamber inlet. ## Define the engine design point Start with the intended chamber conditions, thrust, nozzle geometry, coolant inlet state, and the thermal/geometry choices for the cooling circuit. ```{literalinclude} ../../examples/minimal/minimal_sim.py :language: python :start-after: tutorial:start:engine-inputs :end-before: tutorial:end:engine-inputs :dedent: 4 ``` `cea_fu` and `cea_ox` define the propellants passed to the NASA CEA-backed combustion model. `coolprop_fu` defines the coolant passed to the CoolProp-backed transport-property model. Different backends are used for the coolant and the combustion gas, NASA CEA for the hot gas, CoolProp for the coolant, hence the need to define the ethanol twice. `p_c`, `F`, `eps`, `L_star`, and `MR` establish the thermodynamic design point. `AR_c` represents the chamber aspect ratio, defined as $$ AR_c = \frac{L_c^2}{S_c} $$ where $L_c$ is the chamber length, and $S_c$ is the area of the cross section of the chamber when the section plane passes through the chamber axis.  The remaining inputs define the cooling wall and flow channels: material, hot-gas-to-coolant wall thickness, channel count, rib blockage, coolant-side roughness, helix angle and channel height. ## Compute the combustion and coolant models Pyskyfire uses the supplied design point to construct an aerothermodynamic model of the combustion gases. Upon initialisation, the aerothermodynamics class calculates many parameters about the engine. In this example, the ideal chamber volume, throat radius and fuel mass flow the class has calculated is used further. ```{literalinclude} ../../examples/minimal/minimal_sim.py :language: python :start-after: tutorial:start:aerothermodynamics :end-before: tutorial:end:aerothermodynamics :dedent: 4 ``` The aerothermodynamics class has multiple constructors allowing you to choose which set of inputs is used to construct the hot gas properties. In this example `from_F_eps_Lstar` is used. See other options in {doc}`Aerothermodynamics <../autoapi/pyskyfire/skycea/aerothermodynamics/Aerothermodynamics>`. The calculated `V_c`, `r_t` and `mdot_fu` are inserted into `params` for convenience. `CoolantTransport` supplies coolant thermodynamic and transport properties. ## Generate the thrust-chamber contour Next, we are going to create a nozzle contour. We can choose between a conical nozzle and a bell (Rao) nozzle. The resulting axial and radial coordinates are stored in a `Contour` object. ```{literalinclude} ../../examples/minimal/minimal_sim.py :language: python :start-after: tutorial:start:contour :end-before: tutorial:end:contour :dedent: 4 ``` `get_contour` exposes further shaping parameters beyond those used here. The three curvature factors, `R_1f`, `R_2f`, and `R_3f`, affect the chamber-to-throat and nozzle transitions. ```{raw} html