Skip to content
Simulation of Carnot refrigerator written in Ruby.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



Carnot Engine is written in Ruby 1.9.2


This program simulates a Carnot engine that utilizes a thermal difference to perform work. It has the theoretical maximum possible efficiency for a heat engine. In this simulation, the thermal difference is of a fixed magnitude.


You must have Ruby 1.9.2 installed on your computer.

Running the Program

There may be various ways to run Ruby programs on particular machines. However, these instructions assume that you have access to your computer's command line interface.

To run this file, first download it and place it in an appropriate directory. For example, you may wish to create a subdirectory for Ruby program in your top-level user directory and place the program file in there.

In the command line, go to the directory where the program file is located.

Then enter:

ruby carnot_engine_v01-02.rb

Adjusting Parameters

You can adjust the temperatures of the thermal reservoirs as well as the heat energy flow rate from the cooler reservoir. To do so, change the parameters in the "# Initialize simulation parameters" section of the source code. You will need a text editor for this.


If the program does not run, make sure that at least Ruby version 1.9.2 is installed on your computer.

Make that you are in the correct directory.

If you adjusted the parameters, make sure all are positive and have decimal point. Also make sure that you saved the file in a pure text format and that the file name ends in ".rb"

Copyright and Use Notice

Copyright 2011-13 by Mark Ciotola.

Available for use under GNU license.

You can’t perform that action at this time.