39 #define PITZERFORM_BASE 0
66 #define PITZER_TEMP_CONSTANT 0
67 #define PITZER_TEMP_LINEAR 1
68 #define PITZER_TEMP_COMPLEX1 2
77 #define A_DEBYE_CONST 0
78 #define A_DEBYE_WATER 1
1245 HMWSoln(
const std::string& inputFile,
const std::string&
id =
"");
1427 virtual doublereal
cp_mole()
const;
1433 virtual doublereal
cv_mole()
const;
1451 virtual doublereal
pressure()
const;
1497 virtual doublereal
density()
const;
1553 virtual void setState_TP(doublereal t, doublereal p);
1746 int sizeUA = 6)
const;
1895 err(
"setToEquilState");
1920 virtual void getParameters(
int& n, doublereal*
const c)
const;
1946 err(
"critTemperature");
1952 err(
"critPressure");
1969 err(
"satTemperature");
1991 err(
"vaprFraction");
1996 err(
"setState_sat");
2000 err(
"setState_sat");
2059 double pressure = -1.0)
const;
2076 double pressure = -1.0)
const;
2094 double pressure = -1.0)
const;
2113 double pressure = -1.0)
const;
2133 double pressure = -1.0)
const;
2152 double pressure = -1.0)
const;
2169 double pressure = -1.0)
const;
3107 doublereal IMS_dfCut_;
3108 doublereal IMS_efCut_;
3109 doublereal IMS_afCut_;
3110 doublereal IMS_bfCut_;
3111 doublereal IMS_dgCut_;
3112 doublereal IMS_egCut_;
3113 doublereal IMS_agCut_;
3114 doublereal IMS_bgCut_;
3133 doublereal MC_dpCut_;
3134 doublereal MC_epCut_;
3135 doublereal MC_apCut_;
3136 doublereal MC_bpCut_;
3137 doublereal MC_cpCut_;
3138 doublereal CROP_ln_gamma_o_min;
3139 doublereal CROP_ln_gamma_o_max;
3140 doublereal CROP_ln_gamma_k_min;
3141 doublereal CROP_ln_gamma_k_max;
3159 doublereal
err(
const std::string& msg)
const;
3172 virtual void applyphScale(doublereal* acMolality)
const;
3179 void s_update_lnMolalityActCoeff()
const;
3298 double* etheta,
double* etheta_prime)
const;
3426 static int interp_est(
const std::string& estString);
vector_fp m_Theta_ij_P
Derivative of Theta_ij[i][j] wrt P.
vector_fp m_BMX_IJ_L
Derivative of BMX_IJ wrt T.
vector_fp m_PhiPhi_IJ_P
Derivative of m_PhiPhi_IJ wrt P.
void s_updateIMS_lnMolalityActCoeff() const
This function will be called to update the internally stored natural logarithm of the molality activi...
vector_fp m_CphiMX_ij_LL
Derivative of Cphi_ij[i][j] wrt TT.
void s_update_dlnMolalityActCoeff_dP() const
This function calculates the pressure derivative of the natural logarithm of the molality activity co...
virtual doublereal pressure() const
Pressure.
vector_fp m_Theta_ij_L
Derivative of Theta_ij[i][j] wrt T.
vector_fp m_speciesCharge_Stoich
Stoichiometric species charge -> This is for calculations of the ionic strength which ignore ion-ion ...
void readXMLBinarySalt(XML_Node &BinSalt)
Process an XML node called "binarySaltParameters".
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
WaterProps * m_waterProps
Pointer to the water property calculator.
vector_fp m_CMX_IJ_P
Derivative of m_CMX_IJ wrt P.
vector_fp m_gfunc_IJ
Various temporary arrays used in the calculation of the Pitzer activity coefficients.
vector_fp m_Beta2MX_ij_L
Derivative of Beta2_ij[i][j] wrt T.
vector_fp m_d2lnActCoeffMolaldT2_Unscaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt TT...
doublereal s_NBS_CLM_lnMolalityActCoeff() const
Calculate the Chlorine activity coefficient on the NBS scale.
doublereal MC_X_o_cutoff_
value of the solvent mole fraction that centers the cutoff polynomials for the cutoff =1 process; ...
vector_fp IMS_lnActCoeffMolal_
Logarithm of the molal activity coefficients.
Array2D m_Lambda_nj_coeff
Array of coefficients for Lambda_nj[i][j] in the Pitzer/HMW formulation.
double m_maxIionicStrength
Maximum value of the ionic strength allowed in the calculation of the activity coefficients.
void readXMLLambdaNeutral(XML_Node &BinSalt)
Process an XML node called "lambdaNeutral".
void readXMLThetaAnion(XML_Node &BinSalt)
Process an XML node called "thetaAnion".
vector_fp m_Beta1MX_ij_LL
Derivative of Beta1_ij[i][j] wrt TT.
vector_fp m_Mu_nnn_L
Mu coefficient temperature derivative for the self-ternary neutral coefficient.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
vector_fp m_dlnActCoeffMolaldP_Unscaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt P...
Array2D m_Beta0MX_ij_coeff
Array of coefficients for Beta0, a variable in Pitzer's papers.
double ADebye_J(double temperature=-1.0, double pressure=-1.0) const
Return Pitzer's definition of A_J.
virtual doublereal logStandardConc(size_t k=0) const
Returns the natural logarithm of the standard concentration of the kth species.
vector_fp m_Beta2MX_ij_P
Derivative of Beta2_ij[i][j] wrt P.
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
vector_fp m_Beta2MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
Array2D m_Lambda_nj_P
Derivative of Lambda_nj[i][j] wrt P.
void readXMLMunnnNeutral(XML_Node &BinSalt)
Process an XML node called "MunnnNeutral".
vector_fp m_PhiPhi_IJ
Intermediate variable called PhiPhi in Pitzer's paper.
vector_fp m_Phi_IJ_L
Derivative of m_Phi_IJ wrt T.
Header file for a common definitions used in electrolytes thermodynamics.
int IMS_typeCutoff_
IMS Cutoff type.
vector_fp m_dlnActCoeffMolaldT_Scaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt T...
void setMolarDensity(const doublereal conc)
Set the internally stored molar density (kmol/m^3) for the phase.
vector_fp m_BMX_IJ_P
Derivative of BMX_IJ wrt P.
vector_fp m_Beta0MX_ij_L
Derivative of Beta0_ij[i][j] wrt T.
double elambda[17]
This is elambda, MEC.
Class XML_Node is a tree-based representation of the contents of an XML file.
vector_fp m_dlnActCoeffMolaldP_Scaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt P...
int debugPrinting()
Return int specifying the amount of debug printing.
vector_fp m_Mu_nnn_P
Mu coefficient pressure derivative for the self-ternary neutral coefficient.
void readXMLPsiCommonAnion(XML_Node &BinSalt)
Process an XML node called "psiCommonAnion".
void s_updateScaling_pHScaling() const
Apply the current phScale to a set of activity Coefficients.
virtual void updateStandardStateThermo() const
Updates the standard state thermodynamic functions at the current T and P of the solution.
Array2D m_Lambda_nj_L
Derivative of Lambda_nj[i][j] wrt T. see m_Lambda_ij.
void setDensity(const doublereal rho)
Set the internally stored density (kg/m^3) of the phase.
vector_fp m_BprimeMX_IJ_P
Derivative of BprimeMX wrt P.
void calcMCCutoffParams_()
Calculate molality cut-off parameters.
double AionicRadius(int k=0) const
Reports the ionic radius of the kth species.
vector_fp m_CphiMX_ij_P
Derivative of Cphi_ij[i][j] wrt P.
doublereal s_NBS_CLM_d2lnMolalityActCoeff_dT2() const
Calculate the second temperature derivative of the Chlorine activity coefficient on the NBS scale...
virtual doublereal relative_enthalpy() const
Excess molar enthalpy of the solution from the mixing process.
void calcIMSCutoffParams_()
Precalculate the IMS Cutoff parameters for typeCutoff = 2.
vector_fp m_Psi_ijk_L
Derivative of Psi_ijk[n] wrt T.
void readXMLZetaCation(const XML_Node &BinSalt)
Process an XML node called "zetaCation".
void s_update_d2lnMolalityActCoeff_dT2() const
This function calculates the temperature second derivative of the natural logarithm of the molality a...
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Initialize the phase parameters from an XML file.
vector_fp m_lnActCoeffMolal_Unscaled
Logarithm of the activity coefficients on the molality scale.
vector_fp m_Theta_ij
Array of 2D data for Theta_ij[i][j] in the Pitzer/HMW formulation.
vector_fp m_hfunc_IJ
hfunc, was called gprime in Pitzer's paper.
virtual doublereal critTemperature() const
Critical temperature (K).
double elambda1[17]
This is elambda1, MEC.
virtual doublereal relative_molal_enthalpy() const
Excess molar enthalpy of the solution from the mixing process on a molality basis.
vector_fp m_Beta1MX_ij_P
Derivative of Beta1_ij[i][j] wrt P.
vector_fp m_BprimeMX_IJ_LL
Derivative of BprimeMX wrt TT.
vector_fp m_PhiPhi_IJ_LL
Derivative of m_PhiPhi_IJ wrt TT.
ThermoPhase * duplMyselfAsThermoPhase() const
Duplicator from the ThermoPhase parent class.
void readXMLPsiCommonCation(XML_Node &BinSalt)
Process an XML node called "psiCommonCation".
doublereal IMS_cCut_
Parameter in the polyExp cutoff treatment having to do with rate of exp decay.
virtual void setTemperature(const doublereal temp)
Set the temperature (K)
vector_fp m_Psi_ijk_LL
Derivative of Psi_ijk[n] wrt TT.
double m_IionicMolality
Current value of the ionic strength on the molality scale Associated Salts, if present in the mechani...
vector_fp m_Phi_IJ
Intermediate variable called Phi in Pitzer's paper.
vector_fp m_BphiMX_IJ
Intermediate variable called BphiMX in Pitzer's paper.
Array2D m_CphiMX_ij_coeff
Array of coefficients for CphiMX, a parameter in the activity coefficient formulation.
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
virtual doublereal thermalExpansionCoeff() const
The thermal expansion coefficient.
virtual void setState_Psat(doublereal p, doublereal x)
Set the state to a saturated system at a particular pressure.
void s_updateScaling_pHScaling_dP() const
Apply the current phScale to a set of derivatives of the activity Coefficients wrt pressure...
vector_fp m_tmpV
vector of size m_kk, used as a temporary holding area.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
int formPitzer() const
formPitzer():
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Header for intermediate ThermoPhase object for phases which employ molality based activity coefficien...
Base class for a phase with thermodynamic properties.
void getUnscaledMolalityActivityCoefficients(doublereal *acMolality) const
Get the array of unscaled non-dimensional molality based activity coefficients at the current solutio...
HMWSoln()
Default Constructor.
vector_fp m_lnActCoeffMolal_Scaled
Logarithm of the activity coefficients on the molality scale.
virtual void getActivities(doublereal *ac) const
Get the array of non-dimensional activities at the current solution temperature, pressure, and solution concentration.
std::vector< int > vector_int
Vector of ints.
doublereal MC_X_o_min_
gamma_o value for the cutoff process at the zero solvent point
vector_fp m_Phi_IJ_P
Derivative of m_Phi_IJ wrt P.
PDSS * m_waterSS
Water standard state calculator.
vector_fp m_Alpha1MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
vector_fp m_Phiprime_IJ
Intermediate variable called Phiprime in Pitzer's paper.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
vector_fp m_h2func_IJ
hfunc2, was called gprime in Pitzer's paper.
void readXMLCroppingCoefficients(const XML_Node &acNode)
Process an XML node called "croppingCoefficients" for the cropping coefficients values.
vector_fp m_Psi_ijk_P
Derivative of Psi_ijk[n] wrt P.
void counterIJ_setup() const
Set up a counter variable for keeping track of symmetric binary interactions amongst the solute speci...
vector_fp m_CMX_IJ_L
Derivative of m_CMX_IJ wrt T.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
bool m_molalitiesAreCropped
Boolean indicating whether the molalities are cropped or are modified.
vector_fp m_dlnActCoeffMolaldT_Unscaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt T...
Array2D m_Psi_ijk_coeff
Array of coefficients for Psi_ijk[n] in the Pitzer/HMW formulation.
void s_updateScaling_pHScaling_dT() const
Apply the current phScale to a set of derivatives of the activity Coefficients wrt temperature...
void s_updatePitzer_dlnMolalityActCoeff_dT() const
Calculates the temperature derivative of the natural logarithm of the molality activity coefficients...
virtual void initThermo()
Internal initialization required after all species have been added.
vector_fp m_Mu_nnn
Mu coefficient for the self-ternary neutral coefficient.
vector_fp m_molalitiesCropped
Cropped and modified values of the molalities used in activity coefficient calculations.
The WaterProps class is used to house several approximation routines for properties of water...
vector_fp m_Beta2MX_ij_LL
Derivative of Beta2_ij[i][j] wrt TT.
vector_fp m_CMX_IJ_LL
Derivative of m_CMX_IJ wrt TT.
virtual void getUnitsStandardConc(double *uA, int k=0, int sizeUA=6) const
Returns the units of the standard and generalized concentrations.
Array2D m_Beta2MX_ij_coeff
Array of coefficients for Beta2, a variable in Pitzer's papers.
Array2D m_Lambda_nj_LL
Derivative of Lambda_nj[i][j] wrt TT.
void s_updatePitzer_lnMolalityActCoeff() const
Calculate the Pitzer portion of the activity coefficients.
double ADebye_V(double temperature=-1.0, double pressure=-1.0) const
Return Pitzer's definition of A_V.
doublereal IMS_slopegCut_
Parameter in the polyExp cutoff treatment.
doublereal IMS_slopefCut_
Parameter in the polyExp cutoff treatment.
vector_fp m_Beta0MX_ij_LL
Derivative of Beta0_ij[i][j] wrt TT.
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters.
int m_form_A_Debye
Form of the constant outside the Debye-Huckel term called A.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
void s_update_dlnMolalityActCoeff_dT() const
This function calculates the temperature derivative of the natural logarithm of the molality activity...
void s_updatePitzer_dlnMolalityActCoeff_dP() const
Calculates the Pressure derivative of the natural logarithm of the molality activity coefficients...
vector_int m_CounterIJ
a counter variable for keeping track of symmetric binary interactions amongst the solute species...
doublereal MC_slopepCut_
Parameter in the Molality Exp cutoff treatment.
void s_updateScaling_pHScaling_dT2() const
Apply the current phScale to a set of 2nd derivatives of the activity Coefficients wrt temperature...
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
vector_fp m_CMX_IJ
Intermediate variable called CMX in Pitzer's paper.
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
double m_TempPitzerRef
Reference Temperature for the Pitzer formulations.
vector_fp m_CphiMX_ij_L
Derivative of Cphi_ij[i][j] wrt T.
void calc_lambdas(double is) const
Calculate the lambda interactions.
static int interp_est(const std::string &estString)
Utility function to assign an integer value from a string for the ElectrolyteSpeciesType field...
void constructPhaseXML(XML_Node &phaseNode, std::string id)
Import and initialize a HMWSoln phase specification in an XML tree into the current object...
void calc_thetas(int z1, int z2, double *etheta, double *etheta_prime) const
Calculate etheta and etheta_prime.
vector_fp m_BphiMX_IJ_L
Derivative of BphiMX_IJ wrt T.
vector_fp m_g2func_IJ
This is the value of g2(x2) in Pitzer's papers.
void constructPhaseFile(std::string inputFile, std::string id)
Import, construct, and initialize a HMWSoln phase specification from an XML tree into the current obj...
void readXMLThetaCation(XML_Node &BinSalt)
Process an XML node called "thetaCation".
double m_densWaterSS
density of standard-state water
Array2D m_Lambda_nj
Lambda coefficient for the ij interaction.
virtual ~HMWSoln()
Destructor.
vector_fp m_Phi_IJ_LL
Derivative of m_Phi_IJ wrt TT.
int m_formPitzer
This is the form of the Pitzer parameterization used in this model.
doublereal IMS_gamma_k_min_
gamma_k minimum for the cutoff process at the zero solvent point
vector_fp m_Alpha2MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
virtual double A_Debye_TP(double temperature=-1.0, double pressure=-1.0) const
Value of the Debye Huckel constant as a function of temperature and pressure.
vector_int m_electrolyteSpeciesType
Vector containing the electrolyte species type.
vector_fp m_Beta0MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
vector_fp m_BprimeMX_IJ_L
Derivative of BprimeMX wrt T.
virtual doublereal satTemperature(doublereal p) const
Return the saturation temperature given the pressure.
doublereal IMS_gamma_o_min_
gamma_o value for the cutoff process at the zero solvent point
virtual double dA_DebyedT_TP(double temperature=-1.0, double pressure=-1.0) const
Value of the derivative of the Debye Huckel constant with respect to temperature as a function of tem...
vector_fp m_BMX_IJ_LL
Derivative of BMX_IJ wrt TT.
doublereal temperature() const
Temperature (K).
int m_formGC
Format for the generalized concentration:
double m_A_Debye
A_Debye -> this expression appears on the top of the ln actCoeff term in the general Debye-Huckel exp...
std::vector< int > CROP_speciesCropped_
This is a boolean-type vector indicating whether a species's activity coefficient is in the cropped r...
void initLengths()
Initialize all of the species-dependent lengths in the object.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized activity concentrations.
doublereal s_NBS_CLM_dlnMolalityActCoeff_dT() const
Calculate the temperature derivative of the Chlorine activity coefficient on the NBS scale...
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Virtual base class for a species with a pressure dependent standard state.
double ADebye_L(double temperature=-1.0, double pressure=-1.0) const
Return Pitzer's definition of A_L.
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
virtual double dA_DebyedP_TP(double temperature=-1.0, double pressure=-1.0) const
Value of the derivative of the Debye Huckel constant with respect to pressure, as a function of tempe...
virtual void applyphScale(doublereal *acMolality) const
Apply the current phScale to a set of activity Coefficients or activities.
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
vector_fp m_gamma_tmp
Intermediate storage of the activity coefficient itself.
virtual doublereal vaporFraction() const
Return the fraction of vapor at the current conditions.
virtual int eosType() const
Equation of state type flag.
virtual doublereal critDensity() const
Critical density (kg/m3).
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
doublereal err(const std::string &msg) const
Local error routine.
virtual doublereal critPressure() const
Critical pressure (Pa).
doublereal IMS_X_o_cutoff_
value of the solute mole fraction that centers the cutoff polynomials for the cutoff =1 process; ...
void calcMolalitiesCropped() const
Calculate the cropped molalities.
vector_fp m_Psi_ijk
Array of 3D data used in the Pitzer/HMW formulation.
vector_fp m_pp
Temporary array used in equilibrium calculations.
Class HMWSoln represents a dilute or concentrated liquid electrolyte phase which obeys the Pitzer for...
vector_fp m_BMX_IJ
Intermediate variable called BMX in Pitzer's paper This is the basic cation - anion interaction...
virtual double d2A_DebyedT2_TP(double temperature=-1.0, double pressure=-1.0) const
Value of the 2nd derivative of the Debye Huckel constant with respect to temperature as a function of...
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
double m_IionicMolalityStoich
Stoichiometric ionic strength on the molality scale.
vector_fp m_BprimeMX_IJ
Intermediate variable called BprimeMX in Pitzer's paper.
void s_updatePitzer_CoeffWRTemp(int doDerivs=2) const
Calculates the Pitzer coefficients' dependence on the temperature.
virtual void setToEquilState(const doublereal *lambda_RT)
This method is used by the ChemEquil equilibrium solver.
vector_fp m_d2lnActCoeffMolaldT2_Scaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt TT...
vector_fp m_CphiMX_ij
Array of 2D data used in the Pitzer/HMW formulation.
virtual doublereal density() const
Returns the current value of the density.
int m_formPitzerTemp
This is the form of the temperature dependence of Pitzer parameterization used in the model...
void printCoeffs() const
Print out all of the input Pitzer coefficients.
HMWSoln & operator=(const HMWSoln &right)
Assignment operator.
virtual void setState_Tsat(doublereal t, doublereal x)
Set the state to a saturated system at a particular temperature.
vector_fp m_Beta1MX_ij_L
Derivative of Beta1_ij[i][j] wrt T.
vector_fp m_Theta_ij_LL
Derivative of Theta_ij[i][j] wrt TT.
void s_updatePitzer_d2lnMolalityActCoeff_dT2() const
This function calculates the temperature second derivative of the natural logarithm of the molality a...
Array2D m_Theta_ij_coeff
Array of coefficients for Theta_ij[i][j] in the Pitzer/HMW formulation.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
virtual doublereal satPressure(doublereal T)
Get the saturation pressure for a given temperature.
Array2D m_Mu_nnn_coeff
Array of coefficients form_Mu_nnn term.
doublereal s_NBS_CLM_dlnMolalityActCoeff_dP() const
Calculate the pressure derivative of the Chlorine activity coefficient.
vector_fp m_Mu_nnn_LL
Mu coefficient 2nd temperature derivative for the self-ternary neutral coefficient.
vector_fp m_Aionic
a_k = Size of the ionic species in the DH formulation units = meters
vector_fp m_BphiMX_IJ_P
Derivative of BphiMX_IJ wrt P.
Array2D m_Beta1MX_ij_coeff
Array of coefficients for Beta1, a variable in Pitzer's papers.
vector_fp m_PhiPhi_IJ_L
Derivative of m_PhiPhi_IJ wrt T.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
vector_fp m_Beta0MX_ij_P
Derivative of Beta0_ij[i][j] wrt P.
virtual doublereal isothermalCompressibility() const
The isothermal compressibility.
vector_fp m_BphiMX_IJ_LL
Derivative of BphiMX_IJ wrt TT.