www.mooseframework.org
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)
 

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 24 of file MaterialTimeStepPostprocessor.h.

Constructor & Destructor Documentation

◆ MaterialTimeStepPostprocessor()

MaterialTimeStepPostprocessor::MaterialTimeStepPostprocessor ( const InputParameters &  parameters)

Definition at line 57 of file MaterialTimeStepPostprocessor.C.

58  : ElementPostprocessor(parameters),
59  _use_material_timestep_limit(getParam<bool>("use_material_timestep_limit")),
61  ? &getMaterialPropertyByName<Real>("matl_timestep_limit")
62  : nullptr),
63  _matl_value(std::numeric_limits<Real>::max()),
64  _use_elements_changed(parameters.isParamSetByUser("elements_changed_property")),
66  ? &getMaterialPropertyByName<Real>(
67  getParam<MaterialPropertyName>("elements_changed_property"))
68  : nullptr),
70  ? &getMaterialPropertyOldByName<Real>(
71  getParam<MaterialPropertyName>("elements_changed_property"))
72  : nullptr),
73  _elements_changed(isParamValid("elements_changed") ? getParam<int>("elements_changed") : 0),
74  _count(0),
75  _elements_changed_threshold(parameters.isParamSetByUser("elements_changed_threshold'")
76  ? getParam<Real>("elements_changed_threshold'")
77  : TOLERANCE * TOLERANCE),
78  _qp(0)
79 {
80  if (_use_elements_changed && !parameters.isParamSetByUser("elements_changed"))
81  paramError("elements_changed", "needs to be set when elements_changed_property is defined");
82 
84  mooseError("either use_material_timestep_limit needs to be true or elements_changed_property "
85  "defined");
86 }
unsigned int _qp
Current quadrature point.
const MaterialProperty< Real > * _changed_property
Material property used to determine if elements have changed.
Real _matl_value
Current time step limit from the material properties.
const bool _use_material_timestep_limit
Flag to find the time step limit from material properties.
int _count
Current number of elements changed.
const MaterialProperty< Real > * _changed_property_old
const bool _use_elements_changed
Flag to limit the time step based on the number of elements changed.
const int _elements_changed
Target number of changed elements used to determine if we need to change the time step...
const MaterialProperty< Real > * _matl_time_step
Pointer to the material property containing the time step limit.
const Real _elements_changed_threshold
Tolerance to determine if elements have changed.

Member Function Documentation

◆ execute()

void MaterialTimeStepPostprocessor::execute ( )
virtual

Definition at line 96 of file MaterialTimeStepPostprocessor.C.

97 {
99  {
100  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
101  _matl_value = std::min(_matl_value, (*_matl_time_step)[_qp]);
102  }
103 
105  {
106  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
107  {
108  if (!MooseUtils::absoluteFuzzyEqual((*_changed_property)[_qp],
111  {
112  ++_count;
113  return;
114  }
115  }
116  }
117 }
unsigned int _qp
Current quadrature point.
const MaterialProperty< Real > * _changed_property
Material property used to determine if elements have changed.
Real _matl_value
Current time step limit from the material properties.
const bool _use_material_timestep_limit
Flag to find the time step limit from material properties.
int _count
Current number of elements changed.
const MaterialProperty< Real > * _changed_property_old
const bool _use_elements_changed
Flag to limit the time step based on the number of elements changed.
const MaterialProperty< Real > * _matl_time_step
Pointer to the material property containing the time step limit.
const Real _elements_changed_threshold
Tolerance to determine if elements have changed.

◆ getValue()

Real MaterialTimeStepPostprocessor::getValue ( )
virtual

Definition at line 120 of file MaterialTimeStepPostprocessor.C.

121 {
122  gatherMin(_matl_value);
123  gatherSum(_count);
124 
125  if (_count == 0 || !_use_elements_changed)
126  return _matl_value;
127 
128  return std::min(_dt * (Real)_elements_changed / (Real)_count, _matl_value);
129 }
Real _matl_value
Current time step limit from the material properties.
int _count
Current number of elements changed.
const bool _use_elements_changed
Flag to limit the time step based on the number of elements changed.
const int _elements_changed
Target number of changed elements used to determine if we need to change the time step...

◆ initialize()

void MaterialTimeStepPostprocessor::initialize ( )
virtual

Definition at line 89 of file MaterialTimeStepPostprocessor.C.

90 {
91  _matl_value = std::numeric_limits<Real>::max(); // start w/ the min
92  _count = 0;
93 }
Real _matl_value
Current time step limit from the material properties.
int _count
Current number of elements changed.

◆ threadJoin()

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

Definition at line 132 of file MaterialTimeStepPostprocessor.C.

133 {
134  const MaterialTimeStepPostprocessor & pps = static_cast<const MaterialTimeStepPostprocessor &>(y);
136  _matl_value = std::min(_matl_value, pps._matl_value);
138  _count += pps._count;
139 }
Real _matl_value
Current time step limit from the material properties.
const bool _use_material_timestep_limit
Flag to find the time step limit from material properties.
int _count
Current number of elements changed.
This postporocessor calculates an estimated timestep size that limits an auxiliary variable to below ...
const bool _use_elements_changed
Flag to limit the time step based on the number of elements changed.

Member Data Documentation

◆ _changed_property

const MaterialProperty<Real>* MaterialTimeStepPostprocessor::_changed_property
protected

Material property used to determine if elements have changed.

Definition at line 47 of file MaterialTimeStepPostprocessor.h.

Referenced by execute().

◆ _changed_property_old

const MaterialProperty<Real>* MaterialTimeStepPostprocessor::_changed_property_old
protected

Definition at line 48 of file MaterialTimeStepPostprocessor.h.

Referenced by execute().

◆ _count

int MaterialTimeStepPostprocessor::_count
protected

Current number of elements changed.

Definition at line 55 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 52 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 58 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 38 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 41 of file MaterialTimeStepPostprocessor.h.

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

◆ _qp

unsigned int MaterialTimeStepPostprocessor::_qp
protected

Current quadrature point.

Definition at line 61 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 44 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 35 of file MaterialTimeStepPostprocessor.h.

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


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