This has all of the vector phase field parts of rheoplast. It currently uses the Kobayashi, Warren and Carter 1998 formulation.
#define __FUNCT__ "vectorphase_labels_initcond"
#define p( point )
#define q( point )
#define pfunc( point )
#define qfunc( point )
#define phi( point )
#define eps( point )
#define tau( point )
#define dphidt( point )
#define u( point )
#define v( point )
#define omega( point )
#define pomega( point )
#define pu( point )
#define pv( point )
#define pw( point )
#define T( point )
#define Tfunc( point )
#define __FUNCT__ "vectorphase_temp_parameters_line"
#define __FUNCT__ "vectorphase_interior_line_function"
For vector-valued phase field, there are two field variables p and q, and three temporary fields i>phi, epsilon and tau. Throughout this function, 2-D is assumed, since this formulation is really only good for 2-D at this point (though that may change).
Unfortunately, there is a singularity in theta diffusivity where its gradient is zero.
Giga and Giga and Kobayashi and Giga have outlined a way to solve this, but we haven't yet implemented it. So for now, I'm going with KWC's original 1998 formulation even though it's not quite right. That formulation begins with a slightly different free energy based on angle theta which is orientation times the rotational symmetry order N0. The free energy is given by three terms: the homogeneous free energy F(phi;m) (with derivative f), the gradient penalty term in phi with coefficient epsilon2/2, and the gradient penalty term in theta with coefficient phi2mu(phi)/2.
We can then write the variation in energy as two terms A and B which are coefficients on the variations of phi and theta respectively. As is typical for phase field, these variations lead directly to equations for dynamics of phi and theta such that their time derivatives are A and B/phi respectively then both divided by a kinetic parameter tau.
The really neat thing is that we can turn these dynamics into those for the vector field using the simple transformation where p=phi cos(theta) and q=phi sin(theta), which leads to straightforward expressions for dp/dt and dq/dt in terms of the phi and theta time derivatives.
The functional form of epsilon given in KWC 1998 is available in the LaTeX-based documentation.
Note that to calculate psi we need nearest-neighbor values of phi, but the function needs nearest neighbor values of epsilon. So this forces us to look to next-nearest-neighbors, expanding the required stencil width for these calculations to 2. Make sure these data exist at the edges, or you'll get some wierd behavior at the interfaces!
Note the abstraction violation here: the code calculating
epsilon assumes that phi
is already calculated in the negative
y
direction nearest neighbor(s), but not in the positive direction. This
could therefore fail if for some reason the loops go the other way! A
longer-term fix would allow two levels of temporary parameters, but
it's not clear it's worth this just to save the square roots which are
pretty simple. Also note that this code assumes equal spacings in both
grid directions.
The kinetic timescale parameter
tau
is also a function of
psi which you can see in the LaTeX-based documentation.