User-defined Plugin: Pure Solidification
user_pfm_solidification Class Reference

An example phase-field model of solidification. More...

#include <user_pfm_pure_solidification.h>

Inherits I_PFM_APP_Interface.

Public Member Functions

 user_pfm_solidification ()
 
 ~user_pfm_solidification ()
 
void load_arguments (PF_ARGS *m_args, char *msg_char)
 
void run_pfm_calculation (char *msg)
 
bool sdk_update_prop (string &msg, int ip)
 
bool model_update_PFDB_parameters ()
 This method updates the dynamic parameters of the plugin which can evolve with time. More...
 
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 input_path, string irun="circle")
 
void update_phase_equilibrium ()
 
double model_get_driving_force ()
 
void model_update_laplace_operation (VectorMesh< double > &field, VectorMesh< double > &lap_field, int index)
 
void model_update_rate (int index)
 
bool model_update_field (double dt)
 

Detailed Description

An example phase-field model of solidification.

An example phase-field model of solidification

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

Part 1. Constructor and Destructor

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

I_PFM_APP_Interface * SOLIDIFICATION_app_Creator::Create()
{
return new user_pfm_solidification(); // calling constructor
}
I_PFM_APP_Interface * Create()
Definition: user_pfm_pure_solidification.h:397
user_pfm_solidification()
Definition: pfm_solidification.cpp:392

and

void SOLIDIFICATION_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_pure_solidification.h:406

Part 2. Plugin's interface with PanPhaseField

Load arguments from PanPhaseField: user_pfm_solidification::load_arguments;
Run simulation user_pfm_solidification::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_solidification()

user_pfm_solidification::user_pfm_solidification ( )

Part 1 (a). Constructor

◆ ~user_pfm_solidification()

user_pfm_solidification::~user_pfm_solidification ( )

Part 1 (b). Destructor

Member Function Documentation

◆ load_arguments()

void user_pfm_solidification::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 strickly followed!

The default mode is 1 by built - in G, mu, f, x. 2: Cp, Latent heat and phase slope 4 : ThF - thermodynamic factors

◆ run_pfm_calculation()

void user_pfm_solidification::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 strickly followed!

◆ sdk_update_prop()

bool user_pfm_solidification::sdk_update_prop ( string &  msg,
int  ip 
)

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
[out]msgthe message returned by this method
[in]ipthe index of phase to be updated
Returns
true if properties are updated normally

◆ model_update_PFDB_parameters()

bool user_pfm_solidification::model_update_PFDB_parameters ( )

This method updates the dynamic parameters of the plugin which can evolve with time.

Returns
true, If the update is successful

◆ sdk_get_chemical_mobility()

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

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_solidification::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_solidification::model_initial_condition ( string  input_path,
string  irun = "circle" 
)

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

Initialize composition and order parameters

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

◆ update_phase_equilibrium()

void user_pfm_solidification::update_phase_equilibrium ( )

Part 4 (c)(0). Phase-field model related: Calculate phase equilibrium between liquid and solid phases

Note
User can modify this method for different purpose This method shows an example for calculating the equilibrium between solid and liquid phases. It is deactivated in the template plugin.

skip this function

set this to be true for print properties

get atomic weight

get liquidus surface

get value using PanEngine

get value using PanDataNet

◆ model_get_driving_force()

double user_pfm_solidification::model_get_driving_force ( )

Part 4 (c)(1). Phase-field model related: Calculate driving force of solidification

Note
User must modify this method when new order parameters are included
Returns
driving force value at current temperature

◆ model_update_laplace_operation()

void user_pfm_solidification::model_update_laplace_operation ( VectorMesh< double > &  field,
VectorMesh< double > &  lap_field,
int  index 
)

Part 4 (c)(2). Phase-field model related: Laplace operation on ic-th element

Apply the laplace operator on index-th dimension of a field and its laplace operation

Note
User must modify this method to calculate other operations of fields
Parameters
[in]fieldthe mesh of field to be calculated
[out]lap_fieldthe mesh of laplace operation on the field
[in]indexthe index of field whose laplace operation will be calculated

◆ model_update_rate()

void user_pfm_solidification::model_update_rate ( int  index)

Part 4 (c)(3). 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
Parameters
[in]indexthe index of the order-parameter rate field to be calculated

◆ model_update_field()

bool user_pfm_solidification::model_update_field ( double  dt)

Part 4 (c)(4). 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
[in]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: