Changeset 471 for trunk/matml

Show
Ignore:
Timestamp:
10/05/2009 07:06:45 PM (3 years ago)
Author:
powell
Message:

Opening 0.5 with new arbitrary polynomials in free energy function.

Location:
trunk/matml/src/ternary
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/matml/src/ternary/ChangeLog

    r468 r471  
     1ternary (0.5.0) unstable; urgency=low 
     2 
     3  * New arbitrary polynomial terms in the free energy functions. 
     4 
     5 -- 
     6 
    17ternary (0.4.0) unstable; urgency=low 
    28 
  • trunk/matml/src/ternary/configure.in

    r466 r471  
    33 
    44AM_CONFIG_HEADER(config.h) 
    5 AM_INIT_AUTOMAKE(ternary, 0.4.0) 
    6 RELEASE_DATE="June 18, 2009" 
     5AM_INIT_AUTOMAKE(ternary, 0.5.0) 
     6RELEASE_DATE="when it's ready" 
    77AC_SUBST(RELEASE_DATE) 
    88 
  • trunk/matml/src/ternary/freenergy.c

    r464 r471  
    8383    + eparams->Omega2345*C2*C3*(1.-C2)*(1.-C3); 
    8484 
    85   /* And this folds in the Gaussians +*/ 
     85  /* This adds the polynomials */ 
     86  for (i=0; i<eparams->n_poly; i++) 
     87    ret += (eparams->poly) [i].coeff * pow (C1, (eparams->poly) [i].n1) * 
     88      pow (C2, (eparams->poly) [i].n2) * pow (C3, (eparams->poly) [i].n3); 
     89 
     90  /* And this folds in the Gaussians */ 
    8691  for (i=0; i<eparams->n_gauss; i++) 
    8792    ret += (eparams->gauss) [i].G * 
     
    151156    + eparams->Omega2345*C3*(1.-2.*C2)*(1.-C3); 
    152157 
     158  for (i=0; i<eparams->n_poly; i++) 
     159    ret += (eparams->poly) [i].coeff * pow (C1, (eparams->poly) [i].n1-1) * 
     160      pow (C2, (eparams->poly) [i].n2-1) * pow (C3, (eparams->poly) [i].n3) * 
     161      ((eparams->poly) [i].n2 * C1 - (eparams->poly) [i].n1 * C2); 
     162 
    153163  for (i=0; i<eparams->n_gauss; i++) 
    154164    ret -= 2. * (eparams->gauss) [i].G * (C2-(eparams->gauss) [i].C2) 
     
    212222    + eparams->Omega2345*C2*(1.-C2)*(1.-2.*C3); 
    213223 
     224  for (i=0; i<eparams->n_poly; i++) 
     225    ret += (eparams->poly) [i].coeff * pow (C1, (eparams->poly) [i].n1-1) * 
     226      pow (C2, (eparams->poly) [i].n2) * pow (C3, (eparams->poly) [i].n3-1) * 
     227      ((eparams->poly) [i].n3 * C1 - (eparams->poly) [i].n1 * C3); 
     228 
    214229  for (i=0; i<eparams->n_gauss; i++) 
    215230    ret -= 2. * (eparams->gauss) [i].G * (C3-(eparams->gauss) [i].C3) 
     
    271286    - eparams->Omega2345*2.*C3*(1.-C3); 
    272287 
     288  for (i=0; i<eparams->n_poly; i++) 
     289    ret += (eparams->poly) [i].coeff * pow (C1, (eparams->poly) [i].n1-2) * 
     290      pow (C2, (eparams->poly) [i].n2-2) * pow (C3, (eparams->poly) [i].n3) * 
     291      ((eparams->poly) [i].n2 * ((eparams->poly) [i].n2 - 1) * C1 * C1 
     292       - 2. * (eparams->poly) [i].n1 * (eparams->poly) [i].n2 * C1 * C2 
     293       + (eparams->poly) [i].n1 * ((eparams->poly) [i].n1 - 1) * C2 * C2); 
    273294 
    274295  for (i=0; i<eparams->n_gauss; i++) 
     
    333354    - eparams->Omega2345*2.*C2*(1.-C2); 
    334355 
     356  for (i=0; i<eparams->n_poly; i++) 
     357    ret += (eparams->poly) [i].coeff * pow (C1, (eparams->poly) [i].n1-2) * 
     358      pow (C2, (eparams->poly) [i].n2) * pow (C3, (eparams->poly) [i].n3-2) * 
     359      ((eparams->poly) [i].n3 * ((eparams->poly) [i].n3 - 1) * C1 * C1 
     360       - 2. * (eparams->poly) [i].n1 * (eparams->poly) [i].n3 * C1 * C3 
     361       + (eparams->poly) [i].n1 * ((eparams->poly) [i].n1 - 1) * C3 * C3); 
     362 
    335363  for (i=0; i<eparams->n_gauss; i++) 
    336364    ret += 2. * (eparams->gauss) [i].G 
     
    393421    - eparams->Omega245*(1.-2.*C2) - eparams->Omega345*(1.-2.*C3) 
    394422    + eparams->Omega2345*(1.-2.*C2)*(1.-2.*C3); 
     423 
     424  for (i=0; i<eparams->n_poly; i++) 
     425    ret += (eparams->poly) [i].coeff * pow (C1, (eparams->poly) [i].n1-2) * 
     426      pow (C2, (eparams->poly) [i].n2-1) * pow (C3, (eparams->poly) [i].n3-1) * 
     427      ((eparams->poly) [i].n2 * (eparams->poly) [i].n3 * C1 * C1 
     428       - (eparams->poly) [i].n1 * (eparams->poly) [i].n3 * C1 * C2 
     429       - (eparams->poly) [i].n1 * (eparams->poly) [i].n2 * C1 * C3 
     430       + (eparams->poly) [i].n1 * ((eparams->poly) [i].n1 - 1) * C2 * C3); 
    395431 
    396432  for (i=0; i<eparams->n_gauss; i++) 
     
    520556              points[i].G23=_G23(C1,points[i].C2,points[i].C3, G1,G2,G3, T,P, 
    521557                                 eparams+thefunc, flags); 
    522  
    523558               
    524559          /*+ Mark the energy function, temperature and pressure at which these 
  • trunk/matml/src/ternary/freenergy.h

    r470 r471  
    5050 
    5151typedef struct { 
     52  double coeff; /*+ Coefficient +*/ 
     53  double n1;    /*+ C1 exponent +*/ 
     54  double n2;    /*+ C2 exponent +*/ 
     55  double n3;    /*+ C3 exponent +*/ 
     56} energy_polynomial; /*+ Polynomial free energy term structure +*/ 
     57 
     58typedef struct { 
    5259  char *name; 
    5360  double C2; /*+ Composition at center of this Gaussian term +*/ 
     
    8289  double Omega345; /*+ Species 3-4-5 regular solution interaction parameter +*/ 
    8390  double Omega2345;/*+ Species 2-3-4-5 regular solution interaction parameter+*/ 
     91  energy_polynomial *poly; /*+ Array of polynomial energy parameter structs +*/ 
     92  int n_poly;      /*+ Number of polynomial energy terms +*/ 
    8493  energy_gaussian *gauss; /*+ Array of Gaussian energy parameter structs +*/ 
    8594  int n_gauss;     /*+ Number of Gaussian energy terms +*/ 
  • trunk/matml/src/ternary/square.c

    r463 r471  
    4040  energy_params /* Solid, liquid */ 
    4141    eparams0 = {"Solid", 1.,1., 0.,-.1,-.2, -1.,-1.1,-1.2, 0.,1.,1.,1.,1., 
    42                 -.5,2.,.2, 0.,-.1,-.2,.1,.2,-.1, &species,1}, 
     42                -.5,2.,.2, 0.,-.1,-.2,.1,.2,-.1, NULL,0, &species,1}, 
    4343    eparams1 = {"Liquid", 1.,1., .3,.1,-.1, -2.2,-2.,-1.8, 0.,1.,.67,1.,2., 
    44                 -.3,-.4,-.1, 0.,-.1,-.15,-.05,0.,.3, NULL,0}, 
     44                -.3,-.4,-.1, 0.,-.1,-.15,-.05,0.,.3, NULL,0, NULL,0}, 
    4545      allparams[2] = {eparams0, eparams1}; 
    4646 
  • trunk/matml/src/ternary/ternary.c

    r463 r471  
    3636  visual_point *tpoints=NULL; 
    3737  phase_boundary solid_spinodal, *allbounds=NULL; 
     38  energy_polynomial squarer = { -2., 1., 3., 2. }; 
    3839  /* eparams: name, R,T0, G1@T0,G2,G3, C1,C2,C3, S1,S2,S3,S4,S5, 
    3940     O12,O13,O23, O123,O234,O235,O245,O345,O2345 gauss ptr, gauss number */ 
    4041  energy_params /* Solid, liquid */ 
    4142    eparams0 = {"Solid", 1.,1., 0.,-.1,-.2, -1.,-1.1,-1.2, 1.,.5,.2,0.,0., 
    42                 -.5,2.,.2, 0.,0.,0.,0.,0.,0., NULL,0}, 
     43                -.5,2.,.2, 0.,0.,0.,0.,0.,0., &squarer,1, NULL,0}, 
    4344    eparams1 = {"Liquid", 1.,1., .3,.1,-.1, -2.2,-2.,-1.8, 1.,1.,.67,0.,0., 
    44                 -.3,-.4,-.1, -.5,0.,0.,0.,0.,0., NULL,0}, 
     45                -.3,-.4,-.1, -.5,0.,0.,0.,0.,0., NULL,0, NULL,0}, 
    4546      allparams[2] = {eparams0, eparams1}; 
    4647