MTDATA – Phase Diagram Software from the National Physical Laboratory

 

 

 

Home 

News 

Products 


Training and Support 

FAQs 

Links 

Agents 

Other Services 

 

Services 

 


 

Introduction to ASSESSMENT

The intention of this section is to provide a guided introduction to the various commands and combinations of commands used to set up and execute stepping and optimisation runs within the ASSESSMENT module of MTDATA. This is done through illustrative examples in which typical commands are described and corresponding output is shown in separate tables.The text should always be read in conjunction with the sample output provided. Actual MTDATA commands issued are shown in red italics.

The emphasis in these examples is on commands and techniques specific to  the ASSESSMENT module of MTDATA. Some knowledge is assumed of how MTDATA data input (.mpi) files and databases are created, how data are loaded into MTDATA databases and how phase equilibrium calculations are set up and executed using commands such as SET, CLASSIFY and COMPUTE. Please refer to information about ACCESS, UTILITY and MULTIPHASE for guidance on these tasks.

Preliminary Considerations

The ASSESSMENT module of MTDATA is designed to help in refining the values of thermodynamic parameters from existing data input (.mpi) files such that differences between calculated properties and target experimental data are minimised. This means that every ASSESSMENT session must begin with the loading of a data input (".mpi") file containing preliminary values for all thermodynamic parameters to be considered during that session. New parameters, not present in the loaded .mpi file, cannot be introduced interactively during an ASSESSMENT session.

Typically an initial data input (".mpi") file is created by typing preliminary values for those parameters to be refined into a MTDATA data loading file, populating a temporary database, then performing a database search (see the UTILITY and ACCESS module information). The database search might cover more than one database in order to incorporate well established data items, such as standard unary data for the elements from the UNARY database. Database loading files, used to update values stored in the temporary database, can be created automatically during an ASSESSMENT session.

An experimental file is also required in any ASSESSMENT session involving parameter stepping or optimisation. In practise this means most ASSESSMENT sessions. The experimental file contains instructions for the calculation of individual properties, written as MTDATA commands, and target experimental values. Its name should be given as part of the same command in which the data input (".mpi") file is loaded. For example:

define data 'mydata' experiment 'mydata.amt' !

The structure of experimental files is discussed later.

Prior to the creation of an experimental file it is necessary to collect suitable experimental data for inclusion. This is typically done by means of a literature search. The commissioning of new measurements, or failing that, estimation, may be necessary where existing data are scarce.

Any property that can be calculated using MULTIPHASE can be included in an experimental data file. However, a combination of phase diagram information (such as phase boundary temperatures, compositions of phases in equilibrium) and thermodynamic measurements (such as activities, enthalpies of mixing) generally leads to the best results.

assessment flow chart

The flow chart above gives an overview of the steps that might be taken in developing suitable thermodynamic parameters for a new system. The preliminary considerations outlined above are shown outside the dotted ASSESSMENT module box as they must be addressed before entering the ASSESSMENT module. The sections that follow deal with tasks performed within the ASSESSMENT module, and so are shown inside the dotted ASSESSMENT module box.


The LIST command

LIST is the ASSESSMENT module command used to associate target experimental data and uncertainties with calculated properties or combinations of properties. A phase equilibrium calculation or a phase boundary search must have been completed prior to using LIST in this way.

define system = “KCl,CaCl2” source = demo_1 !

Data for the KCl-CaCl2 system are retrieved from the DEMO_1 database. These data will be used to illustrate the commands used during a typical ASSESSMENT session.

set temperature = 900 n(1) = 0.99 n(2) = 0.01 ! compute !

Using the same commands as would be entered in MULTIPHASE, an overall system temperature and composition are established, the composition expressed in terms of individual amounts of KCl and CaCl2, then a calculation is initiated. Unlike in MULTIPHASE no results are automatically printed to the screen or to the results (".mpr") file.

list property = x(CaCl2<LIQUID>) !
list property = gibbs_energy !

The calculated mole fraction of component CaCl2 in the LIQUID phase is accessed and printed to the screen, then the calculated system Gibbs energy is accessed and printed to the screen. Many other calculated properties can be accessed using the LIST PROPERTY command, such as system enthalpies, partial Gibbs energies, partial pressures of gaseous substances, mass fractions of components in phases and component activities.

set temperature = 1050 n(1) = 0.8 n(2) = 0.2 !
classify reference(1) = liquid reference(2) = liquid ! compute !
list property = h !
list property = gibbs_energy(KCl) !
list prop = activity(KCl) !

It is sensible to establish reference phases for each component before initiating calculations in which thermodynamic properties such as activities, partial Gibbs energies and enthalpies are to be accessed. The liquid is chosen as the reference phase for both components in the example above (this could also have been done using the single command classify reference liquid !) then the calculated system enthalpy, partial Gibbs_energy with respect to KCl and activity of KCl are accessed and printed to the screen.

set user_variable(hold) = h !
set temperature = 900 ! compute !
list property = difference(h:user_variable(hold)) !

The calculated value of the system enthalpy is stored in a user variable named "hold", then a new calculation is performed with a different system temperature. The difference between the new calculated enthalpy and the old value from "hold" is accessed and printed to the screen.

Any property accessible using the LIST PROPERTY command can have its value assigned to a named user variable for future reference. SUM, PRODUCT, RATIO, LOG10 and LN operators are available in addition to DIFFERENCE. Arguments can be properties, user variables or numbers.

list property = ln(activity(KCl)) !

The natural logarithm of the calculated activity of KCl, reference phase previously established using the CLASSIFY command, is accessed and printed to the screen.

range temperature = 1100 500 0.1 ! compute !
list property = temperature(1) !
list property = temperature(2) !

If a temperature RANGE is specified, rather than a single temperature SETting, the COMPUTE command initiates a search for phase boundaries within that temperature RANGE, rather than a single phase equilibrium calculation. In the example above the temperatures of boundaries between 1100 K and 500 K are determined to an accuracy of 0.1 K. The temperatures of each of the first two boundaries in turn are then accessed and printed to the screen.

list property = temp(1)  value = 924  uncert = 1  weight = 2  label = 'tliq' !

This command accesses the temperature appropriate to the first phase boundary, as above, and prints it to the screen, then associates a target experimental VALUE, an experimental UNCERTAINTY, a LABEL and a WEIGHTing factor (for use during optimisation runs) with the result obtained. The difference between the calculated property and its target value is divided by the specified uncertainty, squared, then multiplied by the specified weight in order to establish a contribution to the "sum of squares of errors", minimised during optimisation runs.

list result = experiment(tliq) !

All data associated with the property labelled "tliq", whether calculated or entered explicitly as part of a LIST command, are tabulated and printed to the screen. If no label or number is provided in brackets then all previously LISTed properties are included in the output.

Note that LISTed properties can also be associated with particular ABSCISSA variables for reference during the plotting of results.

list prop = temp(2) val = 872 unc = 1 lab = 'tsol' abscissa x(CaCl2) !

The temperature appropriate to the second phase boundary is accessed and printed to the screen. It is associated with a particular abscissa variable, x(CaCl2), as well as a target value, an experimental uncertainty and a label. This means that, in output requested using PLOT VALUE, its value will be plotted using the mole fraction of component CaCl2 as ABSCISSA, along with the values of other properties associated with the same ABSCISSA.

ASSESSMENT OPTION ? define system="KCl,CaCl2" source=demo_1 !
SEARCHING FOR SYSTEM KCl,CaCl2
SEARCHING DATABASE(S) :
demo_1          - Test database - use only with macro 'testmt.mac'

******                 GOOD DATAFILE CREATED                 ******
Date and time of run  7-APR-2000  14:50:11
* DATAFILE = C:\MTDATA\Work\def.mpi -  CREATED 14:50:11  7-APR-2000
* SYSTEM = KCl,CaCl2,
* NUMBER OF PHASES  =    4
* NUMBER OF SPECIES =    5
*

ASSESSMENT OPTION ? set temperature=900 n(1)=0.99 n(2)=0.01 ! compute !
ASSESSMENT OPTION ? list property x(CaCl2<LIQUID>) !
 The mole fraction of CaCl2<LIQUID> is  .2258012730732503
ASSESSMENT OPTION ? list property=gibbs_energy !
 The Gibbs energy is :  -536164.039895464
ASSESSMENT OPTION ? set temperature=1050 n(1)=0.8 n(2)=0.2 !
ASSESSMENT OPTION ? classify reference(1)=liquid reference(2)=liquid ! compute !
ASSESSMENT OPTION ? list property=h !
 The system enthalpy is :  -6831.52000104793
ASSESSMENT OPTION ? list property=gibbs_energy(KCl) !
 The partial Gibbs energy of KCl is :  -3122.58871327958
ASSESSMENT OPTION ? list property=activity(KCl) !
 The activity of KCl is :  .6993001720395908
ASSESSMENT OPTION ? set user_variable(hold)=h !
ASSESSMENT OPTION ? set temperature=900 ! compute !
ASSESSMENT OPTION ? list property difference(h:user_variable(hold)) !
 H-USER_VARIABLE(hold) = -2.673027E+03
ASSESSMENT OPTION ? list property=ln(activity(KCl)) !
 ln(ACTIVITY(KCl)) = -4.828780E-01
ASSESSMENT OPTION ? range temperature=1100 500 0.1 ! compute !
ASSESSMENT OPTION ? list property temperature(1) !
 The phase boundary temperature is : 923.6987559042488
ASSESSMENT OPTION ? list property temperature(2) !
 The phase boundary temperature is : 871.8755138955712
ASSESSMENT OPTION ? list property=temp(1) value=924 uncert=1 weight=2 label='tliq’ !
The phase boundary temperature is : 923.6987559042488

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
     10 tliq          9.23699E+02  9.24000E+02 1.0000E+00 -3.01244E-01 2.000E+00

ASSESSMENT OPTION ? list result=experiment(tliq) !

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
     10 tliq          9.23699E+02  9.24000E+02 1.0000E+00 -3.01244E-01 2.000E+00

 Mean weighted square of errors of selected experiments
 (omitting any undefined values) = 9.07480D-02 

ASSESSMENT OPTION ? list prop=temp(2) val=872 unc=1 lab=‘tsol’ abscissa x(CaCl2) !
The phase boundary temperature is : 871.8755138955712

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
     11 tsol          8.71876E+02  8.72000E+02 1.0000E+00 -1.24486E-01 1.000E+00

Experimental Files

Experimental files contain instructions for the calculation of individual properties, written as MTDATA commands, each property being associated with a target experimental value, an uncertainty, a label, a weight (optional) and an abscissa variable for use in the plotting of calculated results (optional). Differences between calculated values and their targets, divided by the uncertainty in the target value, then squared, contribute to the sum of squares of errors which is minimised during optimisation runs.

A typical experimental file consists of a series of command blocks. Each block begins with commands like SET, CLASSIFY and RANGE, used to set up a phase equilibrium or phase boundary calculation. This calculation is executed by means of a COMPUTE command. LIST commands, as introduced in the last section, are then used to associate target values, experimental uncertainties, labels, weights and abscissa variables with selected calculated properties.

An example of an experimental file for the KCl-CaCl2 system, named "kcacl.amt", is shown below. Properties considered include enthalpies of mixing and KCl activities, with the liquid phase as reference, phase boundary compositions and the congruent melting temperature of a compound (KCaCl3). Note that the latter has been entered in terms of the difference in Gibbs energy between the compound and a liquid of the same composition, set to zero at the congruent melting temperature. An alternative would have been to establish a temperature RANGE and carry out a phase boundary temperature calculation using commands such as those shown in the table following. This approach is less favoured because the calculations are likely to be more time consuming. In addition, difficulties could be encountered if the values of individual parameters were to alter during a stepping or optimisation run such that the corresponding boundary temperature moved outside the specified temperature RANGE.

Note that the experimental file "kcacl.amt" is completed by the command end_of_experiments. This is preceded by classify normal phase(*) ! to restore phases classified as absent earlier on. 

; KCl activities at 1073 K
set temp 1073 ! classify reference(1) liquid reference(2) liquid !
set n(1) 0.9 n(2) 0.1 ! classify absent phase(*) normal phase(liquid) ! compute !
list prop act(KCl) value 0.872 uncert 0.005 weight 1 label "act1" !
set n(1) 0.8 n(2) 0.2 ! classify absent phase(*) normal phase(liquid) ! compute !
list prop act(KCl) value 0.703 uncert 0.005 weight 1 label "act2" !
set n(1) 0.7 n(2) 0.3 ! classify absent phase(*) normal phase(liquid) ! compute !
list prop act(KCl) value 0.522 uncert 0.005 weight 1 label "act3" !
set n(1) 0.6 n(2) 0.4 ! classify absent phase(*) normal phase(liquid) ! compute !
list prop act(KCl) value 0.356 uncert 0.005 weight 1 label "act4" !
set n(1) 0.5 n(2) 0.5 ! classify absent phase(*) normal phase(liquid) ! compute !
list prop act(KCl) value 0.222 uncert 0.005 weight 1 label "act5" !
set n(1) 0.4 n(2) 0.6 ! classify absent phase(*) normal phase(liquid) ! compute !
list prop act(KCl) value 0.127 uncert 0.005 weight 1 label "act6" !
;
; Liquid in equilibrium with KCl<HALITE> and KCaCl3
set n(1) 0.99 n(2) 0.01 ! set t 872.0 !
classify absent phase(*) normal phase(liquid,halite) ! compute !
lis pro x(CaCl2<LIQUID>) val 0.254 un 0.005 we 5 lab "elo1" !
set n(1) 0.51 n(2) 0.49 ! set t 872.0 !
classify absent phase(*) normal phase(liquid,CaCl3K) ! compute !
lis pro x(CaCl2<LIQUID>) val 0.254 un 0.005 we 5 lab "elo2" !
;
; Liquid in equilibrium with KCaCl3 and CaCl2
set n(1) 0.01 n(2) 0.99 ! set t 900.5 !
classify absent phase(*) normal phase(liquid,CaCl2) ! compute !
lis pro x(CaCl2<LIQUID>) val 0.734 un 0.005 we 5 lab "ehi1" !
set n(1) 0.49 n(2) 0.51 ! set t 900.5 !
classify absent phase(*) normal phase(liquid,CaCl3K) ! compute !
lis pro x(CaCl2<LIQUID>) val 0.734 un 0.005 we 5 lab "ehi2" !
;
; Liquid in equilibrium with KCaCl3
set n(1) 0.51 n(2) 0.49 !
classify absent phase(*) normal phase(liquid,CaCl3K) !
set t 893 ! comp ! lis pro x(CaCl2<LIQUID>) val 0.272 un 0.005 we 1 lab "com1" !
set t 916 ! comp ! lis pro x(CaCl2<LIQUID>) val 0.294 un 0.005 we 1 lab "com2" !
set t 931 ! comp ! lis pro x(CaCl2<LIQUID>) val 0.310 un 0.005 we 1 lab "com3" !
set t 967 ! comp ! lis pro x(CaCl2<LIQUID>) val 0.356 un 0.005 we 1 lab "com4" !
set n(1) 0.49 n(2) 0.51 !
set t 935 ! comp ! lis pro x(CaCl2<LIQUID>) val 0.694 un 0.005 we 1 lab "com5" !
set t 971 ! comp ! lis pro x(CaCl2<LIQUID>) val 0.642 un 0.005 we 1 lab "com6" !
;
; Congruent melting point of KCaCl3 (G(KCaCl3)=G(Liquid) at melting point)
set n(1) 0.5 n(2) 0.5 t 1013.1 !
classify absent phase(*) normal phase(CaCl3K) ! compute !
set user_variable(gcomp) g !
classify absent phase(*) normal phase(liquid) ! compute !
list prop difference(g:user_v(gcomp)) value 0.0 uncert 1 weight 5 label "melt" !
;
; Enthalpy of mixing
classify absent phase(*) normal phase(liquid) !
set temp 1000 ! classify ref(1) liquid ref(2) liquid !
set n(1) 0.35 n(2) 0.65 ! compute !
list prop h val -7980 uncert 5 weight 1 label "hmx1" abs x(KCl) !
set n(1) 0.25 n(2) 0.75 ! compute !
list prop h val -6300 uncert 5 weight 1 label "hmx2" abs x(KCl) !
set n(1) 0.15 n(2) 0.85 ! compute !
list prop h val -4100 uncert 5 weight 1 label "hmx3" abs x(KCl) !
;
classify normal phase(*) !
end_of_experiments

; Congruent melting point of KCaCl3 (phase boundary calculation)
set n(1) 0.5 n(2) 0.5 ! range t 1100 500 0.1 !
classify absent phase(*) normal phase(liquid,CaCl3K) ! compute !
list prop temperature(1) value 1013.1 uncert 0.1 weight 5 lab "melt" !
;

It can be difficult to pick out the numeric data supplied in an experimental file from the surrounding MTDATA commands. The experimental file "kcacl.amt" illustrates this well. In order to simplify such files, MTDATA commands to set up and perform particular types of calculation can be entered in separate macros. This means that an experimental file need only contain a list of macros to be called along with any numbers or character data required as input.

; KCl activities at 1073 K
;   macro     T/C  x(CaCl2) activity  uncertainty  weight  label
"actkcl.mac"  800    0.1     0.872       0.005       1     "act1"
"actkcl.mac"  800    0.2     0.703       0.005       1     "act2"
"actkcl.mac"  800    0.3     0.522       0.005       1     "act3"
"actkcl.mac"  800    0.4     0.356       0.005       1     "act4"
"actkcl.mac"  800    0.5     0.222       0.005       1     "act5"
"actkcl.mac"  800    0.6     0.127       0.005       1     "act6"
;
; Liquid in equilibrium with KCl<HALITE> and KCaCl3
;   macro       phase    T/K  x(CaCl2)  value  uncertainty weight label 
"xcacl2.mac"  p(halite)  872    0.01    0.254     0.005      5    "elo1" 
"xcacl2.mac"  p(CaCl3K)  872    0.49    0.254     0.005      5    "elo2"
;
; Liquid in equilibrium with KCaCl3 and CaCl2
;    macro      phase     T/K  x(CaCl2) value  uncertainty weight label 
"xcacl2.mac"  p(CaCl2)   900.5   0.99   0.734     0.005      5    "ehi1" 
"xcacl2.mac"  p(CaCl3K)  900.5   0.51   0.734     0.005      5    "ehi2"
;
; Liquid in equilibrium with KCaCl3
;    macro      phase     T/K  x(CaCl2) value  uncertainty weight label 
"xcacl2.mac"  p(CaCl3K)   893    0.49   0.272     0.005      1    "com1"
"xcacl2.mac"  p(CaCl3K)   916    0.49   0.294     0.005      1    "com2"
"xcacl2.mac"  p(CaCl3K)   931    0.49   0.310     0.005      1    "com3"
"xcacl2.mac"  p(CaCl3K)   967    0.49   0.356     0.005      1    "com4"
"xcacl2.mac"  p(CaCl3K)   935    0.51   0.694     0.005      1    "com5"
"xcacl2.mac"  p(CaCl3K)   971    0.51   0.642     0.005      1    "com6"
;
; Congruent melting point of KCaCl3
;   macro      phase      T/K   x(CaCl2)  value  uncert weight label
"meltpt.mac"  p(CaCl3K) 1013.1    0.5      0.0      1     5    "melt"
;
; Enthalpy of mixing
;   macro      T/K  x(CaCl2) value  uncert weight  label  abscissa
"enthmx.mac"  1000    0.65   -7980    5      1    "hmx1"   x(CaCl2)
"enthmx.mac"  1000    0.75   -6300    5      1    "hmx2"   x(CaCl2)
"enthmx.mac"  1000    0.85   -4100    5      1    "hmx3"   x(CaCl2)
;
classify normal phase(*) !
end_of_experiments

An example of how the experimental file "kcacl.amt might be simplified using macros called "actkcl.mac", "xcacl2.mac", "meltpt.mac" and "enthmx.mac" is given in the table above. The simplified experimental file is called "kcaclsim.amt". The contents of the macros "actkcl.mac", "xcacl2.mac", "meltpt.mac" and "enthmx.mac" are shown below. Note how, in the macro "actkcl.mac", the SUM command is used to convert temperatures in Celsius, as entered in the experimental file, to temperatures in kelvin.

The experimental files "kcacl.amt" and "kcaclsim.amt" would lead to identical results if used in optimisation runs.

The macro "actkcl.mac"

; Macro to calculate KCl activities with liquid reference
;
classify absent phase(*) normal phase(liquid) !
classify reference liquid !
set user_variable(tcelc) ********
!
set u(tkelv) sum(user_variable(tcelc):273.15) !
set temperature u(tkelv) !
set n 1 n(1) undef n(2) ********
!
compute !
list property activity(KCl) value ********
uncertainty ********
weight ********
label ********
!

The macro "xcacl2.mac"

; Macro to calculate x(CaCl2<LIQUID>) in equilibrium with a specified phase
;
classify absent phase(*) normal p(liquid) normal ********
!
set t ********
!
set n 1 n(1) undef n(2) ********
!
compute !
list property x(CaCl2<LIQUID>) value ********
uncertainty ********
weight ********
label ********
!

The macro "meltpt.mac"

; Macro to calculate the congruent melting point of a specified compound
;
classify absent phase(*) normal ********
!
set n 1 n(1) undef t ********
n(2) ********
!
compute ! set user_variable(gcomp) g !
classify absent phase(*) normal phase(liquid) ! compute !
list property difference(g:user_variable(gcomp)) value ********
uncertainty ********
weight ********
label ********
!

The macro "enthmx.mac"

; Macro to calculate enthalpy of mixing in liquid phase
;
classify absent phase(*) normal phase(liquid) !
classify reference(1) liquid reference(2) liquid !
set t ********
!
set n 1 n(1) undef n(2) ********
!
compute !
list property h value ********
uncertainty ********
weight ********
label ********
abscissa ********
!

As already mentioned, the experimental file to be used during an ASSESSMENT session should be specified as part of the same DEFINE command used to load in thermodynamic data.

define sys = “KCl,CaCl2” sou = demo_1  experiment = "kcacl.amt" !

Experimental files should be always be tested for consistency before attempting optimisation runs based upon them. This can be done by entering the command,

optimise maximum_functions = 0 !

Stepping or optimisation with maximum_functions > 0 should only be attempted if no errors are reported in the output generated by the above command. If errors are reported, the DEFINEd experimental file should be corrected, then tested again.

The sample output shown below features typical entries from the results table generated using optimise maximum_functions = 0 !  The full table is not reproduced.

Sample output for EXPERIMENTAL FILES

ASSESSMENT OPTION ? define sys="KCl,CaCl2" sou=demo_1 experiment="kcacl.amt" !

SEARCHING FOR SYSTEM KCl,CaCl2

SEARCHING DATABASE(S) : demo_1          - Test database - use only with macro 'testmt.mac'

 ******                 GOOD DATAFILE CREATED                 ******

Date and time of run  7-APR-2000  15:41:03
* DATAFILE = C:\MTDATA\Work\def.mpi -  CREATED 15:41:03  7-APR-2000
* SYSTEM = KCl,CaCl2,
* NUMBER OF PHASES  =    4
* NUMBER OF SPECIES =    5
*
ASSESSMENT OPTION ? optimise maximum_functions=0 !
 The activity of KCl is :  .8720666284292496

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
      1 act1          8.72067E-01  8.72000E-01 5.0000E-03  1.33257E-02 1.000E+00

 The activity of KCl is :  .7032910972923411

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
      2 act2          7.03291E-01  7.03000E-01 5.0000E-03  5.82195E-02 1.000E+00

  The activity of KCl is :  .5220842656482606

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
      3 act3          5.22084E-01  5.22000E-01 5.0000E-03  1.68531E-02 1.000E+00

  The activity of KCl is :  .3558643895908951

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
      4 act4          3.55864E-01  3.56000E-01 5.0000E-03 -2.71221E-02 1.000E+00

  The activity of KCl is :  .2223956559107486

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
      5 act5          2.22396E-01  2.22000E-01 5.0000E-03  7.91312E-02 1.000E+00

  The activity of KCl is :  .127062033008948

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
      6 act6          1.27062E-01  1.27000E-01 5.0000E-03  1.24066E-02 1.000E+00

  The mole fraction of CaCl2<LIQUID> is  .253912782657581

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
      7 elo1          2.53913E-01  2.54000E-01 5.0000E-03 -1.74435E-02 5.000E+00

  The mole fraction of CaCl2<LIQUID> is  .2539809054967812

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
      8 elo2          2.53981E-01  2.54000E-01 5.0000E-03 -3.81890E-03 5.000E+00

  The mole fraction of CaCl2<LIQUID> is  .7343676630240455

 ... etc

 The system enthalpy is :  -7979.84687253414

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
     18 hmx1         -7.97985E+03 -7.98000E+03 5.0000E+00  3.06255E-02 1.000E+00

  The system enthalpy is :  -6297.42187688802

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
     19 hmx2         -6.29742E+03 -6.30000E+03 5.0000E+00  5.15625E-01 1.000E+00

  The system enthalpy is :  -4101.70687937515

    No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                       value (C)    value (E)      (U)       (C-E)/U
     20 hmx3         -4.10171E+03 -4.10000E+03 5.0000E+00 -3.41376E-01 1.000E+00

Modifying and Stepping Parameters

It is useful, as a prelude to a full optimisation run, to be able to monitor changes in the sum of squares of errors, calculated using the DEFINEd experimental file, as the values of one or two thermodynamic parameters are stepped automatically between predefined limits. This is possible using the STEP_PARAMETER command. Firstly, however, the parameters to be stepped have to be selected.

show unary_data = halite !

The names, current values and upper temperature limits of all parameters contributing to data for unaries in the halite phase are listed to the screen. A number, or INDEX, is associated with each parameter.

modify index = 65 type = stepped scale = 50000  !

The parameter corresponding to INDEX 65 is flagged for stepping. It will be varied from its current value minus the specified SCALE to its current value plus the specified SCALE. Note that parameter 65 is valid only up to 700 K. All of its counterparts within the same unary data set, valid over different temperature ranges, will be varied in an identical way, the parameters being linked together automatically.

list parameter = value !

The values of all FIXED, STEPPED and OPTIMISED parameters, and parameters LINKed to them, are displayed on the screen. It shows that parameters 71, 77, 83 and 89 are now LINKed to parameter 65 and ensures that any changes made to parameter 65 will automatically be repeated for parameters 71, 77, 83 and 89. In the case of LINKed parameters, the INDEX of the parameter to which they are LINKed is shown in the column headed Type.

list parameter = name(65) !

Lists the name and temperature limits of the parameter specified by INDEX.

step_parameter number_of_steps = 10 !

Initiates a stepping run during which parameters flagged as STEPPED are varied automatically from their current value minus their SCALE to their current value plus their SCALE using the specified NUMBER_OF_STEPS. The sum of squares of errors appropriate to properties LISTed in the experimental file is reported at each stage. The sensitivity of the sum of squares of errors to changes in the values of particular parameters can be explored in this way and the most suitable parameters for optimisation identified.

Although useful, the step_parameter command is no substitute for a sound theoretical understanding of how individual parameters influence calculated thermodynamic properties and phase equilibria.

In the current example, see below,  marked changes are apparent in the calculated sum of squares of errors as parameter 65 is STEPPED. The minimum sum of squares of errors is associated with the data input (.mpi) value of parameter 65, or a step addition of 0.


Sample output for MODIFYING AND STEPPING PARAMETERS

ASSESSMENT OPTION ? show unary_data=halite !

 Index  T(high)    Current    Parameter
          /K        Value       Name
    65   700.00 -4.52490E+05 ClK<HALITE> *xi
    66   700.00  2.63150E+02 ClK<HALITE> *xi*T
    67   700.00 -5.12948E+01 ClK<HALITE> *xi*T*ln(T)
    68   700.00 -1.40523E-03 ClK<HALITE> *xi*T**2
    69   700.00 -1.73100E-06 ClK<HALITE> *xi*T**3
    70   700.00  7.67320E+04 ClK<HALITE> *xi/T
    71   800.00 -4.87176E+05 ClK<HALITE> *xi
    72   800.00  7.62308E+02 ClK<HALITE> *xi*T
    73   800.00 -1.27777E+02 ClK<HALITE> *xi*T*ln(T)
    74   800.00  7.29682E-02 ClK<HALITE> *xi*T**2
    75   800.00 -1.51909E-05 ClK<HALITE> *xi*T**3
    76   800.00  3.00201E+06 ClK<HALITE> *xi/T
    77  1045.00 -7.29641E+05 ClK<HALITE> *xi
    78  1045.00  3.63572E+03 ClK<HALITE> *xi*T
    79  1045.00 -5.53395E+02 ClK<HALITE> *xi*T*ln(T)
    80  1045.00  4.04611E-01 ClK<HALITE> *xi*T**2
    81  1045.00 -6.35871E-05 ClK<HALITE> *xi*T**3
    82  1045.00  2.88679E+07 ClK<HALITE> *xi/T
    83  1100.00 -9.29276E+06 ClK<HALITE> *xi
    84  1100.00  8.37326E+04 ClK<HALITE> *xi*T
    85  1100.00 -1.19459E+04 ClK<HALITE> *xi*T*ln(T)
    86  1100.00  7.09895E+00 ClK<HALITE> *xi*T**2
    87  1100.00 -7.95735E-04 ClK<HALITE> *xi*T**3
    88  1100.00  1.22924E+09 ClK<HALITE> *xi/T
    89  2000.00 -4.69544E+05 ClK<HALITE> *xi
    90  2000.00  4.29820E+02 ClK<HALITE> *xi*T
    91  2000.00 -7.33994E+01 ClK<HALITE> *xi*T*ln(T)

ASSESSMENT OPTION ? modify index=65 type=stepped scale=50000 !
ASSESSMENT OPTION ? list parameter=value !

                          Data File     Current      Stored
  Index Type    Scale     Parameter    Parameter    Parameter
    65  Step  5.000E+04 -4.52490E+05 -4.52490E+05 -4.52490E+05                
    71    65  5.000E+04 -4.87176E+05 -4.87176E+05 -4.87176E+05                 
    77    65  5.000E+04 -7.29641E+05 -7.29641E+05 -7.29641E+05                 
    83    65  5.000E+04 -9.29276E+06 -9.29276E+06 -9.29276E+06                 
    89    65  5.000E+04 -4.69544E+05 -4.69544E+05 -4.69544E+05                  

ASSESSMENT OPTION ? list parameter=name(65) !

          T(low)  T(high)
  Index     /K      /K     Parameter Name
    65    298.15   700.00  ClK<HALITE> *xi                                     

ASSESSMENT OPTION ? step_parameter number_of_steps=10 !

  Table of residual sum squares errors/sum of weights
  Step addn.    Total addn. Total parameter  Sum of squares
                                              of errors

 -5.000000E+04 -5.000000E+04 -5.024899E+05  2.663836E+03
 -4.000000E+04 -4.000000E+04 -4.924899E+05  2.393326E+03
 -3.000000E+04 -3.000000E+04 -4.824899E+05  1.823360E+03
 -2.000000E+04 -2.000000E+04 -4.724899E+05  1.071325E+03
 -1.000000E+04 -1.000000E+04 -4.624899E+05  3.766122E+02
   .000000E+00   .000000E+00 -4.524899E+05  7.521895E-01
  1.000000E+04  1.000000E+04 -4.424899E+05  2.984322E+02
  2.000000E+04  2.000000E+04 -4.324899E+05  2.984322E+02
  3.000000E+04  3.000000E+04 -4.224899E+05  2.984322E+02
  4.000000E+04  4.000000E+04 -4.124899E+05  2.984322E+02
  5.000000E+04  5.000000E+04 -4.024899E+05  2.984322E+02

Optimisation

In an optimisation run the values of selected parameters are varied automatically so as to obtain the best possible agreement between calculated properties and target values from an experimental file. This is done by minimising the sum of squares of errors. To illustrate the commands used to set up and execute an optimisation run, a parameter from the current data input (.mpi) file will be set to zero, then optimised.

modify index = 65 type = unchanged !

Parameter 65, previously STEPPED, is now said to be UNCHANGED. This means that it is removed from the list of FIXED, STEPPED, OPTIMISED and LINKed parameters and its data input (.mpi) file value is restored. All parameters LINKed to parameter 65 are treated similarly.

show interaction_data = liquid !
modify index = 52 type = fixed value = 0.0 !

The names, indices, current values and upper temperature limits of all parameters contributing to data for interactions in the liquid phase are listed to the screen. The current value of parameter 52 is FIXED as zero. This is the temperature independent regular solution parameter of the Redlich-Kister model.

list parameter = offset !

The attributes of all FIXED, STEPPED, OPTIMISED and LINKed parameters, just number 52 in this case, are listed to the screen. Note that the value of the parameter is expressed as an OFFSET from that in the data input (.mpi) file. Its actual value would have been shown if LIST PARAMETER VALUE had been entered. Since no SCALE was specified in the MODIFY statement above, a zero SCALE is shown. This triggers the automatic calculation of suitable SCALEs for optimisation runs.

modify index = 52 type = optimised !

Parameter 52 is marked for automatic change during subsequent optimisation runs.

optimise algorithm = upolyt maximum_functions = 100 !

An optimisation run, in which the UPOLYT algorithm is used to minimise the sum of squares of errors, is initiated. The process is terminated if convergence has not been achieved after 100 steps, each step resulting in the production of a lower value for the sum of squares of errors.

Sample output for OPTIMISATION

ASSESSMENT OPTION ? modify index=65 type=unchanged !
ASSESSMENT OPTION ? show interaction_data=liquid !

  Index  T(high)    Current    Parameter
           /K        Value       Name
    52  3000.00 -3.74554E+04 CaCl2,ClK<LIQUID> *xi*xj
    53  3000.00  9.84500E+00 CaCl2,ClK<LIQUID> *xi*xj*T
    54  3000.00  8.19000E+03 CaCl2,ClK<LIQUID> *xi*xj*(xi-xj)
    55  3000.00 -5.74000E+00 CaCl2,ClK<LIQUID> *xi*xj*(xi-xj)*T
    56  3000.00 -9.25000E+02 CaCl2,ClK<LIQUID> *xi*xj*(xi-xj)**2
    57  3000.00  1.92900E+00 CaCl2,ClK<LIQUID> *xi*xj*(xi-xj)**2*T

ASSESSMENT OPTION ? modify index=52 type=fixed value=0.0 !
ASSESSMENT OPTION ? list parameter=offset !

                          Data File     Current       Stored
  Index Type    Scale     Parameter      Offset       Offset
    52  Fix    .000E+00 -3.74500E+04  3.74500E+04   .00000E+00                 

ASSESSMENT OPTION ? modify index=52 type=optimised !
ASSESSMENT OPTION ? optimise algorithm=upolyt maximum_functions=100 !

  No.    Label      Calculated  Experimental Uncertainty    Error     Weight
                     value (C)    value (E)      (U)       (C-E)/U
    1 act1          8.72057E-01  8.72000E-01 5.0000E-03  1.14482E-02 1.000E+00
    2 act2          7.03261E-01  7.03000E-01 5.0000E-03  5.21632E-02 1.000E+00
    3 act3          5.22034E-01  5.22000E-01 5.0000E-03  6.73774E-03 1.000E+00
    4 act4          3.55803E-01  3.56000E-01 5.0000E-03 -3.93792E-02 1.000E+00
    5 act5          2.22336E-01  2.22000E-01 5.0000E-03  6.71630E-02 1.000E+00
    6 act6          1.27013E-01  1.27000E-01 5.0000E-03  2.56072E-03 1.000E+00
    7 elo1          2.53890E-01  2.54000E-01 5.0000E-03 -2.20953E-02 5.000E+00
    8 elo2          2.54097E-01  2.54000E-01 5.0000E-03  1.93347E-02 5.000E+00
    9 ehi1          7.34397E-01  7.34000E-01 5.0000E-03  7.94281E-02 5.000E+00
   10 ehi2          7.34198E-01  7.34000E-01 5.0000E-03  3.96131E-02 5.000E+00
   11 com1          2.72174E-01  2.72000E-01 5.0000E-03  3.47930E-02 1.000E+00
   12 com2          2.94195E-01  2.94000E-01 5.0000E-03  3.90628E-02 1.000E+00
   13 com3          3.10178E-01  3.10000E-01 5.0000E-03  3.56399E-02 1.000E+00
   14 com4          3.56661E-01  3.56000E-01 5.0000E-03  1.32239E-01 1.000E+00
   15 com5          6.94035E-01  6.94000E-01 5.0000E-03  7.05489E-03 1.000E+00
   16 com6          6.41532E-01  6.42000E-01 5.0000E-03 -9.35231E-02 1.000E+00
   17 melt          3.30445E-02   .00000E+00 1.0000E+00  3.30445E-02 5.000E+00
   18 hmx1         -7.98203E+03 -7.98000E+03 5.0000E+00 -4.06391E-01 1.000E+00
   19 hmx2         -6.29922E+03 -6.30000E+03 5.0000E+00  1.55444E-01 1.000E+00
   20 hmx3         -4.10293E+03 -4.10000E+03 5.0000E+00 -5.86297E-01 1.000E+00

  Index Type  Start Value  Final Value  Difference
    52  Opt.   .00000E+00 -3.74596E+04 -3.74596E+04
Mean weighted square of errors =  1.55369E-02

Graphs are produced during the optimisation run to show how individual parameters are changing and the effect this is having on the mean square of errors. Changes in parameters are expressed in units of the parameter’s SCALE. This allows all parameters to be represented on a single graph. When the mean square of errors is reduced below about a tenth of its original value a log scale is used to show further reductions.

A table comparing calculated and target values for all properties considered during a optimisation run is output to the screen at the end of that run. The starting and final values of OPTIMISED parameters are also shown. Entry of the command,

list result = experiment !

will generate an equivalent table at other times.

Figure 2.2     GRAPHS PRODUCED DURING AN OPTIMISATION RUN

 

Plotting and Saving Results

list parameter = value !

The current (optimised) value of parameter 52, that is -37459.6, is very similar to the original data input file (.mpi) file value of -37450.0. Note that the latter value is retained, by default, in the in-memory store.

save parameter = 52 ! list parameter = value !

This command saves the current (optimised) value of parameter 52 to the in-memory store. The stored value LISTed out for parameter 52 is now the same as the current (optimised) value, not the same as the data input (.mpi) file value.

undo
list parameter = value !

The UNDO command negates the effects of the last optimisation run. This means that all parameters are returned to the values they had at the start of that run. The current value of parameter 52, for example, becomes 0.0.

restore parameter = all ! list parameter = value !

The values of all previously SAVEd parameters are retrieved from the in-memory store. Existing values are overwritten. The current LISTed value for parameter 52 is, once again, -37459.6, the same as the stored value.

plot errors = experiment !

Generates a bar chart in which each bar represents the difference between a calculated PROPERTY and its target VALUE, expressed in units of the associated experimental UNCERTAINTY. This type of chart provides a useful graphical overview of the results of an optimisation run, enabling properties or groups of properties that are difficult to reproduce to be easily identified.

A GRAPH PRODUCED USING plot errors experiment !

 
In the current example all target values are reproduced to within their associated uncertainty. The longest bars are those with labels beginning "hmx", corresponding to calculated enthalpies of mixing. These properties have had smaller uncertainties, relatively speaking, assigned to them, than others in the experimental file "kcacl.amt".

plot values = experiment(hmx) !

Generates a graph which takes the form of a line joining the calculated values of properties associated with the same ABSCISSA variable, plotted against that variable. Properties are chosen according to their labels. In the example below, all properties having labels starting with the letters “hmx” are selected. Symbols representing experimental data are superimposed.

A GRAPH PRODUCED USING plot values experiment !

swap binary
step t = 500 1100 10 ! set n(1) = 0.1 n(2) = 0.9 t = 500 ! compute !

SWAP is used to leave the ASSESSMENT module and enter another MTDATA module, BINARY in this case, retaining the current thermodynamic parameters, and any classifications and settings, in memory. This allows parameters to be tested in other modules without the need for a new data input (.mpi) file to be created. Note that the DEFINE command is not used in the new module. The above commands calculate a KCl-CaCl2 phase diagram in the BINARY module.

replot experiment ‘kcaclsim.amt’ format assessment(5,3,4) label 'com' !

REPLOTs the calculated BINARY diagram with symbols added to represent data points taken from the table in the experimental file "kcaclsim.amt".

 

CALCULATED KCl-CaCl2 BINARY DIAGRAM 

REPLOTTED DIAGRAM WITH EXPERIMENTAL DATA ADDED

Abscissa and ordinate values for each data point are taken from the fifth and third columns respectively of rows containing the characters "com" (see Table showing experimental file "kcaclsim.amt"). The symbol plotted is that corresponding to the fourth letter of the alphabet (D). For a full list of symbols available and their corresponding letters see information about the UTILITY module. Error bars representing specified UNCERTAINTY values are also shown on the replotted diagram.

swap assessment

Swaps back to the ASSESSMENT module, retaining the current thermodynamic parameters in memory. Any settings and classifications made in the module being swapped from, BINARY in this case, are also retained.

save set_up = ‘kcacl_setup.mac’ !

Writes a macro which can be used to re-establish the exact state of the current ASSESSMENT module session at a later date. The contents of the file "kcacl_setup.mac" produced by the above command are shown below.

The ASSESSMENT module set up file “kcacl_setup.mac”

; MTDATA ASSESSMENT MODULE SET UP FILE CREATED 17:23:15  07-APR-2000
; LOG FILE NAME IS C:\MTDATA\Work\mt4370.log                          
DEFINE DATA 'C:\MTDATA\Work\def.mpi' EXPERIMENT 'C:\MTDATA\Work\kcacl.amt’ !
MODIFY INDEX    52 TYPE OPT !
MODIFY INDEX    52 VALUE -3.745960D+04 SCALE 3.255078D+03 !
SET USER_VAR(penalty_function) 1E12 !

save data_loading_file = ‘kcacl_new.loa’ !

Writes an MTDATA data loading file suitable for updating all unary or interaction data sets which include OPTIMISED, STEPPED, FIXED or LINKed parameters. The contents of the file "kcacl_new.loa" produced by the above command is shown below.


The MTDATA data loading file "kcacl_new.loa"

; MTDATA ASSESSMENT MODULE LOAD FILE CREATED 17:26:06  7-APR-2000
; LOG FILE NAME IS C:\MTDATA\Work\mt4370.log                           

CaCl2,ClK<LIQUID> E/J
 ***** GEX(REDLICH-KISTER) DATASET FORMAT *****
    298.150    3
               2
 -3.74596047835D+04  9.84500000000D+00
               2
  8.19000000000D+03 -5.74000000000D+00
               2
 -9.25000000000D+02  1.92900000000D+00
   3000.000
          0    0

Typically the contents of a file such as "kcacl_new.loa" would be loaded into a new database created within the UTILITY module. An updated data input (.mpi) file would then be produced by means of a database search encompassing the new database.

return utility
create_database database = 'kcacl' !
load_data file = 'kcacl_new.loa' !

In the UTILITY module, a database named "kcacl" is created and data are loaded into this database from the file "kcacl_new.loa".

return assessment
define system = 'KCl,CaCl2' source = kcacl,demo_1 output 'kcacl' !

Back in the ASSESSMENT module an updated data input file, given the name "kcacl.mpi", is created. Note that the new database "kcacl" is placed first on the database search list so that the data it contains take preference.

'kcacl_setup.mac

The set up macro SAVEd earlier can be used to re-establish the ASSESSMENT session as it was before RETURNing to the UTILITY module.

Note that data are retrieved from the original data input file (def.mpi) and not from the new data input file (kcacl.mpi). The new file may have a different structure to the original file and so parameters may be numbered differently.

Care should be taken to ensure that the contents of a data input (.mpi) file accessed in a set up macro remain unchanged in between saving the macro and using it to re-establish an ASSESSMENT session, otherwise parameter numbers in the set up macro may become invalid.

Sample output for PLOTTING AND SAVING RESULTS

ASSESSMENT OPTION ? list parameter=value !

                          Data File     Current      Stored
  Index Type    Scale     Parameter    Parameter    Parameter
    52  Opt.  3.255E+03 -3.74500E+04 -3.74596E+04 -3.74500E+04                  

ASSESSMENT OPTION ? save parameter=52 ! list parameter=value !

                          Data File     Current      Stored
  Index Type    Scale     Parameter    Parameter    Parameter
    52  Opt.  3.255E+03 -3.74500E+04 -3.74596E+04 -3.74596E+04                  

ASSESSMENT OPTION ? undo
ASSESSMENT OPTION ? list parameter=value !

                          Data File     Current      Stored
  Index Type    Scale     Parameter    Parameter    Parameter
    52  Opt.  3.255E+03 -3.74500E+04   .00000E+00 -3.74596E+04                  

ASSESSMENT OPTION ? restore parameter=all ! list parameter=value !

                          Data File     Current      Stored
  Index Type    Scale     Parameter    Parameter    Parameter
    52  Opt.  3.255E+03 -3.74500E+04 -3.74596E+04 -3.74596E+04                  

ASSESSMENT OPTION ? plot errors=experiment !
ASSESSMENT OPTION ? plot values=experiment(hmx) !
ASSESSMENT OPTION ? swap binary
BINARY OPTION ? step t=500 1100 10 ! set n(1)=0.1 n(2)=0.9 t=500 ! compute !
BINARY OPTION ? replot experiment "kcaclsim.amt" format assessment(5,3,4) label "com" !
BINARY OPTION ? swap assessment
ASSESSMENT OPTION ? save set_up="kcacl_setup.mac" !
ASSESSMENT OPTION ? save data_loading_file="kcacl_new.loa" !
ASSESSMENT OPTION ? return utility
UTILITY OPTION ? create_database database='kcacl' !
UTILITY OPTION ? load_data file='kcacl_new.loa' !
 CaCl2,ClK<LIQUID>

UTILITY OPTION ? return assessment
ASSESSMENT OPTION ? define system='KCl,CaCl2' source=kcacl,demo_1 output 'kcacl' !

 SEARCHING FOR SYSTEM KCl,CaCl2

 SEARCHING DATABASE(S) :

kcacl        
demo_1          - Test database - use only with macro 'testmt.mac' 

******                 GOOD DATAFILE CREATED                 ******

 Date and time of run  7-APR-2000  17:34:32 
* DATAFILE = C:\Mtdata\Work\kcacl.mpi -  CREATED 17:34:32  7-APR-2000
* SYSTEM = KCl,CaCl2, * NUMBER OF PHASES  =    4 * NUMBER OF SPECIES =    5
* ASSESSMENT OPTION ? 'kcacl_setup.mac Date and time of run  7-APR-2000  17:40:30
* DATAFILE = C:\MTDATA\Work\def.mpi -  CREATED 15:41:03  7-APR-2000
* SYSTEM = KCl,CaCl2,
* NUMBER OF PHASES  =    4
* NUMBER OF SPECIES =    5
*
 
 

Updated 30 July 2010