Home

PanEngine™ 6.0 User's Guide

image

Contents

1. 22 4 4 A FUNCTION FOR SOLIDIFICATION SIMULATION cscccssssseeseecseeesseeseeeseseseeesesesseeseeceeeens 22 TE 23 5 1 DEFINE USER POINTER LOAD DATABASE ETC sssesssesssssssssssesssereserereecreesreessssssssssessereee 23 5 2 CALCULATE THE STABLE PHASE EQUILIBRIUM s esssesssssssssssessssreserrreereeesseessssssssssessereee 23 5 3 FIND A LOCAL PHASE 27 7 7 28 Contents PanEngine 6 0 User s Guide 5 5 SOLIDIFICATION SIMULATION 000000 5 6 CALCULATE THERMODYNAMIC PROPERTIES ssssccccsssseccccccsecccecuessscecccessecccccnsaaeceeseees 5 7 CALCULATE A THERMODYNAMIC FACTOR PanEngine 5 0 User s Guide 1 Introduction to PanEngine What is PanEngine PanEngine is a dynamically linked library DLL for multi component thermodynamics and phase equilibrium calculations It has an application program interface API for a user s custom programs to access the functions in PanEngine A library is a group of functions classes or other resources that can be made available to application programs that need previously implemented entities without the need to know how these functions classes or resources were created or how they function A dynamic link library is a program that holds one or more functions or some functionality that other programs can use Through PanEngine s API users can create custom software to meet their specific needs
2. yn ee ee ee pt gt setT 1000 pt gt setUnitX false 32 PanEngine 5 0 User s Guide pt gt setWt Al 0 1 pt gt setWt Mg 0 8 pt gt setWt Zn 0 1 user gt pe_stateSpacePointConversion_X_Wt amp pt gt st msg cout lt lt Output the point conditions lt lt endl pt gt print cout user gt pe_setOption 1 1 cout lt lt nThermodynamic Property Calculation lt lt endl result user gt pe_getThermodynamicProperty pt Liquid msg if result false cout lt lt Error lt lt msg lt lt endl pause return 0 pt gt print cout int i ofstream out out open GHS_FCC_Al dat ios out out gt gt xAl txMg txZn tG tH ts n for i 0 i lt 100 i double wtAl wtMg wtZn wtMg 0 01 wtZn 0 01 i wtAl 1 wtMg wtZn pt gt setT 300 pt gt setUnitX false pt gt setWt Al wtAl pt gt setWt Mg wtMg pt gt setWt Zn wtZn result user gt pe_getThermodynamicProperty pt fcc_Al msg out lt lt pt gt phasePt 0 st comp 0 x lt lt t lt lt pt gt phasePt 0 st comp 1 x gt gt t gt gt pt gt phasePt 0 st comp 2 x gt gt t out lt lt pt gt phasePt 0 G gt gt t lt lt pt gt phasePt 0 H lt lt t gt gt pt gt phasePt 0 S lt lt endl pt gt print cout out close SSS SSS 55 55 5
3. User user char msg 80 cout lt lt Defining User pointer lt lt endl user pe_defineUser msg cout lt lt msg lt lt endl if user NULL cout lt lt Error in defineUser lt lt endl return 0 sss SSS SS SS SSS SS SS SSS SSS SS SSS SSS SS SSS SSS SSS Load thermodynamic database in tdb Format char tdbFileName AlMgZn tdb bool result cout lt lt Reading database file lt lt endl result user gt pe_readTDBFile tdbFileName msg if result false cout lt lt Error lt lt msg lt lt endl return 0 SS SS SS Define a subsystem for current calculation SSS cout lt lt endl lt lt Define which elements should be used in the calculation result user gt pe_defineSubSystem 3 Al Mg Zn if result false cout lt lt Error lt lt endl return 0 cout lt lt Define and initialize a PanPoint lt lt endl PanPoint pt pt new PanPoint user gt pe_initializePanPoint pt cout lt lt Set temperature lt lt endl pt gt setT 700 cout lt lt Set composition lt lt endl pt gt setUnitX true etc PanEngine 5 0 User s Guide pt gt setX Al 0 1 pt gt setX Mg 0 8 pt gt setX Zn 0 1 cout lt lt Output the point conditions lt lt endl pt gt print cout cout lt lt nFind Stable Poin
4. lt lt Reading database file lt lt endl result user gt pe_readTDBFile tdbFileName msg if result false cout lt lt Error lt lt msg lt lt endl return 0 Define a subsystem for current calculation sss SSS SS SS SSS SS SSS SSS SSS SS SS SS SSS SS SSS SS SSS cout lt lt endl lt lt Define which elements should be used in the calculation lt lt endl result user gt pe_defineSubSystem 3 Al Mg Zn if result false cout lt lt Error lt lt endl return 0 aasssss3 5555555555555 5 5555555555555 55555555 5 Define a PanPoint pointer and initialize it cout lt lt Define and initialize a PanPoint lt lt endl PanPoint pt pt new PanPoint user gt pe_initializePanPoint pt pt gt setT 1000 T is an initial guess for the liquidus surface pt gt setUnitxX false set unit for composition pt gt setWt Al 0 1 pt gt setWt Mg 0 8 pt gt setWt Zn 0 1 user gt pe_stateSpacePointConversion_X_Wt amp pt gt st msg cout lt lt Output the point conditions lt lt endl pt gt print cout cout lt lt Find the liquidus surface for the given composition lt lt endl result user gt pe_findLiquidusSurface pt msg if result false cout lt lt Error lt lt msg lt lt endl pause return 0 else pt gt print cout ssssssss sss 55555555 555555 55
5. pdbFileName char msg NULL Purpose load a thermodynamic database file in encrypted pdb format Arguments tdbFileName database file name msg message Thermodynamic databases in pdb format are encrypted and cannot be viewed nor edited This function reads the pdb type of database 4 2 3 Define a subsystem Full Name bool pe_defineSubSystem int numComponents Purpose define a subsystem for current calculation Arguments NumComponents number of components to be selected component names After a thermodynamic database is successfully loaded the components are selected for the subsystem on which the subsequent calculations will be performed At least two components have to be selected 4 2 4 Output the master system information Full Name bool pe_printMasterSystem char fileName char msg NULL Purpose output master system database information to a file Arguments fileName file name to output msg message This function outputs the master system information i e the database loaded into PanEngine into a text file with a given name If the database is a type of pdb only information on phase names and phase types will be written to the file 4 2 5 Output the sub system information Full Name bool pe_printSubSystem char fileName char msg NULL 17 PanEngine 5 0 User s Guide Purpose output the currently selected sub system information to a file Arguments fileName file
6. user gt pe_findStablePoint pt msg if result false cout lt lt Error lt lt msg lt lt endl pause return 0 else pt gt print cout s33333 3535555555555 5 55555555555 555555 55555555555 55555555555 55 5 5 Calculate a series of stable points while temperature is changing SSS SSS SS SSS SS SSS SSS SSS SS SS SSS SSS SSS SSS SSS SSS SS SS SSS SSS SSS SS SSS SSS cout lt lt Calculating a series of stable points T changes n for int i 0 i lt 10 itt pt gt st TK 850 20 i result user gt pe_findStablePoint pt msg cout lt lt n pt gt print cout Calculate a series of stable equilibrium points while temperature and composition are changing cout lt lt Calculating a series of stable points T and x change n double xAl xMg xZn for i 0 i lt 10 i pt gt st TK 850 20 i xMg 0 1 0 01 i xZn 0 2 0 01 i xAl 1 xMg pt gt setX Al xAl pt gt setX Mg xMg pt gt setX Zn xZn result user gt pe_findStablePoint pt msg cout lt lt n pt gt print cout pe_deleteUser user return 1 26 PanEngine 5 0 User s Guide 27 Find a Local Phase Equilibrium lt lt endl 5 3 PanEngine Test Example 3 stable phase equilibrium local phase equilibrium
7. SSS S555 pt gt setT 400 pt gt setUnitX true pt gt setX Al 0 1 pt gt setX Mg 0 8 pt gt setX Zn 0 1 Calculate thermodynamic factor sss SSS SSS SS SS SS SSS SSS SS SSS SESS cout lt lt nCalculate thermodynamic factors Tij lt lt endl double Tij result user gt pe_getThermodynamicFactor pt Al Zn if result cout lt lt Error lt lt msg lt lt endl pause return 0 cout lt lt Tij Mg Zn lt lt Tij lt lt endl pt gt print cout cout lt lt nCalculate thermodynamic factors Tij lt lt endl result user gt pe_getThermodynamicFactor pt Al Al if result cout lt lt Error lt lt msg lt lt endl pause return 0 cout lt lt Tij Al Zn lt lt Tij lt lt endl 35 pt gt print cout Delete PanEngine User pointer pe_deleteUser user return 1
8. any working PanEngine 5 0 User s Guide directory where the user intends to place his her own codes for applications The library files can also be located in any other area and can be accessed by specifying their appropriate paths in the application program codes The current PanEngine can run on Windows 95 98 ME NT 4 0 2000 XP or higher The recommended programming environment with PanEngine is Microsoft Visual Studio C 6 0 which is the programming environment in which PanEngine was created If a user uses a different C compiler the PanEngine workspace file and project file may not work and then a completely new workspace and project files or make file need to be constructed by the user 2 2 Getting Started with PanEngine Using Microsoft Visual C 6 0 We assume that a full version of Microsoft Visual Studio C 6 0 is installed on the user s computer Follow the steps below to run the PanEngine test examples 1 Attach the CompuTherm hardware dongle to the computer 2 Start Microsoft Visual C 6 0 PanEngine 5 0 User s Guide Microsoft Visual C DOR 6 Edit View Insert Project Build Tools Window Help jals gt 3 emt A dal E alx Build Debug FindinFiles1 FindinFiles2 Results Tali gt Z 3 On the main menu of Microsoft Visual C 6 0 click File Open Workspace Go to the folder PanEngin
9. delete a User pointer These two functions are global functions 4 1 1 Define a User pointer Full Name extern C DECLEXPORT User pe_defineUser char msg Purpose define a User pointer and initialize it Arguments msg Message returned from PanEngine A PanEngine User pointer must be successfully initialized before PanEngine s other functions can be used If the CompuTherm dongle is not attached to the computer the initialization will fail 4 1 2 Delete a User pointer Full Name Purpose delete a User pointer after all calculations are done Arguments User pUser a defined and initialized User pointer After a User pointer pUser is deleted the system information inside PanEngine pointed to by pUser will be deleted and pUser will be a null pointer 4 2 Functions for System PanEngine API functions in the system level manage the system related information such as loading a thermodynamic database suspending or restoring phases 4 2 1 Load a thermodynamic database tdb Name bool pe_readTDBFile char tdbFileName char msg NULL Purpose load a thermodynamic database file in tdb format Arguments tdbFileName database file name msg Message 16 PanEngine 5 0 User s Guide Thermodynamic parameters are stored in files The tdb type of file is a text file which can be modified by the user using a text editor 4 2 2 Load a thermodynamic database pdb Full Name bool pe_readPDBFile char
10. lt lt endl result user gt pe_readPDBFile pdbFileName msg if result false cout lt lt Error lt lt msg lt lt endl return 0 SS SS SS SS Define a subsystem for current calculation sss SSS SS SS SSS SS SSS SSS SS SS SSS SSS SSS SSS SSS SSS cout lt lt Define which elements should be used in the calculation result user gt pe_defineSubSystem 3 Al Mg Zn if result false cout lt lt Error lt lt endl return 0 n Define a PanPoint pointer and initialize it cout lt lt Define and initialize a PanPoint lt lt endl PanPoint pt pt new PanPoint user gt pe_initializePanPoint pt cout lt lt Set temperature lt lt endl pt gt setT 700 PanEngine 5 0 User s Guide setUnitX true true for mole fraction setUnitX false for weight fraction if weight fraction must call the function user gt pe_stateSpacePointConversion_X_Wt amp pt gt st msg to convert weight fraction to mole fraction ssssss S555 5555 55 555 5 5 5 SS SS SS SS SS SS SS SS SSS SS SS SS 555555 cout lt lt Set composition lt lt endl pt gt setUnitxX true use mole fraction pt gt setX Al 0 1 pt gt setX Mg 0 8 pt gt setX Zn 0 1 cout lt lt Output the point conditions lt lt endl pt gt print cout cout lt lt nFind Stable Point n n result
11. lt lt endl return 0 char tdbFileName AlMgZn tdb bool result cout lt lt Reading database file lt lt endl result user gt pe_readTDBFile tdbFileName msg if result false cout lt lt Error lt lt msg lt lt endl return 0 jf presse sass a sa se eee see essa seaass cout lt lt Define which elements should be used in the calculation lt lt endl result user gt pe_defineSubSystem 3 Al Mg Zn if result false cout lt lt Error lt lt endl return 0 34 PanEngine 5 0 User s Guide Mg Tij msg Tig msg cout lt lt Define and initialize a PanPoint lt lt endl PanPoint pt pt new PanPoint user gt pe_initializePanPoint pt Suspend all phases in subsystem cout gt gt nSuspend all phases lt lt endl result user gt pe_suspendAllPhases msg if result cout lt lt Error lt lt msg lt lt endl return 0 else cout lt lt msg lt lt endl Restore one phase cout gt gt nRestore the 802 3 phase lt lt endl result user gt pe_restorePhase HCP_A3 msg if result cout lt lt Error lt lt msg lt lt endl return 0 sss SSS S55 SS SS SS SSS SSS SS SS SSS SSS SSS Set T and composition for a point ssssS S55 SSS SS 5 5 SSS SSS SSS SSS
12. restore all phases Arguments msg Message This function restores all phases in the subsystem 4 2 10 Set option Full Name bool pe_setOption int id int value char msg NULL set calculation options Arguments ia Option index value option value msg message This function sets the calculation options In the current version only the global search algorithm has the option to set id is 4001 for the global search algorithm option and value takes a value 01 0 or 1 The default value for the global search algorithm option is 0 The option value 1 is for a more intensive global search 4 3 Functions for Point Calculation PanEngine uses a specially designed global optimization algorithm to find the most stable phase equilibrium automatically without the user guessing initial values It also provides functions for performing metastable phase equilibrium calculations and other types of calculations The point related calculations in PanEngine API are described below 4 3 1 Initialize a point Full Name bool pe_initializePanPoint PanPoint panPt char msg NULL Purpose Initialize a PanPoint Arguments panet PanPoint pointer to be initialized msg message Calculation results will be stored in an object of class PanPoint Before using a 19 PanEngine 5 0 User s Guide PanPoint object or a pointer it has to be initialized with this function 4 3 2 Convert compositions between units Full Name
13. return 0 sModel SCHEIL cout lt lt nSolidification simulation with SCHEIL model lt lt endl result user gt pe_solidificationSimulation sModel pt calculationProgress msg if result false cout lt lt Error lt lt msg lt lt endl pause return 0 Delete PanEngine User pointer pe_deleteUser user return 1 31 PanEngine 5 0 User s Guide 5 6 Calculate Thermodynamic Properties fj eee eee aaeeseseaseeaesea s User user char msg 80 cout lt lt Defining User pointer lt lt endl user pe_defineUser msg cout lt lt msg lt lt endl if user NULL cout lt lt Error in defineUser lt lt endl return 0 char tdbFileName AlMgZn tdb bool result cout lt lt Reading database file lt lt endl result user gt pe_readTDBFile tdbFileName msg if result false cout lt lt Error lt lt msg lt lt endl return 0 cout lt lt Define which elements should be used in the calculation lt lt endl result user gt pe_defineSubSystem 3 Al Mg Zn if result false cout lt lt Error lt lt endl return 0 2222 saa saasaas sae sassaeasass Define a PanPoint pointer and initialize it cout gt gt Define and initialize a PanPoint lt lt endl PanPoint pt pt new PanPoint user gt pe_initializePanPoint pt
14. ssccsaictunnsverncetunsssbrsdactaversanconsousontebaaieadavteneennnebseieoaaaid 16 eE 16 1 2 Delete G USEr POET iota aA e E ARE 16 4 2 FUNCTIONS FOR SYSTEM ccour dinani eeren E ONE E eaten ARANEAE EEE RAE 16 16 4 2 2 Load a thermodynamic database 7 77 17 4 2 3 Define a Subsystem ccs sexi ee sees 17 4 2 4 Output the master system information ccccccesccescesscesetsscesecesceecesecseeesecesecseceseceeeeseceseceeeeaeceseeseceeeeneeeaeeees 17 4 2 5 Output the sub system information 17 4 2 0 SUSPON CDIUGS Css e SER eas EAE ages vo aa tak 18 2 7 SUSPENG all DNASCS irisi sade tatvanseiteeiasieds TRE E T eee scat dean utente a ee ae 18 4 2 8 Restore a Phas 18 4 2 9 010 all phas S corsini toizcactaentak ceghthi xieecaiadectea ies eigh das ee ees a 19 4210 S t 00 19 4 3 FUNCTIONS FOR POINT 19 43d 000 19 20 4 3 3 Find the globally stable equilibrium 0 20 4 3 4 Find Metastable CQuiliDrtest 20 4 3 5 Find the local thermodynamic Properties 21 4 3 6 Find the liguidus SUL ACE 2225 21 4 3 7 Find th liguidus SLOPE ssiri ruper ee vasesstspusisinsaoeidedndpechasansystedbqsssosbesahes EEE E 21 4 3 0 Find partition coefficient 22 4 3 9 Calculate a thermodynamic
15. 5 55 55 SS SS SS SS SS SS SS SS SS SSS SSS SS SS SS SS SS SS SS SS SS SS SS SS SS SSS SES Calculate a series of points for thermodynamic properties for phase PHI PHI phase has x Al x Mg x Zn 2 5 2 SSS S355 5555 5 5 55 SS SS SS SS SS SS SS SSS SS SSS SS SS SS SS SS SS SS SS SS SS SS SS SS SS SSS SEE out open GHS_PHI dat ios out out gt gt xAl txMg txZn tG tH ts n for i 0 i lt 100 1 double wtAl wtMg wtZn wtMg 0 01 wtZn 0 01 i wtAl 1 wtMg wtZn pt gt setT 300 pt gt setUnitX false pt gt setWt Al wtAl pt gt setWt Mg wtMg pt gt setWt Zn wtZn 33 PanEngine 5 0 User s Guide result user gt pe_getThermodynamicProperty pt PHI msg out lt lt pt gt phasePt 0 st comp 0 x gt gt t gt gt pt gt phasePt 0 st comp 1 x lt lt t gt gt pt gt phasePt 0 st comp 2 x lt lt t out lt lt pt gt phasePt 0 G gt gt t gt gt pt gt phasePt 0 H gt gt t lt lt pt gt phasePt 0 S lt lt endl pt gt print cout out close pe_deleteUser user return 1 5 7 Calculate a Thermodynamic Factor PanEngine Test Example 7 Calculate thermodynamic factor User user char msg 80 cout lt lt Defining User pointer lt lt endl user pe_defineUser msg cout lt lt msg lt lt endl if user NULL cout lt lt Error in defineUser
16. 55555555 Calculate the liquidus slope dT dxi ssssssss 55555555555 5555555555 5555 5 cout lt lt GetLiquidusSlope lt lt endl double slope result user gt pe_getLiquidusSlope pt Al slope msg 29 PanEngine 5 0 User s Guide if result cout lt lt Error lt lt msg lt lt endl pause return 0 else cout gt gt slope gt gt slope lt lt endl pt gt print cout SS Calculate the partition coefficient k double cout gt gt Calculate partition coefficient k lt lt endl result user gt pe_getK pt Liquid HCP_A3 Al k msg if result cout lt lt Error lt lt msg lt lt endl pause return 7 else cout lt lt k lt lt k lt lt endl ee Delete PanEngine User pointer pe_deleteUser user return 1 5 5 Solidification Simulation PanEngine Test Example 5 Solidification Simulation User user char msg 80 cout lt lt Defining User pointer lt lt endl user pe_defineUser msg cout lt lt msg lt lt endl if user NULL cout lt lt Error in defineUser lt lt endl return 0 sss SSS SS SSS SSS SS SS SS SS SS SS SS SSS SS SSS SSS SSS Load thermodynamic database in tdb Format sss SSS SS SS SSS SSS SS SSS SSS SS SS SSS SS
17. Error lt lt msg lt lt endl return 0 else cout lt lt msg lt lt endl Restore all phases cout gt gt nRestore all phases lt lt endl result user gt pe_restoreAllPhases msg if result cout lt lt Error lt lt msg lt lt endl pause return 0 else cout lt lt msg lt lt endl Suspend one phase cout lt lt nSuspend the fcc phase lt lt endl result user gt pe_suspendPhase FCC_A1 msg if result cout gt gt n nError lt lt msg lt lt endl return 0 cout lt lt nRestore the fcc phase lt lt endl result user gt pe_restorePhase FCC_A1 msg if result cout lt lt Error lt lt msg lt lt endl return 0 pe_deleteUser user return 1 24 PanEngine 5 0 User s Guide 25 Calculate the Stable Phase lt lt endl Equilibrium 5 2 User user char msg 80 cout lt lt Defining User pointer lt lt endl user pe_defineUser msg cout lt lt msg lt lt endl if user NULL cout lt lt Error in defineUser lt lt endl return 0 Load thermodynamic database in tdb Format char pdbFileName AlMgZn pdb bool result cout lt lt Reading database file
18. PanEngine 6 0 User s Guide Copyright 2000 2006 CompuTherm LLC PanEngine 6 0 User s Guide PanEngine 6 0 User s Guide Getting Help CompuTherm LLC is committed to providing you with the best possible product support Please select from the following options v Web Site www computherm com 1 info computherm com v Phone 1 608 274 1414 FAX 1 608 274 6045 v Mail CompuTherm LLC 437 S Yellowstone Dr Suite 217 Madison WI 53719 USA Declaration This document is furnished by CompuTherm LLC for information purposes only to licensed users of the PanEngine product and is furnished on an AS IS basis without any warranties expressed or implied Information in this document is subject to change without notice and does not represent a commitment on the part of CompuTherm LLC PanEngine 6 0 User s Guide PanEngine 6 0 User s Guide INTRODUCTION TO 1 GETTING STARTED WITH PANENGINE sissicisneriensaacinaraiesioetniadns 3 2 1 INSTALLATION OF PANE NGINE scccccsccateadstiiscnetenctccqecaantesiueiet EEEE EE EEE ARNES 3 2 2 GETTING STARTED WITH PANENGINE USING MICROSOFT VISUAL C 6 0 4 oom CONC EP amp eve ree N 8 3 1 GIBBS ENERGY MODELS FOR MULTI COMPONENT PHASES 9 3 2 PANENGINE CLASSES ssssicacecacsivassdapuneaseveudeutacaussenwauacnssnseseueciecosvansevinctadsessesneueeonanaans 10 7 79 00 este eles 14 4 1 FUNCTIONS FOR USER POINTER o s
19. SSS SSS SSS char tdbFileName AlMgZn tdb bool result cout lt lt Reading database file lt lt endl result user gt pe_readTDBFile tdbFileName msg if result false cout lt lt Error lt lt msg lt lt endl return 0 30 PanEngine 5 0 User s Guide cout lt lt endl lt lt Define which elements should be used in the calculation lt lt endl result user gt pe_defineSubSystem 3 Al Mg Zn if result false cout lt lt Error lt lt endl return 0 jj ease Beste se SoS ee ee ee ee Define a PanPoint pointer and initialize it 1 nn nL ee ere cout lt lt Define and initialize a PanPoint lt lt endl PanPoint pt pt new PanPoint user gt pe_initializePanPoint pt pt gt setT 1000 T is an initial guess for the liquidus surface pt gt setUnitX false using weight fraction pt gt setWt Al 0 1 pt gt setWt Mg 0 8 pt gt setWt Zn 0 1 user gt pe_stateSpacePointConversion_X_Wt amp pt gt st msg cout lt lt Output the point conditions lt lt endl pt gt print cout SOLIDIFICATION_MODEL sModel sModel LEVER cout lt lt nSolidification simulation with lever rule model lt lt endl result user gt pe_solidificationSimulation sModel pt calculationProgress msg if result false cout lt lt Error lt lt msg lt lt endl pause
20. alculate liquidus slope e Calculate partition coefficient e Calculate thermodynamic factor e Simulate solidification using Scheil or lever rule model PanEngine 5 0 User s Guide 2 Getting Started with PanEngine 2 1 Installation of PanEngine PanEngine is available only from CompuTherm LLC Once purchased a hardware dongle will be provided with PanEngine PanEngine will not run if the dongle is not attached to the user s computer s printer parallel port or USB port PanEngine consists of several different types of files As shown in Table 2 1 the PanEngine thermodynamic calculation interface includes two DLL files two library files three header files and some example programs Table 2 1 List of PanEngine Files File Name Comment PanEngine dll PanEngine dynamically linked library FrontDLL dll Numerical methods related dynamically linked library PanEngine lib PanEngine library file FrontDLL 1lib FrontDLL library file PanEngine h PanEngine header file std h Standard header file user h User API header file main cpp Main program misc cpp Miscellaneous functions e Ponnpine testesamples E AlMgZn tdb Example database file in tdb format AlMgZn pdb Example database file in pdb format EngineTest dsw VC 6 0 project workspace file EngineTest dsp VC 6 0 project file The installation of PanEngine is rather straightforward Simply copy all the files in the folder PanEngine6o in the PanEngine distribution CD to
21. ame name of the phase MODEL_TYPE model thermodynamic model for the phase Comments phase names are defined in the database 12 PanEngine 5 0 User s Guide 3 2 6 class PanPhasePoint PanPhasePoint more information for a phase after a calculation the state space thermodynamic properties species concentrations etc PanPhasePoint PanPhasePoint PanPhasePoint const PanPhasePoint int getNumComp number of components in the phase string name phase name PanStateSpace st statespace of the phase point double G Gibbs free energy double H enthalpy of the phase double 5 entropy double Cp heat capacity vector lt double gt y species fraction on sublattice or internal variables vector lt string gt yName species name double fraction phase fraction default in atomic scale Class Name Definition Public Functions Public Properties Comments the objects of this class will be created by PanEngine after calculation 3 2 7 class PanPoint Class Name PanPoint Definition an equilibrium state with one or more phase points PanPhasePoint Public Functions PanPoint PanPoint PanPoint const PanPoint void 5661 double set temperature in K void setUnitX bool true for mole fraction false for weight fraction void setX char compName double x set composition in mole fraction for a specified component void setWt char
22. bool pe_stateSpacePointConversion_X_Wt PanStateSpace panSt char msg NULL Purpose convert compositions between mole fraction and weight fraction Arguments panst PanStateSpace pointer msg message This function converts the compositions in panSt between mole fraction and weight fraction If panSt gt unitxX is true the composition is given in the unit of mole fraction and this function converts the composition from the unit of mole fraction to that of weight fraction If panSt unitX is false the composition is given in the unit of weight fraction and this function converts the composition from the unit of weight fraction to that of mole fraction 4 3 3 Find the globally stable equilibrium Full Name bool pe_findStablePoint PanPoint panPt char msg NULL find globally stable equilibrium panpt PanPoint pointer msg message Before calling this function to calculate the stable phase equilibrium the state space for this point ie the calculation conditions have to be defined See the test examples in the next section for how to define such calculation conditions 4 3 4 Find a metastable equilibrium Full Name bool pe_findLocalPoint PanPoint panPt char msg NULL find metastable equilibrium panpt PanPoint pointer msg message This function uses a local optimization algorithm for solving the phase equilibrium It requires that panPt have initial values from a previous calculation or the user s input The example give
23. compName double wt set composition in weight fraction for a specified component PanStateSpace st statespace for a PanPoint vector lt PanPhasePoint gt phasePt information for each phase double fs solid fraction solidified so far including this step double 1 liquid fraction remained after this step double Hm summation of H for the system solid liquid phases double Cp summation of Cp for the system solid liquid phases for solidification a PanPoint includes the fraction of solid and liquid 13 Public Properties Comments PanEngine 5 0 User s Guide 4 PanEngine API The functions of the PanEngine application program interface API are defined as virtual functions in a class of User in user h except for the two global functions used for defining a User pointer and deleting an existing User pointer These functions can be divided into four categories according to their purposes 1 User Pointer e define a User pointer and initialize it e delete an existing User pointer 2 System e load a thermodynamic database e define a sub system e suspend one phase e restore one phase e suspend all phases e restore all phases e set an option 3 Point Calculation e define a PanPoint pointer and initialize it e find the globally stable equilibrium e find the metastable equilibrium e find a local thermodynamic properties of a phase e other functions i f
24. e in the user s hard drive and open EngineTest dsw Open Workspace Look in E PanEngine5 Ev EngineTest dsw File name EngineT est Files of type Workspaces dsw mdp Cancel PanEngine 5 0 User s Guide 4 Go to File View in the left window of the VC6 main window and double click on the file main cpp in the folder of Source Files EngineTest Microsoft Visual C main cpp B File Edit View Insert Project Build Tools Window Help af x R g Workspace EngineTest 1 E EngineTest files Source Files extern int test_PanEngine int Dp extern void pause misc cpp PanEngineTest cpp 6 4 Header Files E panengine h E std h E user Resource Files int main int example example 6 8 1 test all examples 14 7 1 test individual example test_PanEngine example pause return 1 5 ClassView Z FileView Find in Files 1 Results Find in Files 2 5 Rebuild EngineTest by click Build Rebuild All 6 Press F5 to run the test examples A DOS window will pop up and intermediate results of the calculations will be shown in this window The final status of the window looks like the following one except that the path name on the top of the window will depend on the location of PanEngine6 PanEngine 5 0 User s Guide cx E prog
25. e diagram PanPoint refers to a system with a specified composition at a certain temperature and pressure A PanPoint object is directly interfaced with the user s code The user can change the conditions temperature or overall compositions of the system through a PanPoint object and get back the thermodynamic properties and phase equilibrium information under the newly specified conditions The stable or metastable phase equilibria information of the system such as phase fractions composition of each phase and thermodynamic properties for each phase are described by PanPhasePoint Class General information about the system such as alloying components alloy overall composition and temperature are stored in PanStateSpace class In the following we will first give a brief introduction of thermodynamic models and then describe the different classes used in PanEngine PanEngine 5 0 User s Guide 3 1 Gibbs Energy Models for Multi Component Phases 3 1 1 Stoichiometric compound The Gibbs energy of a stoichiometric phase is expressed as G Yxa 6 i l where X is the mole fraction of component i G is the Gibbs energy of the pure component i with structure and G is the Gibbs energy of formation of the stoichiometric phase referred to the structure for each component i 3 1 2 Disordered solution phase The Gibbs energy of a disordered solution phase is expressed as G xG RTD x In G i 1 i 1 where X i
26. ies PanSpecies string name species name vector lt PanComponent gt comp components in PanSpecies vector lt double gt b stoichiometric corresponding to comp associate model uses PanSpecies to define the species of the associates 11 Class Name Definition Public Functions Public Properties Comments PanEngine 5 0 User s Guide 3 2 4 class PanStateSpace Class Name PanStateSpace Definition PanStateSpace describes temperature and composition of a system or a phase Public Functions PanStateSpace PanStateSpace PanStateSpace const PanStateSpace amp void setX string amp name double x set composition in mole fraction for specified component double getX string amp name return composition in mole fraction for specified component void setWt string amp name double wt set composition in weight fraction for specified component double getWt string name_ return composition in mole fraction for specified component Public Properties vector lt PanComponent gt comp components in a system or components in a phase double tT system temperature Comments most of calculation conditions are set through this class 3 2 5 class PanPhase Class Name PanPhase Definition information about a phase the name the model type etc Public Functions PanPhase PanPhase PanPhase const PanPhase amp Public Properties string n
27. in thermodynamics and phase equilibria calculations Custom Software Applications PanEngine can be used by users to create custom software applications such as e Microscopic solidification simulations o Microstructure e g the secondary dendrite arm spacing o Microsegregation e g the concentration profile within a dendrite arm e Macroscopic solidification simulations o Casting simulations PanEngine provides enthalpy and the fraction solid as a function of temperature e Heat treatment simulations e Other applications where phase equilibrium information and thermodynamic properties are needed such as the cellular automaton CA and phase field simulation Advantages of PanEngine PanEngine finds the correct stable phase equilibria without requiring the user to guess initial values This is especially important because it is very difficult for the user to enter initial values and verify results when a custom software program needs stable phase equilibrium information for thousands of points For multi component systems it is almost impossible to guess initial values for stable phase equilibria PanEngine 5 0 User s Guide API in PanEngine PanEngine s API has many commonly used functions Some of them are listed below and more details will be given in the following sections e Load database e Set components e Suspend restore phases e Set calculation conditions e Calculate stable equilibrium e Find liquidus surface e C
28. ind the liquidus surface ii calculate the liquidus slope iii calculate the equilibrium partition coefficient iv calculate the thermodynamic factor 4 Solidification Simulation e lever rule e Scheil model The following table summarizes the functions of PanEngine API These functions will be explained in detail in the next section 14 PanEngine 5 0 User s Guide Table 4 1 List of PanEngine API Functions Functions extern C DECLEXPORT User pe_defineUser char msg extern C DECLEXPORT void pe_deleteUser User pUser Comments define a User object User Pointer delete a User object bool pe_readTDBFile char tdbFileName char R err msg NULL load thermodynamic database pe_readPDBFile char pdbFileName char load encrypted thermodynamic database define a sub system with n bool pe_defineSubSystem int numComponents components A B C output master system 1 pe_printMasterSystem char fileName char d b 1 2 NULL database information to a file System 0 pe_printSubSystem char fileName char msg output su system information JED to a file pe_suspendPhase char phaseName char msg suspend one phase _suspendAllPhases char msg NULL suspend all phases 1 torePh har phaseName char pe_restorePhase char phaseName char msg restore one phase restore all phases pe_setOption int id int value char msg set option pe_initializePanPoint PanPoint panP
29. l pe_get ThermodynamicFactor PanPoint panPt char compName_solvent char compName_i char compName_j 8000168 Tij char msg Purpose calculate the thermodynamic factor rij pant PanPoint pointer compName_solvent Component name for solvent compName_i Arguments name for component i compName_j name for component j rij thermodynamic factor msg message The thermodynamic factor is defined as T u xX J 4 4 A Function for Solidification Simulation PanEngine has another API function used in solidification simulations There are two models available lever rule and Scheil During each simulation step results can be monitored through a calculation progress function pointer bool pe_solidificationSimulation SOLIDIFICATION_MODEL model PanPoint panPt Full Name x ProgressPtr prog_ptr char msg NULL Purpose solidification simulation model Simulation model panet point with specified composition prog_ptr calculation progress function pointer msg message Arguments Details on how to use this function will be demonstrated in test example 5 22 PanEngine 5 0 User s Guide Examples 5 This chapter demonstrates how to use PanEngine API functions All the 23 Define User Pointer Load Database etc examples given in this chapter can be found in the file PanEngineTest cpp 5 1 PanEngine Test Example 1 define a PanEngine user pointer database read define s
30. n code and PanEngine are through the objects of PanEngine classes as mentioned at the beginning of this chapter The headers of PanEngine classses are included in the file PanEngine h The major PanEngine classes with frequently used functions and properties are described below 3 2 1 class PanElement Class Name PanElement Definition an element from the periodic table such as Al Public Functions PanElement PanElement const PanElement amp PanElement Public Properties string name element name Comments define an element from the periodic table 10 PanEngine 5 0 User s Guide 3 2 2 class PanComponent PanComponent a component is made up of one or more elements for example Al or FeO PanComponent PanComponent const PanComponent PanComponent string name component name vector lt PanElement gt ele element s in the component double mu chemical potential of the component double h enthalpy of the component double s entropy of the component e double cp heat capacity of the component double x atomic fraction of this component double wt weight fraction of this component PanComponent holds information for a component Class Name Definition Public Functions Public Properties Comments 3 2 3 class PanSpecies PanSpecies species can be made up of one or more components for example O2 PanSpecies PanSpecies const PanSpec
31. n in Section 5 3 uses the function of pe_findStablePoint to find the initial values for the starting point in a series of metastable phase equilibrium calculations However the calculated phase equilibrium can be globally stable one or a metastable one which depends upon the initial values from the previous calculation 20 PanEngine 5 0 User s Guide 4 3 5 Find the local thermodynamic properties bool pe_getThermodynamicProperty PanPoint panPt char phaseName char msg Full Name NULL Purpose find local thermodynamic properties of a phase Arguments panPt PanPoint pointer phasename phase name msg Message This function calculates the thermodynamic properties for a given phase point with the default reference states defined in the database It does not check the possibility of a miscibility gap being formed by the phase 4 3 6 Find the liquidus surface Full Name bool pe_findLiquidusSurface PanPoint panPt char msg NULL Purpose find liquidus surface temperature for given composition Arguments panPt PanPoint pointer msg message This function calculates the liquidus surface temperature for a given point of selceted composition A good initial liquidus surface temperature value helps to find the liquidus surface faster A poor initial value does not give difficulty in finding the liquidus temperature If the initial temperature is not provided a default value of 1000K will be used in PanEngine No matte
32. name to output msg Message This function outputs the currently selected sub system information into a text file with a given name If the database is of the type pdb only the information on phase names and phase types will be written to the file 4 2 6 Suspend a phase Full Name bool pe_suspendPhase char phaseName char msg NULL suspend one phase Arguments phaseName the name of the phase to be suspended msg message Some calculations require some phases to be suspended This function suspends the phase with a specified phase name Only one phase can be suspended with this function If the phase with the name does not exist this function returns false 4 2 7 Suspend all phases Full Name pe_suspendAllPhases char msg NULL Purpose suspend all phases Arguments msg Message All the phases in the subsystem will be suspended Combination of this function with the following function suspends all but one phase 4 2 8 Restore a phase Full Name bool pe_restorePhase char phaseName char msg NULL Purpose restore one phase phaseName the name of the phase to be restored msg message This function restores a phase with the given phase name which has previously been suspended If the phase with the name does not exist in database this function returns false 18 PanEngine 5 0 User s Guide 4 2 9 Restore all phases Full Name bool pe_restoreAllPhases char msg NULL Purpose
33. r what the initial temperature is PanEngine will find the stable liquidus surface 4 3 7 Find the liquidus slope bool pe_getLiquidusSlope PanPoint panPt char compName double amp slope char Full Name megi i Purpose calculate liquidus slope for a component on the liquidus surface Arguments panPt PanPoint pointer comprame component name slope slope msg message This function calculates the liquidus slope along the direction of a specified component on the liquidus surface for a point with given composition The liq slope is defined as where T is the liquidus surface temperate and x is X J the mole fraction for the specified component j 21 PanEngine 5 0 User s Guide 4 3 8 Find a partition coefficient Full Name ee ee ea panPt char phaseNamel char phaseName2 char compName Purpose calculate the partition coefficient k between phaseName1 and phaseName2 for a specified component compname at given state space Atgaments panPt PanPoint pointer phasenamei first phase name phaseName2 second phase name compName Component name x partition coefficient msg message This function calculates the partition coefficient for a component between two gl a equilibrium compositions for the component j in the phases 1 and 2 respectively phases The partition coefficient is defined as k where x and are the 4 3 9 Calculate a thermodynamic factor Full Name boo
34. ram 2006 PanEngine5 EngineTest exe x Calculate thermodynamic factors Tij TijtAl Zn gt 83145 1 T 1888 K 726 85 C Components AL MG ZN 8 1 mu 61839 3 8 8 mu 48965 6 8 1 mu 77922 Phases LIQUID 1 T 1888 K gt 726 85 62 Components AL MG ZN 8 1 mu 61839 3 6 8 mu 48965 6 6 1 mu 77922 53148 6 28966 3 82 5 33 7599 AL MG ZN lt lt key to continue 7 Press any key and return to the VC6 main window The default option for testing PanEngine is to test all seven examples To test an individual example change the integer variable example in main function see the image in Step 4 In the following we will introduce some basic concepts used in PanEngine and describe the details of the API and the test examples PanEngine 5 0 User s Guide 3 Basic Concepts PanPhasePoint PanElement PanPhase z Stoichiometric Compound PanPoint Disordered Solution PanComponent Ordered intermetallic Phase PanStateSpace PanSpecies In the CALPHAD approach the Gibbs energies of all the phases in an alloy system are described by thermodynamic models such as the ones for stoichiometric phases the regular solution type model for disordered phases and the sublattice model for ordered phases with a range of homogeneity or an order disorder transition These types of models have been implemented in PanEngine In PanEngine as shown in the abov
35. s the mole fraction of component i G is the Gibbs energy of the pure component i with structure R is gas constant and T is the absolute temperature G is the excess Gibbs energy of the phase defined as n Get DS gt Aik jhi DLV k 0 i j 1 i j i j J l i j 1 k i j l where the first term represents the binary interaction terms the second represents ternary interactions The 0 p S are binary interaction parameters for the tj binary and the L s are ternary interaction parameters V is defined l1 2 p i j l as V X n 3 1 3 Ordered intermetallic phase using the compound energy formalism The Gibbs energy of an ordered intermetallic phase is described as PanEngine 5 0 User s Guide G G G G where G is expressed in terms of compound energies which are constant at constant temperature and their associated sublattice species concentrations y Gt yiyi y Geg G is the ideal mixing term which assumes the random mixing of species on each sublattice 1 m 07 gt f y ny i l G is also expressed as a function of species concentrations with the sublattice L parameters being the numerical coefficients in the contributing terms 0 DY Loar where Loper 7 yy 3 2 PanEngine Classes PanEngine is a dynamically linked library of thermodynamic and phase equilibrium calculation functions Most of the communications between the user s applicatio
36. t char T NULL initialize a PanPoint Boer convert a state space between pe_stateSpacePointConversion_X_Wt PanStateSpace mole fraction and weight panst char msg NULL fraction bool pe_findStablePoint PanPoint panPt char find globally stable equilibrium bool pe_findLocalPoint PanPoint panPt char msg find meta stable equilibrium 5 NULL Point 5 Calculation bool pe_getThermodynamicProperty PanPoint find local thermodynamic panPt char phaseName char msg NULL properties of a phase bool pe_findLiquidusSurface PanPoint panPt x 2 x ENR gat 2 R find liquidus surface bool pe_getLiquidusSlope PanPoint panPt char compName double amp slope char msg calculate liquidus slope bool pe_getK PanPoint panPt char phaseNamel calculate equilibrium partition char phaseName2 char compName double k ier char msg coefficient virtual bool pe_getThermodynamicFactor PanPoint calculate thermodynamic panPt char compName_solvent char compName_i char compName_j double amp Tij char msg factor of one phase Solidification 200 pe solidificationSimulation 2 simulate solidification with SOLIDIFICATION_MODEL model PanPoint panPt ProgressPtr prog_ptr char msg NULL lever rule or Scheil model 15 PanEngine 5 0 User s Guide 4 1 Functions for User Pointer There are two functions associated with the User pointer define a User pointer and
37. t n n result user gt pe_findStablePoint pt msg if result false cout lt lt Error lt lt msg lt lt endl pause return 7 else pt gt print cout Calculate a series of local phase equilibria Use the previous phase equilibrium results as the initial values for local equilibrium 2 cout gt gt Calculating a series of local points T changes n for int i 0 i lt 10 i pt gt st TK 850 20 i result user gt pe_findLocalPoint pt msg cout lt lt pt gt print cout Delete PanEngine User pointer pe_deleteUser user return 1 5 4 Find the Liquidus Surface ft PanEngine Test Example 4 Calculate liquidus surface Calculate liquidus slope Calculate distribution coefficient J fase ase ase a User user char msg 80 cout lt lt Defining User pointer lt lt endl user pe_defineUser msg 28 PanEngine 5 0 User s Guide cout lt lt msg lt lt endl if user NULL cout lt lt Error in defineUser lt lt endl return 0 sss SSS SSS SS SS SS SS SS SS SS SS SSS SS SSS SSS SSS SES Load thermodynamic database in tdb Format sss SSS SSS SS SS SS SSS SS SSS SS SSS SS SSS SSS SSS SSS char tdbFileName AlMgZn tdb bool result cout
38. ubsystem suspend phases restore phases delete a PanEngine user pointer User user char msg 80 cout lt lt Defining User pointer lt lt endl user pe_defineUser msg cout lt lt msg lt lt endl if user NULL cout lt lt Error in defineUser lt lt endl return 0 SS SS SS Load thermodynamic database in tdb Format sss SSS SSS SS SSS SS SS SS SSS SS SSS SS SS SSS SS SS SES char tdbFileName AlMgZn tdb bool result cout lt lt Reading database file lt lt endl result user gt pe_readTDBFile tdbFileName msg if result false cout lt lt Error lt lt msg lt lt endl return 0 SSS SS SS SSS SSS Define a subsystem for current calculation aassss sss SSeS SSS SS Se SSS esse sees aeaaaaa cout lt lt endl lt lt Define which elements should be used in the calculation lt lt endl result user gt pe_defineSubSystem 3 Al Mg Zn if result false cout lt lt Error lt lt endl return 0 PanEngine 5 0 User s Guide cout lt lt Write database information to master dat lt lt endl user gt pe_printMasterSystem master dat cout lt lt Write subsystem database information to sub dat lt lt endl user gt pe_printSubSystem sub dat cout lt lt nSuspend all phases lt lt endl result user gt pe_suspendAllPhases msg if result cout lt lt

Download Pdf Manuals

image

Related Search

Related Contents

Section-5 Air Brakes - Pennsylvania Department of Transportation  Massive Wall light 17181/06/10  Nobo 1900399  Philips NIVEA 7000 series Electric shaver HQ7330  第14編上水道編  ODEL# CRCD2805  Application Note  OWNER`S MANUAL - Cloudfront.net  9” BAND SAW  

Copyright © All rights reserved.
Failed to retrieve file