ISLEC  Version 4.2
islec.c
Go to the documentation of this file.
1 /* src/islec.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 #include <stdlib.h>
31 #include <stdio.h>
32 #include <string.h>
33 #include <getopt.h>
34 #include <time.h>
35 #include <math.h>
36 #include <stdbool.h>
37 
38 #include "islec.h"
39 #include "copyright.c"
40 #include "usage.c"
41 #include "version.c"
42 #include "clear_comments.c"
43 #include "load_db.c"
44 #include "test_load.c"
45 #include "test_models.c"
46 #include "psc_model.c"
47 #include "rkg_model.c"
48 #include "gem_ipopt.c"
49 #include "print_results.c"
50 #include "sim_process.c"
51 
52 char *l_opt_arg;
53 char* const short_options = "vh";
54 struct option long_options[] = {
55  { "version", 0, NULL, 'v'},
56  { "help", 0, NULL, 'h'},
57  { 0, 0, 0, 0}
58 };
59 
60 int main (int argc, char *argvs[])
61 {
62  int c;
63 
65 
66  if (argc == 1)
67  {
68  print_ec_usage (0);
69  return 100;
70  }
71 
72  while((c = getopt_long (argc, argvs, short_options, long_options, NULL)) != -1)
73  {
74  switch (c)
75  {
76  case 'h':
77  print_ec_usage (0);
78  return 100;
79  case 'v':
80  print_ec_version ();
81  return 201;
82  }
83  }
84 
85  if (argc < 3)
86  {
87  printf ("Input not match\n");
88  return 1;
89  }
90 
91  if (load_db (argvs[1], TEMP_FILE) == false)
92  {
93  return 300;
94  }
95  //test_load ();
96 
97  //test_models ();
98 
99  simulate (argvs[2]);
100 
101  printf ("\nSimulation Ended, Thanks For Your Use!\n\n");
102  return 0;
103 }
void simulate(char *file_name)
Definition: sim_process.c:118
void print_ec_usage(int exit_code)
Definition: usage.c:30
Perform Gibbs energy minimization of the whole thermodynamic system using the open source IPOPT optim...
void print_ec_version()
Definition: version.c:30
Implementation of activity (a) and activity coefficient (r) equations of a revised Pitzer-Simonson-Cl...
Simulate the commonly involved brine chemical process (i.e. single point equilibrium, evaporating, freezing, heating, mixing)
Implementation of activity (a) equation of the Redlich-Kister-Guggenheim (RKG) sub-regular solution m...
Test the correctness of the loaded database content by printing them.
char *const short_options
Definition: islec.c:53
bool load_db(char *input, char *temp)
Definition: load_db.c:718
Header file of the ISLEC program.
struct option long_options[]
Definition: islec.c:54
Test the correctness of the activity equations of PSC and RKG models.
Output ISLEC and ISLRE usage information.
char * l_opt_arg
Definition: islec.c:52
Load (after cleared all commented and black lines) database file into memory object components and ph...
Output ISLEC and ISLRE version information.
int main(int argc, char *argvs[])
Definition: islec.c:60
#define TEMP_FILE
Definition: islec.h:39
Clear all commented lines (started with the character &#39;#&#39;) and black lines included in a user specifi...