Equations of state

From ASCEND
(Redirected from Equations OF State)
Jump to: navigation, search

In physics and thermodynamics, an equation of state is a relation between state variables.[1] More specifically, an equation of state is a thermodynamic equation describing the state of matter under a given set of physical conditions. It is a constitutive equation which provides a mathematical relationship between two or more state functions associated with the matter, such as its temperature, pressure, volume, or internal energy. Equations of state are useful in describing the properties of fluids, mixtures of fluids, solids, and even the interior of stars. (Source : Wikipedia)

Cubic Equations of State

Cubic equations of state are called such because they can be rewritten as a cubic function of Vm.

All the models below are first modeled as a general, re-usable model and then used in a test-model. This code defines virial coefficients as well as the model for ideal gas laws:

REQUIRE "thermodynamics.a4l";

ATOM vdwa REFINES solver_var
	DIMENSION M*L^5/Q^2/T^2
	DEFAULT 0.1 {kg*m^5/mole^2/sec^2};
	lower_bound := 0.0 {kg*m^5/mole^2/sec^2};
	upper_bound := 10.0 {kg*m^5/mole^2/sec^2};
	nominal := 0.1 {kg*m^5/mole^5/sec^2};
END vdwa;

ATOM virialC REFINES solver_var
	DIMENSION L^6/Q^2
	DEFAULT 7000.0 {cm^6/mol^2};
	lower_bound := 0.0 {cm^6/mol^2};
	upper_bound := 1.0 {m^6/mol^2};
	nominal := 7000.0 {cm^6/mol^2};
END virialC;

ATOM virialB REFINES solver_var
	DIMENSION L^3/Q
	DEFAULT 1.0 {m^3/mol};
	lower_bound := -1000.00 {m^3/mol};
	upper_bound := 1000.0 {m^3/mol};
	nominal := 1.0 {m^3/mol};
END virialB;


MODEL idealgas(P WILL_BE pressure;
	T WILL_BE temperature;
	V WILL_BE molar_volume;);

	R IS_A molar_gas_constant;

	eq: P*V = R*T;

METHODS
    METHOD default_self;
		RUN ClearAll;
		RUN specify;
		RUN values;
    END default_self;
    METHOD specify;
		P.fixed := TRUE;
		T.fixed := TRUE;
		V.fixed := FALSE;
    END specify;
    METHOD values;
		P := 1.0 {atm};
		T := 298.0 {K};
    END values;

END idealgas;

MODEL testidealgas;

	ig IS_A idealgas(P,T,V);
	P IS_A pressure;
	T IS_A temperature;
	V IS_A molar_volume;
		
METHODS
    METHOD default_self;
		RUN ClearAll;
		RUN specify;
		RUN values;
    END default_self;
    METHOD specify;
		P.fixed := TRUE;
		T.fixed := TRUE;
		V.fixed := FALSE;
		RUN ig.specify;
    END specify;
    METHOD values;
		P := 1.0 {atm};
		T := 800.0 {K};
		RUN ig.values;
    END values;
END testidealgas;