32 static void do_equilibrium ()
43 static void do_evaporation (
double *initial_components,
double *moved_components,
double *final_components)
67 static void do_freezing (
double iniT,
double stepT,
double finT)
73 printf (
"invalid temperature interval\n");
85 static void do_heating (
double iniT,
double stepT,
double finT)
91 printf (
"invalid temperature interval\n");
103 static void do_mixing (
double *total_components_1,
double *total_components_2,
104 double system_charge_1,
double system_charge_2)
126 if ((fp = fopen (file_name,
"r")) == NULL)
128 printf (
"Open Input File Error!!!\n");
134 if (fscanf (fp,
"%s\n", process) != 1)
136 printf (
"invalid input file\n");
142 for (j = 0; j < 5; j ++)
144 if(strcmp(process,
PROCESS[j]) == 0)
152 rv = fscanf (fp,
"%lf\n", &
system_T);
156 printf (
"Load Input File Error!!!\n");
160 rv = fscanf (fp,
"%lf\n", &
system_P);
164 printf (
"Load Input File Error!!!\n");
172 printf (
"Load Input File Error!!!\n");
182 printf (
"Load Input File Error!!!\n");
194 rv = fscanf (fp,
"%lf\n", &
system_T);
198 printf (
"Load Input File Error!!!\n");
202 rv = fscanf (fp,
"%lf\n", &
system_P);
205 printf (
"Load Input File Error!!!\n");
213 printf (
"Load Input File Error!!!\n");
217 double *initial_components = (
double *)malloc(
sizeof (
double) *
total_comp_num);
218 double *moved_components = (
double *)malloc(
sizeof (
double) *
total_comp_num);
219 double *final_components = (
double *)malloc(
sizeof (
double) *
total_comp_num);
223 rv = fscanf (fp,
"\t%lf", &initial_components[i]);
227 printf (
"Load Input File Error!!!\n");
234 rv = fscanf (fp,
"\t%lf", &moved_components[i]);
238 printf (
"Load Input File Error!!!\n");
245 rv = fscanf (fp,
"\t%lf", &final_components[i]);
249 printf (
"Load Input File Error!!!\n");
254 do_evaporation (initial_components, moved_components, final_components);
261 double initial_T, decreased_T, final_T;
263 rv = fscanf (fp,
"%lf\t%lf\t%lf\n", &initial_T, &decreased_T, &final_T);
267 printf (
"Load Input File Error!!!\n");
271 rv = fscanf (fp,
"%lf\n", &
system_P);
275 printf (
"Load Input File Error!!!\n");
283 printf (
"Load Input File Error!!!\n");
293 printf (
"Load Input File Error!!!\n");
298 do_freezing (initial_T, decreased_T, final_T);
305 double initial_T, increased_T, final_T;
307 rv = fscanf (fp,
"%lf\t%lf\t%lf\n", &initial_T, &increased_T, &final_T);
311 printf (
"Load Input File Error!!!\n");
315 rv = fscanf (fp,
"%lf\n", &
system_P);
319 printf (
"Load Input File Error!!!\n");
327 printf (
"Load Input File Error!!!\n");
337 printf (
"Load Input File Error!!!\n");
342 do_heating (initial_T, increased_T, final_T);
349 rv = fscanf (fp,
"%lf\n", &
system_T);
353 printf (
"Load Input File Error!!!\n");
357 rv = fscanf (fp,
"%lf\n", &
system_P);
360 printf (
"Load Input File Error!!!\n");
364 double system_charge_1;
365 double system_charge_2;
366 double *total_components_1 = (
double *)malloc(
sizeof (
double) *
total_comp_num);
367 double *total_components_2 = (
double *)malloc(
sizeof (
double) *
total_comp_num);
369 rv = fscanf (fp,
"%lf\n", &system_charge_1);
373 printf (
"Load Input File Error!!!\n");
379 rv = fscanf (fp,
"\t%lf", &total_components_1[i]);
383 printf (
"Load Input File Error!!!\n");
388 rv = fscanf (fp,
"%lf\n", &system_charge_2);
392 printf (
"Load Input File Error!!!\n");
398 rv = fscanf (fp,
"\t%lf", &total_components_2[i]);
402 printf (
"Load Input File Error!!!\n");
407 do_mixing (total_components_1, total_components_2, system_charge_1, system_charge_2);
void simulate(char *file_name)
double * total_components
int gem_ipopt()
Perform Gibbs energy minimization (GEM) using the IPOPT algrithium.