edu.davidson.chm.equilibria
Class Phase

java.lang.Object
  extended by edu.davidson.chm.equilibria.Phase
All Implemented Interfaces:
PhysicalConstants
Direct Known Subclasses:
Gas, Liquid, Solid, Solution

public abstract class Phase
extends java.lang.Object
implements PhysicalConstants

The phase (a gas, liquid, solid, or solution) is a component in a chemical system and contains one or more chemical species. The user must explicitly define each species in addition to defining the phase.

Physical States:

s indicates a pure solid, which contains a single species whose charge must be zero.

l indicates a pure liquid, which contains a single species whose charge must be zero.

g indicates a gas, which contains one or more species, each of which must have a charge of zero.

d indicates a solution, which contains one or more species. The solvent must have a charge of zero. If the solvent is protic, the solvent acid and base species are automatically generated and given labels "acid" and "base".

All "set" methods for extensive quantities (moles, mass, volume) set the analytical value. All "get" methods return the actual value. If the "get" method is called after the equilibrium problem is solved, the returned value is the equilibrium value. If the "get" method is called prior to solving the equilibrium problem, the value has no reliable meaning.

Copyright (c) David N. Blauch

Version:
2.2
Author:
David N. Blauch

Field Summary
protected  boolean autoChargeBalance
           
protected  ChemSystem chemSystem
           
protected  double density
           
protected  double dielectricConstant
           
protected  boolean isProtic
           
protected  java.lang.String label
           
protected  char physState
           
protected  java.util.Vector<Species> species
           
protected  double volume
           
 
Fields inherited from interface edu.davidson.chm.equilibria.PhysicalConstants
F, k, No, perm, qe, R, RJ
 
Constructor Summary
Phase()
           
 
Method Summary
 Species addSpecies(ChemSpecies _chemSpecies, double _moles)
          Adds more of an existing ChemSpecies to the phase.
 void addSpecies(Species _species)
          Adds a Species to the phase.
 Species addSpecies(java.lang.String _chemSpeciesLabel, double _moles)
          Adds more of an existing ChemSpecies to the phase.
abstract  Phase copyOf(ChemSystem _chemSystem)
          Creates a copy of the phase and places it in the indicated ChemSystem.
 Species[] createSpecies(ChemSpecies[] _chemSpecies, double[] _moles)
          Creates a series of new Species and adds them to the Phase.
 Species createSpecies(ChemSpecies _chemSpecies, double _moles)
          Creates a new Species and adds it to the Phase.
abstract  Species getAcid()
          Returns the conjugate acid of the solvent for a solution with a protic solvent.
 boolean getAutoChargeBalance()
          Returns the autoChargeBalance property
abstract  Species getBase()
          Returns the conjugate base of the solvent for a solution with a protic solvent.
 ChemSystem getChemSystem()
          Returns the chemical system in which the phase exists
 double getDensity()
          Returns the density of the phase in grams per milliliter
 double getDielectricConstant()
          Returns the dielectric constant of the phase
 double getEDHEa()
          Returns the Extended Debye-Huckel Equations a parameter, which appears in the numerator of the expression for ln f.
 double getEDHEb()
          Returns the Extended Debye-Huckel Equations b parameter in units of 1/angstrom, which appears in the denominator of the expression for ln f.
 java.lang.String getInfo()
          Returns information about this class
abstract  double getIonicStrength()
          Returns the ionic strength of the phase
 boolean getIsProtic()
          Returns true if the phase is a solution with a protic solvent
 java.lang.String getLabel()
          Returns the phase label
 double getMass()
          Returns the total mass of the phase in grams
 double getMoles()
          Returns the total moles of species in the phase
 int getNbrSpecies()
          Returns the number of species in the phase
 double getpH()
          Returns the pH of the phase.
 char getPhysicalState()
          Returns the physical state of the phase.
 double getpOH()
          Returns the pOH of the phase.
abstract  double getPressure()
          Returns the pressure of the phase.
 double getPressure(double _moles, double _volume)
          Returns the pressure of the phase for the specified number of moles and the indicated volume (in Liters).
abstract  Species getSolvent()
          Returns the solvent species of a solution.
 Species[] getSpecies()
          Returns an array of species in the system
 Species getSpecies(ChemSpecies _chemSpecies)
          Returns the Species with the given ChemSpecies.
 Species getSpecies(java.lang.String _label)
          Returns the species with the given label; returns null if the species does not exist.
 Species getSpeciesAt(int _index)
          Returns species at given index
abstract  double getVolume()
          Returns the volume of the phase in liters
 boolean removeSpecies(Species _species)
          Removes the species from the phase.
 boolean removeSpecies(java.lang.String _label)
          Removes the species with the given label.
 void scale(double _factor)
          Scales the amount of the phase.
 void setAutoChargeBalance(boolean _val)
          Sets the autoChargeBalance property.
abstract  void setDensity(double _density)
          Sets the density of the phase.
 void setDielectricConstant(double _dielectricConstant)
          Sets the dielectric constant for the phase (solvent in a solution)
 void setLabel(java.lang.String _label)
          Sets the label for a phase
abstract  void setMass(double _mass)
          Sets the mass for the phase.
abstract  void setVolume(double _volume)
          Sets the volume for the phase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

label

protected java.lang.String label

species

protected java.util.Vector<Species> species

chemSystem

protected ChemSystem chemSystem

physState

protected char physState

isProtic

protected boolean isProtic

density

protected double density

dielectricConstant

protected double dielectricConstant

volume

protected double volume

autoChargeBalance

protected boolean autoChargeBalance
Constructor Detail

Phase

public Phase()
Method Detail

addSpecies

public void addSpecies(Species _species)
Adds a Species to the phase. If an existing Species has the same ChemSpecies, the existing Species is removed from the Phase and replaced with the new Species.


addSpecies

public Species addSpecies(ChemSpecies _chemSpecies,
                          double _moles)
Adds more of an existing ChemSpecies to the phase. If the Species is not found in the Phase, a new Species is created and added to the Phase. Returns the Species that was added.

Parameters:
_moles - amount of the species to be added

addSpecies

public Species addSpecies(java.lang.String _chemSpeciesLabel,
                          double _moles)
Adds more of an existing ChemSpecies to the phase. The Species based on this ChemSpecies must already exist, otherwise null is returned.

Parameters:
_moles - amount of the species to be added

createSpecies

public Species[] createSpecies(ChemSpecies[] _chemSpecies,
                               double[] _moles)
Creates a series of new Species and adds them to the Phase. If a Species containing one of the ChemSpecies already exists, the amount of that Species is increased.

Parameters:
_moles - array containing the amount of each species to be created or added
Returns:
an array containing the newly created or existing Species

copyOf

public abstract Phase copyOf(ChemSystem _chemSystem)
Creates a copy of the phase and places it in the indicated ChemSystem.


createSpecies

public Species createSpecies(ChemSpecies _chemSpecies,
                             double _moles)
Creates a new Species and adds it to the Phase. If a Species containing the ChemSpecies already exists, the amount of that Species is increased.

Parameters:
_moles - amount of the species to be created or added
Returns:
the newly created or existing Species

getAcid

public abstract Species getAcid()
Returns the conjugate acid of the solvent for a solution with a protic solvent. If the phase is not a solution with a protic solvent, null is returned.


getAutoChargeBalance

public boolean getAutoChargeBalance()
Returns the autoChargeBalance property


getBase

public abstract Species getBase()
Returns the conjugate base of the solvent for a solution with a protic solvent. If the phase is not a solution with a protic solvent, null is returned.


getChemSystem

public ChemSystem getChemSystem()
Returns the chemical system in which the phase exists


getDensity

public double getDensity()
Returns the density of the phase in grams per milliliter


getDielectricConstant

public double getDielectricConstant()
Returns the dielectric constant of the phase


getEDHEa

public double getEDHEa()
Returns the Extended Debye-Huckel Equations a parameter, which appears in the numerator of the expression for ln f.


getEDHEb

public double getEDHEb()
Returns the Extended Debye-Huckel Equations b parameter in units of 1/angstrom, which appears in the denominator of the expression for ln f.


getInfo

public java.lang.String getInfo()
Returns information about this class


getIonicStrength

public abstract double getIonicStrength()
Returns the ionic strength of the phase


getIsProtic

public boolean getIsProtic()
Returns true if the phase is a solution with a protic solvent


getLabel

public java.lang.String getLabel()
Returns the phase label


getMass

public double getMass()
Returns the total mass of the phase in grams


getMoles

public double getMoles()
Returns the total moles of species in the phase


getNbrSpecies

public int getNbrSpecies()
Returns the number of species in the phase


getpH

public double getpH()
Returns the pH of the phase. Returns zero if the phase is not a solution with a protic solvent.


getPhysicalState

public char getPhysicalState()
Returns the physical state of the phase.

s = solid (this phase contains only one species)

l = liquid (this phase contains only one species)

g = gas

d = solution (the phase contains a solvent and solutes)


getpOH

public double getpOH()
Returns the pOH of the phase. Returns zero if the phase is not a solution with a protic solvent.


getPressure

public abstract double getPressure()
Returns the pressure of the phase.


getPressure

public double getPressure(double _moles,
                          double _volume)
Returns the pressure of the phase for the specified number of moles and the indicated volume (in Liters). This method always returns the system pressure in the default deployment. This method is overridden in the Gas class.


getSolvent

public abstract Species getSolvent()
Returns the solvent species of a solution. For other phases null is returned. This method can be used to determine whether or not a phase is a solution.


getSpecies

public Species getSpecies(java.lang.String _label)
Returns the species with the given label; returns null if the species does not exist. To avoid problems, give all species in the chemical system an unique label. Species have the same descriptive label as the ChemSpecies on which they are based.


getSpecies

public Species getSpecies(ChemSpecies _chemSpecies)
Returns the Species with the given ChemSpecies. Returns null if no Species contains the given ChemSpecies.


getSpecies

public Species[] getSpecies()
Returns an array of species in the system


getSpeciesAt

public Species getSpeciesAt(int _index)
Returns species at given index


getVolume

public abstract double getVolume()
Returns the volume of the phase in liters


removeSpecies

public boolean removeSpecies(Species _species)
Removes the species from the phase. If the Phase is a pure solid or pure liquid, the single Species cannot be removed. In this case, either remove the Phase itself or add a new Species to replace the existing Species.

Returns:
true if species found and removed; false otherwise
See Also:
addSpecies(edu.davidson.chm.equilibria.Species)

removeSpecies

public boolean removeSpecies(java.lang.String _label)
Removes the species with the given label. In this case, either remove the Phase itself or add a new Species to replace the existing Species.

Returns:
true if species found and removed; false otherwise
See Also:
addSpecies(edu.davidson.chm.equilibria.Species)

scale

public void scale(double _factor)
Scales the amount of the phase. If the factor is two, for example, the moles of each species is doubled. The method effectively creates more or less of the phase without altering the molar concentrations of the species

Parameters:
_factor - scaling factor

setAutoChargeBalance

public void setAutoChargeBalance(boolean _val)
Sets the autoChargeBalance property. If true, the Equilibria object will create a counter-ion species, if necessary, to balance the charge in the phase. The counter-ion is given the label "X+" and "X-" and analytical moles are set to the values necessary to balance the charge in the phase.


setDensity

public abstract void setDensity(double _density)
Sets the density of the phase.

Parameters:
_density - density in grams per milliliter

setDielectricConstant

public void setDielectricConstant(double _dielectricConstant)
Sets the dielectric constant for the phase (solvent in a solution)


setLabel

public void setLabel(java.lang.String _label)
Sets the label for a phase


setMass

public abstract void setMass(double _mass)
Sets the mass for the phase.

Parameters:
_mass - mass in grams

setVolume

public abstract void setVolume(double _volume)
Sets the volume for the phase.

Parameters:
_volume - volume in liters