https://mooseframework.inl.gov
Public Member Functions | Protected Attributes | List of all members
WeightedTransition Class Reference

Weighted transition between two functions of one variable. More...

#include <WeightedTransition.h>

Inheritance diagram for WeightedTransition:
[legend]

Public Member Functions

 WeightedTransition (const Real &x_center, const Real &transition_width)
 Constructor. More...
 
virtual Real value (const Real &x, const Real &f1, const Real &f2) const override
 Computes the transition value. More...
 
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. More...
 
Real weight (const Real &x) const
 Computes the weight of the first function. More...
 
const RealleftEnd () const
 Returns the coordinate of the left end of the transition. More...
 
const RealrightEnd () const
 Returns the coordinate of the right end of the transition. More...
 

Protected Attributes

const Real _x_center
 Center point of transition. More...
 
const Real _transition_width
 Width of transition. More...
 
const Real _x1
 Left end point of transition. More...
 
const Real _x2
 Right end point of transition. More...
 

Detailed Description

Weighted transition between two functions of one variable.

Definition at line 17 of file WeightedTransition.h.

Constructor & Destructor Documentation

◆ WeightedTransition()

WeightedTransition::WeightedTransition ( const Real x_center,
const Real transition_width 
)

Constructor.

Parameters
[in]x_centerCenter point of transition
[in]transition_widthWidth of transition

Definition at line 12 of file WeightedTransition.C.

13  : SmoothTransition(x_center, transition_width)
14 {
15 }
SmoothTransition(const Real &x_center, const Real &transition_width)
Constructor.

Member Function Documentation

◆ derivative()

Real WeightedTransition::derivative ( const Real x,
const Real f1,
const Real f2,
const Real df1dx,
const Real df2dx 
) const

Computes the derivative of the transition value.

Parameters
[in]xPoint at which to evaluate transition
[in]f1First function value
[in]f2Second function value
[in]df1dxFirst function derivative
[in]df2dxSecond function derivative

Definition at line 32 of file WeightedTransition.C.

Referenced by SmoothTransitionTestMaterial::computeQpProperties().

34 {
35  if (x <= _x1)
36  return df1dx;
37  else if (x >= _x2)
38  return df2dx;
39  else
40  {
41  const Real w = weight(x);
42  const Real dwdx = -0.5 * std::sin(M_PI / (_x2 - _x1) * (x - _x1)) * M_PI / (_x2 - _x1);
43  return w * df1dx + (1.0 - w) * df2dx + dwdx * (f1 - f2);
44  }
45 }
const Real _x2
Right end point of transition.
Real weight(const Real &x) const
Computes the weight of the first function.
const std::vector< double > x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real _x1
Left end point of transition.

◆ leftEnd()

const Real& SmoothTransition::leftEnd ( ) const
inlineinherited

Returns the coordinate of the left end of the transition.

Definition at line 40 of file SmoothTransition.h.

Referenced by CubicTransitionFunction::CubicTransitionFunction(), and SmoothTransitionTestMaterial::SmoothTransitionTestMaterial().

40 { return _x1; }
const Real _x1
Left end point of transition.

◆ rightEnd()

const Real& SmoothTransition::rightEnd ( ) const
inlineinherited

Returns the coordinate of the right end of the transition.

Definition at line 45 of file SmoothTransition.h.

Referenced by CubicTransitionFunction::CubicTransitionFunction(), and SmoothTransitionTestMaterial::SmoothTransitionTestMaterial().

45 { return _x2; }
const Real _x2
Right end point of transition.

◆ value()

Real WeightedTransition::value ( const Real x,
const Real f1,
const Real f2 
) const
overridevirtual

Computes the transition value.

Parameters
[in]xPoint at which to evaluate function
[in]f1Left function
[in]f2Right function

Implements SmoothTransition.

Definition at line 18 of file WeightedTransition.C.

Referenced by SmoothTransitionTestMaterial::computeQpProperties(), and CosineTransitionFunction::value().

19 {
20  if (x <= _x1)
21  return f1;
22  else if (x >= _x2)
23  return f2;
24  else
25  {
26  const Real w = weight(x);
27  return w * f1 + (1.0 - w) * f2;
28  }
29 }
const Real _x2
Right end point of transition.
Real weight(const Real &x) const
Computes the weight of the first function.
const std::vector< double > x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real _x1
Left end point of transition.

◆ weight()

Real WeightedTransition::weight ( const Real x) const

Computes the weight of the first function.

Parameters
[in]xPoint at which to evaluate weight

Definition at line 48 of file WeightedTransition.C.

Referenced by derivative(), and value().

49 {
50  return 0.5 * (std::cos(M_PI / (_x2 - _x1) * (x - _x1)) + 1.0);
51 }
const Real _x2
Right end point of transition.
const std::vector< double > x
const Real _x1
Left end point of transition.

Member Data Documentation

◆ _transition_width

const Real SmoothTransition::_transition_width
protectedinherited

Width of transition.

Definition at line 51 of file SmoothTransition.h.

◆ _x1

const Real SmoothTransition::_x1
protectedinherited

◆ _x2

const Real SmoothTransition::_x2
protectedinherited

◆ _x_center

const Real SmoothTransition::_x_center
protectedinherited

Center point of transition.

Definition at line 49 of file SmoothTransition.h.


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