20 "Computes the KKS phase concentrations by using a nested Newton iteration "
21 "to solve the equal chemical potential and concentration conservation equations for "
22 "multiphase systems. This class is intented to be used with "
23 "KKSPhaseConcentrationMultiPhaseDerivatives.");
27 "hj_names",
"Switching functions in the same order as all_etas.");
29 "Fj_names",
"Free energy material objects in the same order as all_etas.");
32 "Phase concentrations. They must have the same order as Fj_names and global_cs, for "
33 "example, c1, c2, b1, b2.");
35 "Initial values of ci in the same order of ci_names");
36 params.
addParam<MaterialPropertyName>(
38 "The output number of nested Newton iterations at each quadrature point.");
39 params.
addCoupledVar(
"args",
"The coupled variables of free energies.");
41 "damped_Newton",
false,
"Whether or not to use the damped Newton's method.");
42 params.
addParam<MaterialName>(
"conditions",
44 "Material property that checks bounds and conditions on the "
45 "material properties being solved for.");
53 _prop_c(coupledValues(
"global_cs")),
54 _num_c(coupledComponents(
"global_cs")),
55 _num_j(coupledComponents(
"all_etas")),
56 _hj_names(getParam<
std::vector<MaterialPropertyName>>(
"hj_names")),
58 _Fj_names(getParam<
std::vector<MaterialName>>(
"Fj_names")),
60 _ci_names(getParam<
std::vector<MaterialPropertyName>>(
"ci_names")),
61 _prop_ci(_num_c * _num_j),
62 _ci_old(_num_c * _num_j),
63 _ci_IC(getParam<
std::vector<Real>>(
"ci_IC")),
66 _args_names(coupledNames(
"args")),
67 _n_args(coupledComponents(
"args")),
70 _iter(declareProperty<Real>(
"nested_iterations")),
71 _abs_tol(getParam<Real>(
"absolute_tolerance")),
72 _rel_tol(getParam<Real>(
"relative_tolerance")),
73 _damped_newton(getParam<bool>(
"damped_Newton")),
74 _condition_name(getParam<MaterialName>(
"conditions")),
86 for (
const auto m : make_range(
_num_j))
90 for (
const auto m : make_range(
_num_j))
97 for (
const auto n : make_range(
_num_c))
103 for (
unsigned int l = 0; l <
_num_c; ++l)
105 _d2Fidcidbi[m][n][l] = &getMaterialPropertyDerivative<Real>(
112 for (
const auto m : make_range(
_num_j))
116 for (
const auto n : make_range(
_n_args))
121 for (
const auto m : make_range(
_num_c))
125 for (
const auto n : make_range(
_n_args))
150 for (
unsigned int m = 0; m <
_num_j; ++m)
164 solution(m) = (*
_ci_old[m])[_qp];
176 for (
const auto m : make_range(
_num_j))
177 _Fj_mat[m]->computePropertiesAtQp(_qp);
180 for (
const auto m : make_range(
_num_c))
182 for (
const auto n : make_range(
_num_j - 1))
187 for (
const auto l : make_range(
_num_j))
194 for (
const auto m : make_range(
_num_c))
197 for (
const auto n : make_range(
_num_j - 1))
199 for (
const auto l : make_range(
_num_c))
207 for (
const auto n : make_range(
_num_j))
229 mooseException(
"Nested Newton iteration did not converge.");
registerMooseObject("PhaseFieldApp", KKSPhaseConcentrationMultiPhaseMaterial)
const unsigned int _num_c
Number of global concentrations.
const unsigned int _n_args
Number of coupled variables of free energies.
std::vector< std::vector< const MaterialProperty< Real > * > > _dFidci
Derivative of free energies wrt phase concentrations .
std::vector< const MaterialProperty< Real > * > _prop_hj
const MaterialProperty< Real > * _C
virtual void initQpStatefulProperties() override
MaterialBase * _condition
MaterialProperty< Real > & _iter
Number of nested Newton iteration.
const unsigned int _num_j
Number of phase parameters.
std::vector< std::vector< const MaterialProperty< Real > * > > _dFidarg
Derivative of free energies wrt coupled variables .
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _d2Fidcidbi
KKSPhaseConcentrationMultiPhaseMaterial(const InputParameters ¶meters)
const std::vector< const VariableValue * > _prop_c
Global concentrations.
std::vector< MaterialProperty< Real > * > _prop_ci
std::vector< std::vector< const MaterialProperty< Real > * > > _d2F1dc1darg
const bool _damped_newton
Check whether to use damping.
const Real _abs_tol
Absolute and relative tolerance of nested Newton iteration.
std::vector< const MaterialProperty< Real > * > _ci_old
std::vector< MaterialPropertyName > _hj_names
Switching functions.
const std::vector< VariableName > _args_names
Coupled variables of free energies.
MaterialName _condition_name
Condition that must be violated for damping to occur.
std::vector< MaterialBase * > _Fj_mat
Free energy instantiation of the MaterialBase class.
std::vector< Real > _ci_IC
const std::vector< MaterialName > _Fj_names
Free energies.
NestedSolve _nested_solve
Instantiation of the NestedSolve class.
static InputParameters validParams()
std::vector< MaterialPropertyName > _ci_names
Phase concentrations.
std::vector< const MaterialProperty< Real > * > _prop_Fi
virtual void initialSetup() override
virtual void computeQpProperties() override
virtual void computePropertiesAtQp(unsigned int qp)
virtual void resize(const std::size_t size) override final
void nonlinearDamped(V &guess, T &&compute, C &&computeCondition)
typename std::conditional< N==1, NSReal, typename std::conditional< N==0, NestedSolveTempl< is_ad >::DynamicVector, Eigen::Matrix< NSReal, N, 1 > >::type >::type Value
const State & getState() const
void nonlinear(V &guess, T &&compute)
typename std::conditional< N==1, NSReal, typename std::conditional< N==0, NestedSolveTempl< is_ad >::DynamicMatrix, Eigen::Matrix< NSReal, N, N > >::type >::type Jacobian
static InputParameters validParams()
void setRelativeTolerance(Real rel)
void setAbsoluteTolerance(Real abs)
const std::size_t & getIterations()