https://mooseframework.inl.gov
SmoothTransitionTestMaterial.C
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 
11 
12 registerMooseObject("ThermalHydraulicsTestApp", SmoothTransitionTestMaterial);
13 
16 {
18 
19  MooseEnum transition_type("cubic weighted");
20  params.addRequiredParam<MooseEnum>("transition_type", transition_type, "The transition to test");
21 
22  params.addRequiredCoupledVar("var", "Variable on which transition depends");
23 
24  params.addClassDescription("Class for testing objects derived from SmoothTransition");
25 
26  return params;
27 }
28 
31 
32  _transition_type(getParam<MooseEnum>("transition_type")),
33 
34  _var(coupledValue("var")),
35 
36  _cubic_transition(0.0, 1.0),
37  _weighted_transition(0.0, 1.0),
38 
39  _matprop(declareProperty<Real>("mymatprop")),
40  _dmatprop_dvar(declarePropertyDerivativeTHM<Real>("mymatprop", "var"))
41 {
42  const Real & x1 = _cubic_transition.leftEnd();
43  const Real & x2 = _cubic_transition.rightEnd();
44  _cubic_transition.initialize(f1(x1), f2(x2), df1dx(x1), df2dx(x2));
45 }
46 
47 void
49 {
50  const Real & x = _var[_qp];
51 
52  if (_transition_type == "cubic")
53  {
56  }
57  else if (_transition_type == "weighted")
58  {
61  }
62 }
63 
64 Real
66 {
67  return 2 * x + 2;
68 }
69 
70 Real
72 {
73  return -0.5 * std::pow(x - 1, 2) + 1;
74 }
75 
76 Real
77 SmoothTransitionTestMaterial::df1dx(const Real & /*x*/) const
78 {
79  return 2;
80 }
81 
82 Real
84 {
85  return 1 - x;
86 }
void initialize(const Real &f1_end_value, const Real &f2_end_value, const Real &df1dx_end_value, const Real &df2dx_end_value)
Initializes the polynomial coefficients.
registerMooseObject("ThermalHydraulicsTestApp", SmoothTransitionTestMaterial)
Class for testing objects derived from SmoothTransition.
virtual Real value(const Real &x, const Real &f1, const Real &f2) const override
Computes the transition value.
const WeightedTransition _weighted_transition
void addRequiredParam(const std::string &name, const std::string &doc_string)
Real derivative(const Real &x, const Real &df1dx, const Real &df2dx) const
Computes the derivative of the transition value.
static InputParameters validParams()
const std::vector< double > x
const Real & leftEnd() const
Returns the coordinate of the left end of the transition.
virtual Real value(const Real &x, const Real &f1, const Real &f2) const override
Computes the transition value.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
const Real & rightEnd() const
Returns the coordinate of the right end of the transition.
virtual void computeQpProperties() override
Real derivative(const Real &x, const Real &f1, const Real &f2, const Real &df1dx, const Real &df2dx) const
Computes the derivative of the transition value.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
MaterialProperty< Real > & _dmatprop_dvar
MooseUnits pow(const MooseUnits &, int)
SmoothTransitionTestMaterial(const InputParameters &parameters)