# [An Ideal Gas Cycle Calculator](https://blog.hirnschall.net/gas-cycle-calculator/)

author: [Sebastian Hirnschall](https://blog.hirnschall.net/about/)

meta description: Symbolic calculator for ideal gas cycle problems (FSAE-friendly). Enter state-change types and knowns, get solved P-V and T-V diagrams in the browser.

meta title: Ideal Gas Cycle Calculator — Symbolic P-V & T-V Solver

date published: 13.05.2026 (DD.MM.YYYY format)
date last modified: 13.05.2026 (DD.MM.YYYY format)

---

About
-----

The tool below calculates and plots an ideal gas cycle given the type of each state change and enough known variables. It was originally built for FSAE rules quiz usage.

Similar to [Everything Aero](https://blog.hirnschall.net/everything-aero/), this tool uses SymPy in the browser to solve the resulting system of equations symbolically.

How to use it:

* Enter one input "equation" per line.
* Input all state change types (e.g. `type1-2 = isobaric`). Supported types are `isobaric`, `isochoric`, `isothermal`, and `adiabatic`. States are numbered 1, 2, ... and the cycle closes when the last state change returns to state 1.
* Add all additional known variables for pressure, volume, and temperature. E.g. `p1=100000`, `v1=1`, `t1=300`. The index corresponds to the state number.
* For adiabatic legs the heat capacity ratio \(\gamma\) defaults to an unknown and is solved for. To pin it, add `gammaA-B=1.4` where `A` and `B` are the state indices of that leg (e.g. `gamma1-2=1.4`).
* The tool uses SI units.
* Optionally, `bar` and `C` can be used (multiplied) to convert units. E.g. `p1=2*bar`, `t1=37*C`. Scientific notation is also supported (e.g. `p1=2e5`).
* Click **Solve** and hover over the diagrams to read state values.

The solver determines which equations to use and solves for all unknowns. Results are rendered with Plotly as a P-V and a T-V diagram.

The calculator runs a full Python environment in the browser. It needs a few seconds to start up and install packages with pip (in the browser environment only). SymPy and Plotly are lazily loaded on the first **Solve** press, so that first solve takes a few seconds.

If the tool fails to load, reload the page and check the console (press F12).

Calculator
----------

Loading Python

...




Examples
--------

Let's take a look at how to use the calculator for different FS rules quiz questions. Both examples below use the same four-state cycle (alternating isothermal and isochoric transitions), but ask for a different unknown. The original problem statements are linked from each example.

### Example 1: FS-Quiz Question 66

[FS-Quiz Question 66](https://fs-quiz.eu/question/66) states \(p\_1 = 7\) bar, \(V\_1 = 0.6\) m³, \(V\_2 = 3.3\) m³, \(T\_2 = 800\)°C, and \(p\_3 = 0.6\) bar along with the type of state change for each point. We need to find the pressure in point 4 (\(p\_4\)).

The input therefore becomes the information given in the question.

```
type1-2 = isothermal
type2-3 = isochoric
type3-4 = isothermal
type4-1 = isochoric
p1=7*bar
v1=.6
v2=3.3
t2=800*C
p3=.6*bar
```

Hovering over point 4 on the P-V diagram shows \(p\_4 = 3.3 \cdot 10^5\) Pa, i.e. \(p\_4 = 3.3\) bar. Fig. 1 shows the input and the resulting P-V and T-V plots along with the solution for \(p\_4\).

![Input and solution for FS-Quiz Question 66 (ideal gas cycle), with point 4 hovered on the P-V diagram](https://blog.hirnschall.net/gas-cycle-calculator/resources/img/fs-quiz-66.jpg)


Figure 1: Input and solution for FS-Quiz Question 66 (ideal gas cycle), with point 4 hovered on the P-V diagram

### Example 2: FS-Quiz Question 155

[FS-Quiz Question 155](https://fs-quiz.eu/question/155) gives \(p\_1 = 6.5\) bar, \(V\_1 = 0.7\) m³, \(V\_2 = 2.1\) m³, \(p\_4 = 1.2\) bar, and \(T\_1 = 800\) K. We need to find \(T\_3\).

Again, the input for the solver is everything stated in the exercise:

```
type1-2 = isothermal
type2-3 = isochoric
type3-4 = isothermal
type4-1 = isochoric
p1=6.5*bar
v1=.7
v2=2.1
p4=1.2*bar
t1=800
```

Note that `t1=800` has no `*C` as it is given in Kelvin directly. Hovering point 3 on the T-V diagram shows \(T\_3 \approx 147.7\) K which is the correct solution to question 155 as shown in fig. 2.

![Input and solution for FS-Quiz Question 155 (ideal gas cycle), with point 3 hovered on the T-V diagram](https://blog.hirnschall.net/gas-cycle-calculator/resources/img/fs-quiz-155.jpg)


Figure 2: Input and solution for FS-Quiz Question 155 (ideal gas cycle), with point 3 hovered on the T-V diagram

How It Works
------------

The web UI is built with [ngapp](https://cerbsim.github.io/ngapp) and runs python entirely in the browser. Each declared state change type is mapped to a single equation in the solver. The unit suffixes (`bar`, `C`) are implemented as additional equations/knowns. SymPy assembles and solves the resulting system symbolically, and Plotly plots the cycle on a P-V and a T-V diagram. Hovering a point shows its state values in SI units in the tool-tip.

### State Change Equations

The isothermal, isobaric, and isochoric relations follow from the ideal gas law \(pV = nRT\) under one conserved quantity. The adiabatic case (no heat exchange) instead follows from \(pV^\gamma = \text{const}\), where \(\gamma\) is the heat capacity ratio. The relations between adjacent states \(i\) and \(j\) are:

* **Isothermal** (\(T\_i = T\_j\)):
  $$p\_i V\_i = p\_j V\_j$$
* **Isobaric** (\(p\_i = p\_j\)):
  $$\dfrac{V\_i}{T\_i} = \dfrac{V\_j}{T\_j}$$
* **Isochoric** (\(V\_i = V\_j\)):
  $$\dfrac{p\_i}{T\_i} = \dfrac{p\_j}{T\_j}$$
* **Adiabatic** (no heat exchange):
  $$p\_i V\_i^\gamma = p\_j V\_j^\gamma \quad\text{and}\quad T\_i V\_i^{\gamma-1} = T\_j V\_j^{\gamma-1}$$