https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
47void
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
64Real
66{
67 return 2 * x + 2;
68}
69
70Real
72{
73 return -0.5 * std::pow(x - 1, 2) + 1;
74}
75
76Real
77SmoothTransitionTestMaterial::df1dx(const Real & /*x*/) const
78{
79 return 2;
80}
81
82Real
84{
85 return 1 - x;
86}
const std::vector< double > x
registerMooseObject("ThermalHydraulicsTestApp", SmoothTransitionTestMaterial)
Real derivative(const Real &x, const Real &df1dx, const Real &df2dx) const
Computes the derivative of the transition value.
virtual Real value(const Real &x, const Real &f1, const Real &f2) const override
Computes the transition value.
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.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
Class for testing objects derived from SmoothTransition.
MaterialProperty< Real > & _dmatprop_dvar
const WeightedTransition _weighted_transition
SmoothTransitionTestMaterial(const InputParameters &parameters)
const Real & rightEnd() const
Returns the coordinate of the right end of the transition.
const Real & leftEnd() const
Returns the coordinate of the left end of the transition.
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.
virtual Real value(const Real &x, const Real &f1, const Real &f2) const override
Computes the transition value.