www.mooseframework.org
Public Member Functions | Private Attributes | List of all members
PolycrystalRandomIC Class Reference

Random initial condition for a polycrystalline material. More...

#include <PolycrystalRandomIC.h>

Inheritance diagram for PolycrystalRandomIC:
[legend]

Public Member Functions

 PolycrystalRandomIC (const InputParameters &parameters)
 
virtual Real value (const Point &p)
 

Private Attributes

const unsigned int _op_num
 
const unsigned int _op_index
 
const unsigned int _random_type
 

Detailed Description

Random initial condition for a polycrystalline material.

Definition at line 24 of file PolycrystalRandomIC.h.

Constructor & Destructor Documentation

◆ PolycrystalRandomIC()

PolycrystalRandomIC::PolycrystalRandomIC ( const InputParameters &  parameters)

Definition at line 28 of file PolycrystalRandomIC.C.

29  : InitialCondition(parameters),
30  _op_num(getParam<unsigned int>("op_num")),
31  _op_index(getParam<unsigned int>("op_index")),
32  _random_type(getParam<unsigned int>("random_type"))
33 {
34 }
const unsigned int _op_num
const unsigned int _random_type
const unsigned int _op_index

Member Function Documentation

◆ value()

Real PolycrystalRandomIC::value ( const Point &  p)
virtual

Definition at line 37 of file PolycrystalRandomIC.C.

38 {
39  Point cur_pos = p;
40  Real val = MooseRandom::rand();
41 
42  switch (_random_type)
43  {
44  case 0: // Continuously random
45  return val;
46 
47  case 1: // Discretely random
48  {
49  unsigned int rndind = _op_num * val;
50 
51  if (rndind == _op_index)
52  return 1.0;
53  else
54  return 0.0;
55  }
56  }
57 
58  paramError("random_type", "Bad type passed in PolycrystalRandomIC");
59 }
const unsigned int _op_num
const unsigned int _random_type
const unsigned int _op_index

Member Data Documentation

◆ _op_index

const unsigned int PolycrystalRandomIC::_op_index
private

Definition at line 33 of file PolycrystalRandomIC.h.

Referenced by value().

◆ _op_num

const unsigned int PolycrystalRandomIC::_op_num
private

Definition at line 32 of file PolycrystalRandomIC.h.

Referenced by value().

◆ _random_type

const unsigned int PolycrystalRandomIC::_random_type
private

Definition at line 34 of file PolycrystalRandomIC.h.

Referenced by value().


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