Skip to content
A bunch of old C programs that use the Numerical Recipes to solve three thermodynamics problems. Learn more at http://nrthermo.tk
C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
breitwigner
gibbs
nr
pvdiagrams
LICENSE.md
README.md

README.md

Computational Physics

Numerical recipes applied to thermodynamics

This is a bunch of old C programs based on the good ol' Numerical Recipes http://www.nr.com/. Vectors' components start in 1 and not in 0 as we are used to.

Example:

	for (i=1; i<=N; i++) {
		printf("Enter initial value of parameter %d: ", i);
		scanf("%lf", &a[i]);
	}

Folder structure

There are three computational physics problems proposed:

  • Folder breitwigner: Solving the Breit-Wigner formula, actually a Nuclear Physics problem.
  • Folder pvdiagrams: Pressure-Volume (PV) diagrams and the van der Waals equation.
  • Folder gibbs: Vapor-liquid equilibrium and calculation of the excess Gibbs potential.

The Numerical Recipes libraries used for this calculations are stored in the folder nr, but you can also install them in your system and load them normally, if you prefer. Check the NR documentation to learn more about it.

The libraries in the nr folder used for these computational physics problems are NOT included due to license restrictions. The snippets might not work without them.

Compiling and running

The -lm is needed to link the math libraries.

Compile:

$ gcc filename.c -o filename -lm

Run:

$ ./filename

Dedicated site

Learn more at http://nrthermo.tk

Licenses

License All code is GNU licensed.

License Numerical Recipes libraries are licensed according to these terms.

You can’t perform that action at this time.