added simplified examples

git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@4320 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
Scott R Charlton 2010-04-28 05:50:47 +00:00
parent 397a26f50e
commit e4d448c202
9 changed files with 1815 additions and 4 deletions

View File

@ -39,8 +39,6 @@ else
fi
AM_CONDITIONAL([BUILD_FORTRAN], [test "X$IPQ_FORTRAN" = "Xyes"])
# Disable shared library building by default (use --enable-shared to enable)
##AC_DISABLE_SHARED
AC_PROG_LIBTOOL
# Checks for libraries.
@ -51,6 +49,21 @@ AC_PROG_LIBTOOL
# Checks for library functions.
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile tests/phreeqc.dat tests/ex1])
AC_CONFIG_FILES([
Makefile
src/Makefile
src/phreeqcpp/Makefile
src/phreeqcpp/phreeqc/Makefile
tests/Makefile
tests/phreeqc.dat
tests/ex1
examples/ex1
examples/main_fortran.cxx
examples/Makefile
examples/phreeqc.dat
examples/test_c.c
examples/test_cxx.cxx
examples/test_f.f
examples/test_f90.f90
])
AC_OUTPUT

50
examples/Makefile.in Normal file
View File

@ -0,0 +1,50 @@
CC = @CC@
CPPFLAGS = -I@top_srcdir@/include @CPPFLAGS@
CXX = @CXX@
DEFS = @DEFS@
F77 = @F77@
FC = @FC@
CFLAGS = @CFLAGS@
FFLAGS = -I@top_srcdir@/include @FFLAGS@
FCLIBS = @FCLIBS@
LIBTOOL = @SHELL@ @top_builddir@/libtool
LDFLAGS = @LDFLAGS@
IPHREEQC_LA = @top_builddir@/src/libiphreeqc.la
all: test_c test_cxx test_f test_f90
test_c: test_c.lo $(IPHREEQC_LA)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o test_c test_c.lo $(IPHREEQC_LA)
test_cxx: test_cxx.lo $(IPHREEQC_LA)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o test_cxx test_cxx.lo $(IPHREEQC_LA)
test_f: test_f.lo main_fortran.lo $(IPHREEQC_LA)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o test_f test_f.lo main_fortran.lo $(IPHREEQC_LA) $(FCLIBS)
test_f90: test_f90.lo main_fortran.lo $(IPHREEQC_LA)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o test_f90 test_f90.lo main_fortran.lo $(IPHREEQC_LA) $(FCLIBS)
.SUFFIXES: .c .cxx .f .f90 .lo
.c.lo:
$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
.cxx.lo:
$(LIBTOOL) --mode=compile $(CXX) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
.f.lo:
$(LIBTOOL) --mode=compile $(F77) $(FFLAGS) -c -o $@ $<
.f90.lo:
$(LIBTOOL) --mode=compile $(FC) $(FFLAGS) -c -o $@ $<
main_fortran.lo: main_fortran.cxx
$(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
clean:
$(LIBTOOL) --mode=clean rm -f test_c test_cxx test_f test_c.lo test_cxx.lo test_f.lo main_fortran.lo

71
examples/ex1.in Normal file
View File

@ -0,0 +1,71 @@
TITLE Example 1.--Add uranium and speciate seawater.
SOLUTION 1 SEAWATER FROM NORDSTROM ET AL. (1979)
units ppm
pH 8.22
pe 8.451
density 1.023
temp 25.0
redox O(0)/O(-2)
Ca 412.3
Mg 1291.8
Na 10768.0
K 399.1
Fe 0.002
Mn 0.0002 pe
Si 4.28
Cl 19353.0
Alkalinity 141.682 as HCO3
S(6) 2712.0
N(5) 0.29 gfw 62.0
N(-3) 0.03 as NH4
U 3.3 ppb N(5)/N(-3)
O(0) 1.0 O2(g) -0.7
SOLUTION_MASTER_SPECIES
U U+4 0.0 238.0290 238.0290
U(4) U+4 0.0 238.0290
U(5) UO2+ 0.0 238.0290
U(6) UO2+2 0.0 238.0290
SOLUTION_SPECIES
#primary master species for U
#is also secondary master species for U(4)
U+4 = U+4
log_k 0.0
U+4 + 4 H2O = U(OH)4 + 4 H+
log_k -8.538
delta_h 24.760 kcal
U+4 + 5 H2O = U(OH)5- + 5 H+
log_k -13.147
delta_h 27.580 kcal
#secondary master species for U(5)
U+4 + 2 H2O = UO2+ + 4 H+ + e-
log_k -6.432
delta_h 31.130 kcal
#secondary master species for U(6)
U+4 + 2 H2O = UO2+2 + 4 H+ + 2 e-
log_k -9.217
delta_h 34.430 kcal
UO2+2 + H2O = UO2OH+ + H+
log_k -5.782
delta_h 11.015 kcal
2UO2+2 + 2H2O = (UO2)2(OH)2+2 + 2H+
log_k -5.626
delta_h -36.04 kcal
3UO2+2 + 5H2O = (UO2)3(OH)5+ + 5H+
log_k -15.641
delta_h -44.27 kcal
UO2+2 + CO3-2 = UO2CO3
log_k 10.064
delta_h 0.84 kcal
UO2+2 + 2CO3-2 = UO2(CO3)2-2
log_k 16.977
delta_h 3.48 kcal
UO2+2 + 3CO3-2 = UO2(CO3)3-4
log_k 21.397
delta_h -8.78 kcal
PHASES
Uraninite
UO2 + 4 H+ = U+4 + 2 H2O
log_k -3.490
delta_h -18.630 kcal
END

View File

@ -0,0 +1,9 @@
#define F_MAIN FC_FUNC(f_main, F_MAIN)
extern "C" void F_MAIN();
int main(void)
{
F_MAIN();
return 0;
}

1556
examples/phreeqc.dat.in Normal file

File diff suppressed because it is too large Load Diff

33
examples/test_c.c.in Normal file
View File

@ -0,0 +1,33 @@
#include <IPhreeqc.h>
int
main(int argc, const char* argv[])
{
int id;
id = CreateIPhreeqc();
if (id < 0)
{
return 1;
}
if (LoadDatabase(id, "phreeqc.dat") != 0)
{
OutputLastError(id);
return 2;
}
if (RunFile(id, "ex1") != 0)
{
OutputLastError(id);
return 3;
}
if (DestroyIPhreeqc(id) != IPQ_OK)
{
OutputLastError(id);
return 4;
}
return 0;
}

22
examples/test_cxx.cxx.in Normal file
View File

@ -0,0 +1,22 @@
#include <iostream>
#include <IPhreeqc.hpp>
int
main(int argc, const char* argv[])
{
IPhreeqc iphreeqc;
if (iphreeqc.LoadDatabase("phreeqc.dat") != 0)
{
std::cout << iphreeqc.GetLastErrorString();
return 1;
}
if (iphreeqc.RunFile("ex1") != 0)
{
std::cout << iphreeqc.GetLastErrorString();
return 2;
}
return 0;
}

27
examples/test_f.f.in Normal file
View File

@ -0,0 +1,27 @@
SUBROUTINE F_MAIN
IMPLICIT NONE
INCLUDE 'IPhreeqc.f.inc'
INTEGER id
id = CreateIPhreeqc()
IF (id.LT.0) THEN
STOP
ENDIF
IF (LoadDatabase(id, "phreeqc.dat").NE.0) THEN
CALL OutputLastError(id)
STOP
ENDIF
IF (RunFile(id, "ex1").NE.0) THEN
CALL OutputLastError(id)
STOP
ENDIF
IF (DestroyIPhreeqc(id).NE.0) THEN
CALL OutputLastError(id)
STOP
ENDIF
END SUBROUTINE F_MAIN

30
examples/test_f90.f90.in Normal file
View File

@ -0,0 +1,30 @@
SUBROUTINE F_MAIN
IMPLICIT NONE
INCLUDE 'IPhreeqc.f90.inc'
INTEGER id
id = CreateIPhreeqc()
IF (id.LT.0) THEN
STOP
ENDIF
IF (LoadDatabase(id, "phreeqc.dat").NE.0) THEN
CALL OutputLastError(id)
STOP
ENDIF
IF (RunFile(id, "ex1").NE.0) THEN
CALL OutputLastError(id)
STOP
ENDIF
IF (DestroyIPhreeqc(id).NE.0) THEN
CALL OutputLastError(id)
STOP
ENDIF
END SUBROUTINE F_MAIN