https://mooseframework.inl.gov
InterfaceQpMaterialPropertyBaseUserObject.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 #pragma once
11 
13 
18 template <typename T>
20 {
21 public:
29 
30 protected:
34  virtual Real computeRealValue(const unsigned int qp) override final;
39  const unsigned int qp) = 0;
40 
48 };
49 
50 template <typename T>
53 {
55  params.addRequiredParam<MaterialPropertyName>("property", "The material property name");
56  params.addParam<MaterialPropertyName>("property_neighbor", "The neighbor material property name");
57  params.addClassDescription(
58  "Computes the interface material property value or rate across an interface. The value or "
59  "rate is computed according to the provided interface_value_type parameter.");
60  return params;
61 }
62 
63 template <typename T>
65  const InputParameters & parameters)
66  : InterfaceQpUserObjectBase(parameters),
67  _prop(getMaterialProperty<T>("property")),
68  _prop_neighbor(parameters.isParamSetByUser("property_neighbor")
69  ? getNeighborMaterialProperty<T>("property_neighbor")
70  : getNeighborMaterialProperty<T>("property")),
71  _prop_old(_value_type > 0 ? &getMaterialPropertyOld<T>("property") : nullptr),
72  _prop_neighbor_old(_value_type > 0
73  ? ((parameters.isParamSetByUser("property_neighbor")
74  ? &getNeighborMaterialPropertyOld<T>("property_neighbor")
75  : &getNeighborMaterialPropertyOld<T>("property")))
76  : nullptr)
77 {
78 }
79 
80 template <typename T>
81 Real
83 {
84  Real value_primary = 0;
85  Real value_secondary = 0;
86  // using an if else here because a switch produce an unkown error in the docuemantion test
87  if (_value_type == 0) /*value*/
88  {
89  value_primary = computeScalarMaterialProperty(&_prop, qp);
90  value_secondary = computeScalarMaterialProperty(&_prop_neighbor, qp);
91  }
92  else if (_value_type == 1) /*rate*/
93  {
94  if (_dt != 0)
95  {
96  value_primary = (computeScalarMaterialProperty(&_prop, qp) -
97  computeScalarMaterialProperty(_prop_old, qp)) /
98  _dt;
99  value_secondary = (computeScalarMaterialProperty(&_prop_neighbor, qp) -
100  computeScalarMaterialProperty(_prop_neighbor_old, qp)) /
101  _dt;
102  }
103  }
104  else if (_value_type == 2) /*increment*/
105  {
106  value_primary =
107  (computeScalarMaterialProperty(&_prop, qp) - computeScalarMaterialProperty(_prop_old, qp));
108  value_secondary = (computeScalarMaterialProperty(&_prop_neighbor, qp) -
109  computeScalarMaterialProperty(_prop_neighbor_old, qp));
110  }
111  else
112  mooseError("InterfaceQpMaterialPropertyBaseUserObject::computeRealValue the supplied "
113  "value type has not been implemented");
114 
115  return computeInterfaceValueType(value_primary, value_secondary);
116 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const MaterialProperty< T > & _prop
the material property and neighbor material property current and old value
InterfaceQpMaterialPropertyBaseUserObject(const InputParameters &parameters)
Class constructor.
This is a base class for userobjects collecting values of variables or material properites across an ...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual Real computeRealValue(const unsigned int qp) override final
method defining the scalar value computation given a scalar material property value ...
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
virtual Real computeScalarMaterialProperty(const MaterialProperty< T > *, const unsigned int qp)=0
method returning a scalar material property value given a generic T type
Specialization of InterfaceQpUserObjectBase for material properties.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
const InputParameters & parameters() const
Get the parameters of the object.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...