www.mooseframework.org
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
MaterialTimeStepPostprocessor Class Reference

This postporocessor calculates an estimated timestep size that limits an auxiliary variable to below a given threshold. More...

#include <MaterialTimeStepPostprocessor.h>

Inheritance diagram for MaterialTimeStepPostprocessor:
[legend]

Public Member Functions

 MaterialTimeStepPostprocessor (const InputParameters &parameters)
 
virtual void initialize ()
 
virtual void execute ()
 
virtual Real getValue ()
 
virtual void threadJoin (const UserObject &y)
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Attributes

const bool _use_material_timestep_limit
 Flag to find the time step limit from material properties. More...
 
const MaterialProperty< Real > * _matl_time_step
 Pointer to the material property containing the time step limit. More...
 
Real _matl_value
 Current time step limit from the material properties. More...
 
const bool _use_elements_changed
 Flag to limit the time step based on the number of elements changed. More...
 
const int _elements_changed
 Target number of changed elements used to determine if we need to change the time step. More...
 
int _count
 Current number of elements changed. More...
 
const Real _elements_changed_threshold
 Tolerance to determine if elements have changed. More...
 
unsigned int _qp
 Current quadrature point. More...
 
const MaterialProperty< Real > * _changed_property
 Material property used to determine if elements have changed. More...
 
const MaterialProperty< Real > * _changed_property_old
 

Detailed Description

This postporocessor calculates an estimated timestep size that limits an auxiliary variable to below a given threshold.

Definition at line 23 of file MaterialTimeStepPostprocessor.h.

Constructor & Destructor Documentation

◆ MaterialTimeStepPostprocessor()

MaterialTimeStepPostprocessor::MaterialTimeStepPostprocessor ( const InputParameters &  parameters)

Definition at line 58 of file MaterialTimeStepPostprocessor.C.

59  : ElementPostprocessor(parameters),
60  _use_material_timestep_limit(getParam<bool>("use_material_timestep_limit")),
62  ? &getMaterialPropertyByName<Real>("matl_timestep_limit")
63  : nullptr),
64  _matl_value(std::numeric_limits<Real>::max()),
65  _use_elements_changed(parameters.isParamSetByUser("elements_changed_property")),
67  ? &getMaterialPropertyByName<Real>(
68  getParam<MaterialPropertyName>("elements_changed_property"))
69  : nullptr),
71  ? &getMaterialPropertyOldByName<Real>(
72  getParam<MaterialPropertyName>("elements_changed_property"))
73  : nullptr),
74  _elements_changed(isParamValid("elements_changed") ? getParam<int>("elements_changed") : 0),
75  _count(0),
76  _elements_changed_threshold(parameters.isParamSetByUser("elements_changed_threshold'")
77  ? getParam<Real>("elements_changed_threshold'")
78  : TOLERANCE * TOLERANCE),
79  _qp(0)
80 {
81  if (_use_elements_changed && !parameters.isParamSetByUser("elements_changed"))
82  paramError("elements_changed", "needs to be set when elements_changed_property is defined");
83 
85  mooseError("either use_material_timestep_limit needs to be true or elements_changed_property "
86  "defined");
87 }

Member Function Documentation

◆ execute()

void MaterialTimeStepPostprocessor::execute ( )
virtual

Definition at line 97 of file MaterialTimeStepPostprocessor.C.

98 {
100  {
101  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
102  _matl_value = std::min(_matl_value, (*_matl_time_step)[_qp]);
103  }
104 
106  {
107  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
108  {
109  if (!MooseUtils::absoluteFuzzyEqual((*_changed_property)[_qp],
112  {
113  ++_count;
114  return;
115  }
116  }
117  }
118 }

◆ getValue()

Real MaterialTimeStepPostprocessor::getValue ( )
virtual

Definition at line 121 of file MaterialTimeStepPostprocessor.C.

122 {
123  gatherMin(_matl_value);
124  gatherSum(_count);
125 
126  if (_count == 0 || !_use_elements_changed)
127  return _matl_value;
128 
129  return std::min(_dt * (Real)_elements_changed / (Real)_count, _matl_value);
130 }

◆ initialize()

void MaterialTimeStepPostprocessor::initialize ( )
virtual

Definition at line 90 of file MaterialTimeStepPostprocessor.C.

91 {
92  _matl_value = std::numeric_limits<Real>::max(); // start w/ the min
93  _count = 0;
94 }

◆ threadJoin()

void MaterialTimeStepPostprocessor::threadJoin ( const UserObject &  y)
virtual

Definition at line 133 of file MaterialTimeStepPostprocessor.C.

134 {
135  const MaterialTimeStepPostprocessor & pps = static_cast<const MaterialTimeStepPostprocessor &>(y);
137  _matl_value = std::min(_matl_value, pps._matl_value);
139  _count += pps._count;
140 }

◆ validParams()

InputParameters MaterialTimeStepPostprocessor::validParams ( )
static

Definition at line 25 of file MaterialTimeStepPostprocessor.C.

26 {
27  InputParameters params = ElementPostprocessor::validParams();
28 
29  params.addClassDescription("This postprocessor estimates a timestep that reduces the increment "
30  "change in a material property below a given threshold.");
31 
32  params.addParam<bool>("use_material_timestep_limit",
33  true,
34  "if true, the time step is limited by the minimum value of the "
35  "matl_timestep_limit property");
36 
37  params.addParam<MaterialPropertyName>("elements_changed_property",
38  "Name of the material property used to limit the time step "
39  "if its value changes by more than "
40  "'elements_changed_threshold' in at least "
41  "'elements_changed' elements");
42 
43  params.addRangeCheckedParam<int>("elements_changed",
44  "elements_changed > 0",
45  "Maximum number of elements within which the property named in "
46  "'elements_changed_property' is allowed to change by more than "
47  "'elements_changed_threshold' before the time step is limited.");
48 
49  params.addRangeCheckedParam<Real>("elements_changed_threshold",
50  "elements_changed_threshold' > 0",
51  "Maximum permitted change in the value of "
52  "'elements_changed_property' in 'elements_changed' elements "
53  "before the time step is limited.");
54 
55  return params;
56 }

Member Data Documentation

◆ _changed_property

const MaterialProperty<Real>* MaterialTimeStepPostprocessor::_changed_property
protected

Material property used to determine if elements have changed.

Definition at line 48 of file MaterialTimeStepPostprocessor.h.

Referenced by execute().

◆ _changed_property_old

const MaterialProperty<Real>* MaterialTimeStepPostprocessor::_changed_property_old
protected

Definition at line 49 of file MaterialTimeStepPostprocessor.h.

Referenced by execute().

◆ _count

int MaterialTimeStepPostprocessor::_count
protected

Current number of elements changed.

Definition at line 56 of file MaterialTimeStepPostprocessor.h.

Referenced by execute(), getValue(), initialize(), and threadJoin().

◆ _elements_changed

const int MaterialTimeStepPostprocessor::_elements_changed
protected

Target number of changed elements used to determine if we need to change the time step.

Definition at line 53 of file MaterialTimeStepPostprocessor.h.

Referenced by getValue().

◆ _elements_changed_threshold

const Real MaterialTimeStepPostprocessor::_elements_changed_threshold
protected

Tolerance to determine if elements have changed.

Definition at line 59 of file MaterialTimeStepPostprocessor.h.

Referenced by execute().

◆ _matl_time_step

const MaterialProperty<Real>* MaterialTimeStepPostprocessor::_matl_time_step
protected

Pointer to the material property containing the time step limit.

Definition at line 39 of file MaterialTimeStepPostprocessor.h.

Referenced by execute().

◆ _matl_value

Real MaterialTimeStepPostprocessor::_matl_value
protected

Current time step limit from the material properties.

Definition at line 42 of file MaterialTimeStepPostprocessor.h.

Referenced by execute(), getValue(), initialize(), and threadJoin().

◆ _qp

unsigned int MaterialTimeStepPostprocessor::_qp
protected

Current quadrature point.

Definition at line 62 of file MaterialTimeStepPostprocessor.h.

Referenced by execute().

◆ _use_elements_changed

const bool MaterialTimeStepPostprocessor::_use_elements_changed
protected

Flag to limit the time step based on the number of elements changed.

Definition at line 45 of file MaterialTimeStepPostprocessor.h.

Referenced by execute(), getValue(), MaterialTimeStepPostprocessor(), and threadJoin().

◆ _use_material_timestep_limit

const bool MaterialTimeStepPostprocessor::_use_material_timestep_limit
protected

Flag to find the time step limit from material properties.

Definition at line 36 of file MaterialTimeStepPostprocessor.h.

Referenced by execute(), MaterialTimeStepPostprocessor(), and threadJoin().


The documentation for this class was generated from the following files:
MaterialTimeStepPostprocessor::_elements_changed
const int _elements_changed
Target number of changed elements used to determine if we need to change the time step.
Definition: MaterialTimeStepPostprocessor.h:53
MaterialTimeStepPostprocessor::_matl_time_step
const MaterialProperty< Real > * _matl_time_step
Pointer to the material property containing the time step limit.
Definition: MaterialTimeStepPostprocessor.h:39
MaterialTimeStepPostprocessor::_qp
unsigned int _qp
Current quadrature point.
Definition: MaterialTimeStepPostprocessor.h:62
MaterialTimeStepPostprocessor::_changed_property
const MaterialProperty< Real > * _changed_property
Material property used to determine if elements have changed.
Definition: MaterialTimeStepPostprocessor.h:48
MaterialTimeStepPostprocessor::_matl_value
Real _matl_value
Current time step limit from the material properties.
Definition: MaterialTimeStepPostprocessor.h:42
MaterialTimeStepPostprocessor::_changed_property_old
const MaterialProperty< Real > * _changed_property_old
Definition: MaterialTimeStepPostprocessor.h:49
validParams
InputParameters validParams()
MaterialTimeStepPostprocessor::_use_elements_changed
const bool _use_elements_changed
Flag to limit the time step based on the number of elements changed.
Definition: MaterialTimeStepPostprocessor.h:45
MaterialTimeStepPostprocessor::_use_material_timestep_limit
const bool _use_material_timestep_limit
Flag to find the time step limit from material properties.
Definition: MaterialTimeStepPostprocessor.h:36
MaterialTimeStepPostprocessor::_elements_changed_threshold
const Real _elements_changed_threshold
Tolerance to determine if elements have changed.
Definition: MaterialTimeStepPostprocessor.h:59
MaterialTimeStepPostprocessor::_count
int _count
Current number of elements changed.
Definition: MaterialTimeStepPostprocessor.h:56
MaterialTimeStepPostprocessor
This postporocessor calculates an estimated timestep size that limits an auxiliary variable to below ...
Definition: MaterialTimeStepPostprocessor.h:23