root/trunk/matml/src/ternary/freenergy.h
| Revision 487, 4.8 kB (checked in by powell, 3 years ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | /*************************************** |
| 2 | $Header$ |
| 3 | |
| 4 | This is the freenergy.h header file with structures and prototypes for |
| 5 | calculating free energy functions for ternary systems. |
| 6 | ***************************************/ |
| 7 | |
| 8 | |
| 9 | #ifndef FREENERGY_H |
| 10 | #define FREENERGY_H |
| 11 | |
| 12 | typedef struct { |
| 13 | double C2; /*+ Ternary concentration variable |
| 14 | +latex+$C_2$ ($0\rightarrow1$) |
| 15 | -latex-2 (0 -> 1) |
| 16 | +*/ |
| 17 | double C3; /*+ Ternary concentration variable |
| 18 | +latex+$C_3$ ($0\rightarrow1-C_2$) |
| 19 | -latex-3 (0 -> 1-C2) |
| 20 | +*/ |
| 21 | int efunc; /*+ Index indicating which energy surface (phase) this point |
| 22 | is on; a negative value indicates that energy derivatives |
| 23 | are not yet calculated. +*/ |
| 24 | double T; /*+ Temperature at which the free energies and derivatives |
| 25 | are valid +*/ |
| 26 | double P; /*+ Pressure at which the free energies and derivatives are |
| 27 | valid, -1 if not valid +*/ |
| 28 | double G; /*+ Free energy +*/ |
| 29 | double G2; /*+ Free energy derivative |
| 30 | +latex+$\partial G/\partial C_2$ |
| 31 | -latex-dG/dC2 |
| 32 | +*/ |
| 33 | double G3; /*+ Free energy derivative |
| 34 | +latex+$\partial G/\partial C_3$ |
| 35 | -latex-dG/dC3 |
| 36 | +*/ |
| 37 | double G22; /*+ Free energy second derivative |
| 38 | +latex+$\partial^2 G/\partial C_2^2$ |
| 39 | +html+ d<sup>2</sup>G/dC2<sup>2</sup> |
| 40 | +*/ |
| 41 | double G33; /*+ Free energy second derivative |
| 42 | +latex+$\partial^2 G/\partial C_3^2$ |
| 43 | +html+ d<sup>2</sup>G/dC3<sup>2</sup> |
| 44 | +*/ |
| 45 | double G23; /*+ Free energy mixed partial second derivative |
| 46 | +latex+$\partial^2 G/\partial C_2\partial C_3$ |
| 47 | +html+ d<sup>2</sup>G/dC2dC3 |
| 48 | +*/ |
| 49 | } energy_point; |
| 50 | |
| 51 | typedef struct { |
| 52 | double coeff; /*+ Coefficient at 0 temperature +*/ |
| 53 | double dcdT; /*+ Temperature derivative of coefficient +*/ |
| 54 | double n1; /*+ C1 exponent +*/ |
| 55 | double n2; /*+ C2 exponent +*/ |
| 56 | double n3; /*+ C3 exponent +*/ |
| 57 | } energy_polynomial; /*+ Polynomial free energy term structure +*/ |
| 58 | |
| 59 | typedef struct { |
| 60 | char *name; |
| 61 | double C2; /*+ Composition at center of this Gaussian term +*/ |
| 62 | double C3; /*+ Composition at center of this Gaussian term +*/ |
| 63 | double G; /*+ Free energy addition at the Gaussian center +*/ |
| 64 | double w; /*+ Width of the Gaussian distribution +*/ |
| 65 | double n; /*+ Exponent of the distribution, currently fixed at 2 +*/ |
| 66 | } energy_gaussian; /*+ Gaussian free energy term structure +*/ |
| 67 | |
| 68 | typedef struct { |
| 69 | char *name; /*+ Name of this phase +*/ |
| 70 | double R; /*+ Ideal gas law constant +*/ |
| 71 | double T0; /*+ Reference temperature +*/ |
| 72 | double G1_T0; /*+ Free energy of species 1 at reference temperature +*/ |
| 73 | double G2_T0; /*+ Free energy of species 2 at reference temperature +*/ |
| 74 | double G3_T0; /*+ Free energy of species 3 at reference temperature +*/ |
| 75 | double G1_C; /*+ Species 1 heat capacity +*/ |
| 76 | double G2_C; /*+ Species 2 heat capacity +*/ |
| 77 | double G3_C; /*+ Species 3 heat capacity +*/ |
| 78 | double S1; /*+ Species 1 entropy coefficient (inverse Flory-Huggins relative molar volume) +*/ |
| 79 | double S2; /*+ Species 2 entropy coefficient +*/ |
| 80 | double S3; /*+ Species 3 entropy coefficient +*/ |
| 81 | double S4; /*+ 1-C2 entropy coefficient for square system +*/ |
| 82 | double S5; /*+ 1-C3 entropy coefficient for square system +*/ |
| 83 | double Omega12; /*+ Species 1-2 regular solution interaction parameter +*/ |
| 84 | double Omega13; /*+ Species 1-3 regular solution interaction parameter +*/ |
| 85 | double Omega23; /*+ Species 2-3 regular solution interaction parameter +*/ |
| 86 | double Omega123; /*+ Species 1-2-3 regular solution interaction parameter +*/ |
| 87 | double Omega234; /*+ Species 2-3-4 regular solution interaction parameter +*/ |
| 88 | double Omega235; /*+ Species 2-3-5 regular solution interaction parameter +*/ |
| 89 | double Omega245; /*+ Species 2-4-5 regular solution interaction parameter +*/ |
| 90 | double Omega345; /*+ Species 3-4-5 regular solution interaction parameter +*/ |
| 91 | double Omega2345;/*+ Species 2-3-4-5 regular solution interaction parameter+*/ |
| 92 | energy_polynomial *poly; /*+ Array of polynomial energy parameter structs +*/ |
| 93 | int n_poly; /*+ Number of polynomial energy terms +*/ |
| 94 | energy_gaussian *gauss; /*+ Array of Gaussian energy parameter structs +*/ |
| 95 | int n_gauss; /*+ Number of Gaussian energy terms +*/ |
| 96 | } energy_params; /*+ Free energy parameters structure +*/ |
| 97 | |
| 98 | typedef enum { |
| 99 | STANDARD=0, |
| 100 | WITH_DERIVATIVES=1, |
| 101 | NO_INFINITY=2, |
| 102 | WITH_DERIVATIVES_NO_INFINITY=3 |
| 103 | } free_energy_flags; |
| 104 | |
| 105 | #define TERNARY_INFINITY HUGE_VALF |
| 106 | #define TERNARY_NEGATIVE_INFINITY (-HUGE_VALF) |
| 107 | |
| 108 | double free_energy |
| 109 | (double C2, double C3, double T, double P, energy_params *eparams); |
| 110 | int free_energies |
| 111 | (energy_point *points, int n, double T, double P, energy_params *eparams, |
| 112 | int efunc, free_energy_flags flags); |
| 113 | #if HAVE_LAPACK == yes |
| 114 | int adjust_gaussians |
| 115 | (double T, double P, double *G0, energy_params *eparams, int efunc); |
| 116 | #endif |
| 117 | |
| 118 | #endif // FREENERGY_H |
Note: See TracBrowser
for help on using the browser.