PanPhaseField SDK
PanPhaseField SDK Manual

Overview of SDK

PanPhaseField SDK is a comprehensive environment for developing PanPhaseField plugins that can easily run in both GUI and console mode, and in mutiple OS. With the PanPhaseField SDK, plugins can directly get the needed thermodynamic input from CALPHAD database and use Pandat GUI to visualize their simulation results.

Features of PanPhaseField SDK include:

  • A comprehensive environment for developing PanPhaseField plugins.
  • A direct coupling between phase-field models and CALPHAD method in a fast and efficient way. No curve fitting of Gibbs energy is needed and no assumption of pseudo binary or ternary is necessary. Phase-field simulation of multi-component commercial alloys becomes a reality!
  • Two plugin templates (solidification and spinodal decomposition) are provided for a quick start of implementing cutomized phase-field models.
  • Work in both console mode and GUI mode.
  • Convenient inputs and powerful 1D/2D/3D visualization based on the VTK engine are provided. The simulation results in VTK files are also compatible with ParaView. Model parameters are stored in the phase-field database file (.pfdb), which allows users to manage these parameters easily.
  • Plugins can run in different computing environments: Windows/Linux PC, Clusters and Cloud machines.

How to use this SDK in Windows OS

Step 1. Open the PanPhaseFieldSDK folder

In console mode folder, user can:

  • Run phase-field simulations in console mode.
  • Build user-defined console mode executables (See source/ folder)
  • Build user-defined plugins (See User_Plugin_Examples/ folder)
  • Access resources of PanPhaseField SDK:
    • For console mode executable, see include/ and lib/ folders.
    • For each plugin example, see User_Plugin_Examples/APP_NAME/include/, User_Plugin_Examples/APP_NAME/lib/, User_Plugin_Examples/APP_NAME/PanResult/ and User_Plugin_Examples/APP_NAME/PFM_SDK/ folders.

Step 2. Run a phase-field simulation in console mode

We can run a phase-field simulation in console mode without opening GUI. Results from console mode can be visualized after importing to Pandat's GUI.

Note
See the instruction on importing console-mode results to Pandat's GUI.

To perform a simulation in console mode, we can run a Windows batch file (.bat) or a Linux/Unix shell script (.sh).
Example .bat files and .sh files are in PanPhaseFieldSDK/bin/windows/Examples/ and PanPhaseFieldSDK/bin/linux/Examples/
Pandat batch file (.pbfx) is passed as an argument to the console mode, for example in Windows batch file (.bat):

In this case, Precipitation_AlNi_1D.pbfx must contain the following line

It is important to specify the app name (app="precipitation") for the PanPhaseFieldSDK.exe to perform the simulation by loading the pre-installed application PFM_Precipitation.dll. There is another pre-installed application PFM_Spinodal.dll whose app name is "spinodal":

Besides the pre-installed applications, users can also simulate with user-defined plugins. User-defined plugin (application) must be stored in bin/windows/PanPhaseField_Plugins/ in Windows OS:

or bin/linux/PanPhaseField_Plugins/ in Linux OS

Step 3. Build a new user-defined plugin

Note
Follow instructions on Spinodal decomposition plugin to edit a new plugin.

3.1. Inside User_Plugin_Examples/ folder, copy any of the templates and rename it.

3.2. Inside User_Plugin_Examples/USER_PFM_YOURAPP/, rename the project to a user-defined name.

3.3. Open "PanPhaseFieldSDK/PanPhaseField_ConsoleMode.sln" in Visual Studio 2015 or later.
Add the plugin to the console-mode environment.
Right-click "User_Model_Plugin" in the "Solution Explorer". Select "Add->Existing Project..." and choose the created USER_PFM_YOURAPP project

3.4. The loaded project will show its old name. Rename the loaded project to a new one that is different from what is copied.

3.5. Register plugin with Pandat : For registering the plugin with Pandat, we need to change the plugin details within the source code.

3.6. Rebuild the new plugin in Visual studio and make sure that there is no error.

Warning
Visual Studio Configuration must be Release and x64

3.7. The built plugin should be USER_PFM_YOURAPP/bin/USER_PFM_YOURAPP.dll

3.8 Remember to copy this USER_PFM_YOURAPP.dll to PanPhaseFieldSDK/bin/windows/PanPhaseField_Plugins/ so that console mode executable can use it. Run the example batchfile PanPhaseFieldSDK\bin\windows\Examples\user_plugin\plugin_spinodal\resource\Spinodal_60Cr20Ni_700C_2D.pbfx by modifying the "app" to USER_PFM_YOURAPP in the batchfile as shown below. If the plugin runs successfully, go ahead and modify this new plugin according to the instructions in Spinodal plugin.

<calculation name="FeCrNi 60Cr20Ni 700C 2D" type="phasefield" app="USER_PFM_YOURAPP">
Note
Follow instructions in Step 2. Run a phase-field simulation in console mode for running the new plugin in console mode.

Highlights of SDK

  • In addition to basic thermodynamic data (Gibbs energy, chemical potential, phase fraction, phase composition) and kinetic data (like atomic mobility) by activating extended output mode (look at Set_PFM_SDK_Mode()), users can also calculate
    • Latent heat of Solidification.
    • Specific heat of individual phases.
    • Liquidus surface.
    • Solidus and Liquidus slope of phase diagram.
    • Thermodynamic factors of individual phases.
  • User-defined properties of the microstructure can be calculated on-the-fly and will be made available in the Pandat result table for further analysis (Look at pandat_result_utility::Pandat_Result_Table::update_pandat_result_table_custom()). Sample code is implemented in the spinodal plugin.
SPINODAL PLUGIN: The difference between the maximum and minium concentration in the microstructure for each element is shown as a function of time. This quantity is calculated using "custom_property" feature.
  • Upto 256 custom parameters can defined in *.pfdb file for each phase. Implementation can be found in the solidfication plugin
    Illustration of custom parameter from the solidfication plugin. The underlined lines (green color) in *.pfdb highlight the dynamic parameter feature of the SDK.
  • User-defined SDK variables and dynamic parameters (which is a function of SDK variables) can also given as input in *.pfdb file. Implementation can be found in the solidfication plugin.
  • Additionally, user can define custom logfile to track the progress of the simulation (Look at plugin_log_utility::PFPLUGIN_LOG())