https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
SLKKSSum Class Reference

Enforce the sum of sublattice concentrations to a given phase concentration. More...

#include <SLKKSSum.h>

Inheritance diagram for SLKKSSum:
[legend]

Public Types

typedef std::vector< intJvarMap
 

Public Member Functions

 SLKKSSum (const InputParameters &parameters)
 
virtual void computeOffDiagJacobian (unsigned int jvar) override
 
unsigned int mapJvarToCvar (unsigned int jvar)
 
int mapJvarToCvar (unsigned int jvar, const JvarMap &jvar_map)
 
bool mapJvarToCvar (unsigned int jvar, unsigned int &cvar)
 
const JvarMapgetJvarMap ()
 
const JvarMapgetParameterJvarMap (std::string parameter_name)
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 

Protected Attributes

Real _a_u
 sublattice fraction for the sublattice B concentration represented by the kernel variable
 
const VariableValue_target
 AuxVariable to hold the target sum.
 
const unsigned int _n_args
 
unsigned int _ncs
 sublattice A variables
 
std::vector< const VariableValue * > _cs
 
std::vector< Real > _a_cs
 
const JvarMap_cs_map
 

Private Attributes

const std::size_t _jvar_max_size
 
JvarMap _jvar_map
 
std::map< std::string, JvarMap_jvar_local_map
 

Detailed Description

Enforce the sum of sublattice concentrations to a given phase concentration.

This is for test simulations to equilibrate the internal degrees of freedom in a phase with multiple sublattices. The total concentration is prescribed by an AuxVariable. D. Schwen et al. https://doi.org/10.1016/j.commatsci.2021.110466

Definition at line 22 of file SLKKSSum.h.

Constructor & Destructor Documentation

◆ SLKKSSum()

SLKKSSum::SLKKSSum ( const InputParameters parameters)

Definition at line 28 of file SLKKSSum.C.

30 _ncs(coupledComponents("cs")),
31 _cs(_ncs),
32 _a_cs(getParam<std::vector<Real>>("as")),
34 _a_u(getParam<Real>("a")),
35 _target(coupledValue("sum"))
36{
37 if (_a_cs.size() != _ncs)
38 paramError("as", "Specify one sublattice site fraction per sublattice concentration variable");
39
40 // check and re-normalize sublattice B site fractions
41 Real sum = _a_u;
42 for (std::size_t i = 0; i < _ncs; ++i)
43 sum += _a_cs[i];
44 if (sum <= 0.0)
45 paramError("as", "The sum of the 'as' values and 'a' must be greater than zero");
46 for (std::size_t i = 0; i < _ncs; ++i)
47 _a_cs[i] /= sum;
48 _a_u /= sum;
49
50 // fetch coupled concentrations
51 for (std::size_t i = 0; i < _ncs; ++i)
52 _cs[i] = &coupledValue("cs", i);
53}
const JvarMap & getParameterJvarMap(std::string parameter_name)
const JvarMap & _cs_map
Definition SLKKSSum.h:38
unsigned int _ncs
sublattice A variables
Definition SLKKSSum.h:35
std::vector< Real > _a_cs
Definition SLKKSSum.h:37
Real _a_u
sublattice fraction for the sublattice B concentration represented by the kernel variable
Definition SLKKSSum.h:42
const VariableValue & _target
AuxVariable to hold the target sum.
Definition SLKKSSum.h:45
std::vector< const VariableValue * > _cs
Definition SLKKSSum.h:36
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Member Function Documentation

◆ computeQpJacobian()

Real SLKKSSum::computeQpJacobian ( )
protectedvirtual

Definition at line 66 of file SLKKSSum.C.

67{
68 return _test[_i][_qp] * _phi[_j][_qp] * _a_u;
69}

◆ computeQpOffDiagJacobian()

Real SLKKSSum::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 72 of file SLKKSSum.C.

73{
74 auto csvar = mapJvarToCvar(jvar, _cs_map);
75 if (csvar >= 0)
76 return _test[_i][_qp] * _phi[_j][_qp] * _a_cs[csvar];
77
78 return 0.0;
79}
unsigned int mapJvarToCvar(unsigned int jvar)

◆ computeQpResidual()

Real SLKKSSum::computeQpResidual ( )
protectedvirtual

Definition at line 56 of file SLKKSSum.C.

57{
58 Real csum = _u[_qp] * _a_u;
59 for (std::size_t i = 0; i < _ncs; ++i)
60 csum += (*_cs[i])[_qp] * _a_cs[i];
61
62 return _test[_i][_qp] * (csum - _target[_qp]);
63}

◆ validParams()

InputParameters SLKKSSum::validParams ( )
static

Definition at line 16 of file SLKKSSum.C.

17{
18 auto params = Kernel::validParams();
19 params.addClassDescription(
20 "Enforce the sum of sublattice concentrations to a given phase concentration.");
21 params.addRequiredCoupledVar("cs", "other sublattice concentrations in the same phase");
22 params.addRequiredParam<Real>("a", "Sublattice site fraction for the kernel variable");
23 params.addRequiredParam<std::vector<Real>>("as", "Phase a sublattice site fractions");
24 params.addRequiredCoupledVar("sum", "prescribed sum");
25 return params;
26}
static InputParameters validParams()

Member Data Documentation

◆ _a_cs

std::vector<Real> SLKKSSum::_a_cs
protected

Definition at line 37 of file SLKKSSum.h.

Referenced by computeQpOffDiagJacobian(), computeQpResidual(), and SLKKSSum().

◆ _a_u

Real SLKKSSum::_a_u
protected

sublattice fraction for the sublattice B concentration represented by the kernel variable

Definition at line 42 of file SLKKSSum.h.

Referenced by computeQpJacobian(), computeQpResidual(), and SLKKSSum().

◆ _cs

std::vector<const VariableValue *> SLKKSSum::_cs
protected

Definition at line 36 of file SLKKSSum.h.

Referenced by computeQpResidual(), and SLKKSSum().

◆ _cs_map

const JvarMap& SLKKSSum::_cs_map
protected

Definition at line 38 of file SLKKSSum.h.

Referenced by computeQpOffDiagJacobian().

◆ _ncs

unsigned int SLKKSSum::_ncs
protected

sublattice A variables

Definition at line 35 of file SLKKSSum.h.

Referenced by computeQpResidual(), and SLKKSSum().

◆ _target

const VariableValue& SLKKSSum::_target
protected

AuxVariable to hold the target sum.

Definition at line 45 of file SLKKSSum.h.

Referenced by computeQpResidual().


The documentation for this class was generated from the following files: