https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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.
 
virtual Real value (const Real &x, const Real &f1, const Real &f2) const override
 Computes the transition value.
 
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.
 
Real weight (const Real &x) const
 Computes the weight of the first function.
 
const Real & leftEnd () const
 Returns the coordinate of the left end of the transition.
 
const Real & rightEnd () const
 Returns the coordinate of the right end of the transition.
 

Protected Attributes

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

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}
Base class for smooth transitions between two functions of one variable.

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.

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 std::vector< double > x
const Real _x1
Left end point of transition.
const Real _x2
Right end point of transition.
Real weight(const Real &x) const
Computes the weight of the first function.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by SmoothTransitionTestMaterial::computeQpProperties().

◆ 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.

40{ return _x1; }

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

◆ 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.

45{ return _x2; }

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

◆ 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.

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}

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

◆ 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.

49{
50 return 0.5 * (std::cos(M_PI / (_x2 - _x1) * (x - _x1)) + 1.0);
51}

Referenced by derivative(), and value().

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: