Class Leachman
java.lang.Object
neqsim.thermo.util.leachman.Leachman
The Leachman class provides methods to calculate the density, pressure, and various thermodynamic
properties of hydrogen using the Leachman method. It supports different types of hydrogen:
normal, para, and ortho.
The class includes methods for setting up the parameters for different hydrogen types, calculating the density from temperature and pressure, and calculating various thermodynamic properties.
The main methods include:
SetupLeachman(String): Initializes the constants and parameters for the specified hydrogen type.DensityLeachman(int, double, double, doubleW, intW, StringW): Calculates the density as a function of temperature and pressure.PressureLeachman(double, double, doubleW, doubleW): Calculates the pressure and compressibility factor.propertiesLeachman(double, double, doubleW, doubleW, doubleW, doubleW, doubleW, doubleW, doubleW, doubleW, doubleW, doubleW, doubleW, doubleW, doubleW, doubleW, doubleW, doubleW): Calculates various thermodynamic properties.
The class also includes helper methods for calculating the ideal gas and real gas Helmholtz energy and their derivatives.
Example usage:
Leachman leachman = new Leachman();
leachman.SetupLeachman("normal");
doubleW density = new doubleW(30);
doubleW pressure = new doubleW(500.0);
intW ierr = new intW(0);
StringW herr = new StringW("");
leachman.DensityLeachman(0, 500, pressure.val, density, ierr, herr);
System.out.println("Density: " + density.val);
Note: The class uses the doubleW and intW classes from the org.netlib.util package to handle output parameters.
- Author:
- victor
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double(package private) double(package private) double(package private) double[](package private) double[](package private) double[](package private) double[]private String(package private) int(package private) int(package private) int(package private) int(package private) int(package private) int(package private) double(package private) int(package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double[](package private) double(package private) double[](package private) double[](package private) double[](package private) double[](package private) double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidAlpha0Leachman(double T, double D, org.netlib.util.doubleW[] a0) Calculate the ideal gas Helmholtz energy and its derivatives with respect to tau and delta.(package private) voidAlpharLeachman(int itau, int idelta, double T, double D, org.netlib.util.doubleW[][] ar) Calculate the residual Helmholtz energy and its derivatives with respect to tau and delta.voidDensityLeachman(int iFlag, double T, double P, org.netlib.util.doubleW D, org.netlib.util.intW ierr, org.netlib.util.StringW herr) Calculate density as a function of temperature and pressure using the Leachman method.static voidmain.voidPressureLeachman(double T, double D, org.netlib.util.doubleW P, org.netlib.util.doubleW Z) Calculate the pressure and compressibility factor using the Leachman method.voidpropertiesLeachman(double T, double D, org.netlib.util.doubleW P, org.netlib.util.doubleW Z, org.netlib.util.doubleW dPdD, org.netlib.util.doubleW d2PdD2, org.netlib.util.doubleW d2PdTD, org.netlib.util.doubleW dPdT, org.netlib.util.doubleW U, org.netlib.util.doubleW H, org.netlib.util.doubleW S, org.netlib.util.doubleW Cv, org.netlib.util.doubleW Cp, org.netlib.util.doubleW W, org.netlib.util.doubleW G, org.netlib.util.doubleW JT, org.netlib.util.doubleW Kappa, org.netlib.util.doubleW A) PropertiesGERG.(package private) voidPseudoCriticalPointLeachman(org.netlib.util.doubleW Tcx, org.netlib.util.doubleW Dcx) voidInitialize the constants and parameters for the default hydrogen type (normal) using the Leachman method.voidSetupLeachman(String hydrogenType) SetupGERG.
-
Field Details
-
hydrogenType
-
R_L
double R_L -
M_L
double M_L -
Tc
double Tc -
Dc
double Dc -
dPdDsave
double dPdDsave -
K
int K -
a0k
double[] a0k -
b0k
double[] b0k -
K_normal
int K_normal -
a0k_normal
double[] a0k_normal -
b0k_normal
double[] b0k_normal -
K_para
int K_para -
a0k_para
double[] a0k_para -
b0k_para
double[] b0k_para -
K_ortho
int K_ortho -
a0k_ortho
double[] a0k_ortho -
b0k_ortho
double[] b0k_ortho -
l
int l -
m
int m -
n
int n -
N_i
double[] N_i -
t_i
double[] t_i -
d_i
double[] d_i -
p_i
double[] p_i -
phi_i
double[] phi_i -
beta_i
double[] beta_i -
gamma_i
double[] gamma_i -
D_i
double[] D_i -
N_i_normal
double[] N_i_normal -
t_i_normal
double[] t_i_normal -
d_i_normal
double[] d_i_normal -
p_i_normal
double[] p_i_normal -
phi_i_normal
double[] phi_i_normal -
beta_i_normal
double[] beta_i_normal -
gamma_i_normal
double[] gamma_i_normal -
D_i_normal
double[] D_i_normal -
N_i_para
double[] N_i_para -
t_i_para
double[] t_i_para -
d_i_para
double[] d_i_para -
p_i_para
double[] p_i_para -
phi_i_para
double[] phi_i_para -
beta_i_para
double[] beta_i_para -
gamma_i_para
double[] gamma_i_para -
D_i_para
double[] D_i_para -
N_i_ortho
double[] N_i_ortho -
t_i_ortho
double[] t_i_ortho -
d_i_ortho
double[] d_i_ortho -
p_i_ortho
double[] p_i_ortho -
phi_i_ortho
double[] phi_i_ortho -
beta_i_ortho
double[] beta_i_ortho -
gamma_i_ortho
double[] gamma_i_ortho -
D_i_ortho
double[] D_i_ortho -
epsilon
double epsilon
-
-
Constructor Details
-
Leachman
public Leachman()
-
-
Method Details
-
DensityLeachman
public void DensityLeachman(int iFlag, double T, double P, org.netlib.util.doubleW D, org.netlib.util.intW ierr, org.netlib.util.StringW herr) Calculate density as a function of temperature and pressure using the Leachman method. This is an iterative routine that calls PressureLeachman to find the correct state point. Generally, only 6 iterations at most are required. If the iteration fails to converge, the ideal gas density and an error message are returned. No checks are made to determine the phase boundary, which would have guaranteed that the output is in the gas phase (or liquid phase when iFlag=2). It is up to the user to locate the phase boundary, and thus identify the phase of the T and P inputs. If the state point is 2-phase, the output density will represent a metastable state.- Parameters:
iFlag- Set to 0 for strict pressure solver in the gas phase without checks (fastest mode, but output state may not be stable single phase). Set to 1 to make checks for possible 2-phase states (result may still not be stable single phase, but many unstable states will be identified). Set to 2 to search for liquid phase (and make the same checks when iFlag=1).T- Temperature (K)P- Pressure (kPa)D- Density (mol/l). For the liquid phase, an initial value can be sent to the routine to avoid a solution in the metastable or gas phases. The initial value should be sent as a negative number.ierr- Error number (0 indicates no error)herr- Error message if ierr is not equal to zero
-
PressureLeachman
public void PressureLeachman(double T, double D, org.netlib.util.doubleW P, org.netlib.util.doubleW Z) Calculate the pressure and compressibility factor using the Leachman method.- Parameters:
T- Temperature (K)D- Density (mol/l)P- Output parameter for pressure (kPa)Z- Output parameter for compressibility factor
-
AlpharLeachman
void AlpharLeachman(int itau, int idelta, double T, double D, org.netlib.util.doubleW[][] ar) Calculate the residual Helmholtz energy and its derivatives with respect to tau and delta. Outputs:- ar(0,0) - Residual Helmholtz energy (dimensionless, =a/RT)
- ar(0,1) - delta*partial (ar)/partial(delta)
- ar(0,2) - delta^2*partial^2(ar)/partial(delta)^2
- ar(0,3) - delta^3*partial^3(ar)/partial(delta)^3
- ar(1,0) - tau*partial (ar)/partial(tau)
- ar(1,1) - tau*delta*partial^2(ar)/partial(tau)/partial(delta)
- ar(2,0) - tau^2*partial^2(ar)/partial(tau)^2
- Parameters:
itau- Order of derivative with respect to tauidelta- Order of derivative with respect to deltaT- Temperature (K)D- Density (mol/l)ar- Output array for Helmholtz energy and its derivatives
-
Alpha0Leachman
void Alpha0Leachman(double T, double D, org.netlib.util.doubleW[] a0) Calculate the ideal gas Helmholtz energy and its derivatives with respect to tau and delta.- Parameters:
T- Temperature (K)D- Density (mol/l)a0- Output array for ideal gas Helmholtz energy and its derivatives
-
propertiesLeachman
public void propertiesLeachman(double T, double D, org.netlib.util.doubleW P, org.netlib.util.doubleW Z, org.netlib.util.doubleW dPdD, org.netlib.util.doubleW d2PdD2, org.netlib.util.doubleW d2PdTD, org.netlib.util.doubleW dPdT, org.netlib.util.doubleW U, org.netlib.util.doubleW H, org.netlib.util.doubleW S, org.netlib.util.doubleW Cv, org.netlib.util.doubleW Cp, org.netlib.util.doubleW W, org.netlib.util.doubleW G, org.netlib.util.doubleW JT, org.netlib.util.doubleW Kappa, org.netlib.util.doubleW A) PropertiesGERG.
- Parameters:
T- a doubleD- a doubleP- adoubleWobjectZ- adoubleWobjectdPdD- adoubleWobjectd2PdD2- adoubleWobjectd2PdTD- adoubleWobjectdPdT- adoubleWobjectU- adoubleWobjectH- adoubleWobjectS- adoubleWobjectCv- adoubleWobjectCp- adoubleWobjectW- adoubleWobjectG- adoubleWobjectJT- adoubleWobjectKappa- adoubleWobjectA- adoubleWobject
-
PseudoCriticalPointLeachman
void PseudoCriticalPointLeachman(org.netlib.util.doubleW Tcx, org.netlib.util.doubleW Dcx) - Parameters:
Tcx- temperature in KelvinDcx- density
-
SetupLeachman
-
SetupLeachman
public void SetupLeachman()Initialize the constants and parameters for the default hydrogen type (normal) using the Leachman method. -
main
-