Go to the documentation of this file.
47 #define PITZER_TEMP_CONSTANT 0
48 #define PITZER_TEMP_LINEAR 1
49 #define PITZER_TEMP_COMPLEX1 2
58 #define A_DEBYE_CONST 0
59 #define A_DEBYE_WATER 1
1056 HMWSoln(
const std::string& inputFile,
const std::string&
id =
"");
1130 virtual doublereal
cp_mole()
const;
1136 virtual doublereal
cv_mole()
const;
1196 virtual void setDensity(
const doublereal rho);
1480 void setBinarySalt(
const std::string& sp1,
const std::string& sp2,
1481 size_t nParams,
double* beta0,
double* beta1,
double* beta2,
1482 double* Cphi,
double alpha1,
double alpha2);
1483 void setTheta(
const std::string& sp1,
const std::string& sp2,
1484 size_t nParams,
double* theta);
1485 void setPsi(
const std::string& sp1,
const std::string& sp2,
1486 const std::string& sp3,
size_t nParams,
double* psi);
1487 void setLambda(
const std::string& sp1,
const std::string& sp2,
1488 size_t nParams,
double* lambda);
1489 void setMunnn(
const std::string& sp,
size_t nParams,
double* munnn);
1490 void setZeta(
const std::string& sp1,
const std::string& sp2,
1491 const std::string& sp3,
size_t nParams,
double* psi);
1493 void setPitzerTempModel(
const std::string& model);
1494 void setPitzerRefTemperature(
double Tref) {
1502 void setMaxIonicStrength(
double Imax) {
1506 void setCroppingCoefficients(
double ln_gamma_k_min,
double ln_gamma_k_max,
1507 double ln_gamma_o_min,
double ln_gamma_o_max);
1528 virtual void initThermoXML(XML_Node& phaseNode,
const std::string&
id);
2254 doublereal IMS_dfCut_;
2255 doublereal IMS_efCut_;
2256 doublereal IMS_afCut_;
2257 doublereal IMS_bfCut_;
2258 doublereal IMS_dgCut_;
2259 doublereal IMS_egCut_;
2260 doublereal IMS_agCut_;
2261 doublereal IMS_bgCut_;
2270 doublereal MC_dpCut_;
2271 doublereal MC_epCut_;
2272 doublereal MC_apCut_;
2273 doublereal MC_bpCut_;
2274 doublereal MC_cpCut_;
2275 doublereal CROP_ln_gamma_o_min;
2276 doublereal CROP_ln_gamma_o_max;
2277 doublereal CROP_ln_gamma_k_min;
2278 doublereal CROP_ln_gamma_k_max;
2303 virtual void applyphScale(doublereal* acMolality)
const;
2310 void s_update_lnMolalityActCoeff()
const;
2400 mutable doublereal m_last_is;
2420 double* etheta,
double* etheta_prime)
const;
vector_fp m_PhiPhi_IJ_LL
Derivative of m_PhiPhi_IJ wrt TT. Vector index is counterIJ.
void s_updateIMS_lnMolalityActCoeff() const
This function will be called to update the internally stored natural logarithm of the molality activi...
void s_update_dlnMolalityActCoeff_dP() const
This function calculates the pressure derivative of the natural logarithm of the molality activity co...
HMWSoln()
Default Constructor.
virtual doublereal pressure() const
Returns the current pressure of the phase.
vector_fp m_PhiPhi_IJ_P
Derivative of m_PhiPhi_IJ wrt P. Vector index is counterIJ.
int m_formPitzerTemp
This is the form of the temperature dependence of Pitzer parameterization used in the model.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
void calc_thetas(int z1, int z2, double *etheta, double *etheta_prime) const
Calculate etheta and etheta_prime.
vector_fp m_Mu_nnn_L
Mu coefficient temperature derivative for the self-ternary neutral coefficient.
vector_fp m_Beta2MX_ij_P
Derivative of Beta2_ij[i][j] wrt P. Vector index is counterIJ.
vector_fp m_CphiMX_ij_LL
Derivative of Cphi_ij[i][j] wrt TT. Vector index is counterIJ.
vector_fp m_CphiMX_ij_L
Derivative of Cphi_ij[i][j] wrt T. Vector index is counterIJ.
vector_fp m_CphiMX_ij_P
Derivative of Cphi_ij[i][j] wrt P. Vector index is counterIJ.
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...
vector_fp m_Beta1MX_ij_P
Derivative of Beta1_ij[i][j] wrt P. Vector index is counterIJ.
vector_fp m_d2lnActCoeffMolaldT2_Scaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt TT.
vector_fp m_BMX_IJ
Intermediate variable called BMX in Pitzer's paper.
vector_fp m_molalitiesCropped
Cropped and modified values of the molalities used in activity coefficient calculations.
void s_updateScaling_pHScaling_dT() const
Apply the current phScale to a set of derivatives of the activity Coefficients wrt temperature.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
vector_fp m_dlnActCoeffMolaldT_Unscaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt T.
vector_fp m_dlnActCoeffMolaldT_Scaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt T.
vector_fp m_Psi_ijk
Array of 3D data used in the Pitzer/HMW formulation.
vector_fp m_hfunc_IJ
hfunc, was called gprime in Pitzer's paper.
vector_fp m_CMX_IJ_L
Derivative of m_CMX_IJ wrt T. Vector index is counterIJ.
vector_fp m_dlnActCoeffMolaldP_Scaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt P.
Array2D m_Lambda_nj
Lambda coefficient for the ij interaction.
void s_update_d2lnMolalityActCoeff_dT2() const
This function calculates the temperature second derivative of the natural logarithm of the molality a...
double elambda1[17]
This is elambda1, MEC.
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
void readXMLMunnnNeutral(XML_Node &BinSalt)
Process an XML node called "MunnnNeutral".
void s_updateScaling_pHScaling() const
Apply the current phScale to a set of activity Coefficients.
void s_updatePitzer_dlnMolalityActCoeff_dT() const
Calculates the temperature derivative of the natural logarithm of the molality activity coefficients.
vector_fp m_Beta2MX_ij_L
Derivative of Beta2_ij[i][j] wrt T. Vector index is counterIJ.
vector_fp m_Beta1MX_ij_LL
Derivative of Beta1_ij[i][j] wrt TT. Vector index is counterIJ.
vector_fp m_BMX_IJ_L
Derivative of BMX_IJ wrt T. Vector index is counterIJ.
vector_fp m_gfunc_IJ
Various temporary arrays used in the calculation of the Pitzer activity coefficients.
void readXMLPsi(XML_Node &BinSalt)
Process an XML node called "psiCommonAnion" or "psiCommonCation".
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized activity concentrations.
Array2D m_Mu_nnn_coeff
Array of coefficients form_Mu_nnn term.
double m_maxIionicStrength
Maximum value of the ionic strength allowed in the calculation of the activity coefficients.
vector_fp m_Phi_IJ_P
Derivative of m_Phi_IJ wrt P. Vector index is counterIJ.
vector_fp m_Phi_IJ
Intermediate variable called Phi in Pitzer's paper.
vector_fp m_Phiprime_IJ
Intermediate variable called Phiprime in Pitzer's paper.
vector_fp m_lnActCoeffMolal_Scaled
Logarithm of the activity coefficients on the molality scale.
vector_fp m_Phi_IJ_LL
Derivative of m_Phi_IJ wrt TT. Vector index is counterIJ.
vector_fp m_Mu_nnn
Mu coefficient for the self-ternary neutral coefficient.
vector_fp m_Psi_ijk_L
Derivative of Psi_ijk[n] wrt T.
double m_IionicMolality
Current value of the ionic strength on the molality scale Associated Salts, if present in the mechani...
void s_update_dlnMolalityActCoeff_dT() const
This function calculates the temperature derivative of the natural logarithm of the molality activity...
doublereal s_NBS_CLM_dlnMolalityActCoeff_dP() const
Calculate the pressure derivative of the Chlorine activity coefficient.
Array2D m_CphiMX_ij_coeff
Array of coefficients for CphiMX, a parameter in the activity coefficient formulation.
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 readXMLTheta(XML_Node &BinSalt)
Process an XML node called "thetaAnion" or "thetaCation".
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.
void initLengths()
Initialize all of the species-dependent lengths in the object.
void calcIMSCutoffParams_()
Precalculate the IMS Cutoff parameters for typeCutoff = 2.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
PDSS * m_waterSS
Water standard state calculator.
Array2D m_Beta0MX_ij_coeff
Array of coefficients for Beta0, a variable in Pitzer's papers.
void s_updatePitzer_dlnMolalityActCoeff_dP() const
Calculates the Pressure derivative of the natural logarithm of the molality activity coefficients.
void counterIJ_setup() const
Set up a counter variable for keeping track of symmetric binary interactions amongst the solute speci...
doublereal IMS_X_o_cutoff_
value of the solute mole fraction that centers the cutoff polynomials for the cutoff =1 process;
vector_fp m_Psi_ijk_P
Derivative of Psi_ijk[n] wrt P.
doublereal MC_X_o_cutoff_
value of the solvent mole fraction that centers the cutoff polynomials for the cutoff =1 process;
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
vector_fp m_CMX_IJ
Intermediate variable called CMX in Pitzer's paper.
doublereal s_NBS_CLM_dlnMolalityActCoeff_dT() const
Calculate the temperature derivative of the Chlorine activity coefficient on the NBS scale.
virtual void setMolarDensity(const doublereal conc)
Set the internally stored molar density (kmol/m^3) for the phase.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
void s_updatePitzer_lnMolalityActCoeff() const
Calculate the Pitzer portion of the activity coefficients.
vector_fp m_CMX_IJ_LL
Derivative of m_CMX_IJ wrt TT. Vector index is counterIJ.
double elambda[17]
This is elambda, MEC.
vector_fp m_PhiPhi_IJ
Intermediate variable called PhiPhi in Pitzer's paper.
void calc_lambdas(double is) const
Calculate the lambda interactions.
vector_fp m_h2func_IJ
hfunc2, was called gprime in Pitzer's paper.
vector_fp m_dlnActCoeffMolaldP_Unscaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt P.
void s_updateScaling_pHScaling_dP() const
Apply the current phScale to a set of derivatives of the activity Coefficients wrt pressure.
void calcMolalitiesCropped() const
Calculate the cropped molalities.
vector_fp m_BprimeMX_IJ_P
Derivative of BprimeMX wrt P. Vector index is counterIJ.
double ADebye_V(double temperature=-1.0, double pressure=-1.0) const
Return Pitzer's definition of A_V.
virtual void getActivities(doublereal *ac) const
Get the array of non-dimensional activities at the current solution temperature, pressure,...
vector_fp m_Mu_nnn_P
Mu coefficient pressure derivative for the self-ternary neutral coefficient.
vector_fp m_BphiMX_IJ_P
Derivative of BphiMX_IJ wrt P. Vector index is counterIJ.
vector_fp m_Theta_ij
Array of 2D data for Theta_ij[i][j] in the Pitzer/HMW formulation.
Array2D m_Lambda_nj_L
Derivative of Lambda_nj[i][j] wrt T. see m_Lambda_ij.
vector_fp m_Alpha2MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
double ADebye_J(double temperature=-1.0, double pressure=-1.0) const
Return Pitzer's definition of A_J.
vector_fp m_BprimeMX_IJ_LL
Derivative of BprimeMX wrt TT. Vector index is counterIJ.
vector_fp m_BprimeMX_IJ
Intermediate variable called BprimeMX in Pitzer's paper.
void readXMLZetaCation(const XML_Node &BinSalt)
Process an XML node called "zetaCation".
vector_fp m_CMX_IJ_P
Derivative of m_CMX_IJ wrt P. Vector index is counterIJ.
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
void s_updatePitzer_CoeffWRTemp(int doDerivs=2) const
Calculates the Pitzer coefficients' dependence on the temperature.
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...
vector_fp m_Beta0MX_ij_L
Derivative of Beta0_ij[i][j] wrt T. Vector index is counterIJ.
vector_fp m_BMX_IJ_LL
Derivative of BMX_IJ wrt TT. Vector index is counterIJ.
virtual void initThermo()
Class XML_Node is a tree-based representation of the contents of an XML file.
void getUnscaledMolalityActivityCoefficients(doublereal *acMolality) const
Get the array of unscaled non-dimensional molality based activity coefficients at the current solutio...
void printCoeffs() const
Print out all of the input Pitzer coefficients.
void calcMCCutoffParams_()
Calculate molality cut-off parameters.
virtual doublereal relative_molal_enthalpy() const
Excess molar enthalpy of the solution from the mixing process on a molality basis.
Array2D m_Psi_ijk_coeff
Array of coefficients for Psi_ijk[n] in the Pitzer/HMW formulation.
Array2D m_Lambda_nj_coeff
Array of coefficients for Lambda_nj[i][j] in the Pitzer/HMW formulation.
vector_fp m_BprimeMX_IJ_L
Derivative of BprimeMX wrt T. Vector index is counterIJ.
vector_fp m_Beta1MX_ij_L
Derivative of Beta1_ij[i][j] wrt T. Vector index is counterIJ.
doublereal IMS_slopegCut_
Parameter in the polyExp cutoff treatment.
double m_A_Debye
A_Debye: this expression appears on the top of the ln actCoeff term in the general Debye-Huckel expre...
vector_fp m_Beta2MX_ij_LL
Derivative of Beta2_ij[i][j] wrt TT. Vector index is counterIJ.
vector_fp m_Beta0MX_ij_P
Derivative of Beta0_ij[i][j] wrt P. Vector index is counterIJ.
std::unique_ptr< WaterProps > m_waterProps
Pointer to the water property calculator.
virtual void setDensity(const doublereal rho)
Set the internally stored density (kg/m^3) of the phase.
void readXMLBinarySalt(XML_Node &BinSalt)
Process an XML node called "binarySaltParameters".
doublereal temperature() const
Temperature (K).
doublereal IMS_cCut_
Parameter in the polyExp cutoff treatment having to do with rate of exp decay.
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...
void s_updateScaling_pHScaling_dT2() const
Apply the current phScale to a set of 2nd derivatives of the activity Coefficients wrt temperature.
vector_fp m_CphiMX_ij
Array of 2D data used in the Pitzer/HMW formulation.
vector_fp m_BphiMX_IJ_L
Derivative of BphiMX_IJ wrt T. Vector index is counterIJ.
vector_fp m_d2lnActCoeffMolaldT2_Unscaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt TT.
vector_fp m_PhiPhi_IJ_L
Derivative of m_PhiPhi_IJ wrt T. Vector index is counterIJ.
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.
vector_fp m_g2func_IJ
This is the value of g2(x2) in Pitzer's papers. Vector index is counterIJ.
Array2D m_Theta_ij_coeff
Array of coefficients for Theta_ij[i][j] in the Pitzer/HMW formulation.
doublereal s_NBS_CLM_d2lnMolalityActCoeff_dT2() const
Calculate the second temperature derivative of the Chlorine activity coefficient on the NBS scale.
doublereal s_NBS_CLM_lnMolalityActCoeff() const
Calculate the Chlorine activity coefficient on the NBS scale.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Initialize the phase parameters from an XML file.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
double ADebye_L(double temperature=-1.0, double pressure=-1.0) const
Return Pitzer's definition of A_L.
Array2D m_Beta1MX_ij_coeff
Array of coefficients for Beta1, a variable in Pitzer's papers.
double m_TempPitzerRef
Reference Temperature for the Pitzer formulations.
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
vector_fp m_lnActCoeffMolal_Unscaled
Logarithm of the activity coefficients on the molality scale.
vector_fp m_Theta_ij_P
Derivative of Theta_ij[i][j] wrt P. Vector index is counterIJ.
Class HMWSoln represents a dilute or concentrated liquid electrolyte phase which obeys the Pitzer for...
vector_fp m_Psi_ijk_LL
Derivative of Psi_ijk[n] wrt TT.
vector_fp m_BphiMX_IJ
Intermediate variable called BphiMX in Pitzer's paper.
virtual void applyphScale(doublereal *acMolality) const
Apply the current phScale to a set of activity Coefficients or activities.
std::vector< int > vector_int
Vector of ints.
vector_fp m_Beta1MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
bool m_molalitiesAreCropped
Boolean indicating whether the molalities are cropped or are modified.
vector_fp m_BphiMX_IJ_LL
Derivative of BphiMX_IJ wrt TT. Vector index is counterIJ.
vector_fp m_Mu_nnn_LL
Mu coefficient 2nd temperature derivative for the self-ternary neutral coefficient.
void readXMLLambdaNeutral(XML_Node &BinSalt)
Process an XML node called "lambdaNeutral".
void setA_Debye(double A)
Set the A_Debye parameter.
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
Virtual base class for a species with a pressure dependent standard state.
vector_fp IMS_lnActCoeffMolal_
Logarithm of the molal activity coefficients.
vector_fp m_Theta_ij_L
Derivative of Theta_ij[i][j] wrt T. Vector index is counterIJ.
Namespace for the Cantera kernel.
void s_updatePitzer_d2lnMolalityActCoeff_dT2() const
This function calculates the temperature second derivative of the natural logarithm of the molality a...
vector_int m_CounterIJ
a counter variable for keeping track of symmetric binary interactions amongst the solute species.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
vector_fp m_Theta_ij_LL
Derivative of Theta_ij[i][j] wrt TT. Vector index is counterIJ.
vector_fp m_BMX_IJ_P
Derivative of BMX_IJ wrt P. Vector index is counterIJ.
vector_fp m_Beta0MX_ij_LL
Derivative of Beta0_ij[i][j] wrt TT. Vector index is counterIJ.
virtual std::string type() const
String indicating the thermodynamic model implemented.
vector_int CROP_speciesCropped_
This is a boolean-type vector indicating whether a species's activity coefficient is in the cropped r...
vector_fp m_Beta2MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
vector_fp m_gamma_tmp
Intermediate storage of the activity coefficient itself.
vector_fp m_Phi_IJ_L
Derivative of m_Phi_IJ wrt T. Vector index is counterIJ.
int m_form_A_Debye
Form of the constant outside the Debye-Huckel term called A.
virtual doublereal relative_enthalpy() const
Excess molar enthalpy of the solution from the mixing process.
vector_fp m_Beta0MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
Array2D m_Lambda_nj_P
Derivative of Lambda_nj[i][j] wrt P.
vector_fp m_tmpV
vector of size m_kk, used as a temporary holding area.