Partial Differential Equations¶
How SLOTH solves Partial Differential Equations?¶
Partial Differential Equations (PDEs) are the most important kind of problem for SLOTH.
As illustrated in the figure 1, PDEs for SLOTH can be expressed in the following form:
where is the vector of unknowns expressed as a function of the time and the position . In this equation, and are two nonlinear forms associated with the time derivative operator and the differential operators, respectively. For steady problem, .
For SLOTH, all PDEs are solved using a unified nonlinear algorithm based on the Newton solver. This approach is adopted to maximize the generality of the implementation, although it may incur a minor computational overhead for linear PDEs.
On the use of a Newton Solver
The use of a Newton solver represents a pragmatic choice. Nevertheless, the code has been structured in such a way that alternative algorithms can be incorporated in the future.
Definition of PDEs for SLOTH is made with a C++ object of type Problem, which is a template class instantiated with three template parameters: first, an OPERATOR object, second, a Variables object (see VARS in the example), and third, a PostProcessing object (see PST in the example).
The OPERATOR object in Problem refers to an object that inherits from base classes responsible for solving the nonlinear system (1).
These classes are illustrated in the figure 2: OperatorBase is a base class with two derived classes:
TransientOperatorBase, which inherits from theTimeDependentOperatorclass ofMFEMand is dedicated to unsteady PDEs,SteadyOperatorBase, which inherits from theOperatorclass ofMFEMand is dedicated to steady PDEs.
In addition to these classes, there are two classes used to compute the residual and the Jacobian associated with the Newton-Raphson algorithm -- see ReducedOperator and SteadyReducedOperator classes in the figure 2.
As illustrated in the figure 3, these operators are associated with NonLinearFormIntegrators which are used to compute the residual vector and the Jacobian matrix for the nonlinear problems.
How to define Partial Differential Equations?¶
Integrators¶
All SLOTH integrators inherit from the MFEM BlockNonlinearFormIntegrator class.
In the figure 3, the integrators are gathered in two grouped:
-
Time Derivative Integrators (see in the equation (1)):
TimeDerivative,SplitTimeDerivative,HeatTimeDerivative. They are only used for transient problems.This integrator concerns the following mathemical expression:
This integrator concerns the following vectorial expression:
This integrator must be associated with the
SplitAllenCahnandCahnHilliardintegrators.This integrator concerns the following mathemical expression:
where and are two
SLOTHcoefficients of typeGlossaryType::ConcentrationandGlossaryType::HeatCapacity, respectively. By default, coefficients are set to one. -
Differential Operators (see in the equation (1)):
Fick,Fourier,MassFlux,AllenCahn,SplitAllenCahn,CahnHilliard,MeltingCalphad,MeltingConstant,MeltingTemperature,LatentHeat. They can be combined as for example,AllenCahnandMeltingTemperature.This integrator concerns the following mathemical expression:
where is a mandantory
SLOTHcoefficient of typeGlossaryType::Diffusivity.This integrator concerns the following mathemical expression:
where is a mandantory
SLOTHcoefficient of typeGlossaryType::Conductivity.This integrator concerns the following mathematical expression:
where are mobility-type coefficients and \(\zeta_i\) diffusion potentials. The latter can be defined as a function of chemical potentials or diffusion potentials , which can themselves be scaled by temperature:
Three parameters are available with this integrator. They are listed in the table 1.
Parameter Name Type Default Value Description ScaleVariablesByTemperatureboolfalse indicates wheter potentials are scaled by temperature ScaleCoefficientsByTemperatureboolfalse indicates wheter mobility coefficients are scaled by temperature EnableDiffusionChemicalPotentialsboolfalse indicates wheter diffusion potentials are considered - Table 1 - parameters allowed with
MassFlux
For simulations based on this integrator, temperature, potentials and mobility coefficients must be defined as an auxiliary variable of problem.
This integrator concerns the following vectorial expression:
where , , and are mandantory
SLOTHcoefficients of typeGlossaryType::Mobility,GlossaryType::CapillaryandGlossaryType::FreeEnergy, respectively.This integrator concerns the following vectorial expression:
where , , and are mandantory
SLOTHcoefficients of typeGlossaryType::Mobility,GlossaryType::CapillaryandGlossaryType::FreeEnergy, respectively.This integrator must be associated with the
SplitTimeDerivativeintegrator.This integrator concerns the following vectorial expression:
where , , and are mandantory
SLOTHcoefficients of typeGlossaryType::Mobility,GlossaryType::CapillaryandGlossaryType::FreeEnergy, respectively.This integrator must be associated with the
SplitTimeDerivativeintegrator.This integrator concerns the following mathemical expression:
where , are mandantory
SLOTHcoefficients of typeGlossaryType::MobilityandGlossaryType::PhaseFieldPotential, respectively.is the enthalpy of melting. It is constant and equal to the value of parameter named
melting_factor.This integrator can be used to simulate melting phenomena based on an ad-hoc melting contribution.
For these simulations, it must be associated with the
AllenCahnintegrator.This integrator concerns the following mathemical expression:
where , are mandantory
SLOTHcoefficients of typeGlossaryType::MobilityandGlossaryType::PhaseFieldPotential, respectively.is the enthalpy of melting defined by:
where is the enthalpy of melting, the temperature and the temperature of melting.
This integrator can be used to simulate melting phenomena based on an ad-hoc melting contribution.
For these simulations, it must be associated with the
AllenCahnintegrator.Two mandatory parameters are requested by this integrator. They are listed in the table 1.
Parameter Name Type Default Value Description melting_temperaturedoublemelting temperature melting_enthalpydoublemelting enthalpy - Table 1 - parameters allowed with
MeltingTemperature
For simulations based on this integrator, temperature must be defined as an auxiliary variable of the phase-field problem.
This integrator concerns the following mathemical expression:
where , are mandantory
SLOTHcoefficients of typeGlossaryType::MobilityandGlossaryType::PhaseFieldPotential, respectively.is an optional seed value mimicking a nucleus calculated by a CALPHAD problem.
is the enthalpy of melting calculated by a CALPHAD problem.
This integrator can be used for CALPHAD-informed phase-field simulation1. For these simulations, it must be associated with the
AllenCahnintegrator.Two mandatory parameters are requested by this integrator. They are listed in the table 1.
Parameter Name Type Default Value Description primary_phasestd::stringname of the phase before melting secondary_phasestd::stringname of the phase after melting - Table 1 - parameters requested by
MeltingCalphad
For simulations based on this integrator, CALPHAD outputs -driving forces and nucleus- must be defined as auxiliary variables of the phase-field problem.
This integrator concerns the following mathemical expression:
where is a mandantory
SLOTHcoefficient of typeGlossaryType::Mobility.This integrator can be only associated with the
Fourierintegrator to solve heat transfer equation for two-phase problems. - Table 1 - parameters allowed with
On the inheritance from BlockNonlinearFormIntegrator instead of NonlinearFormIntegrator
For SLOTH integrators, inheriting from BlockNonlinearFormIntegrator maximizes the generality of the implementation, as it allows solving both single-unknown problems and problems with several unknowns.
Operators¶
This operator allows solving transient problems.
TransientOperator is a template class instantiated with two template parameters: first, the kind of finite element and second, the spatial dimension.
Alias declaration for TransientOperator class template
This example show how to define a convenient alias for the TransientOperator class template instantiated with mfem::H1_FECollection in dimension 3.
The OPERATOR operator must be defined by:
- a vector of spatial discretisation objects (see Meshing) [required],
- a vector of strings specifying the integrators used to model spatial differential operators [required],
- a set of parameters (see Parameters) [optional],
- a ODE solver for time stepping [required],
- a string specifying the integrator used to model time derivative operator [required].
On the size of the vector of spatial discretisation objects
In SLOTH, each operator is designed to solve a system of PDEs with a monolithic algorithm.
The size of the vector of spatial discretisation objects must be equal to the number of unknowns.
Regarding the time stepping, three ODE solvers have been integrated in SLOTH among those provided by MFEM:
- The backward Euler method (
SLOTHobjectTimeScheme::EulerImplicit), - The forward Euler method (
SLOTHobjectTimeScheme::EulerExplicit), - The Runge-Kutta 4 method (
SLOTHobjectTimeScheme::RungeKutta4).
Extension of the list of ODE solver in SLOTH
MFEM provides several ODE solvers. To begin, SLOTHdevelopment team integrates the most common methods, namely Euler and Runge-Kutta 4 methods.
In the future, this list could be extended to account for high order methods.
Definition of a transient operator
This example assume a Cahn-Hilliard problem with two unknowns (phi and mu).
The OPERATOR object, denoted by phasefield_ope, is well declared with a vector of two spatial discretization objects, the CahnHilliard and SplitTimeDerivative integrators and an Euler Implicit time-stepping method.
Definition of a transient operator with a combination of integrators
The integrators for the differential operators can be combined.
using OPERATOR = TransientOperator<mfem::H1_FECollection, 3>;
std::vector<SPA*> spatials{&spatial};
OPERATOR phasefield_ope(spatials, {"AllenCahn", "MeltingConstant"}, TimeScheme::EulerImplicit, "TimeDerivative");
where is a constant enthalpy of melting.
This operator allows solving steady problems.
SteadyOperator is a template class instantiated with two template parameters: first, the kind of finite element and second, the spatial dimension.
Alias declaration for SteadyOperator class template
This example show how to define a convenient alias for the SteadyOperator class template instantiated with mfem::H1_FECollection in dimension 3.
The OPERATOR operator must be defined by:
- a vector of spatial discretisation objects (see Meshing) [required],
- a vector of strings specifying the integrators used to model spatial differential operators [required],
- a set of parameters (see Parameters) [optional].
On the size of the vector of spatial discretisation objects
In SLOTH, each operator is designed to solve a system of PDEs with a monolithic algorithm.
The size of the vector of spatial discretisation objects must be equal to the number of unknowns.
Definition of a steady operator
This example assume an Allen-Cahn problem with one unknowns (phi).
The OPERATOR object, denoted by phasefield_ope, is well declared with a vector of one spatial discretization object and the AllenCahn integrator.
Problems¶
As already mentioned, Problem for SLOTH is a template class instantiated with three template parameters: first, an OPERATOR object, second, a Variables object, and third, a PostProcessing object.
The PDE problem must be defined by:
- an Operator [required],
- primary Variables [required],
- a vector of Coefficients [required],
- a set of parameters (see Parameters) [optional],
- an PostProcessing object [required],
- a set of auxiliary Variables [optional].
On the size of the vector of Coefficients objects
The size of the vector of Coefficients objects must be equal to the number of variables.
On the order of the vector of Coefficients objects
The order of coefficent in the vector of Coefficients objects corresponds the order unknowns in the Variables object.
Definition of a Cahn-Hilliard problem
using OPERATOR = SteadyOperator<mfem::H1_FECollection, 3>;
std::vector<SPA*> spatials{&spatial, &spatial};
// Variables: phi, mu
auto phi = VAR(&spatial, bcs_phi, "phi", Glossary::PhaseField, 2, phi_initial_condition);
auto mu = VAR(&spatial, bcs_mu, "mu", Glossary::ChemicalPotential, 2, mu_initial_condition);
auto vars = VARS(phi, mu);
// Operator
OPE phasefield_ope(spatials, {"CahnHilliard"}, TimeScheme::EulerImplicit, "SplitTimeDerivative");
// Coefficients
// Interface thickness
const double epsilon(0.02);
// Two-phase mobility
const double mob(1.);
// Gradient coefficient
const double lambda = (epsilon * epsilon);
Coefficient grad_energy(Glossary::GradEnergy, Scheme::Implicit, GradientEnergy(lambda));
Coefficient double_well(Glossary::FreeEnergy, Scheme::Implicit, W(omega));
Coefficient capillary(Glossary::Capillary, lambda);
Coefficient mobility(Glossary::Mobility, mob);
Coefficients coef_phase_field(double_well, capillary, mobility, grad_energy);
// Problem (pst is PostProcessing object not detailed here)
PDE phase_filed_pb(phasefield_ope, vars, {coef_phase_field, coef_phase_field}, pst);
This example assume an two-phase problem solved by Cahn-Hilliard equations with two unknowns (phi and mu).
The OPERATOR object, denoted by phasefield_ope, is well declared with a vector of two spatial discretization objects, the CahnHilliard integrator for the right-hand-side of PDEs and the SplitTimeDerivative for the left-hand-side.
For this example, the Backward Euler method is considered (see TimeScheme::EulerImplicit).
For this problem, a vector of two Coefficients is considered for phi and mu, respectively. Here, the same Coefficients are used for both variables accordingly with the CahnHilliard integrator.
As expected by this integrator, coefficients of type Glossary::FreeEnergy, Glossary::Capillary and Glossary::Mobility are defined. The coefficient of type Glossary::GradEnergy is only used to compute the gradient terms in the output of the density of energy.
This example has no parameters or auxiliary variables.
-
Clément Introïni, Jérôme Sercombe, Isabelle Ramière, and Romain Le Tellier. Phase-field modeling with the taf-id of incipient melting and oxygen transport in nuclear fuel during power transients. Journal of Nuclear Materials, 556:153173, 2021. ↩