User-defined Plugin: Pure Solidification
Pure-Solidification Plugin Template Manual

Class diagram of pure-solidification plugin

How to use this template for generating a custom plugin

Note
It is recommended that plugins are built inside console-mode environment. (Open "PanPhaseField_ConsoleMode/PanPhaseField_ConsoleMode.sln")
Follow the instruction of PanPhaseField SDK to use the environment.

Step 1: Add user-defined model

1.1. Create a copy of this plugin by following the instructions here.

1.2. Replace the content of user_pfm_solidification::run_pfm_calculation with user's source codes.

1.3.To assign model parameter value through PhaseField Database (.pfdb) file, it is optional to edit user_pfm_solidification::load_arguments. For example, a custom parameter can be added in source code:

auto custom_pars = args_ext.custom_parameters();
double val = 0.0;
auto it = custom_pars.find("my_parameter");
if (it != custom_pars.end()) {
val = it->second;
}

1.3. To assign the value of this custom parameter, edit "Custom Parameters" Table of pfdb in the following way:

<ParameterTable type="custom" name="Custom Parameters">
<Parameter name="my_parameter" value="0.1" description="Custom parameter"/>
</ParameterTable>

See full features of pfdb file in Syntax and Examples of Phase-Field Database File (.PFDB) of Pandat's manual.

Step 2: Get thermodynamic/kinetic properties from PanPhaseField SDK

An example of getting thermodynamic/kinetic properties from PanPhaseField SDK is shown in user_pfm_solidification::sdk_update_prop. For example to get Gibbs free energy of solid and liquid phases:

// output is a PFM_SDK_Output_Data object
m_pfm_sdk->get_pt_val(thread_id, solid_phase_id, &input, &output, msg_char);
double G_solid = output.phase_Gibbs_energy[0]; // Solid Gibbs free energy
m_pfm_sdk->get_pt_val(thread_id, liquid_phase_id, &input, &output, msg_char);
double G_liquid = output.phase_Gibbs_energy[0]; // Liquid Gibbs free energy

See details about how to use available properties in PanPhaseField SDK's document.

(Optional Step) Customize the solidification model in this template

Besides adding a new model, user can choose to customize the solidification model in this plugin template. Edit the following methods in pfm_solidification_model.cpp to customize the model:

See details of these methods by clicking links or view the source code.

(Optional Step) Disable optional source codes

Optional source codes are related to Pandat result table writer, Pandat GUI's progress message, and some Performance logs. To disable these source code, simply modify:

See details of the Macro definition by clicking links.