User-defined Plugin: Spinodal Decomposition
user_pfm_spinodal Class Reference

An example phase-field model of spinodal decomposition. More...

#include <user_pfm_spinodal.h>

Inherits I_PFM_APP_Interface.

Public Member Functions

 user_pfm_spinodal ()
 
 ~user_pfm_spinodal ()
 
void load_arguments (PF_ARGS *m_args, char *msg_char)
 
void run_pfm_calculation (char *msg)
 
bool sdk_update_prop (string &msg)
 
void sdk_get_chemical_mobility (double(*chemical_mobility)[PDN_BSZ][PDN_BSZ], double(*atomic_mobility), double(*composition))
 
void model_allocate_memory ()
 
bool model_initial_condition (string irun="Random")
 
void model_update_laplace_operation ()
 
void model_update_rate ()
 
bool model_update_field (double dt)
 

Detailed Description

An example phase-field model of spinodal decomposition.

An example phase-field model of spinodal decomposition

Note
Please follow the parts to implement your phase-field model

Part 1. Constructor and Destructor

Constructor: user_pfm_spinodal::user_pfm_spinodal();
Destructor: user_pfm_spinodal::~user_pfm_spinodal();
Default constructor and destructor without any arguments must be defined.
These will be used by class SPINODAL_app_Creator. For example:

I_PFM_APP_Interface * SPINODAL_app_Creator::Create()
{
return new user_pfm_spinodal(); // calling constructor
}
I_PFM_APP_Interface * Create()
Definition: user_pfm_spinodal.h:342
user_pfm_spinodal()
Definition: pfm_spinodal.cpp:290

and

void SPINODAL_app_Creator::Delete(I_PFM_APP_Interface* user_app) {
if (user_app != NULL)
{
delete user_app; // calling destructor
}
}
void Delete(I_PFM_APP_Interface *user_app)
Definition: user_pfm_spinodal.h:351

Part 2. Plugin's interface with PanPhaseField

Load arguments from PanPhaseField: user_pfm_spinodal::load_arguments;
Run simulation user_pfm_spinodal::run_pfm_calculation;
These will be called by PanPhaseField GUI or console mode and must be implemented

Warning
the interface methods' signature must be strictly followed!

Part 3. PanPhaseField SDK related

(a) Call PanEngine/PanDataNet Through PanPhaseField SDK
(b) Convert physical properties from PanPhaseField SDK output to properites used by model, for example converting atomic mobility (from PanPhaseField SDK) to chemical mobility

Part 4. Phase-field model related

User must update a set of methods to implement customized phase-field model
(a) Allocate memory
(b) Set initial condition
(c) Time-integration related functions, for example laplace operation on chemical profile, calculating chemical diffusion rate, and updating chemical profile

Class diagram of this plugin

Constructor & Destructor Documentation

◆ user_pfm_spinodal()

user_pfm_spinodal::user_pfm_spinodal ( )

Part 1 (a). Constructor

◆ ~user_pfm_spinodal()

user_pfm_spinodal::~user_pfm_spinodal ( )

Part 1 (b). Destructor

Member Function Documentation

◆ load_arguments()

void user_pfm_spinodal::load_arguments ( PF_ARGS *  m_args,
char *  msg_char 
)

Part 2 (a). Plugin's interface with PanPhaseField: Loading arguments from PanPhaseField

PanPhaseField SDK is also created inside this method
load_arguments(PF_ARGS* args, char* msg) Load arguments from PanPhaseField (APP interface)

Note
User must follow Step 2(a) of this mehtod to include more argument from PF_ARGS
Parameters
[in]m_argsthe argument from PanPhaseField
[out]msg_charthe message from this method
Warning
the interface method's signature must be strictly followed!

◆ run_pfm_calculation()

void user_pfm_spinodal::run_pfm_calculation ( char *  msg)

Part 2 (b). Plugin's interface with PanPhaseField: Run phase-field simulation

Load arguments from PanPhaseField (App interface)

Parameters
[out]msgthe message from this method
Warning
the interface method's signature must be strictly followed!

◆ sdk_update_prop()

bool user_pfm_spinodal::sdk_update_prop ( string &  msg)

Part 3 (a). PanPhaseField SDK related: Call PanEngine/PanDataNet Through PanPhaseField SDK

Update thermodynamic/kinetic properties of the entire system

Note
only chemical potential and atomic mobility is obtained from this method. User needs to modify it to obtain more properties
Parameters
msgthe message returned by this method
Returns
true if properties are updated normally

◆ sdk_get_chemical_mobility()

void user_pfm_spinodal::sdk_get_chemical_mobility ( double(*)  chemical_mobility[PDN_BSZ][PDN_BSZ],
double *  atomic_mobility,
double *  composition 
)
inline

Part 3 (b). PanPhaseField SDK related: Convert physical properties for phase-field model

Convert atomic mobility to chemical mobility

Parameters
[out]chemical_mobilitythe chemical mobility array whose size is the number of component
[in]atomic_mobilitythe atomic mobility array whose size is the number of component
[in]compositionthe composition array whose size is the number of component

◆ model_allocate_memory()

void user_pfm_spinodal::model_allocate_memory ( )

Part 4 (a). Phase-field model related: Allocate memory

Allocate memory for mesh grid

Note
User must modify this method to add fields such as order parameters

◆ model_initial_condition()

bool user_pfm_spinodal::model_initial_condition ( string  irun = "Random")

Part 4 (b). Phase-field model related: Initialial condition

Initialize composition mesh grid

Note
User must modify this method to initialize other fields such as order parameters.
Parameters
irunthe mode of initialization.
Returns
true if initialization finishes normally.

◆ model_update_laplace_operation()

void user_pfm_spinodal::model_update_laplace_operation ( )

Part 4 (c)(1). Phase-field model related: Laplace operation

Apply the laplace operator on system's composition mesh(conc) and update lapC

Note
User must modify this method to calculate other operations of fields

◆ model_update_rate()

void user_pfm_spinodal::model_update_rate ( )

Part 4 (c)(2). Phase-field model related: Composition diffusion rate

Update rate of composition change for the entire system

Note
User must modify this method to calculate rate for other fields such as order parameters

◆ model_update_field()

bool user_pfm_spinodal::model_update_field ( double  dt)

Part 4 (c)(3). Phase-field model related: Calculate composition profile

Update composition of the entire system

Note
User must modify this method to update other fields such as order parameters
Parameters
dtthe normalized time step size whose real value is dt*tao
Returns
true if updating finishes normally

The documentation for this class was generated from the following files: