www.mooseframework.org
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ExternalForceDensityMaterial Class Reference

This Material calculates the force density acting on a particle/grain due to interaction between particles. More...

#include <ExternalForceDensityMaterial.h>

Inheritance diagram for ExternalForceDensityMaterial:
[legend]

Public Member Functions

 ExternalForceDensityMaterial (const InputParameters &parameters)
 

Protected Member Functions

virtual void computeQpProperties ()
 

Private Attributes

Function & _force_x
 
Function & _force_y
 
Function & _force_z
 
const VariableValue & _c
 concentration field considered to be the density of particles More...
 
VariableName _c_name
 
const Real _k
 stiffness constant More...
 
unsigned int _op_num
 
std::vector< const VariableValue * > _vals
 
std::vector< VariableName > _vals_name
 
MaterialProperty< std::vector< RealGradient > > & _dF
 force density material More...
 
MaterialProperty< std::vector< RealGradient > > & _dFdc
 first order derivative of force density material w.r.t c More...
 
std::vector< MaterialProperty< std::vector< RealGradient > > * > _dFdeta
 

Detailed Description

This Material calculates the force density acting on a particle/grain due to interaction between particles.

Definition at line 27 of file ExternalForceDensityMaterial.h.

Constructor & Destructor Documentation

◆ ExternalForceDensityMaterial()

ExternalForceDensityMaterial::ExternalForceDensityMaterial ( const InputParameters &  parameters)

Definition at line 31 of file ExternalForceDensityMaterial.C.

32  : DerivativeMaterialInterface<Material>(parameters),
33  _force_x(getFunction("force_x")),
34  _force_y(getFunction("force_y")),
35  _force_z(getFunction("force_z")),
36  _c(coupledValue("c")),
37  _c_name(getVar("c", 0)->name()),
38  _k(getParam<Real>("k")),
39  _op_num(coupledComponents(
40  "etas")), // determine number of grains from the number of names passed in.
41  _vals(_op_num), // Size variable arrays
43  _dF(declareProperty<std::vector<RealGradient>>("force_density_ext")),
44  _dFdc(declarePropertyDerivative<std::vector<RealGradient>>("force_density_ext", _c_name)),
46 {
47  // Loop through grains and load coupled variables into the arrays
48  for (unsigned int i = 0; i < _op_num; ++i)
49  {
50  _vals[i] = &coupledValue("etas", i);
51  _vals_name[i] = getVar("etas", i)->name();
52  _dFdeta[i] =
53  &declarePropertyDerivative<std::vector<RealGradient>>("force_density_ext", _vals_name[i]);
54  }
55 }
MaterialProperty< std::vector< RealGradient > > & _dFdc
first order derivative of force density material w.r.t c
std::vector< VariableName > _vals_name
const VariableValue & _c
concentration field considered to be the density of particles
const Real _k
stiffness constant
std::vector< MaterialProperty< std::vector< RealGradient > > * > _dFdeta
MaterialProperty< std::vector< RealGradient > > & _dF
force density material
std::vector< const VariableValue * > _vals

Member Function Documentation

◆ computeQpProperties()

void ExternalForceDensityMaterial::computeQpProperties ( )
protectedvirtual

Definition at line 58 of file ExternalForceDensityMaterial.C.

59 {
60  _dF[_qp].resize(_op_num);
61  _dFdc[_qp].resize(_op_num);
62 
63  for (unsigned int i = 0; i < _op_num; ++i)
64  {
65  _dF[_qp][i](0) = _k * _c[_qp] * _force_x.value(_t, _q_point[_qp]) * (*_vals[i])[_qp];
66  _dF[_qp][i](1) = _k * _c[_qp] * _force_y.value(_t, _q_point[_qp]) * (*_vals[i])[_qp];
67  _dF[_qp][i](2) = _k * _c[_qp] * _force_z.value(_t, _q_point[_qp]) * (*_vals[i])[_qp];
68 
69  _dFdc[_qp][i](0) = _k * _force_x.value(_t, _q_point[_qp]) * (*_vals[i])[_qp];
70  _dFdc[_qp][i](1) = _k * _force_y.value(_t, _q_point[_qp]) * (*_vals[i])[_qp];
71  _dFdc[_qp][i](2) = _k * _force_z.value(_t, _q_point[_qp]) * (*_vals[i])[_qp];
72  }
73 
74  for (unsigned int i = 0; i < _op_num; ++i)
75  {
76  (*_dFdeta[i])[_qp].resize(_op_num);
77  for (unsigned int j = 0; j < _op_num; ++j)
78  {
79  (*_dFdeta[i])[_qp][j](0) = _k * _c[_qp] * _force_x.value(_t, _q_point[_qp]);
80  (*_dFdeta[i])[_qp][j](1) = _k * _c[_qp] * _force_y.value(_t, _q_point[_qp]);
81  (*_dFdeta[i])[_qp][j](2) = _k * _c[_qp] * _force_z.value(_t, _q_point[_qp]);
82  }
83  }
84 }
MaterialProperty< std::vector< RealGradient > > & _dFdc
first order derivative of force density material w.r.t c
const VariableValue & _c
concentration field considered to be the density of particles
const Real _k
stiffness constant
std::vector< MaterialProperty< std::vector< RealGradient > > * > _dFdeta
MaterialProperty< std::vector< RealGradient > > & _dF
force density material
std::vector< const VariableValue * > _vals

Member Data Documentation

◆ _c

const VariableValue& ExternalForceDensityMaterial::_c
private

concentration field considered to be the density of particles

Definition at line 41 of file ExternalForceDensityMaterial.h.

Referenced by computeQpProperties().

◆ _c_name

VariableName ExternalForceDensityMaterial::_c_name
private

Definition at line 42 of file ExternalForceDensityMaterial.h.

◆ _dF

MaterialProperty<std::vector<RealGradient> >& ExternalForceDensityMaterial::_dF
private

force density material

Definition at line 51 of file ExternalForceDensityMaterial.h.

Referenced by computeQpProperties().

◆ _dFdc

MaterialProperty<std::vector<RealGradient> >& ExternalForceDensityMaterial::_dFdc
private

first order derivative of force density material w.r.t c

Definition at line 53 of file ExternalForceDensityMaterial.h.

Referenced by computeQpProperties().

◆ _dFdeta

std::vector<MaterialProperty<std::vector<RealGradient> > *> ExternalForceDensityMaterial::_dFdeta
private

◆ _force_x

Function& ExternalForceDensityMaterial::_force_x
private

Definition at line 36 of file ExternalForceDensityMaterial.h.

Referenced by computeQpProperties().

◆ _force_y

Function& ExternalForceDensityMaterial::_force_y
private

Definition at line 37 of file ExternalForceDensityMaterial.h.

Referenced by computeQpProperties().

◆ _force_z

Function& ExternalForceDensityMaterial::_force_z
private

Definition at line 38 of file ExternalForceDensityMaterial.h.

Referenced by computeQpProperties().

◆ _k

const Real ExternalForceDensityMaterial::_k
private

stiffness constant

Definition at line 44 of file ExternalForceDensityMaterial.h.

Referenced by computeQpProperties().

◆ _op_num

unsigned int ExternalForceDensityMaterial::_op_num
private

◆ _vals

std::vector<const VariableValue *> ExternalForceDensityMaterial::_vals
private

◆ _vals_name

std::vector<VariableName> ExternalForceDensityMaterial::_vals_name
private

Definition at line 48 of file ExternalForceDensityMaterial.h.

Referenced by ExternalForceDensityMaterial().


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