www.mooseframework.org
MaterialTensorAux.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "MaterialTensorAux.h"
11 #include "SymmTensor.h"
12 
13 registerMooseObject("SolidMechanicsApp", MaterialTensorAux);
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<AuxKernel>();
21  params.addRequiredParam<MaterialPropertyName>("tensor", "The material tensor name.");
22  params.addParam<unsigned int>("qp_select", "The quad point you want evaluated");
23  params.addClassDescription(
24  "Outputs quantities related to second-order tensors used as material properties");
25  return params;
26 }
27 
28 MaterialTensorAux::MaterialTensorAux(const InputParameters & parameters)
29  : AuxKernel(parameters),
30  _material_tensor_calculator(parameters),
31  _tensor(getMaterialProperty<SymmTensor>("tensor")),
32  _has_qp_select(isParamValid("qp_select")),
33  _qp_select(_has_qp_select ? getParam<unsigned int>("qp_select") : 0)
34 {
35 }
36 
37 Real
39 {
40  RealVectorValue direction;
41  unsigned int qp_call;
42 
43  if (_has_qp_select)
44  {
45  if (_qp_select < _q_point.size())
46  qp_call = _qp_select;
47  else
48  {
49  Moose::err << "qp_select = " << _qp_select << std::endl;
50  Moose::err << "qp = " << _qp << std::endl;
51  Moose::err << "q_point.size() = " << _q_point.size() << std::endl;
52  mooseError("The parameter qp_select is not valid");
53  }
54  }
55  else
56  qp_call = _qp;
57 
58  Real value =
59  _material_tensor_calculator.getTensorQuantity(_tensor[qp_call], _q_point[qp_call], direction);
60  return value;
61 }
MaterialTensorAux::_tensor
const MaterialProperty< SymmTensor > & _tensor
Definition: MaterialTensorAux.h:32
SymmTensor.h
MaterialTensorAux::_has_qp_select
const bool _has_qp_select
Definition: MaterialTensorAux.h:34
MaterialTensorCalculator::getTensorQuantity
Real getTensorQuantity(const SymmTensor &tensor, const Point &curr_point, RealVectorValue &direction)
Definition: MaterialTensorCalculator.C:71
validParams< MaterialTensorCalculator >
InputParameters validParams< MaterialTensorCalculator >()
Definition: MaterialTensorCalculator.C:15
MaterialTensorAux::_qp_select
const unsigned int _qp_select
Definition: MaterialTensorAux.h:35
MaterialTensorAux::_material_tensor_calculator
MaterialTensorCalculator _material_tensor_calculator
Definition: MaterialTensorAux.h:31
MaterialTensorAux::MaterialTensorAux
MaterialTensorAux(const InputParameters &parameters)
Definition: MaterialTensorAux.C:28
MaterialTensorAux.h
MaterialTensorAux::computeValue
virtual Real computeValue()
Definition: MaterialTensorAux.C:38
registerMooseObject
registerMooseObject("SolidMechanicsApp", MaterialTensorAux)
validParams< MaterialTensorAux >
InputParameters validParams< MaterialTensorAux >()
Definition: MaterialTensorAux.C:17
SymmTensor
Definition: SymmTensor.h:21
MaterialTensorAux
Definition: MaterialTensorAux.h:21