User-defined Plugin: Spinodal Decomposition
user_pfm_spinodal.h
Go to the documentation of this file.
1
10// //
11// P A N P H A S E F I E L D //
12// //
13// Version 2022 //
14// CompuTherm, LLC //
15// Copyright, 2000-2022 //
16// //
17// www.computherm.com //
18// //
20
21#pragma once
22
23#include "pfm_spinodal_config.h"
24#include "ppf_APP_interface.h"
25
26// The following ifdef block is the standard way of creating macros which make exporting
27// from a DLL simpler. All files within this DLL are compiled with the SPINODAL_V1_EXPORTS
28// symbol defined on the command line. This symbol should not be defined on any project
29// that uses this DLL. This way any other project whose source files include this file see
30// USER_PFM_SPINODAL_API functions as being imported from a DLL, whereas this DLL sees symbols
31// defined with this macro as being exported.
32#ifdef __GNUC__
33#define USER_PFM_SPINODAL_API
34#else
35#define USER_PFM_SPINODAL_API __declspec(dllexport)
36#endif // __GNUC__
37
38using namespace std;
39
101class user_pfm_spinodal : public I_PFM_APP_Interface
102{
103
104public:
110
116
117
118public:
129 void load_arguments(PF_ARGS* m_args, char* msg_char);
130
138 void run_pfm_calculation(char *msg);
139
140public:
149 bool sdk_update_prop(string &msg);
150
159 void sdk_get_chemical_mobility(double(*chemical_mobility)[PDN_BSZ][PDN_BSZ], double(*atomic_mobility), double(*composition));
160
161public:
169
178 bool model_initial_condition(string irun="Random");
179
187
194 void model_update_rate();
195
204 bool model_update_field(double dt);
205
206private:
207 // ------------------------ //
208 // PanPhaseField SDK object //
209 // ------------------------ //
210 PFM_SDK* m_pfm_sdk;
212 // -------------------------------------------//
213 // Model parameters loaded from PanPhaseField //
214 // ------------------------------------------ //
215 string calc_name;
217 int num_thread;
219 map<string, double> homogen_condition;
221 int L;
222 int M;
223 int N;
224 vector<int> dim_order_map;
226 TempCalculator m_thermal_stack;
227 double duration;
229 vector<double> plot_time_stack;
230 size_t N_profiles;
232 string imode;
234 double Cijkla, Cijklb, Cijklc;
236 double Gnormal;
237 double Bnormal;
239 double Namp;
240 double lo;
241 double kappa_l;
242 double molar_vol;
244 double tao;
246 vector<string> comp_names;
247 string ref_comp;
248 size_t ncomp;
250 vector<string> phase_names;
252 // --------------------------------------------------- //
253 // VTK I/O related varialbes loaded from PanPhaseField //
254 // --------------------------------------------------- //
255 string VTK_dir;
256 vtk_stream_utility::VTK_Stream vtk_stream;
258 // ------------------------------------------------ //
259 // PanPhaseField SDK related input/output variables //
260 // ------------------------------------------------ //
261 vector<PFM_SDK_Input_Condition> sdk_input;
262 vector<PFM_SDK_Output_Data> sdk_output;
263 double Mchemical__pdn[32][32][32];
265 // --------------------- //
266 // phase-field mesh grid //
267 // --------------------- //
268 VectorMesh<double> dcdt;
269 VectorMesh<double> lapC;
270 VectorMesh<double> conc;
271 VectorMesh<double> mu;
272 MatrixMesh<double> chem_mobility;
274 // --------------------- //
275 // time-integral related //
276 // --------------------- //
277 double TK_cur;
278 double dt;
279 double tt;
280 bool was_dt_limited;
281 double dt_before_limited;
282 int iter_step_cnt;
284#ifdef ENABLE_PANDAT_PROGRESS_MESSAGE
285 // --------------------------------------------- //
286 // (Optional) Pandat GUI progress window message //
287 // --------------------------------------------- //
288 CALCULATION_PROGRESS m_progress_ptr;
289#endif
290
291#ifdef ENABLE_PANDAT_RESULT_TABLE
292 // ------------------------------------------------------------------------------ //
293 // (Optional) Pandat Result Table I/O related varialbes loaded from PanPhaseField //
294 // ------------------------------------------------------------------------------ //
295 vector<pair<string, string>> dbs;
296 int ppf_calc_id;
297 string pandat_table_dir;
299 // ------------------------------ //
300 // (Optional) Pandat Result Table //
301 // ------------------------------ //
302 P_Result_Dict m_result;
303#endif
304
305#ifdef ENABLE_PERFORMANCE_LOG
306 // -------------------------- //
307 // (Optional) Performance log //
308 // -------------------------- //
309 vector<double> sdk_api_call_cnt;
310 double thermodynamic_time;
311#endif
312
313};//end of user_pfm_spinodal
314
315
335class SPINODAL_app_Creator : public I_PFM_APP_Creator
336{
337public:
338
342 I_PFM_APP_Interface * Create()
343 {
344 return new user_pfm_spinodal();
345 }
346
351 void Delete(I_PFM_APP_Interface* user_app) {
352 if (user_app != NULL)
353 {
354 delete user_app;
355 }
356 }
357
362 {
363 return 1.0;
364 }
365
369 const char* getName()
370 {
371 return "USER_PFM_SPINODAL";
372 }
373
377 const char* getDescription()
378 {
379 return "A template plugin for spinodal decomposition";
380 }
381};
Creator of this user-defined spinodal decomposition model.
Definition: user_pfm_spinodal.h:336
const char * getDescription()
Definition: user_pfm_spinodal.h:377
const char * getName()
Definition: user_pfm_spinodal.h:369
void Delete(I_PFM_APP_Interface *user_app)
Definition: user_pfm_spinodal.h:351
float getVersion()
Definition: user_pfm_spinodal.h:361
I_PFM_APP_Interface * Create()
Definition: user_pfm_spinodal.h:342
An example phase-field model of spinodal decomposition.
Definition: user_pfm_spinodal.h:102
void load_arguments(PF_ARGS *m_args, char *msg_char)
Definition: pfm_spinodal.cpp:129
~user_pfm_spinodal()
Definition: pfm_spinodal.cpp:305
bool model_update_field(double dt)
Definition: pfm_spinodal_model.cpp:183
void run_pfm_calculation(char *msg)
Definition: pfm_spinodal_calculation.cpp:4
void model_update_laplace_operation()
Definition: pfm_spinodal_model.cpp:95
void model_allocate_memory()
Definition: pfm_spinodal_model.cpp:12
bool model_initial_condition(string irun="Random")
Definition: pfm_spinodal_model.cpp:47
user_pfm_spinodal()
Definition: pfm_spinodal.cpp:290
bool sdk_update_prop(string &msg)
Definition: pfm_spinodal_property.cpp:19
void sdk_get_chemical_mobility(double(*chemical_mobility)[PDN_BSZ][PDN_BSZ], double(*atomic_mobility), double(*composition))
Definition: pfm_spinodal_property.cpp:4
void model_update_rate()
Definition: pfm_spinodal_model.cpp:132
Configuration of user-defined plugin: spinodal decomposition.
#define PDN_BSZ
Definition: pfm_spinodal_config.h:63