!* Simple example only intended to showcase the
!* nucleation command


!*YAPFI macro
!*-----------
SET_NUMBER_OF_THREADS
8!Number of threads /1/



MANDATORY_DATA
c_fe_bcc_fcc_liq_demo!GES file / ANALYTICAL [<analytic init file>]
1073!(Initial) Temperature [K] /1000.0000/
!Pressure [Pa] /100000.00/
!Element C substitutional /YES/
!Element FE substitutional /YES/
!Initially homogeneous composition /YES/
0.01!Initial mole fraction of element C
0.99!Initial mole fraction of element FE
!*Enter state of phases, 1:Entered, 2: Suspended
2!State of phase (LIQUID) /1/
!State of phase (BCC_A2) /1/
!State of phase (FCC_A1) /1/
2!Dimensionality /1/
128!Nr of grid points in dimension #1 /10/
128!Nr of grid points in dimension #2 /10/
10.24e-6!Domain width [m] in dimension #1 /1.0000000/
10.24e-6!Domain width [m] in dimension #2 /1.0000000/
!Periodic boundary in dimension #1 /NO/
!Periodic boundary in dimension #2 /NO/
!*Grid type. 1:Linear, 2:Geometric, 3: Double geometric, 4: Read from file
!Grid type in dimension #1 /1/
!Grid type in dimension #2 /1/
!*Info: Initial time is always zero
0.5!Simulation time [s] /1.0000000/
!Maximum timestep [s] /0.10000000/
!Minimum timestep [s] /0.10000000E-09/
!Initial timestep [s] /0.10000000E-09/
!Save interval /1/
0.05!Minimum elapsed time between saves [f(time)], [s] /1.0/

PHASE_FIELD_DATA
!Use phase-field variables /YES/
4!Total nr of phase-field variables /2/
!File containing initial phase-field variable values
!*Associate phases with phase-field variables
!*Phase indices:
!*1:BCC_A2
!*2:FCC_A1
2!Index of associated phase of phase-field variable # 1
2!Index of associated phase of phase-field variable # 2
1!Index of associated phase of phase-field variable # 3
1!Index of associated phase of phase-field variable # 4
!*Enter g_1
!*Shorthand notations:
!*gs11=\sum_\alpha G_{m\alpha}(\Phi_\alpha^3(10-15\Phi_\alpha+6\phi_\alpha^2))/
!*     \sum_\alpha\Phi_alpha^3(10-15\Phi_\alpha+6\Phi_alpha^2)
!*gs12=\sum_iG_{mi}\phi_i
!*gs13 is gs11 without normalization
!*variable GXX correspond to Gm of phase
gs11!Gm expression for g_1
!*Enter g_2
!*Shorthand notations:
!*gs21=8\sum_i\phi_i^2(1-\phi_i)^2
!*gs22=0.626\sum_i(\frac{\tanh(2)^2-1}{\tanh(2)^2}\log[1-\tanh(2)^2(2\phi_i-1)^2]-(2\phi_i-1)^2)
!*gs23=10.67(0.25-0.5\sum\phi_i^2+0.25(\sum\phi_i^2)^2+0.5\sum_i\sum_{j>i}\phi_i^2\phi_j^2
75*gs23!Gm expression for g_2
!*Enter epsilon_ij expressions (<=0 is enforced)
3.75e-13!E0102
3.75e-13!E0103
3.75e-13!E0104
3.75e-13!E0203
3.75e-13!E0204
3.75e-13!E0304
(5*2e-16)/(1e-7^2)!Enter phase-field mobility expression

NUMERICAL_SETTINGS
!Degree of implicity /1.0000000/
!Relative error tolerance /0.50000000E-01/
!Absolute error tolerance /0.10000000E-07/
!Jacobian perturbation parameter /0.10000000E-02/
!Clean Jacobian /NO/
!Minimum mole fraction /0.10000000E-14/
!Minimum mobility /0.10000000E-39/
!Maximum temperature /6000.0000/
!Maximum timestep change factor /2.0000000/
!Enforce a maximum \Delta T per time-step /NO/
!Temporally piece-wise locally constant coefficients /YES/
y!Enable linearized time-steps /NO/
y!Assume a maximum width of interfaces /NO/
1e-7!Enter width of interface as real value (>0.0) or nr of grid points (3,5,7,..)
!Set non-active phase-field variables away from interfaces to zero /YES/


INITIAL_SINGLE_PHASE
y!Set whole domain to consist of a single phase /NO/
1!Enter corresponding phase-field variable index

INITIAL_PRECIPITATE
2!Enter corresponding phase-field variable index
!*Options:
!*1.Spherical precipitate
!*2.Segment/triangle/tetrahedron precipitate at origin
!*3.Arbitrary segment/triangular/tetrahedron precipitate
3!Precipitate option
!*Enter coordinates of point #1
5.12e-6!coordinate in spatial dimension #1
0!coordinate in spatial dimension #2
!*Enter coordinates of point #2
5.12e-6!coordinate in spatial dimension #1
10.24e-6!coordinate in spatial dimension #2
!*Enter coordinates of point #3
10.24e-6!coordinate in spatial dimension #1
10.24e-6!coordinate in spatial dimension #2
!*Enter precipitate composition (mole fraction)
0.01!Element C
0.99!Element FE
!Relative grid fineness around precipitate (only relevant with adaptive meshing) /0/

INITIAL_PRECIPITATE
2!Enter corresponding phase-field variable index
!*Options:
!*1.Spherical precipitate
!*2.Segment/triangle/tetrahedron precipitate at origin
!*3.Arbitrary segment/triangular/tetrahedron precipitate
3!Precipitate option
!*Enter coordinates of point #1
5.12e-6!coordinate in spatial dimension #1
0!coordinate in spatial dimension #2
!*Enter coordinates of point #2
10.24e-6!coordinate in spatial dimension #1
10.24e-6!coordinate in spatial dimension #2
!*Enter coordinates of point #3
10.24e-6!coordinate in spatial dimension #1
0!coordinate in spatial dimension #2
!*Enter precipitate composition (mole fraction)
0.01!Element C
0.99!Element FE
!Relative grid fineness around precipitate (only relevant with adaptive meshing) /0/


NUCLEATION
y!Enable nucleation /NO/
!Nucleation check time interval (>= 0) [s] /0.0000000/
0.01!Minimum time until first check for nucleation (>= 0) [s] /0.0000000/
y!Log nucleation events on file /NO/
y!Save state after nucleation event /NO/
!Maximum nr of nuclei per check (<=0 means no maximum) /-1/
!Minimize time-step after nucleation event /YES/
!*Nucleation schemes:
!*1.Fixed coordinate
!*2.Interface nucleation (also homogeneous)
!*--------------------------
1!Nucleation scheme
y!Fixed nuclei composition /NO/
5.57e-4!Nucleus C mole fraction
0.999443!Nucleus FE mole fraction
3!Index of associated phase-field variable
-1.0!Critical non-dimensional (Dm/RT) driving force (>0) /0.10000000E-02/
!Distance to disallow nucleation from existing phase region [m] (<0 disables) /-1.0000000/
2e-6!Enter nuclei coordinate in dimension 1
2e-6!Enter nuclei coordinate in dimension 2
1e-6!Enter precipitate radius
10!Relative grid fineness around precipitate (only relevant with adaptive meshing) /0/
!Reactivate nuclei /NO/
y!Add another nucleation scheme/site
!*--------------------------
2!Nucleation scheme
!Maximum number of precipitates /1/
y!Fixed nuclei composition /NO/
5.57e-4!Nucleus C mole fraction
0.99943!Nucleus FE mole fraction
4!Index of associated phase-field variable
-1.0!Critical non-dimensional (Dm/RT) driving force (>0) /0.10000000E-02/
!Enter nuclei at points of maximum driving force /NO/
!Distance to disallow nucleation from existing phase region [m] (<0 disables) /-1.0000000/
!Interface phi threshold value (>=0.0) (0 yields homogeneous nucleation) /0.10000000/
1e-6!Enter precipitate radius
10!Relative grid fineness around precipitate (only relevant with adaptive meshing) /0/
!Reactivate nuclei /NO/
n!Add another nucleation scheme/site



RANDOM_NUMBER_SETTINGS
y!Use a single seed for the pseudorandom number generator /NO/
-1!Enter integer seed (1 digit) (<0 for internal vector) /1/



ADAPTIVE_MESHING
y!Use adaptive meshing /NO/
!Initial allocation factor (>=1) /1.0000000/
!Adapt mesh based on composition gradients /YES/
1e-3!Max composition Delta for C /0.10000000/
1e-4!Min composition Delta for C /0.10000000E-01/
!Max composition Delta for FE /0.10000000/
!Min composition Delta for FE /0.10000000E-01/
!Adapt mesh based on phase-field variable gradients /YES/
0.01!Max phase-field variable Delta /0.10000000/
0.001!Min phase-field variable Delta /0.10000000E-01/
n!Adapt mesh based on temperature gradients /YES/
1!Domain size integer aspect ratio, 1st spatial dimension
1!Domain size integer aspect ratio, 2nd spatial dimension
!Input integer (1) or real valued (2) parameters /1/
7!Initial depth (>0)
5!Minimum depth (>0)
10!Maximum depth (>0)
!Base interval to adapt mesh on cumulative change /NO/

SOLVER
!*Solvers:
!*1.Jacobian solver
!*2.Implicit solver
1!Choose solver /1/



SAVE_SETTINGS
!Filename prefix /yapfisim/
!*Possible additional properties to be saved:
!*1.Gm
!*2.\varepsilon_{ij} (only for phase-field)
!*3.d\phi_i/dt (only for phase-field)
!*4.dg_{12}/d\phi_i (only for phase-field)
!*5.dg_\nabla/d\phi_i (only for phase-field)
!*6.\nabla\xi_i (only for phase-field)
!*7.active \phi (only for phase-field)
!*8.g_1 (only for phase-field)
!*9.g_2 (only for phase-field)
!*10.\sum\nabla\phi_i\sum\nabla\phi_j\varepsilon_{ij} (only for phase-field)
!*11.\sum\nabla c_i\sum\nabla c_j\kappa_{ij} (only if gradient energy contribution)
!*12.User defined functions
!*13.Save coordinates and variable values only in csv-like separate file
y!Add additional properties to be saved /NO/
12!Enter code for additional save property (-1*code to cancel, zero to exit)
!*Allowed variables are:
!*XC,XFE,P01,P02,P03,P04,T
!*Options for user defined functions:
!*0.Exit
!*1.Enter a function
!*2.Delete a function
!*3.List all entered functions
1!Choose user defined function option
interfaces!Enter function description
p01*(1-p01)+p02*(1-p02)+p03*(1-p03)+p04*(1-p04)!Enter function
0!Choose user defined function option
0!Enter code for additional save property (-1*code to cancel, zero to exit)


ENTER_MOBILITY_ESTIMATE
!*Enter mobility estimate(s) using the phase and element indices given below.
!*Mobility estimates overrides any other data.
!*A zero (0) wildcard indicates all phases/elements
!*Exit by entering any value outside the valid ranges.
!*Phase indices:
!*1 : BCC_A2
!*2 : FCC_A1
!*Element indices:
!*1 : C
!*2 : FE
0!Mobility estimate phase index
0!Mobility estimate element index
2e-16!Mobility estimate




