User-defined Plugin: Spinodal Decomposition
Spinodal Decomposition Plugin Template Manual

Class diagram of spinodal decomposition 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 phase-field model

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

1.2. Replace the content of user_pfm_spinodal::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_spinodal::load_arguments. For example, a custom parameter for the matrix phase 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.4. 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>

1.5. Optionally, the user can also control interpolation step-size of PanDataNet through *.pfdb file as shown below:

<ParameterTable type="PDN_config" name="Step sizes of the interpolation in the datanet">
<Parameter type="PDN_x_step" value="0.01" description="Step-size for the concentration" />
<Parameter type="PDN_T_step" value="0.5" description="Step-size for the temperature interpolation" />
<Parameter type="PDN_f_step" value="0.01" description="For KKS engine; Step-size for phase-fraction interpolation" />
</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_spinodal::sdk_update_prop. For example to get chemical potential:

// output is a PFM_SDK_Output_Data object
m_pfm_sdk->get_pt_val(thread_id, phase_id, &input, &output, msg_char);
for (int ic = 0; ic < ncomp - 1; ic++) {
double mu_ic = output.mu[ic] - output.mu[ncomp - 1]; // chemical potential relative to last element
}

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

(Optional Step) Customize the spinodal model in this template

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

See details of these methods by clicking their link 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.