blog.hirnschall.net
home

Contents

Subscribe for New Projects

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, this tool uses SymPy in the browser to solve the resulting system of equations symbolically.

How to use it:

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 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
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 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
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 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:

This post is part of multiple articles on Mechanical Engineering and Simulation.

Below are two related posts you might like:

Type-Safe CAN Layer in C++ (Code Generation)

Type-Safe CAN Layer in C++ (Code Generation)

Eliminate manual bit packing errors with compile-time validation and code generation — full C++ implementation included.

Design, Simulate (3D FEM), and Build a SATA Backplane

Design, Simulate (3D FEM), and Build a SATA Backplane

Impedance matching, differential pairs, crosstalk, S-parameter analysis, full wave 3D FEM simulation, and much more.

Get Notified of New Articles

Subscribe to get notified about new projects. Our Privacy Policy applies.
Sebastian Hirnschall
Article by: Sebastian Hirnschall
Updated: 13.05.2026

License

This project (with exceptions) is published under the CC Attribution-ShareAlike 4.0 International License.