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

#include <MatVecRealGradAuxKernelAction.h>

Inheritance diagram for MatVecRealGradAuxKernelAction:
[legend]

Public Member Functions

 MatVecRealGradAuxKernelAction (const InputParameters &params)
 
virtual void act ()
 

Protected Attributes

const AuxVariableName _div_var
 
const std::vector< MaterialPropertyName > _prop
 
const MaterialPropertyName _div_prop
 

Detailed Description

Definition at line 15 of file MatVecRealGradAuxKernelAction.h.

Constructor & Destructor Documentation

◆ MatVecRealGradAuxKernelAction()

MatVecRealGradAuxKernelAction::MatVecRealGradAuxKernelAction ( const InputParameters &  params)

Definition at line 38 of file MatVecRealGradAuxKernelAction.C.

39  : Action(params),
40  _div_var(getParam<AuxVariableName>("divergence_variable")),
41  _prop(getParam<std::vector<MaterialPropertyName>>("property")),
42  _div_prop(getParam<MaterialPropertyName>("divergence_property"))
43 {
44  mooseDeprecated("Use 'MaterialVectorAuxKernel' or 'MaterialVectorGradAuxKernel' action instead "
45  "depending on data_type of MaterialProperty<std::vector<data_type> >");
46 }
const std::vector< MaterialPropertyName > _prop

Member Function Documentation

◆ act()

void MatVecRealGradAuxKernelAction::act ( )
virtual

Definition at line 49 of file MatVecRealGradAuxKernelAction.C.

50 {
51  const std::vector<std::string> var_name_base =
52  getParam<std::vector<std::string>>("var_name_base");
53 
54  const unsigned int op_num = getParam<unsigned int>("op_num");
55  const unsigned int dim = getParam<unsigned int>("dim");
56  const unsigned int size_v = var_name_base.size();
57  const unsigned int size_p = _prop.size();
58 
59  if (size_p != size_v)
60  paramError("property", "var_name_base and property must be vectors of the same dimension");
61 
62  for (unsigned int op = 0; op < op_num; ++op)
63  {
64  for (unsigned int val = 0; val < size_v; ++val)
65  for (unsigned int x = 0; x < dim; ++x)
66  {
67  std::string var_name = var_name_base[val] + Moose::stringify(x) + Moose::stringify(op);
68  {
69  InputParameters params = _factory.getValidParams("MaterialStdVectorRealGradientAux");
70  params.set<AuxVariableName>("variable") = var_name;
71  params.set<MaterialPropertyName>("property") = _prop[val];
72  params.set<unsigned int>("component") = x;
73  params.set<unsigned int>("index") = op;
74  params.set<bool>("use_displaced_mesh") = getParam<bool>("use_displaced_mesh");
75  _problem->addAuxKernel("MaterialStdVectorRealGradientAux", "grad_" + var_name, params);
76  }
77  }
78 
79  if (isParamValid("divergence_variable"))
80  {
81  if (isParamValid("divergence_property"))
82  {
83  InputParameters params = _factory.getValidParams("MaterialStdVectorAux");
84  params.set<AuxVariableName>("variable") = _div_var;
85  params.set<MaterialPropertyName>("property") = _div_prop;
86  params.set<unsigned int>("index") = op;
87  params.set<bool>("use_displaced_mesh") = getParam<bool>("use_displaced_mesh");
88  _problem->addAuxKernel("MaterialStdVectorAux", "div_" + Moose::stringify(op), params);
89  }
90  else
91  mooseError("Must specify a divergence_property name along with divergence_variable name");
92  }
93  }
94 }
const std::vector< MaterialPropertyName > _prop

Member Data Documentation

◆ _div_prop

const MaterialPropertyName MatVecRealGradAuxKernelAction::_div_prop
protected

Definition at line 25 of file MatVecRealGradAuxKernelAction.h.

Referenced by act().

◆ _div_var

const AuxVariableName MatVecRealGradAuxKernelAction::_div_var
protected

Definition at line 23 of file MatVecRealGradAuxKernelAction.h.

Referenced by act().

◆ _prop

const std::vector<MaterialPropertyName> MatVecRealGradAuxKernelAction::_prop
protected

Definition at line 24 of file MatVecRealGradAuxKernelAction.h.

Referenced by act().


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