AllenCahn solve the Cahn-Hilliard and Allen-Cahn equations using free energies provided by Function Material objects. These include parsed function materials with free energy expressions supplied in the configuration files and all necessary derivatives to build the Residuals and Jacobian elements computed automatically using automatic differentiation (
This enables rapid implementation of new Phase Field models without writing custom kernels and recompiling the code.
The CHParsed and SplitCHParsed Kernels access the function material properties with the derivatives necessary to compute the Residuals and Jacobians.
ACParsed is the Allen-Cahn derived from
ACBulk. The free energy function to be used for this kernel is selected using the
[./ACSolid] type = AllenCahn f_name = F variable = phi mob_name = L [../]
CahnHilliard is the non-split operator Cahn-Hilliard Kernel derived from
CHBulk. The free energy function to be used for this kernel is selected using the
[./CHSolid] type = CahnHilliard f_name = F variable = cv mob_name = M_v [../]
SplitCHParsed is the split operator Cahn-Hilliard Kernel derived from
[./c_res] type = SplitCHParsed variable = c f_name = F kappa_name = kappa_v w = w [../] [./w_res] type = SplitCHWRes variable = w c = c mob_name = M_v [../]
The convenience of parsed and automatically differentiated functions does come with a performance penalty. Despite optimizations the parsed functions are slower than hand coded and compiled functions.
JIT (Just In Time) compilation is available for parsed functions. The JIT system is utilized by adding the
enable_jit = true (default) option in the
DerivativeParsedMaterial block. MOOSE will then attempt to compile the free energy functions and its derivatives into machine code and use it for the residual and Jacobian calculations. This almost fully recovers the performance of hand coded free energies while retaining the flexibility of automatic differentiation.