https://mooseframework.inl.gov
Loading...
Searching...
No Matches
KKSMultiACBulkBase.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "KKSMultiACBulkBase.h"
11
14{
16 params.addClassDescription("Multi-order parameter KKS model kernel for the Bulk Allen-Cahn. This "
17 "operates on one of the order parameters 'eta_i' as the non-linear "
18 "variable");
19 params.addRequiredParam<std::vector<MaterialPropertyName>>(
20 "Fj_names", "List of free energies for each phase. Place in same order as hj_names!");
21 params.addRequiredParam<std::vector<MaterialPropertyName>>(
22 "hj_names", "Switching Function Materials that provide h. Place in same order as Fj_names!");
23 params.addRequiredCoupledVar("eta_i",
24 "Order parameter that derivatives are taken with respect to");
25 return params;
26}
27
29 : ACBulk<Real>(parameters),
30 _etai_name(coupledName("eta_i", 0)),
31 _etai_var(coupled("eta_i", 0)),
32 _Fj_names(getParam<std::vector<MaterialPropertyName>>("Fj_names")),
33 _num_j(_Fj_names.size()),
34 _prop_Fj(_num_j),
35 _prop_dFjdarg(_num_j),
36 _hj_names(getParam<std::vector<MaterialPropertyName>>("hj_names")),
37 _prop_hj(_num_j),
38 _prop_dhjdetai(_num_j),
39 _prop_d2hjdetai2(_num_j),
40 _prop_d2hjdetaidarg(_num_j)
41{
42 // check passed in parameter vectors
43 if (_num_j != _hj_names.size())
44 paramError("hj_names", "Need to pass in as many hj_names as Fj_names");
45
46 // reserve space and set phase material properties
47 for (unsigned int n = 0; n < _num_j; ++n)
48 {
49 // get phase free energy
50 _prop_Fj[n] = &getMaterialPropertyByName<Real>(_Fj_names[n]);
51 _prop_dFjdarg[n].resize(_n_args);
52
53 // get switching function and derivatives wrt eta_i, the nonlinear variable
54 _prop_hj[n] = &getMaterialPropertyByName<Real>(_hj_names[n]);
55 _prop_dhjdetai[n] = &getMaterialPropertyDerivative<Real>(_hj_names[n], _etai_name);
57 &getMaterialPropertyDerivative<Real>(_hj_names[n], _etai_name, _etai_name);
58 _prop_d2hjdetaidarg[n].resize(_n_args);
59
60 for (unsigned int i = 0; i < _n_args; ++i)
61 {
62 // Get derivatives of all Fj wrt all coupled variables
63 _prop_dFjdarg[n][i] = &getMaterialPropertyDerivative<Real>(_Fj_names[n], i);
64
65 // Get second derivatives of all hj wrt eta_i and all coupled variables
66 _prop_d2hjdetaidarg[n][i] = &getMaterialPropertyDerivative<Real>(_hj_names[n], _etai_name, i);
67 }
68 }
69}
70
71void
73{
75
76 for (unsigned int n = 0; n < _num_j; ++n)
77 {
78 validateNonlinearCoupling<Real>(_Fj_names[n]);
79 validateNonlinearCoupling<Real>(_hj_names[n]);
80 }
81}
This is the Allen-Cahn equation base class that implements the bulk or local energy term of the equat...
Definition ACBulk.h:25
virtual void initialSetup()
Definition ACBulk.h:79
static InputParameters validParams()
Definition ACBulk.h:69
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
KKSMultiACBulkBase(const InputParameters &parameters)
virtual void initialSetup()
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_dFjdarg
Derivatives of the free energy functions (needed for off-diagonal Jacobians)
std::vector< MaterialPropertyName > _Fj_names
Names of free energy functions for each phase .
std::vector< const MaterialProperty< Real > * > _prop_hj
Values of the switching functions for each phase .
std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
Derivatives of the switching functions wrt the order parameter for this kernel.
static InputParameters validParams()
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2hjdetaidarg
Second derivatives of the switching functions (needed for off-diagonal Jacobians)
std::vector< const MaterialProperty< Real > * > _prop_Fj
Values of the free energy functions for each phase .
VariableName _etai_name
name of order parameter that derivatives are taken wrt (needed to retrieve the derivative material pr...
std::vector< MaterialPropertyName > _hj_names
switching function names
std::vector< const MaterialProperty< Real > * > _prop_d2hjdetai2
Second derivatives of the switching functions wrt the order parameter for this kernel.