20 "iteration to solve the equal chemical "
21 "potential and concentration conservation equations. This class is "
22 "intended to be used with KKSPhaseConcentrationDerivatives.");
24 params.
addRequiredParam<MaterialPropertyName>(
"h_name",
"Switching function h(eta).");
27 "Phase concentrations. The order must match Fa, Fb, and global_cs, for example, c1, c2, b1, "
30 "Initial values of ci in the same order as ci_names.");
33 params.
addParam<MaterialPropertyName>(
35 "The output number of nested Newton iterations at each quadrature point.");
36 params.
addCoupledVar(
"args",
"The coupled variables of Fa and Fb.");
38 "damped_Newton",
false,
"Whether or not to use the damped Newton's method.");
39 params.
addParam<MaterialName>(
"conditions",
41 "Material property that checks bounds and conditions on the "
42 "material properties being solved for.");
49 _prop_c(coupledValues(
"global_cs")),
50 _num_c(coupledComponents(
"global_cs")),
51 _prop_h(getMaterialProperty<Real>(
"h_name")),
52 _ci_names(getParam<
std::vector<MaterialPropertyName>>(
"ci_names")),
55 _ci_IC(getParam<
std::vector<Real>>(
"ci_IC")),
56 _Fa_name(getParam<MaterialName>(
"fa_name")),
57 _Fb_name(getParam<MaterialName>(
"fb_name")),
61 _dFidci_copy(_num_c * 2),
63 _d2Fadc1db1_copy(_num_c),
64 _args_names(coupledNames(
"args")),
65 _n_args(coupledComponents(
"args")),
67 _dFadarg_copy(_n_args),
69 _dFbdarg_copy(_n_args),
70 _d2Fadcadarg(_n_args),
71 _d2Fadcadarg_copy(_n_args),
72 _iter(declareProperty<Real>(
"nested_iterations")),
73 _abs_tol(getParam<Real>(
"absolute_tolerance")),
74 _rel_tol(getParam<Real>(
"relative_tolerance")),
75 _damped_newton(getParam<bool>(
"damped_Newton")),
76 _condition_name(getParam<MaterialName>(
"conditions")),
81 for (
const auto m : make_range(
_num_c * 2))
96 for (
const auto m : make_range(
_num_c))
110 for (
const auto m : make_range(2))
113 for (
const auto n : make_range(
_num_c))
116 for (
const auto l : make_range(
_num_c))
123 _d2Fidcidbi[1][n][l] = &getMaterialPropertyDerivative<Real>(
130 for (
const auto m : make_range(
_num_c))
133 for (
const auto n : make_range(
_num_c))
139 for (
const auto m : make_range(
_n_args))
149 for (
const auto m : make_range(
_n_args))
153 for (
const auto n : make_range(
_num_c))
171 for (
const auto m : make_range(
_num_c * 2))
178 _Fa = &getMaterial(
"fa_name");
179 _Fb = &getMaterial(
"fb_name");
190 for (
unsigned int m = 0; m <
_num_c * 2; ++m)
191 solution(m) = (*
_ci_old[m])[_qp];
200 for (
const auto m : make_range(
_num_c * 2))
207 for (
const auto m : make_range(
_num_c))
209 residual(m * 2) = (*
_dFidci[m * 2])[_qp] - (*
_dFidci[m * 2 + 1])[_qp];
217 for (
const auto m : make_range(
_num_c))
219 for (
const auto n : make_range(
_num_c))
222 jacobian(m * 2, n * 2) = (*
_d2Fidcidbi[0][m][n])[_qp];
223 jacobian(m * 2, n * 2 + 1) = -(*
_d2Fidcidbi[1][m][n])[_qp];
226 jacobian(m * 2 + 1, m * 2) = 1 -
_prop_h[_qp];
227 jacobian(m * 2 + 1, m * 2 + 1) =
_prop_h[_qp];
232 for (
const auto m : make_range(
_num_c * 2))
245 mooseException(
"Nested Newton iteration did not converge.");
248 for (
const auto m : make_range(
_num_c * 2))
252 for (
const auto m : make_range(2))
255 for (
const auto m : make_range(
_num_c * 2))
258 for (
const auto m : make_range(
_num_c))
260 for (
const auto n : make_range(
_num_c))
264 for (
const auto m : make_range(
_n_args))
270 for (
const auto m : make_range(
_n_args))
272 for (
const auto n : make_range(
_num_c))
registerMooseObject("PhaseFieldApp", KKSPhaseConcentrationMaterial)
const MaterialName _Fb_name
std::vector< MaterialProperty< Real > * > _prop_ci
MaterialBase * _Fa
Free energy instantiation of the MaterialBase class.
const std::vector< const VariableValue * > _prop_c
Global concentrations.
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _d2Fidcidbi
const MaterialProperty< Real > * _C
std::vector< const MaterialProperty< Real > * > _prop_Fi
std::vector< const MaterialProperty< Real > * > _ci_old
std::vector< std::vector< MaterialProperty< Real > * > > _d2Fadc1db1_copy
std::vector< const MaterialProperty< Real > * > _dFadarg
Derivative of free energies wrt coupled variables .
MaterialProperty< Real > & _iter
Number of nested Newton iteration.
const unsigned int _n_args
Number of coupled variables of free energies.
std::vector< const MaterialProperty< Real > * > _dFbdarg
Derivative of free energies wrt coupled variables .
virtual void computeQpProperties() override
virtual void initialSetup() override
const bool _damped_newton
Add damping functionality to nested Newton solve.
std::vector< MaterialProperty< Real > * > _dFadarg_copy
const unsigned int _num_c
Number of global concentrations.
const MaterialName _Fa_name
Free energies.
std::vector< MaterialProperty< Real > * > _dFidci_copy
const Real _abs_tol
Absolute and relative tolerance of nested Newton iteration.
std::vector< std::vector< const MaterialProperty< Real > * > > _d2Fadcadarg
const std::vector< MaterialPropertyName > _ci_names
Phase concentrations.
std::vector< std::vector< MaterialProperty< Real > * > > _d2Fadcadarg_copy
const std::vector< Real > _ci_IC
std::vector< MaterialProperty< Real > * > _dFbdarg_copy
KKSPhaseConcentrationMaterial(const InputParameters ¶meters)
NestedSolve _nested_solve
Instantiation of the NestedSolve class.
MaterialBase * _condition
std::vector< MaterialProperty< Real > * > _Fi_copy
static InputParameters validParams()
const MaterialProperty< Real > & _prop_h
Switching functions.
const std::vector< VariableName > _args_names
Coupled variables of free energies.
MaterialName _condition_name
Material property that defines the confidence bounds for the newton solve.
std::vector< const MaterialProperty< Real > * > _dFidci
Derivative of free energies wrt phase concentrations .
virtual void initQpStatefulProperties() override
virtual void computePropertiesAtQp(unsigned int qp)
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()