MATLAB: How to calculate Gibbs Energy with Thermocalc Toolbox 7

thermo-calc toolbox 7

Hello,
I am trying to calculate the Gibbs Energy with Thermocalc-Toolbox-7 as shown below. That only works for a system of 'fe c cr' also if I use the TCFE7 or 8 database? Is there anything wrong with the script? I want to add Mn but with Mn there is always an error: "ERROR IN CFCE: ERROR COMPUTING EQUILIBRIUM" % %
tc_init_root;
tc_open_database('TCFE7');
tc_check_error;
sel='fe c cr'; tc_element_select(sel); tc_get_data;
tc_phase_reject('*'); tc_phase_select('fcc bcc'); tc_set_phase_addition('bcc',400);
tc_set_condition('t',1200); tc_set_condition('p',101325); tc_set_condition('n',1); tc_set_condition('w(c)',0.1); tc_set_condition('w(mn)',1.7); tc_set_condition('w(cr)',0.3); tc_set_condition('w(si)',0.5); tc_compute_equilibrium; tc_check_error;
T=1500:-100:400; nT=length(T);
for i=1:nT
tc_set_condition('t',T(i));
tc_set_phase_status('bcc','entered',1);
tc_set_phase_status('fcc','suspended',0);
tc_compute_equilibrium;
tc_check_error;
gm1(i)=tc_get_value('gv(bcc)');
tc_set_phase_status('fcc','entered',1);
tc_set_phase_status('bcc','suspended',0);
tc_compute_equilibrium;
tc_check_error;
gm2(i)=tc_get_value('gv(fcc)');
gm(i)=gm1(i)-gm2(i);
end

Best Answer

Hello Max,
as you use weight fractions to define the composition of your system, the total amount of all defined elements must not exceed a value of 1. Therefore " tc_set_condition('w(mn)',1.7); " causes an error in the equilibrium calculations. I suppose you entered the alloy composition in ma.-%, which is not correct as you use weight fractions to define your system. Dividing the values in ma.-% by 100 gives you the weight fractions which you can enter into your script.