www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CrystalPlasticitySlipRateGSS Class Referenceabstract

Phenomenological constitutive model slip rate userobject class. More...

#include <CrystalPlasticitySlipRateGSS.h>

Inheritance diagram for CrystalPlasticitySlipRateGSS:
[legend]

Public Member Functions

 CrystalPlasticitySlipRateGSS (const InputParameters &parameters)
 
virtual bool calcSlipRate (unsigned int qp, Real dt, std::vector< Real > &val) const
 
virtual bool calcSlipRateDerivative (unsigned int qp, Real, std::vector< Real > &val) const
 
virtual void calcFlowDirection (unsigned int qp, std::vector< RankTwoTensor > &flow_direction) const
 
virtual bool calcSlipRate (unsigned qp, Real dt, std::vector< Real > &val) const =0
 
virtual bool calcSlipRateDerivative (unsigned qp, Real dt, std::vector< Real > &val) const =0
 
virtual unsigned int variableSize () const
 Returns the size of variable. More...
 

Protected Member Functions

virtual void readFileFlowRateParams ()
 
virtual void getFlowRateParams ()
 
virtual void getSlipSystems ()
 

Protected Attributes

const MaterialProperty< std::vector< Real > > & _mat_prop_state_var
 
const MaterialProperty< RankTwoTensor > & _pk2
 
DenseVector< Real > _a0
 
DenseVector< Real > _xm
 
const MaterialProperty< std::vector< RankTwoTensor > > & _flow_direction
 
unsigned int _num_slip_sys_props
 Number of slip system specific properties provided in the file containing slip system normals and directions. More...
 
std::vector< Real > _flowprops
 
std::string _slip_sys_file_name
 File should contain slip plane normal and direction. More...
 
std::string _slip_sys_flow_prop_file_name
 File should contain values of the flow rate equation parameters. More...
 
unsigned int _num_slip_sys_flowrate_props
 Number of slip system flow rate parameters. More...
 
Real _slip_incr_tol
 Slip increment tolerance. More...
 
DenseVector< Real > _mo
 
DenseVector< Real > _no
 
const MaterialProperty< RankTwoTensor > & _crysrot
 Crystal rotation. More...
 
unsigned int _variable_size
 

Detailed Description

Phenomenological constitutive model slip rate userobject class.

Definition at line 24 of file CrystalPlasticitySlipRateGSS.h.

Constructor & Destructor Documentation

◆ CrystalPlasticitySlipRateGSS()

CrystalPlasticitySlipRateGSS::CrystalPlasticitySlipRateGSS ( const InputParameters &  parameters)

Definition at line 30 of file CrystalPlasticitySlipRateGSS.C.

31  : CrystalPlasticitySlipRate(parameters),
33  getMaterialProperty<std::vector<Real>>(parameters.get<std::string>("uo_state_var_name"))),
34  _pk2(getMaterialPropertyByName<RankTwoTensor>("pk2")),
37  _flow_direction(getMaterialProperty<std::vector<RankTwoTensor>>(_name + "_flow_direction"))
38 {
39  if (_slip_sys_flow_prop_file_name.length() != 0)
41  else
43 }
std::string _slip_sys_flow_prop_file_name
File should contain values of the flow rate equation parameters.
const MaterialProperty< std::vector< RankTwoTensor > > & _flow_direction
CrystalPlasticitySlipRate(const InputParameters &parameters)
const MaterialProperty< RankTwoTensor > & _pk2
const MaterialProperty< std::vector< Real > > & _mat_prop_state_var

Member Function Documentation

◆ calcFlowDirection()

void CrystalPlasticitySlipRateGSS::calcFlowDirection ( unsigned int  qp,
std::vector< RankTwoTensor > &  flow_direction 
) const
virtual

Implements CrystalPlasticitySlipRate.

Definition at line 132 of file CrystalPlasticitySlipRateGSS.C.

134 {
135  DenseVector<Real> mo(LIBMESH_DIM * _variable_size), no(LIBMESH_DIM * _variable_size);
136 
137  // Update slip direction and normal with crystal orientation
138  for (unsigned int i = 0; i < _variable_size; ++i)
139  {
140  for (unsigned int j = 0; j < LIBMESH_DIM; ++j)
141  {
142  mo(i * LIBMESH_DIM + j) = 0.0;
143  for (unsigned int k = 0; k < LIBMESH_DIM; ++k)
144  mo(i * LIBMESH_DIM + j) =
145  mo(i * LIBMESH_DIM + j) + _crysrot[qp](j, k) * _mo(i * LIBMESH_DIM + k);
146  }
147 
148  for (unsigned int j = 0; j < LIBMESH_DIM; ++j)
149  {
150  no(i * LIBMESH_DIM + j) = 0.0;
151  for (unsigned int k = 0; k < LIBMESH_DIM; ++k)
152  no(i * LIBMESH_DIM + j) =
153  no(i * LIBMESH_DIM + j) + _crysrot[qp](j, k) * _no(i * LIBMESH_DIM + k);
154  }
155  }
156 
157  // Calculate Schmid tensor and resolved shear stresses
158  for (unsigned int i = 0; i < _variable_size; ++i)
159  for (unsigned int j = 0; j < LIBMESH_DIM; ++j)
160  for (unsigned int k = 0; k < LIBMESH_DIM; ++k)
161  flow_direction[i](j, k) = mo(i * LIBMESH_DIM + j) * no(i * LIBMESH_DIM + k);
162 }
const MaterialProperty< RankTwoTensor > & _crysrot
Crystal rotation.

◆ calcSlipRate() [1/2]

bool CrystalPlasticitySlipRateGSS::calcSlipRate ( unsigned int  qp,
Real  dt,
std::vector< Real > &  val 
) const
virtual

Definition at line 165 of file CrystalPlasticitySlipRateGSS.C.

166 {
167  DenseVector<Real> tau(_variable_size);
168 
169  for (unsigned int i = 0; i < _variable_size; ++i)
170  tau(i) = _pk2[qp].doubleContraction(_flow_direction[qp][i]);
171 
172  for (unsigned int i = 0; i < _variable_size; ++i)
173  {
174  val[i] = _a0(i) * std::pow(std::abs(tau(i) / _mat_prop_state_var[qp][i]), 1.0 / _xm(i)) *
175  std::copysign(1.0, tau(i));
176  if (std::abs(val[i] * dt) > _slip_incr_tol)
177  {
178 #ifdef DEBUG
179  mooseWarning("Maximum allowable slip increment exceeded ", std::abs(val[i]) * dt);
180 #endif
181  return false;
182  }
183  }
184 
185  return true;
186 }
Real _slip_incr_tol
Slip increment tolerance.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
const MaterialProperty< std::vector< RankTwoTensor > > & _flow_direction
const MaterialProperty< RankTwoTensor > & _pk2
const MaterialProperty< std::vector< Real > > & _mat_prop_state_var

◆ calcSlipRate() [2/2]

virtual bool CrystalPlasticitySlipRate::calcSlipRate ( unsigned  qp,
Real  dt,
std::vector< Real > &  val 
) const
pure virtualinherited

◆ calcSlipRateDerivative() [1/2]

bool CrystalPlasticitySlipRateGSS::calcSlipRateDerivative ( unsigned int  qp,
Real  ,
std::vector< Real > &  val 
) const
virtual

Definition at line 189 of file CrystalPlasticitySlipRateGSS.C.

192 {
193  DenseVector<Real> tau(_variable_size);
194 
195  for (unsigned int i = 0; i < _variable_size; ++i)
196  tau(i) = _pk2[qp].doubleContraction(_flow_direction[qp][i]);
197 
198  for (unsigned int i = 0; i < _variable_size; ++i)
199  val[i] = _a0(i) / _xm(i) *
200  std::pow(std::abs(tau(i) / _mat_prop_state_var[qp][i]), 1.0 / _xm(i) - 1.0) /
201  _mat_prop_state_var[qp][i];
202 
203  return true;
204 }
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
const MaterialProperty< std::vector< RankTwoTensor > > & _flow_direction
const MaterialProperty< RankTwoTensor > & _pk2
const MaterialProperty< std::vector< Real > > & _mat_prop_state_var

◆ calcSlipRateDerivative() [2/2]

virtual bool CrystalPlasticitySlipRate::calcSlipRateDerivative ( unsigned  qp,
Real  dt,
std::vector< Real > &  val 
) const
pure virtualinherited

◆ getFlowRateParams()

void CrystalPlasticitySlipRateGSS::getFlowRateParams ( )
protectedvirtual

Reimplemented from CrystalPlasticitySlipRate.

Definition at line 71 of file CrystalPlasticitySlipRateGSS.C.

Referenced by CrystalPlasticitySlipRateGSS().

72 {
73  if (_flowprops.size() <= 0)
74  mooseError("CrystalPlasticitySlipRateGSS: Error in reading flow rate properties: Specify "
75  "input in .i file or a slip_sys_flow_prop_file_name");
76 
77  _a0.resize(_variable_size);
78  _xm.resize(_variable_size);
79 
80  unsigned int num_data_grp = 2 + _num_slip_sys_flowrate_props; // Number of data per group e.g.
81  // start_slip_sys, end_slip_sys,
82  // value1, value2, ..
83 
84  for (unsigned int i = 0; i < _flowprops.size() / num_data_grp; ++i)
85  {
86  Real vs, ve;
87  unsigned int is, ie;
88 
89  vs = _flowprops[i * num_data_grp];
90  ve = _flowprops[i * num_data_grp + 1];
91 
92  if (vs <= 0 || ve <= 0)
93  mooseError("CrystalPlasticitySlipRateGSS: Indices in flow rate parameter read must be "
94  "positive integers: is = ",
95  vs,
96  " ie = ",
97  ve);
98 
99  if (vs != std::floor(vs) || ve != std::floor(ve))
100  mooseError("CrystalPlasticitySlipRateGSS: Error in reading flow props: Values specifying "
101  "start and end number of slip system groups should be integer");
102 
103  is = static_cast<unsigned int>(vs);
104  ie = static_cast<unsigned int>(ve);
105 
106  if (is > ie)
107  mooseError("CrystalPlasticitySlipRateGSS: Start index is = ",
108  is,
109  " should be greater than end index ie = ",
110  ie,
111  " in flow rate parameter read");
112 
113  for (unsigned int j = is; j <= ie; ++j)
114  {
115  _a0(j - 1) = _flowprops[i * num_data_grp + 2];
116  _xm(j - 1) = _flowprops[i * num_data_grp + 3];
117  }
118  }
119 
120  for (unsigned int i = 0; i < _variable_size; ++i)
121  {
122  if (!(_a0(i) > 0.0 && _xm(i) > 0.0))
123  {
124  mooseWarning(
125  "CrystalPlasticitySlipRateGSS: Non-positive flow rate parameters ", _a0(i), ",", _xm(i));
126  break;
127  }
128  }
129 }
unsigned int _num_slip_sys_flowrate_props
Number of slip system flow rate parameters.

◆ getSlipSystems()

void CrystalPlasticitySlipRate::getSlipSystems ( )
protectedvirtualinherited

Definition at line 67 of file CrystalPlasticitySlipRate.C.

Referenced by CrystalPlasticitySlipRate::CrystalPlasticitySlipRate().

68 {
69  Real vec[LIBMESH_DIM];
70  std::ifstream fileslipsys;
71 
72  MooseUtils::checkFileReadable(_slip_sys_file_name);
73 
74  fileslipsys.open(_slip_sys_file_name.c_str());
75 
76  for (unsigned int i = 0; i < _variable_size; ++i)
77  {
78  // Read the slip normal
79  for (unsigned int j = 0; j < LIBMESH_DIM; ++j)
80  if (!(fileslipsys >> vec[j]))
81  mooseError(
82  "CrystalPlasticitySlipRate Error: Premature end of file reading slip system file \n");
83 
84  // Normalize the vectors
85  Real mag;
86  mag = Utility::pow<2>(vec[0]) + Utility::pow<2>(vec[1]) + Utility::pow<2>(vec[2]);
87  mag = std::sqrt(mag);
88 
89  for (unsigned j = 0; j < LIBMESH_DIM; ++j)
90  _no(i * LIBMESH_DIM + j) = vec[j] / mag;
91 
92  // Read the slip direction
93  for (unsigned int j = 0; j < LIBMESH_DIM; ++j)
94  if (!(fileslipsys >> vec[j]))
95  mooseError(
96  "CrystalPlasticitySlipRate Error: Premature end of file reading slip system file \n");
97 
98  // Normalize the vectors
99  mag = Utility::pow<2>(vec[0]) + Utility::pow<2>(vec[1]) + Utility::pow<2>(vec[2]);
100  mag = std::sqrt(mag);
101 
102  for (unsigned int j = 0; j < LIBMESH_DIM; ++j)
103  _mo(i * LIBMESH_DIM + j) = vec[j] / mag;
104 
105  mag = 0.0;
106  for (unsigned int j = 0; j < LIBMESH_DIM; ++j)
107  mag += _mo(i * LIBMESH_DIM + j) * _no(i * LIBMESH_DIM + j);
108 
109  if (std::abs(mag) > 1e-8)
110  mooseError("CrystalPlasticitySlipRate Error: Slip direction and normal not orthonormal, "
111  "System number = ",
112  i,
113  "\n");
114  }
115 
116  fileslipsys.close();
117 }
std::string _slip_sys_file_name
File should contain slip plane normal and direction.

◆ readFileFlowRateParams()

void CrystalPlasticitySlipRateGSS::readFileFlowRateParams ( )
protectedvirtual

Reimplemented from CrystalPlasticitySlipRate.

Definition at line 46 of file CrystalPlasticitySlipRateGSS.C.

Referenced by CrystalPlasticitySlipRateGSS().

47 {
48  MooseUtils::checkFileReadable(_slip_sys_flow_prop_file_name);
49 
50  std::ifstream file;
51  file.open(_slip_sys_flow_prop_file_name.c_str());
52 
53  std::vector<Real> vec;
54  vec.resize(_num_slip_sys_flowrate_props);
55 
56  for (unsigned int i = 0; i < _variable_size; ++i)
57  {
58  for (unsigned int j = 0; j < _num_slip_sys_flowrate_props; ++j)
59  if (!(file >> vec[j]))
60  mooseError(
61  "Error CrystalPlasticitySlipRateGSS: Premature end of slip_sys_flow_rate_param file");
62 
63  _a0(i) = vec[0];
64  _xm(i) = vec[1];
65  }
66 
67  file.close();
68 }
std::string _slip_sys_flow_prop_file_name
File should contain values of the flow rate equation parameters.
unsigned int _num_slip_sys_flowrate_props
Number of slip system flow rate parameters.

◆ variableSize()

unsigned int CrystalPlasticityUOBase::variableSize ( ) const
virtualinherited

Returns the size of variable.

Definition at line 29 of file CrystalPlasticityUOBase.C.

30 {
31  return _variable_size;
32 }

Member Data Documentation

◆ _a0

DenseVector<Real> CrystalPlasticitySlipRateGSS::_a0
protected

◆ _crysrot

const MaterialProperty<RankTwoTensor>& CrystalPlasticitySlipRate::_crysrot
protectedinherited

Crystal rotation.

Definition at line 69 of file CrystalPlasticitySlipRate.h.

Referenced by calcFlowDirection().

◆ _flow_direction

const MaterialProperty<std::vector<RankTwoTensor> >& CrystalPlasticitySlipRateGSS::_flow_direction
protected

Definition at line 45 of file CrystalPlasticitySlipRateGSS.h.

Referenced by calcSlipRate(), and calcSlipRateDerivative().

◆ _flowprops

std::vector<Real> CrystalPlasticitySlipRate::_flowprops
protectedinherited

Definition at line 46 of file CrystalPlasticitySlipRate.h.

Referenced by getFlowRateParams().

◆ _mat_prop_state_var

const MaterialProperty<std::vector<Real> >& CrystalPlasticitySlipRateGSS::_mat_prop_state_var
protected

Definition at line 38 of file CrystalPlasticitySlipRateGSS.h.

Referenced by calcSlipRate(), and calcSlipRateDerivative().

◆ _mo

DenseVector<Real> CrystalPlasticitySlipRate::_mo
protectedinherited

◆ _no

DenseVector<Real> CrystalPlasticitySlipRate::_no
protectedinherited

◆ _num_slip_sys_flowrate_props

unsigned int CrystalPlasticitySlipRate::_num_slip_sys_flowrate_props
protectedinherited

Number of slip system flow rate parameters.

Definition at line 60 of file CrystalPlasticitySlipRate.h.

Referenced by getFlowRateParams(), and readFileFlowRateParams().

◆ _num_slip_sys_props

unsigned int CrystalPlasticitySlipRate::_num_slip_sys_props
protectedinherited

Number of slip system specific properties provided in the file containing slip system normals and directions.

Definition at line 44 of file CrystalPlasticitySlipRate.h.

◆ _pk2

const MaterialProperty<RankTwoTensor>& CrystalPlasticitySlipRateGSS::_pk2
protected

Definition at line 40 of file CrystalPlasticitySlipRateGSS.h.

Referenced by calcSlipRate(), and calcSlipRateDerivative().

◆ _slip_incr_tol

Real CrystalPlasticitySlipRate::_slip_incr_tol
protectedinherited

Slip increment tolerance.

Definition at line 63 of file CrystalPlasticitySlipRate.h.

Referenced by calcSlipRate().

◆ _slip_sys_file_name

std::string CrystalPlasticitySlipRate::_slip_sys_file_name
protectedinherited

File should contain slip plane normal and direction.

Definition at line 49 of file CrystalPlasticitySlipRate.h.

Referenced by CrystalPlasticitySlipRate::getSlipSystems().

◆ _slip_sys_flow_prop_file_name

std::string CrystalPlasticitySlipRate::_slip_sys_flow_prop_file_name
protectedinherited

File should contain values of the flow rate equation parameters.

Values for every slip system must be provided. Should have the same order of slip systens as in slip_sys_file. The option of reading all the properties from .i is still present.

Definition at line 57 of file CrystalPlasticitySlipRate.h.

Referenced by CrystalPlasticitySlipRateGSS(), and readFileFlowRateParams().

◆ _variable_size

unsigned int CrystalPlasticityUOBase::_variable_size
protectedinherited

◆ _xm

DenseVector<Real> CrystalPlasticitySlipRateGSS::_xm
protected

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