ISLEC  Version 4.2
test_models.c
Go to the documentation of this file.
1 /* src/test_models.c
2  *
3  * Copyright (C) 2011-2018 Dongdong Li
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundataion; either version 3 of the License, or (at
8  * your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABLITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
30 extern bool test_models ()
31 {
32  if (phases.aqueous == NULL || phases.solidsolution == NULL)
33  {
34  printf ("There is no PHASES defined\n");
35  return false;
36  }
37  else
38  {
39  double naq[6] = {55.51, 5.0, 1.0, 1.0, 1.0, 1.0};
40  printf ("aw(aq) = %lf\n", psc_a (phases.aqueous[0], 0, naq, 298.15, 1.0));
41  printf ("aH+(aq) = %lf\n", psc_a (phases.aqueous[0], 1, naq, 298.15, 1.0));
42  printf ("aH2PO4(aq) = %lf\n", psc_a (phases.aqueous[0], 2, naq, 298.15, 1.0));
43  printf ("aH3PO4(aq) = %lf\n", psc_a (phases.aqueous[0], 3, naq, 298.15, 1.0));
44  printf ("aHSO4(aq) = %lf\n", psc_a (phases.aqueous[0], 4, naq, 298.15, 1.0));
45  printf ("aSO4(aq) = %lf\n", psc_a (phases.aqueous[0], 5, naq, 298.15, 1.0));
46 
47  double nss[2] = {0.5, 0.5};
48  printf ("aKCl(ss) = %lf\n", rkg_a (phases.solidsolution[0], 0, nss, 298.15, 1.0));
49  }
50 
51  return true;
52 }
double rkg_a(SOLIDSOLUTION_PHASE ss, int index, double *n, double T, double P)
Definition: rkg_model.c:99
AQUEOUS_PHASE * aqueous
Definition: islec.h:189
double psc_a(AQUEOUS_PHASE aq, int index, double *n, double T, double P)
Definition: psc_model.c:3496
SOLIDSOLUTION_PHASE * solidsolution
Definition: islec.h:191
PHASES phases
Definition: islec.h:206
bool test_models()
Definition: test_models.c:30