Added 2 tests with debugging turned on.

This commit is contained in:
Harry Moffat 2006-07-06 21:54:16 +00:00
parent fd6141eddf
commit 9520238fb1
16 changed files with 1608 additions and 2 deletions

View file

@ -11,11 +11,11 @@
.SUFFIXES : .d
# the name of the executable program to be created
PROG_NAME = HMW_graph_GvT
PROG_NAME = HMW_graph_GvI
# the object files to be linked together. List those generated from Fortran
# and from C/C++ separately
OBJS = HMW_graph_GvT.o sortAlgorithms.o
OBJS = HMW_graph_GvI.o sortAlgorithms.o
# Location of the current build. Will assume that tests are run
# in the source directory tree location

View file

@ -0,0 +1,10 @@
Makefile
HMW_test_1
output.txt
outputa.txt
.cvsignore.swp
.depends
HMW_test_1.d
diff_test.out
table.csv

View file

@ -0,0 +1,182 @@
<?xml version="1.0"?>
<ctml>
<phase id="NaCl_electrolyte" dim="3">
<speciesArray datasrc="#species_waterSolution">
H2O(L) Cl- H+ Na+ OH-
</speciesArray>
<state>
<temperature units="K"> 298.15 </temperature>
<pressure units="Pa"> 101325.0 </pressure>
<soluteMolalities>
Na+:6.0954
Cl-:6.0954
H+:2.1628E-9
OH-:1.3977E-6
</soluteMolalities>
</state>
<!-- thermo model identifies the inherited class
from ThermoPhase that will handle the thermodynamics.
-->
<thermo model="HMW">
<standardConc model="solvent_volume" />
<activityCoefficients model="Pitzer">
<!-- A_Debye units = sqrt(kg/gmol)
This is adjusted to match the GWB value so
that numerical comparisons can be made
Aln = 0.5107
-->
<A_Debye> 1.175930 </A_Debye>
<!-- B_Debye units = sqrt(kg/gmol)/m
-->
<B_Debye> 3.28640E9 </B_Debye>
<ionicRadius default="3.042843" units="Angstroms">
</ionicRadius>
<binarySaltParameters cation="Na+" anion="Cl-">
<beta0> 0.0765 </beta0>
<beta1> 0.2664 </beta1>
<beta2> 0.0 </beta2>
<Cphi> 0.00127 </Cphi>
<Alpha1> 2.0 </Alpha1>
</binarySaltParameters>
<binarySaltParameters cation="H+" anion="Cl-">
<beta0> 0.1775 </beta0>
<beta1> 0.2945 </beta1>
<beta2> 0.0 </beta2>
<Cphi> 0.0008 </Cphi>
<Alpha1> 2.0 </Alpha1>
</binarySaltParameters>
<binarySaltParameters cation="Na+" anion="OH-">
<beta0> 0.0864 </beta0>
<beta1> 0.253 </beta1>
<beta2> 0.0 </beta2>
<Cphi> 0.0044 </Cphi>
<Alpha1> 2.0 </Alpha1>
</binarySaltParameters>
<thetaAnion anion1="Cl-" anion2="OH-">
<Theta> -0.05 </Theta>
</thetaAnion>
<psiCommonCation cation="Na+" anion1="Cl-" anion2="OH-">
<Theta> -0.05 </Theta>
<Psi> -0.006 </Psi>
</psiCommonCation>
<thetaCation cation1="Na+" cation2="H+">
<Theta> 0.036 </Theta>
</thetaCation>
<psiCommonAnion anion="Cl-" cation1="Na+" cation2="H+">
<Theta> 0.036 </Theta>
<Psi> -0.004 </Psi>
</psiCommonAnion>
</activityCoefficients>
<solvent> H2O(L) </solvent>
</thermo>
<elementArray datasrc="elements.xml"> O H C Fe Si N Na Cl </elementArray>
</phase>
<speciesData id="species_waterSolution">
<!-- species H2O(L) -->
<species name="H2O(L)">
<atomArray>H:2 O:1 </atomArray>
<thermo>
<NASA Tmax="600.0" Tmin="273.14999999999998" P0="100000.0">
<floatArray name="coeffs" size="7">
7.255750050E+01, -6.624454020E-01, 2.561987460E-03, -4.365919230E-06,
2.781789810E-09, -4.188654990E+04, -2.882801370E+02
</floatArray>
</NASA>
</thermo>
<standardState model="constant_incompressible">
<molarVolume> 0.05555555 </molarVolume>
</standardState>
</species>
<species name="Na+">
<atomArray> Na:1 </atomArray>
<charge> +1 </charge>
<thermo>
<Mu0 Pref="100000.0" Tmax="1000.0" Tmin="200.0">
<H298 units="cal/mol"> 0.0 </H298>
<numPoints> 2 </numPoints>
<floatArray size="2" title="Mu0Values" units="Dimensionless">
-125.5213, -125.5213
</floatArray>
<floatArray size="2" title="Mu0Temperatures">
298.15, 333.15
</floatArray>
</Mu0>
</thermo>
<standardState model="constant_incompressible">
<molarVolume> 1.3 </molarVolume>
</standardState>
</species>
<species name="Cl-">
<atomArray> Cl:1 </atomArray>
<charge> -1 </charge>
<standardState model="constant_incompressible">
<molarVolume> 1.3 </molarVolume>
</standardState>
<thermo>
<Mu0 Pref="100000.0" Tmax="333." Tmin="298.">
<H298 units="cal/mol"> 0.0 </H298>
<numPoints> 2 </numPoints>
<floatArray size="2" title="Mu0Values" units="Dimensionless">
-52.8716 , -52.8716
</floatArray>
<floatArray size="2" title="Mu0Temperatures">
298.15, 333.15
</floatArray>
</Mu0>
</thermo>
</species>
<species name="H+">
<atomArray> H:1 </atomArray>
<charge> +1 </charge>
<standardState model="constant_incompressible">
<molarVolume> 1.3 </molarVolume>
</standardState>
<thermo>
<Mu0 Pref="100000.0" Tmax="333." Tmin="298.">
<H298 units="cal/mol"> 0.0 </H298>
<numPoints> 2 </numPoints>
<floatArray size="2" title="Mu0Values" units="Dimensionless">
0.0 , 0.0
</floatArray>
<floatArray size="2" title="Mu0Temperatures">
298.15, 333.15
</floatArray>
</Mu0>
</thermo>
</species>
<species name="OH-">
<atomArray> O:1 H:1 </atomArray>
<charge> -1 </charge>
<standardState model="constant_incompressible">
<molarVolume> 1.3 </molarVolume>
</standardState>
<thermo>
<Mu0 Pref="100000.0" Tmax="333." Tmin="298.">
<H298 units="cal/mol"> 0.0 </H298>
<numPoints> 2 </numPoints>
<floatArray size="2" title="Mu0Values" units="Dimensionless">
-91.523 , -91.523
</floatArray>
<floatArray size="2" title="Mu0Temperatures">
298.15, 333.15
</floatArray>
</Mu0>
</thermo>
</species>
</speciesData>
</ctml>

View file

@ -0,0 +1,164 @@
/* ======================================================================= */
/* $RCSfile$ */
/* $Author$ */
/* $Date$ */
/* $Revision$ */
/* ======================================================================= */
#include <stdio.h>
#ifdef SRCDIRTREE
#include "ct_defs.h"
#include "HMWSoln.h"
#else
#include "cantera/Cantera.h"
#include "HMWSoln.h"
#endif
using namespace Cantera;
int CHECK_DEBUG_HKM = 0;
void printUsage() {
cout << "usage: HMW_test_1 " << endl;
cout <<" -> Everything is hardwired" << endl;
}
void pAtable(HMWSoln *HMW) {
int nsp = HMW->nSpecies();
double acMol[100];
double mf[100];
double activities[100];
double moll[100];
HMW->m_debugCalc = 1;
HMW->getMolalityActivityCoefficients(acMol);
HMW->getMoleFractions(mf);
HMW->getActivities(activities);
HMW->m_debugCalc = 0;
HMW->getMolalities(moll);
string sName;
printf(" Name Activity ActCoeffMolal "
" MoleFract Molality\n");
for (int k = 0; k < nsp; k++) {
sName = HMW->speciesName(k);
printf("%16s %13g %13g %13g %13g\n",
sName.c_str(), activities[k], acMol[k], mf[k], moll[k]);
}
}
int main(int argc, char **argv)
{
int retn = 0;
try {
#ifdef DEBUG_HKM
CHECK_DEBUG_HKM = 1;
#endif
if (CHECK_DEBUG_HKM != 1) {
printf("Check can only be done if DEBUG_HKM is defined\n");
exit(-1);
}
HMWSoln *HMW = new HMWSoln(1);
int nsp = HMW->nSpecies();
/*
*
*/
double a1 = HMW->AionicRadius(1);
printf("a1 = %g\n", a1);
double a2 = HMW->AionicRadius(2);
printf("a2 = %g\n", a2);
double mu0[100];
double moll[100];
string sName;
HMW->getMolalities(moll);
moll[1] = 6.0997;
moll[2] = 2.1628E-9;
moll[3] = 6.0997;
moll[4] =1.3977E-6;
/*
* Equalize charge balance and dump into Cl-
*/
double sum = -moll[1] + moll[2] + moll[3] - moll[4];
moll[1] += sum;
HMW->setMolalities(moll);
HMW->setState_TP(298.15, 1.01325E5);
pAtable(HMW);
HMW->setState_TP(298.15, 1.01325E5);
HMW->getStandardChemPotentials(mu0);
// translate from J/kmol to kJ/gmol
int k;
for (k = 0; k < nsp; k++) {
mu0[k] *= 1.0E-6;
}
printf(" Species Standard chemical potentials (kJ/gmol) \n");
printf("------------------------------------------------------------\n");
for (k = 0; k < nsp; k++) {
sName = HMW->speciesName(k);
printf("%16s %16.9g\n", sName.c_str(), mu0[k]);
}
printf("------------------------------------------------------------\n");
printf(" Some DeltaSS values: Delta(mu_0)\n");
double deltaG;
int i1, i2, j1;
double RT = 8.314472E-3 * 298.15;
i1 = HMW->speciesIndex("Na+");
i2 = HMW->speciesIndex("Cl-");
deltaG = -432.6304 - mu0[i1] - mu0[i2];
printf(" NaCl(S): Na+ + Cl- -> NaCl(S): %14.7g kJ/gmol \n",
deltaG);
printf(" : %14.7g (dimensionless) \n",
deltaG/RT);
printf(" : %14.7g (dimensionless/ln10) \n",
deltaG/(RT * log(10.0)));
printf(" G0(NaCl(S)) = %14.7g (fixed)\n", -432.6304);
printf(" G0(Na+) = %14.7g\n", mu0[i1]);
printf(" G0(Cl-) = %14.7g\n", mu0[i2]);
i1 = HMW->speciesIndex("H+");
i2 = HMW->speciesIndex("H2O(L)");
j1 = HMW->speciesIndex("OH-");
if (i1 < 0 || i2 < 0 || j1 < 0) {
printf("problems\n");
exit(-1);
}
deltaG = mu0[j1] + mu0[i1] - mu0[i2];
printf(" OH-: H2O(L) - H+ -> OH-: %14.7g kJ/gmol \n",
deltaG);
printf(" : %14.7g (dimensionless) \n",
deltaG/RT);
printf(" : %14.7g (dimensionless/ln10) \n",
deltaG/(RT * log(10.0)));
printf(" G0(OH-) = %14.7g\n", mu0[j1]);
printf(" G0(H+) = %14.7g\n", mu0[i1]);
printf(" G0(H2O(L)) = %14.7g\n", mu0[i2]);
printf("------------------------------------------------------------\n");
delete HMW;
HMW = 0;
Cantera::appdelete();
return retn;
} catch (CanteraError) {
showErrors();
return -1;
}
}

View file

@ -0,0 +1,112 @@
#!/bin/sh
############################################################################
#
# Makefile to compile and link a C++ application to
# Cantera.
#
#############################################################################
# addition to suffixes
.SUFFIXES : .d
# the name of the executable program to be created
PROG_NAME = HMW_test_1
# the object files to be linked together. List those generated from Fortran
# and from C/C++ separately
OBJS = HMW_test_1
# Location of the current build. Will assume that tests are run
# in the source directory tree location
src_dir_tree = 1
# additional flags to be passed to the linker. If your program
# requires other external libraries, put them here
LINK_OPTIONS = @EXTRA_LINK@
#############################################################################
# Check to see whether we are in the msvc++ environment
os_is_win = @OS_IS_WIN@
# Fortran libraries
FORT_LIBS = @FLIBS@
# the C++ compiler
CXX = @CXX@
# C++ compile flags
ifeq ($(src_dir_tree), 1)
CXX_FLAGS = -DSRCDIRTREE @CXXFLAGS@
else
CXX_FLAGS = @CXXFLAGS@
endif
# Ending C++ linking libraries
LCXX_END_LIBS = @LCXX_END_LIBS@
# the directory where the Cantera libraries are located
CANTERA_LIBDIR=@buildlib@
# required Cantera libraries
CANTERA_LIBS = @LOCAL_LIBS@ -lctcxx
# the directory where Cantera include files may be found.
ifeq ($(src_dir_tree), 1)
CANTERA_INCDIR=../../../Cantera/src
INCLUDES=-I$(CANTERA_INCDIR) -I$(CANTERA_INCDIR)/thermo
else
CANTERA_INCDIR=@ctroot@/build/include/cantera
INCLUDES=-I$(CANTERA_INCDIR) -I$(CANTERA_INCDIR)/kernel
endif
# flags passed to the C++ compiler/linker for the linking step
LCXX_FLAGS = -L$(CANTERA_LIBDIR) @LOCAL_LIB_DIRS@ @CXXFLAGS@
# How to compile C++ source files to object files
.@CXX_EXT@.@OBJ_EXT@:
$(CXX) -c $< $(INCLUDES) $(CXX_FLAGS)
# How to compile the dependency file
.cpp.d:
g++ -MM $(INCLUDES) $(CXX_FLAGS) $*.cpp > $*.d
# List of dependency files to be created
DEPENDS=$(OBJS:.o=.d)
# Program Name
PROGRAM = $(PROG_NAME)$(EXE_EXT)
all: $(PROGRAM) .depends
$(PROGRAM): $(OBJS) $(CANTERA_LIBDIR)/libcantera.a \
$(CANTERA_LIBDIR)/libcaThermo.a
$(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(LINK_OPTIONS) \
$(CANTERA_LIBS) @LIBS@ $(FORT_LIBS) \
$(LCXX_END_LIBS)
# depends target -> forces recalculation of dependencies
depends:
@MAKE@ .depends
.depends: $(DEPENDS)
cat $(DEPENDS) > .depends
# Do the test -> For the windows vc++ environment, we have to skip checking on
# whether the program is uptodate, because we don't utilize make
# in that environment to build programs.
test:
ifeq ($(os_is_win), 1)
else
@MAKE@ $(PROGRAM)
endif
./runtest
clean:
$(RM) $(OBJS) $(PROGRAM) $(DEPENDS) .depends
../../../bin/rm_cvsignore
(if test -d SunWS_cache ; then \
$(RM) -rf SunWS_cache ; \
fi )

View file

@ -0,0 +1,2 @@
This test exercises the basic Pitzer model.

View file

@ -0,0 +1,246 @@
Index Name MoleF Molality Charge
0 H2O(L) 8.1992706e-01 5.5508435e+01 0.0
1 Cl- 9.0036447e-02 6.0953986e+00 -1.0
2 H+ 3.1947185e-11 2.1628000e-09 1.0
3 Na+ 9.0036468e-02 6.0954000e+00 1.0
4 OH- 2.0645728e-08 1.3977000e-06 -1.0
Species Species beta0MX beta1MX beta2MX CphiMX alphaMX thetaij
Cl- H+ 0.17750 0.29450 0.00000 0.00080 2.00000 0.00000
Cl- Na+ 0.07650 0.26640 0.00000 0.00127 2.00000 0.00000
Cl- OH- 0.00000 0.00000 0.00000 0.00000 0.00000 -0.05000
H+ Na+ 0.00000 0.00000 0.00000 0.00000 0.00000 0.03600
H+ OH- 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
Na+ OH- 0.08640 0.25300 0.00000 0.00440 2.00000 0.00000
Species Species Species psi
Cl- H+ Na+ -0.00400
Cl- Na+ H+ -0.00400
Cl- Na+ OH- -0.00600
Cl- OH- Na+ -0.00600
H+ Cl- Na+ -0.00400
H+ Na+ Cl- -0.00400
Na+ Cl- H+ -0.00400
Na+ Cl- OH- -0.00600
Na+ H+ Cl- -0.00400
Na+ OH- Cl- -0.00600
OH- Cl- Na+ -0.00600
OH- Na+ Cl- -0.00600
a1 = 3.04284e-10
a2 = 3.04284e-10
Debugging information from hmw_act
Step 1:
ionic strenth = 6.0997000e+00
total molar charge = 1.2199400e+01
Is = 6.0997
ij = 1, elambda = 0.0454012, elambda1 = -0.00306854
ij = 2, elambda = 0.200776, elambda1 = -0.014532
ij = 3, elambda = 0.47109, elambda1 = -0.0351127
ij = 4, elambda = 0.857674, elambda1 = -0.0650149
ij = 4, elambda = 0.857674, elambda1 = -0.0650149
ij = 6, elambda = 1.98206, elambda1 = -0.153152
ij = 8, elambda = 3.57685, elambda1 = -0.279391
ij = 9, elambda = 4.55112, elambda1 = -0.356872
ij = 12, elambda = 8.18289, elambda1 = -0.646977
ij = 16, elambda = 14.6822, elambda1 = -1.16875
Step 2:
z1= 1 z2= 1 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 1 z2= 2 E-theta(I) = -0.059044, E-thetaprime(I) = 0.004790
z1= 1 z2= 3 E-theta(I) = -0.355533, E-thetaprime(I) = 0.028969
z1= 1 z2= 4 E-theta(I) = -1.068400, E-thetaprime(I) = 0.087216
z1= 2 z2= 1 E-theta(I) = -0.059044, E-thetaprime(I) = 0.004790
z1= 2 z2= 2 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 2 z2= 3 E-theta(I) = -0.178237, E-thetaprime(I) = 0.014566
z1= 2 z2= 4 E-theta(I) = -0.951372, E-thetaprime(I) = 0.077813
z1= 3 z2= 1 E-theta(I) = -0.355533, E-thetaprime(I) = 0.028969
z1= 3 z2= 2 E-theta(I) = -0.178237, E-thetaprime(I) = 0.014566
z1= 3 z2= 3 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 3 z2= 4 E-theta(I) = -0.357010, E-thetaprime(I) = 0.029220
z1= 4 z2= 1 E-theta(I) = -1.068400, E-thetaprime(I) = 0.087216
z1= 4 z2= 2 E-theta(I) = -0.951372, E-thetaprime(I) = 0.077813
z1= 4 z2= 3 E-theta(I) = -0.357010, E-thetaprime(I) = 0.029220
z1= 4 z2= 4 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
Step 3:
Species Species g(x) hfunc(x)
Cl- H+ 0.07849 -0.07133
Cl- Na+ 0.07849 -0.07133
Cl- OH- 0.00000 0.00000
H+ Na+ 0.00000 0.00000
H+ OH- 0.00000 0.00000
Na+ OH- 0.07849 -0.07133
Step 4:
Species Species BMX BprimeMX BphiMX
1 0.200614: 0.1775 0.2945 0.0784862
Cl- H+ 0.2006142 -0.0034438 0.1796081
2 0.0974087: 0.0765 0.2664 0.0784862
Cl- Na+ 0.0974087 -0.0031152 0.0784069
Cl- OH- 0.0000000 0.0000000 0.0000000
H+ Na+ 0.0000000 0.0000000 0.0000000
5 0: 0 0 0
H+ OH- 0.0000000 0.0000000 0.0000000
6 0.106257: 0.0864 0.253 0.0784862
Na+ OH- 0.1062570 -0.0029585 0.0882110
Step 5:
Species Species CMX
Cl- H+ 0.0004000
Cl- Na+ 0.0006350
Cl- OH- 0.0000000
H+ Na+ 0.0000000
H+ OH- 0.0000000
Na+ OH- 0.0022000
Step 6:
Species Species Phi_ij Phiprime_ij Phi^phi_ij
Cl- H+ 0.000000 0.000000 0.000000
Cl- Na+ 0.000000 0.000000 0.000000
Cl- OH- -0.050000 0.000000 -0.050000
H+ Na+ 0.036000 0.000000 0.036000
H+ OH- 0.000000 0.000000 0.000000
Na+ OH- 0.000000 0.000000 0.000000
Step 7:
initial value of F = -1.143942
F = -1.143942
F = -1.259847
F = -1.259847
F = -1.259847
F = -1.259847
F = -1.259847
Step 8:
Cl- lngamma[i]= -0.000641 gamma[i]= 0.999359
-1.25985 1.23558 -1.90923e-07 -5.27697e-11 0.023626 0
H+ lngamma[i]= 1.531269 gamma[i]= 4.624042
-1.25985 2.47714 0.290353 0 0.023626 0
Na+ lngamma[i]= -0.000641 gamma[i]= 0.999359
-1.25985 1.23558 1.02952e-10 -5.11533e-08 0.023626 0
OH- lngamma[i]= -0.609449 gamma[i]= 0.543650
-1.25985 1.45998 -0.833208 0 0.023626 0
Step 9:
term1= -1.489777 sum1= 3.205458 sum2= 0.000000 sum3= -0.000001 sum4= 0.000000 sum5= 0.000000
sum_m_phi_minus_1= 3.431360 osmotic_coef= 1.281273
Step 10:
Weight of Solvent = 18.01528
molalitySum = 12.1994
ln_a_water= -0.281593 a_water= 0.754581
Debugging information from hmw_act
Step 1:
ionic strenth = 6.0997000e+00
total molar charge = 1.2199400e+01
Is = 6.0997
ij = 1, elambda = 0.0454012, elambda1 = -0.00306854
ij = 2, elambda = 0.200776, elambda1 = -0.014532
ij = 3, elambda = 0.47109, elambda1 = -0.0351127
ij = 4, elambda = 0.857674, elambda1 = -0.0650149
ij = 4, elambda = 0.857674, elambda1 = -0.0650149
ij = 6, elambda = 1.98206, elambda1 = -0.153152
ij = 8, elambda = 3.57685, elambda1 = -0.279391
ij = 9, elambda = 4.55112, elambda1 = -0.356872
ij = 12, elambda = 8.18289, elambda1 = -0.646977
ij = 16, elambda = 14.6822, elambda1 = -1.16875
Step 2:
z1= 1 z2= 1 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 1 z2= 2 E-theta(I) = -0.059044, E-thetaprime(I) = 0.004790
z1= 1 z2= 3 E-theta(I) = -0.355533, E-thetaprime(I) = 0.028969
z1= 1 z2= 4 E-theta(I) = -1.068400, E-thetaprime(I) = 0.087216
z1= 2 z2= 1 E-theta(I) = -0.059044, E-thetaprime(I) = 0.004790
z1= 2 z2= 2 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 2 z2= 3 E-theta(I) = -0.178237, E-thetaprime(I) = 0.014566
z1= 2 z2= 4 E-theta(I) = -0.951372, E-thetaprime(I) = 0.077813
z1= 3 z2= 1 E-theta(I) = -0.355533, E-thetaprime(I) = 0.028969
z1= 3 z2= 2 E-theta(I) = -0.178237, E-thetaprime(I) = 0.014566
z1= 3 z2= 3 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 3 z2= 4 E-theta(I) = -0.357010, E-thetaprime(I) = 0.029220
z1= 4 z2= 1 E-theta(I) = -1.068400, E-thetaprime(I) = 0.087216
z1= 4 z2= 2 E-theta(I) = -0.951372, E-thetaprime(I) = 0.077813
z1= 4 z2= 3 E-theta(I) = -0.357010, E-thetaprime(I) = 0.029220
z1= 4 z2= 4 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
Step 3:
Species Species g(x) hfunc(x)
Cl- H+ 0.07849 -0.07133
Cl- Na+ 0.07849 -0.07133
Cl- OH- 0.00000 0.00000
H+ Na+ 0.00000 0.00000
H+ OH- 0.00000 0.00000
Na+ OH- 0.07849 -0.07133
Step 4:
Species Species BMX BprimeMX BphiMX
1 0.200614: 0.1775 0.2945 0.0784862
Cl- H+ 0.2006142 -0.0034438 0.1796081
2 0.0974087: 0.0765 0.2664 0.0784862
Cl- Na+ 0.0974087 -0.0031152 0.0784069
Cl- OH- 0.0000000 0.0000000 0.0000000
H+ Na+ 0.0000000 0.0000000 0.0000000
5 0: 0 0 0
H+ OH- 0.0000000 0.0000000 0.0000000
6 0.106257: 0.0864 0.253 0.0784862
Na+ OH- 0.1062570 -0.0029585 0.0882110
Step 5:
Species Species CMX
Cl- H+ 0.0004000
Cl- Na+ 0.0006350
Cl- OH- 0.0000000
H+ Na+ 0.0000000
H+ OH- 0.0000000
Na+ OH- 0.0022000
Step 6:
Species Species Phi_ij Phiprime_ij Phi^phi_ij
Cl- H+ 0.000000 0.000000 0.000000
Cl- Na+ 0.000000 0.000000 0.000000
Cl- OH- -0.050000 0.000000 -0.050000
H+ Na+ 0.036000 0.000000 0.036000
H+ OH- 0.000000 0.000000 0.000000
Na+ OH- 0.000000 0.000000 0.000000
Step 7:
initial value of F = -1.143942
F = -1.143942
F = -1.259847
F = -1.259847
F = -1.259847
F = -1.259847
F = -1.259847
Step 8:
Cl- lngamma[i]= -0.000641 gamma[i]= 0.999359
-1.25985 1.23558 -1.90923e-07 -5.27697e-11 0.023626 0
H+ lngamma[i]= 1.531269 gamma[i]= 4.624042
-1.25985 2.47714 0.290353 0 0.023626 0
Na+ lngamma[i]= -0.000641 gamma[i]= 0.999359
-1.25985 1.23558 1.02952e-10 -5.11533e-08 0.023626 0
OH- lngamma[i]= -0.609449 gamma[i]= 0.543650
-1.25985 1.45998 -0.833208 0 0.023626 0
Step 9:
term1= -1.489777 sum1= 3.205458 sum2= 0.000000 sum3= -0.000001 sum4= 0.000000 sum5= 0.000000
sum_m_phi_minus_1= 3.431360 osmotic_coef= 1.281273
Step 10:
Weight of Solvent = 18.01528
molalitySum = 12.1994
ln_a_water= -0.281593 a_water= 0.754581
Name Activity ActCoeffMolal MoleFract Molality
H2O(L) 0.754581 0.92042 0.819823 55.5084
Cl- 6.09579 0.999359 0.0900885 6.0997
H+ 1.00009e-08 4.62404 3.19431e-11 2.1628e-09
Na+ 6.09579 0.999359 0.0900885 6.0997
OH- 7.5986e-07 0.54365 2.06431e-08 1.3977e-06
Species Standard chemical potentials (kJ/gmol)
------------------------------------------------------------
H2O(L) -306.685777
Cl- -131.064852
H+ 0.0017225
Na+ -311.160543
OH- -226.880122
------------------------------------------------------------
Some DeltaSS values: Delta(mu_0)
NaCl(S): Na+ + Cl- -> NaCl(S): 9.594995 kJ/gmol
: 3.870573 (dimensionless)
: 1.680969 (dimensionless/ln10)
G0(NaCl(S)) = -432.6304 (fixed)
G0(Na+) = -311.1605
G0(Cl-) = -131.0649
OH-: H2O(L) - H+ -> OH-: 79.80738 kJ/gmol
: 32.1939 (dimensionless)
: 13.98163 (dimensionless/ln10)
G0(OH-) = -226.8801
G0(H+) = 0.0017225
G0(H2O(L)) = -306.6858
------------------------------------------------------------

View file

@ -0,0 +1,42 @@
#!/bin/sh
#
#
temp_success="1"
/bin/rm -f output.txt outputa.txt
##########################################################################
prog=HMW_test_1
if test ! -x $prog ; then
echo $prog ' does not exist'
exit -1
fi
##########################################################################
/bin/rm -f test.out test.diff output.txt
#################################################################
#
CANTERA_DATA=${CANTERA_DATA:=../../../data/inputs}; export CANTERA_DATA
CANTERA_BIN=${CANTERA_BIN:=../../../bin}
#################################################################
$prog > output.txt
retnStat=$?
if [ $retnStat != "0" ]
then
temp_success="0"
echo "$prog returned with bad status, $retnStat, check output"
fi
$CANTERA_BIN/exp3to2.sh output.txt > outputa.txt
diff -w outputa.txt output_blessed.txt > diff_test.out
retnStat=$?
if [ $retnStat = "0" ]
then
echo "successful diff comparison on $prog test"
else
echo "unsuccessful diff comparison on $prog test"
echo "FAILED" > csvCode.txt
temp_success="0"
fi

View file

@ -0,0 +1,8 @@
.depends
HMW_test_3
HMW_test_3.d
Makefile
diff_test.out
output.txt
outputa.txt
table.csv

View file

@ -0,0 +1,190 @@
<?xml version="1.0"?>
<ctml>
<phase id="NaCl_electrolyte" dim="3">
<speciesArray datasrc="#species_waterSolution">
H2O(L) Cl- H+ Na+ OH-
</speciesArray>
<state>
<temperature units="K"> 298.15 </temperature>
<pressure units="Pa"> 101325.0 </pressure>
<soluteMolalities>
Na+:6.0954
Cl-:6.0954
H+:2.1628E-9
OH-:1.3977E-6
</soluteMolalities>
</state>
<!-- thermo model identifies the inherited class
from ThermoPhase that will handle the thermodynamics.
-->
<thermo model="HMW">
<standardConc model="solvent_volume" />
<activityCoefficients model="Pitzer" TempModel="complex1">
<!-- A_Debye units = sqrt(kg/gmol)
This is adjusted to match the GWB value so
that numerical comparisons can be made
Aln = 0.5107
-->
<A_Debye> 1.175930 </A_Debye>
<!-- B_Debye units = sqrt(kg/gmol)/m
-->
<B_Debye> 3.28640E9 </B_Debye>
<ionicRadius default="3.042843" units="Angstroms">
</ionicRadius>
<binarySaltParameters cation="Na+" anion="Cl-">
<beta0> 0.0765, 0.008946, -3.3158E-6,
-777.03, -4.4706
</beta0>
<beta1> 0.2664, 6.1608E-5, 1.0715E-6 </beta1>
<beta2> 0.0 </beta2>
<Cphi> 0.00127, -4.655E-5, 0.0,
33.317, 0.09421
</Cphi>
<Alpha1> 2.0 </Alpha1>
</binarySaltParameters>
<binarySaltParameters cation="H+" anion="Cl-">
<beta0> 0.1775, 0.0, 0.0,
0.0, 0.0
</beta0>
<beta1> 0.2945, 0.0, 0.0 </beta1>
<beta2> 0.0 </beta2>
<Cphi> 0.0008, 0.0, 0.0,
0.0, 0.0
</Cphi>
<Alpha1> 2.0 </Alpha1>
</binarySaltParameters>
<binarySaltParameters cation="Na+" anion="OH-">
<beta0> 0.0864, 0.0, 0.0, 0.0, 0.0 </beta0>
<beta1> 0.253, 0.0, 0.0 </beta1>
<beta2> 0.0 </beta2>
<Cphi> 0.0044, 0.0, 0.0, 0.0, 0.0 </Cphi>
<Alpha1> 2.0 </Alpha1>
</binarySaltParameters>
<thetaAnion anion1="Cl-" anion2="OH-">
<Theta> -0.05 </Theta>
</thetaAnion>
<psiCommonCation cation="Na+" anion1="Cl-" anion2="OH-">
<Theta> -0.05 </Theta>
<Psi> -0.006 </Psi>
</psiCommonCation>
<thetaCation cation1="Na+" cation2="H+">
<Theta> 0.036 </Theta>
</thetaCation>
<psiCommonAnion anion="Cl-" cation1="Na+" cation2="H+">
<Theta> 0.036 </Theta>
<Psi> -0.004 </Psi>
</psiCommonAnion>
</activityCoefficients>
<solvent> H2O(L) </solvent>
</thermo>
<elementArray datasrc="elements.xml"> O H C Fe Si N Na Cl </elementArray>
</phase>
<speciesData id="species_waterSolution">
<!-- species H2O(L) -->
<species name="H2O(L)">
<atomArray>H:2 O:1 </atomArray>
<thermo>
<NASA Tmax="600.0" Tmin="273.14999999999998" P0="100000.0">
<floatArray name="coeffs" size="7">
7.255750050E+01, -6.624454020E-01, 2.561987460E-03, -4.365919230E-06,
2.781789810E-09, -4.188654990E+04, -2.882801370E+02
</floatArray>
</NASA>
</thermo>
<standardState model="constant_incompressible">
<molarVolume> 0.05555555 </molarVolume>
</standardState>
</species>
<species name="Na+">
<atomArray> Na:1 </atomArray>
<charge> +1 </charge>
<thermo>
<Mu0 Pref="100000.0" Tmax="1000.0" Tmin="200.0">
<H298 units="cal/mol"> 0.0 </H298>
<numPoints> 2 </numPoints>
<floatArray size="2" title="Mu0Values" units="Dimensionless">
-125.5213, -125.5213
</floatArray>
<floatArray size="2" title="Mu0Temperatures">
298.15, 333.15
</floatArray>
</Mu0>
</thermo>
<standardState model="constant_incompressible">
<molarVolume> 1.3 </molarVolume>
</standardState>
</species>
<species name="Cl-">
<atomArray> Cl:1 </atomArray>
<charge> -1 </charge>
<standardState model="constant_incompressible">
<molarVolume> 1.3 </molarVolume>
</standardState>
<thermo>
<Mu0 Pref="100000.0" Tmax="333." Tmin="298.">
<H298 units="cal/mol"> 0.0 </H298>
<numPoints> 2 </numPoints>
<floatArray size="2" title="Mu0Values" units="Dimensionless">
-52.8716 , -52.8716
</floatArray>
<floatArray size="2" title="Mu0Temperatures">
298.15, 333.15
</floatArray>
</Mu0>
</thermo>
</species>
<species name="H+">
<atomArray> H:1 </atomArray>
<charge> +1 </charge>
<standardState model="constant_incompressible">
<molarVolume> 1.3 </molarVolume>
</standardState>
<thermo>
<Mu0 Pref="100000.0" Tmax="333." Tmin="298.">
<H298 units="cal/mol"> 0.0 </H298>
<numPoints> 2 </numPoints>
<floatArray size="2" title="Mu0Values" units="Dimensionless">
0.0 , 0.0
</floatArray>
<floatArray size="2" title="Mu0Temperatures">
298.15, 333.15
</floatArray>
</Mu0>
</thermo>
</species>
<species name="OH-">
<atomArray> O:1 H:1 </atomArray>
<charge> -1 </charge>
<standardState model="constant_incompressible">
<molarVolume> 1.3 </molarVolume>
</standardState>
<thermo>
<Mu0 Pref="100000.0" Tmax="333." Tmin="298.">
<H298 units="cal/mol"> 0.0 </H298>
<numPoints> 2 </numPoints>
<floatArray size="2" title="Mu0Values" units="Dimensionless">
-91.523 , -91.523
</floatArray>
<floatArray size="2" title="Mu0Temperatures">
298.15, 333.15
</floatArray>
</Mu0>
</thermo>
</species>
</speciesData>
</ctml>

View file

@ -0,0 +1,151 @@
/* ======================================================================= */
/* $RCSfile$ */
/* $Author$ */
/* $Date$ */
/* $Revision$ */
/* ======================================================================= */
#include <stdio.h>
#ifdef SRCDIRTREE
#include "ct_defs.h"
#include "HMWSoln.h"
#else
#include "cantera/Cantera.h"
#include "HMWSoln.h"
#endif
using namespace Cantera;
void printUsage() {
cout << "usage: HMW_test_1 " << endl;
cout <<" -> Everything is hardwired" << endl;
}
void pAtable(HMWSoln *HMW) {
int nsp = HMW->nSpecies();
double acMol[100];
double mf[100];
double activities[100];
double moll[100];
HMW->getMolalityActivityCoefficients(acMol);
HMW->getMoleFractions(mf);
HMW->getActivities(activities);
HMW->getMolalities(moll);
string sName;
printf(" Name Activity ActCoeffMolal "
" MoleFract Molality\n");
for (int k = 0; k < nsp; k++) {
sName = HMW->speciesName(k);
printf("%16s %13g %13g %13g %13g\n",
sName.c_str(), activities[k], acMol[k], mf[k], moll[k]);
}
}
int main(int argc, char **argv)
{
int retn = 0;
try {
HMWSoln *HMW = new HMWSoln("HMW_NaCl_tc.xml");
int nsp = HMW->nSpecies();
/*
*
*/
double a1 = HMW->AionicRadius(1);
printf("a1 = %g\n", a1);
double a2 = HMW->AionicRadius(2);
printf("a2 = %g\n", a2);
double mu0[100];
double moll[100];
string sName;
HMW->getMolalities(moll);
moll[1] = 6.0997;
moll[2] = 2.1628E-9;
moll[3] = 6.0997;
moll[4] =1.3977E-6;
double Temp = 150 + 273.15;
/*
* Equalize charge balance and dump into Cl-
*/
double sum = -moll[1] + moll[2] + moll[3] - moll[4];
moll[1] += sum;
HMW->setState_TPM(Temp, OneAtm, moll);
#ifdef DEBUG_HKM
HMW->m_debugCalc = true;
#endif
printf(" Temperature = %g K\n", Temp);
HMW->printCoeffs();
pAtable(HMW);
HMW->setState_TP(Temp, 1.01325E5);
HMW->getStandardChemPotentials(mu0);
// translate from J/kmol to kJ/gmol
int k;
for (k = 0; k < nsp; k++) {
mu0[k] *= 1.0E-6;
}
printf(" Species Standard chemical potentials (kJ/gmol) \n");
printf("------------------------------------------------------------\n");
for (k = 0; k < nsp; k++) {
sName = HMW->speciesName(k);
printf("%16s %16.9g\n", sName.c_str(), mu0[k]);
}
printf("------------------------------------------------------------\n");
printf(" Some DeltaSS values: Delta(mu_0)\n");
double deltaG;
int i1, i2, j1;
double RT = 8.314472E-3 * 298.15;
i1 = HMW->speciesIndex("Na+");
i2 = HMW->speciesIndex("Cl-");
deltaG = -432.6304 - mu0[i1] - mu0[i2];
printf(" NaCl(S): Na+ + Cl- -> NaCl(S): %14.7g kJ/gmol \n",
deltaG);
printf(" : %14.7g (dimensionless) \n",
deltaG/RT);
printf(" : %14.7g (dimensionless/ln10) \n",
deltaG/(RT * log(10.0)));
i1 = HMW->speciesIndex("H+");
i2 = HMW->speciesIndex("H2O(L)");
j1 = HMW->speciesIndex("OH-");
if (i1 < 0 || i2 < 0 || j1 < 0) {
printf("problems\n");
exit(-1);
}
deltaG = mu0[j1] + mu0[i1] - mu0[i2];
printf(" OH-: H2O(L) - H+ -> OH-: %14.7g kJ/gmol \n",
deltaG);
printf(" : %14.7g (dimensionless) \n",
deltaG/RT);
printf(" : %14.7g (dimensionless/ln10) \n",
deltaG/(RT * log(10.0)));
printf("------------------------------------------------------------\n");
delete HMW;
HMW = 0;
Cantera::appdelete();
return retn;
} catch (CanteraError) {
showErrors();
return -1;
}
}

View file

@ -0,0 +1,112 @@
#!/bin/sh
############################################################################
#
# Makefile to compile and link a C++ application to
# Cantera.
#
#############################################################################
# addition to suffixes
.SUFFIXES : .d
# the name of the executable program to be created
PROG_NAME = HMW_test_3
# the object files to be linked together. List those generated from Fortran
# and from C/C++ separately
OBJS = HMW_test_3
# Location of the current build. Will assume that tests are run
# in the source directory tree location
src_dir_tree = 1
# additional flags to be passed to the linker. If your program
# requires other external libraries, put them here
LINK_OPTIONS = @EXTRA_LINK@
#############################################################################
# Check to see whether we are in the msvc++ environment
os_is_win = @OS_IS_WIN@
# Fortran libraries
FORT_LIBS = @FLIBS@
# the C++ compiler
CXX = @CXX@
# C++ compile flags
ifeq ($(src_dir_tree), 1)
CXX_FLAGS = -DSRCDIRTREE @CXXFLAGS@
else
CXX_FLAGS = @CXXFLAGS@
endif
# Ending C++ linking libraries
LCXX_END_LIBS = @LCXX_END_LIBS@
# the directory where the Cantera libraries are located
CANTERA_LIBDIR=@buildlib@
# required Cantera libraries
CANTERA_LIBS = @LOCAL_LIBS@ -lctcxx
# the directory where Cantera include files may be found.
ifeq ($(src_dir_tree), 1)
CANTERA_INCDIR=../../../Cantera/src
INCLUDES=-I$(CANTERA_INCDIR) -I$(CANTERA_INCDIR)/thermo
else
CANTERA_INCDIR=@ctroot@/build/include/cantera
INCLUDES=-I$(CANTERA_INCDIR) -I$(CANTERA_INCDIR)/kernel
endif
# flags passed to the C++ compiler/linker for the linking step
LCXX_FLAGS = -L$(CANTERA_LIBDIR) @LOCAL_LIB_DIRS@ @CXXFLAGS@
# How to compile C++ source files to object files
.@CXX_EXT@.@OBJ_EXT@:
$(CXX) -c $< $(INCLUDES) $(CXX_FLAGS)
# How to compile the dependency file
.cpp.d:
g++ -MM $(INCLUDES) $(CXX_FLAGS) $*.cpp > $*.d
# List of dependency files to be created
DEPENDS=$(OBJS:.o=.d)
# Program Name
PROGRAM = $(PROG_NAME)$(EXE_EXT)
all: $(PROGRAM) .depends
$(PROGRAM): $(OBJS) $(CANTERA_LIBDIR)/libcantera.a \
$(CANTERA_LIBDIR)/libcaThermo.a
$(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(LINK_OPTIONS) \
$(CANTERA_LIBS) @LIBS@ $(FORT_LIBS) \
$(LCXX_END_LIBS)
# depends target -> forces recalculation of dependencies
depends:
@MAKE@ .depends
.depends: $(DEPENDS)
cat $(DEPENDS) > .depends
# Do the test -> For the windows vc++ environment, we have to skip checking on
# whether the program is uptodate, because we don't utilize make
# in that environment to build programs.
test:
ifeq ($(os_is_win), 1)
else
@MAKE@ $(PROGRAM)
endif
./runtest
clean:
$(RM) $(OBJS) $(PROGRAM) $(DEPENDS) .depends
../../../bin/rm_cvsignore
(if test -d SunWS_cache ; then \
$(RM) -rf SunWS_cache ; \
fi )

View file

@ -0,0 +1,2 @@
This test exercises the basic Pitzer model.

View file

@ -0,0 +1,335 @@
a1 = 3.04284e-10
a2 = 3.04284e-10
Temperature = 423.15 K
Index Name MoleF Molality Charge
0 H2O(L) 8.1982292e-01 5.5508435e+01 0.0
1 Cl- 9.0088519e-02 6.0996986e+00 -1.0
2 H+ 3.1943127e-11 2.1628000e-09 1.0
3 Na+ 9.0088540e-02 6.0997000e+00 1.0
4 OH- 2.0643106e-08 1.3977000e-06 -1.0
Species Species beta0MX beta1MX beta2MX CphiMX alphaMX thetaij
Cl- H+ 0.17750 0.29450 0.00000 0.00080 2.00000 0.00000
Cl- Na+ 0.10037 0.37071 0.00000 -0.00457 2.00000 0.00000
Cl- OH- 0.00000 0.00000 0.00000 0.00000 0.00000 -0.05000
H+ Na+ 0.00000 0.00000 0.00000 0.00000 0.00000 0.03600
H+ OH- 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
Na+ OH- 0.08640 0.25300 0.00000 0.00440 2.00000 0.00000
Species Species Species psi
Cl- H+ Na+ -0.00400
Cl- Na+ H+ -0.00400
Cl- Na+ OH- -0.00600
Cl- OH- Na+ -0.00600
H+ Cl- Na+ -0.00400
H+ Na+ Cl- -0.00400
Na+ Cl- H+ -0.00400
Na+ Cl- OH- -0.00600
Na+ H+ Cl- -0.00400
Na+ OH- Cl- -0.00600
OH- Cl- Na+ -0.00600
OH- Na+ Cl- -0.00600
Debugging information from hmw_act
Step 1:
ionic strenth = 6.0997000e+00
total molar charge = 1.2199400e+01
Is = 6.0997
ij = 1, elambda = 0.0454012, elambda1 = -0.00306854
ij = 2, elambda = 0.200776, elambda1 = -0.014532
ij = 3, elambda = 0.47109, elambda1 = -0.0351127
ij = 4, elambda = 0.857674, elambda1 = -0.0650149
ij = 4, elambda = 0.857674, elambda1 = -0.0650149
ij = 6, elambda = 1.98206, elambda1 = -0.153152
ij = 8, elambda = 3.57685, elambda1 = -0.279391
ij = 9, elambda = 4.55112, elambda1 = -0.356872
ij = 12, elambda = 8.18289, elambda1 = -0.646977
ij = 16, elambda = 14.6822, elambda1 = -1.16875
Step 2:
z1= 1 z2= 1 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 1 z2= 2 E-theta(I) = -0.059044, E-thetaprime(I) = 0.004790
z1= 1 z2= 3 E-theta(I) = -0.355533, E-thetaprime(I) = 0.028969
z1= 1 z2= 4 E-theta(I) = -1.068400, E-thetaprime(I) = 0.087216
z1= 2 z2= 1 E-theta(I) = -0.059044, E-thetaprime(I) = 0.004790
z1= 2 z2= 2 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 2 z2= 3 E-theta(I) = -0.178237, E-thetaprime(I) = 0.014566
z1= 2 z2= 4 E-theta(I) = -0.951372, E-thetaprime(I) = 0.077813
z1= 3 z2= 1 E-theta(I) = -0.355533, E-thetaprime(I) = 0.028969
z1= 3 z2= 2 E-theta(I) = -0.178237, E-thetaprime(I) = 0.014566
z1= 3 z2= 3 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 3 z2= 4 E-theta(I) = -0.357010, E-thetaprime(I) = 0.029220
z1= 4 z2= 1 E-theta(I) = -1.068400, E-thetaprime(I) = 0.087216
z1= 4 z2= 2 E-theta(I) = -0.951372, E-thetaprime(I) = 0.077813
z1= 4 z2= 3 E-theta(I) = -0.357010, E-thetaprime(I) = 0.029220
z1= 4 z2= 4 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
Step 3:
Species Species g(x) hfunc(x)
Cl- H+ 0.07849 -0.07133
Cl- Na+ 0.07849 -0.07133
Cl- OH- 0.00000 0.00000
H+ Na+ 0.00000 0.00000
H+ OH- 0.00000 0.00000
Na+ OH- 0.07849 -0.07133
Step 4:
Species Species BMX BprimeMX BphiMX
1 0.200614: 0.1775 0.2945 0.0784862
Cl- H+ 0.2006142 -0.0034438 0.1796081
2 0.129466: 0.10037 0.37071 0.0784862
Cl- Na+ 0.1294658 -0.0043350 0.1030237
Cl- OH- 0.0000000 0.0000000 0.0000000
H+ Na+ 0.0000000 0.0000000 0.0000000
5 0: 0 0 0
H+ OH- 0.0000000 0.0000000 0.0000000
6 0.106257: 0.0864 0.253 0.0784862
Na+ OH- 0.1062570 -0.0029585 0.0882110
Step 5:
Species Species CMX
Cl- H+ 0.0004000
Cl- Na+ -0.0022865
Cl- OH- 0.0000000
H+ Na+ 0.0000000
H+ OH- 0.0000000
Na+ OH- 0.0022000
Step 6:
Species Species Phi_ij Phiprime_ij Phi^phi_ij
Cl- H+ 0.000000 0.000000 0.000000
Cl- Na+ 0.000000 0.000000 0.000000
Cl- OH- -0.050000 0.000000 -0.050000
H+ Na+ 0.036000 0.000000 0.036000
H+ OH- 0.000000 0.000000 0.000000
Na+ OH- 0.000000 0.000000 0.000000
Step 7:
initial value of F = -1.143942
F = -1.143942
F = -1.305230
F = -1.305230
F = -1.305230
F = -1.305230
F = -1.305230
Step 8:
Cl- lngamma[i]= 0.018952 gamma[i]= 1.019133
-1.30523 1.40926 -1.90923e-07 -5.27697e-11 -0.085074 0
H+ lngamma[i]= 1.377186 gamma[i]= 3.963731
-1.30523 2.47714 0.290353 0 -0.085074 0
Na+ lngamma[i]= 0.018952 gamma[i]= 1.019133
-1.30523 1.40926 1.02952e-10 -5.11533e-08 -0.085074 0
OH- lngamma[i]= -0.763533 gamma[i]= 0.466017
-1.30523 1.45998 -0.833208 0 -0.085074 0
Step 9:
term1= -1.489777 sum1= 2.795284 sum2= 0.000000 sum3= -0.000001 sum4= 0.000000 sum5= 0.000000
sum_m_phi_minus_1= 2.611013 osmotic_coef= 1.214028
Step 10:
Weight of Solvent = 18.01528
molalitySum = 12.1994
ln_a_water= -0.266814 a_water= 0.765816
Debugging information from hmw_act
Step 1:
ionic strenth = 6.0997000e+00
total molar charge = 1.2199400e+01
Is = 6.0997
ij = 1, elambda = 0.0454012, elambda1 = -0.00306854
ij = 2, elambda = 0.200776, elambda1 = -0.014532
ij = 3, elambda = 0.47109, elambda1 = -0.0351127
ij = 4, elambda = 0.857674, elambda1 = -0.0650149
ij = 4, elambda = 0.857674, elambda1 = -0.0650149
ij = 6, elambda = 1.98206, elambda1 = -0.153152
ij = 8, elambda = 3.57685, elambda1 = -0.279391
ij = 9, elambda = 4.55112, elambda1 = -0.356872
ij = 12, elambda = 8.18289, elambda1 = -0.646977
ij = 16, elambda = 14.6822, elambda1 = -1.16875
Step 2:
z1= 1 z2= 1 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 1 z2= 2 E-theta(I) = -0.059044, E-thetaprime(I) = 0.004790
z1= 1 z2= 3 E-theta(I) = -0.355533, E-thetaprime(I) = 0.028969
z1= 1 z2= 4 E-theta(I) = -1.068400, E-thetaprime(I) = 0.087216
z1= 2 z2= 1 E-theta(I) = -0.059044, E-thetaprime(I) = 0.004790
z1= 2 z2= 2 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 2 z2= 3 E-theta(I) = -0.178237, E-thetaprime(I) = 0.014566
z1= 2 z2= 4 E-theta(I) = -0.951372, E-thetaprime(I) = 0.077813
z1= 3 z2= 1 E-theta(I) = -0.355533, E-thetaprime(I) = 0.028969
z1= 3 z2= 2 E-theta(I) = -0.178237, E-thetaprime(I) = 0.014566
z1= 3 z2= 3 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 3 z2= 4 E-theta(I) = -0.357010, E-thetaprime(I) = 0.029220
z1= 4 z2= 1 E-theta(I) = -1.068400, E-thetaprime(I) = 0.087216
z1= 4 z2= 2 E-theta(I) = -0.951372, E-thetaprime(I) = 0.077813
z1= 4 z2= 3 E-theta(I) = -0.357010, E-thetaprime(I) = 0.029220
z1= 4 z2= 4 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
Step 3:
Species Species g(x) hfunc(x)
Cl- H+ 0.07849 -0.07133
Cl- Na+ 0.07849 -0.07133
Cl- OH- 0.00000 0.00000
H+ Na+ 0.00000 0.00000
H+ OH- 0.00000 0.00000
Na+ OH- 0.07849 -0.07133
Step 4:
Species Species BMX BprimeMX BphiMX
1 0.200614: 0.1775 0.2945 0.0784862
Cl- H+ 0.2006142 -0.0034438 0.1796081
2 0.129466: 0.10037 0.37071 0.0784862
Cl- Na+ 0.1294658 -0.0043350 0.1030237
Cl- OH- 0.0000000 0.0000000 0.0000000
H+ Na+ 0.0000000 0.0000000 0.0000000
5 0: 0 0 0
H+ OH- 0.0000000 0.0000000 0.0000000
6 0.106257: 0.0864 0.253 0.0784862
Na+ OH- 0.1062570 -0.0029585 0.0882110
Step 5:
Species Species CMX
Cl- H+ 0.0004000
Cl- Na+ -0.0022865
Cl- OH- 0.0000000
H+ Na+ 0.0000000
H+ OH- 0.0000000
Na+ OH- 0.0022000
Step 6:
Species Species Phi_ij Phiprime_ij Phi^phi_ij
Cl- H+ 0.000000 0.000000 0.000000
Cl- Na+ 0.000000 0.000000 0.000000
Cl- OH- -0.050000 0.000000 -0.050000
H+ Na+ 0.036000 0.000000 0.036000
H+ OH- 0.000000 0.000000 0.000000
Na+ OH- 0.000000 0.000000 0.000000
Step 7:
initial value of F = -1.143942
F = -1.143942
F = -1.305230
F = -1.305230
F = -1.305230
F = -1.305230
F = -1.305230
Step 8:
Cl- lngamma[i]= 0.018952 gamma[i]= 1.019133
-1.30523 1.40926 -1.90923e-07 -5.27697e-11 -0.085074 0
H+ lngamma[i]= 1.377186 gamma[i]= 3.963731
-1.30523 2.47714 0.290353 0 -0.085074 0
Na+ lngamma[i]= 0.018952 gamma[i]= 1.019133
-1.30523 1.40926 1.02952e-10 -5.11533e-08 -0.085074 0
OH- lngamma[i]= -0.763533 gamma[i]= 0.466017
-1.30523 1.45998 -0.833208 0 -0.085074 0
Step 9:
term1= -1.489777 sum1= 2.795284 sum2= 0.000000 sum3= -0.000001 sum4= 0.000000 sum5= 0.000000
sum_m_phi_minus_1= 2.611013 osmotic_coef= 1.214028
Step 10:
Weight of Solvent = 18.01528
molalitySum = 12.1994
ln_a_water= -0.266814 a_water= 0.765816
Name Activity ActCoeffMolal MoleFract Molality
H2O(L) 0.765816 0.934123 0.819823 55.5084
Cl- 6.2164 1.01913 0.0900885 6.0997
H+ 8.57276e-09 3.96373 3.19431e-11 2.1628e-09
Na+ 6.21641 1.01913 0.0900885 6.0997
OH- 6.51352e-07 0.466017 2.06431e-08 1.3977e-06
Debugging information from hmw_act
Step 1:
ionic strenth = 6.0997000e+00
total molar charge = 1.2199400e+01
Is = 6.0997
ij = 1, elambda = 0.0454012, elambda1 = -0.00306854
ij = 2, elambda = 0.200776, elambda1 = -0.014532
ij = 3, elambda = 0.47109, elambda1 = -0.0351127
ij = 4, elambda = 0.857674, elambda1 = -0.0650149
ij = 4, elambda = 0.857674, elambda1 = -0.0650149
ij = 6, elambda = 1.98206, elambda1 = -0.153152
ij = 8, elambda = 3.57685, elambda1 = -0.279391
ij = 9, elambda = 4.55112, elambda1 = -0.356872
ij = 12, elambda = 8.18289, elambda1 = -0.646977
ij = 16, elambda = 14.6822, elambda1 = -1.16875
Step 2:
z1= 1 z2= 1 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 1 z2= 2 E-theta(I) = -0.059044, E-thetaprime(I) = 0.004790
z1= 1 z2= 3 E-theta(I) = -0.355533, E-thetaprime(I) = 0.028969
z1= 1 z2= 4 E-theta(I) = -1.068400, E-thetaprime(I) = 0.087216
z1= 2 z2= 1 E-theta(I) = -0.059044, E-thetaprime(I) = 0.004790
z1= 2 z2= 2 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 2 z2= 3 E-theta(I) = -0.178237, E-thetaprime(I) = 0.014566
z1= 2 z2= 4 E-theta(I) = -0.951372, E-thetaprime(I) = 0.077813
z1= 3 z2= 1 E-theta(I) = -0.355533, E-thetaprime(I) = 0.028969
z1= 3 z2= 2 E-theta(I) = -0.178237, E-thetaprime(I) = 0.014566
z1= 3 z2= 3 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
z1= 3 z2= 4 E-theta(I) = -0.357010, E-thetaprime(I) = 0.029220
z1= 4 z2= 1 E-theta(I) = -1.068400, E-thetaprime(I) = 0.087216
z1= 4 z2= 2 E-theta(I) = -0.951372, E-thetaprime(I) = 0.077813
z1= 4 z2= 3 E-theta(I) = -0.357010, E-thetaprime(I) = 0.029220
z1= 4 z2= 4 E-theta(I) = 0.000000, E-thetaprime(I) = 0.000000
Step 3:
Species Species g(x) hfunc(x)
Cl- H+ 0.07849 -0.07133
Cl- Na+ 0.07849 -0.07133
Cl- OH- 0.00000 0.00000
H+ Na+ 0.00000 0.00000
H+ OH- 0.00000 0.00000
Na+ OH- 0.07849 -0.07133
Step 4:
Species Species BMX BprimeMX BphiMX
1 0.200614: 0.1775 0.2945 0.0784862
Cl- H+ 0.2006142 -0.0034438 0.1796081
2 0.129466: 0.10037 0.37071 0.0784862
Cl- Na+ 0.1294658 -0.0043350 0.1030237
Cl- OH- 0.0000000 0.0000000 0.0000000
H+ Na+ 0.0000000 0.0000000 0.0000000
5 0: 0 0 0
H+ OH- 0.0000000 0.0000000 0.0000000
6 0.106257: 0.0864 0.253 0.0784862
Na+ OH- 0.1062570 -0.0029585 0.0882110
Step 5:
Species Species CMX
Cl- H+ 0.0004000
Cl- Na+ -0.0022865
Cl- OH- 0.0000000
H+ Na+ 0.0000000
H+ OH- 0.0000000
Na+ OH- 0.0022000
Step 6:
Species Species Phi_ij Phiprime_ij Phi^phi_ij
Cl- H+ 0.000000 0.000000 0.000000
Cl- Na+ 0.000000 0.000000 0.000000
Cl- OH- -0.050000 0.000000 -0.050000
H+ Na+ 0.036000 0.000000 0.036000
H+ OH- 0.000000 0.000000 0.000000
Na+ OH- 0.000000 0.000000 0.000000
Step 7:
initial value of F = -1.143942
F = -1.143942
F = -1.305230
F = -1.305230
F = -1.305230
F = -1.305230
F = -1.305230
Step 8:
Cl- lngamma[i]= 0.018952 gamma[i]= 1.019133
-1.30523 1.40926 -1.90923e-07 -5.27697e-11 -0.085074 0
H+ lngamma[i]= 1.377186 gamma[i]= 3.963731
-1.30523 2.47714 0.290353 0 -0.085074 0
Na+ lngamma[i]= 0.018952 gamma[i]= 1.019133
-1.30523 1.40926 1.02952e-10 -5.11533e-08 -0.085074 0
OH- lngamma[i]= -0.763533 gamma[i]= 0.466017
-1.30523 1.45998 -0.833208 0 -0.085074 0
Step 9:
term1= -1.489777 sum1= 2.795284 sum2= 0.000000 sum3= -0.000001 sum4= 0.000000 sum5= 0.000000
sum_m_phi_minus_1= 2.611013 osmotic_coef= 1.214028
Step 10:
Weight of Solvent = 18.01528
molalitySum = 12.1994
ln_a_water= -0.266814 a_water= 0.765816
Species Standard chemical potentials (kJ/gmol)
------------------------------------------------------------
H2O(L) -317.175857
Cl- -186.014783
H+ 0.0017225
Na+ -441.615962
OH- -322.000801
------------------------------------------------------------
Some DeltaSS values: Delta(mu_0)
NaCl(S): Na+ + Cl- -> NaCl(S): 195.0003 kJ/gmol
: 78.66216 (dimensionless)
: 34.16254 (dimensionless/ln10)
OH-: H2O(L) - H+ -> OH-: -4.823222 kJ/gmol
: -1.945664 (dimensionless)
: -0.8449909 (dimensionless/ln10)
------------------------------------------------------------

View file

@ -0,0 +1,42 @@
#!/bin/sh
#
#
temp_success="1"
/bin/rm -f output.txt outputa.txt
##########################################################################
prog=HMW_test_3
if test ! -x $prog ; then
echo $prog ' does not exist'
exit -1
fi
##########################################################################
/bin/rm -f test.out test.diff output.txt
#################################################################
#
CANTERA_DATA=${CANTERA_DATA:=../../../data/inputs}; export CANTERA_DATA
CANTERA_BIN=${CANTERA_BIN:=../../../bin}
#################################################################
$prog > output.txt
retnStat=$?
if [ $retnStat != "0" ]
then
temp_success="0"
echo "$prog returned with bad status, $retnStat, check output"
fi
$CANTERA_BIN/exp3to2.sh output.txt > outputa.txt
diff -w outputa.txt output_blessed.txt > diff_test.out
retnStat=$?
if [ $retnStat = "0" ]
then
echo "successful diff comparison on $prog test"
else
echo "unsuccessful diff comparison on $prog test"
echo "FAILED" > csvCode.txt
temp_success="0"
fi

View file

@ -23,6 +23,8 @@ ifeq ($(test_electrolytes),1)
cd HMW_graph_HvT; @MAKE@ all
cd HMW_graph_CpvT; @MAKE@ all
cd HMW_graph_VvT; @MAKE@ all
cd HMW_test_1; @MAKE@ all
cd HMW_test_3; @MAKE@ all
endif
test:
@ -41,6 +43,8 @@ ifeq ($(test_electrolytes),1)
cd HMW_graph_HvT; @MAKE@ test
cd HMW_graph_CpvT; @MAKE@ test
cd HMW_graph_VvT; @MAKE@ test
cd HMW_test_1; @MAKE@ test
cd HMW_test_3; @MAKE@ test
endif
clean:
@ -57,6 +61,8 @@ clean:
cd HMW_graph_HvT; @MAKE@ clean
cd HMW_graph_CpvT; @MAKE@ clean
cd HMW_graph_VvT; @MAKE@ clean
cd HMW_test_1; @MAKE@ clean
cd HMW_test_3; @MAKE@ clean
depends:
ifeq ($(test_issp),1)
@ -74,4 +80,6 @@ ifeq ($(test_electrolytes),1)
cd HMW_graph_HvT; @MAKE@ depends
cd HMW_graph_CpvT; @MAKE@ depends
cd HMW_graph_VvT; @MAKE@ depends
cd HMW_test_1; @MAKE@ depends
cd HMW_test_3; @MAKE@ depends
endif