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

PFCFreezingIC creates an intial density for a PFC model that has one area of a set crystal structure (initialized using sinusoids) and all the rest with a random structure. More...

#include <PFCFreezingIC.h>

Inheritance diagram for PFCFreezingIC:
[legend]

Public Member Functions

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

Private Attributes

Real _x1
 
Real _y1
 
Real _z1
 
Real _x2
 
Real _y2
 
Real _z2
 
Real _lc
 
MooseEnum _crystal_structure
 
Point _bottom_left
 
Point _top_right
 
Point _range
 
Real _min
 
Real _max
 
Real _val_range
 
Real _inside
 
Real _outside
 
unsigned int _icdim
 

Detailed Description

PFCFreezingIC creates an intial density for a PFC model that has one area of a set crystal structure (initialized using sinusoids) and all the rest with a random structure.

The random values will fall between 0 and 1.

Definition at line 25 of file PFCFreezingIC.h.

Constructor & Destructor Documentation

PFCFreezingIC::PFCFreezingIC ( const InputParameters &  parameters)

Definition at line 42 of file PFCFreezingIC.C.

43  : InitialCondition(parameters),
44  _x1(getParam<Real>("x1")),
45  _y1(getParam<Real>("y1")),
46  _z1(getParam<Real>("z1")),
47  _x2(getParam<Real>("x2")),
48  _y2(getParam<Real>("y2")),
49  _z2(getParam<Real>("z2")),
50  _lc(getParam<Real>("lc")),
51  _crystal_structure(getParam<MooseEnum>("crystal_structure")),
53  _top_right(_x2, _y2, _z2),
55  _min(getParam<Real>("min")),
56  _max(getParam<Real>("max")),
57  _val_range(_max - _min),
58  _inside(getParam<Real>("inside")),
59  _outside(getParam<Real>("outside"))
60 {
61  _console << "MooseEnum? " << _crystal_structure << std::endl;
62 
63  for (unsigned int i = 0; i < LIBMESH_DIM; i++)
64  mooseAssert(_range(i) >= 0.0, "x1, y1 or z1 is not less than x2, y2 or z2");
65 
66  MooseRandom::seed(getParam<unsigned int>("seed"));
67 
68  if (_range(1) == 0.0)
69  _icdim = 1;
70  else if (_range(2) < 1.0e-10 * _range(0))
71  _icdim = 2;
72  else
73  _icdim = 3;
74 }
Point _bottom_left
Definition: PFCFreezingIC.h:44
MooseEnum _crystal_structure
Definition: PFCFreezingIC.h:42
unsigned int _icdim
Definition: PFCFreezingIC.h:51

Member Function Documentation

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

Definition at line 77 of file PFCFreezingIC.C.

78 {
79  // If out of bounds, set random value
80  for (unsigned int i = 0; i < LIBMESH_DIM; i++)
81  if (p(i) < _bottom_left(i) || p(i) > _top_right(i))
82  return _min + _val_range * MooseRandom::rand();
83 
84  // If in bounds, set sinusoid IC to make atoms
85  Real val = 0.0;
86  if (_crystal_structure == "FCC")
87  {
88  // Note: this effectively (and now explicitly) returns 0.0 for FCC.
89  return 0.0;
90 
91  for (unsigned int i = 0; i < _icdim; i++)
92  val += std::cos((2.0 / _lc * p(i)) * libMesh::pi);
93  }
94  else
95  {
96  if (_icdim > 2)
97  {
98  for (unsigned int i = 0; i < _icdim; i++)
99  // one mode approximation for initial condition
100  val += (std::cos((2.0 / _lc * p(i % 3)) * libMesh::pi) *
101  std::cos((2.0 / _lc * p((i + 1) % 3)) * libMesh::pi)) /
102  4.0; // Doesn't work in 2D
103  }
104  else
105  {
106  for (unsigned int i = 0; i < _icdim; i++)
107  val *= std::cos((2.0 / _lc * p(i)) * libMesh::pi); // 2D IC for 111 plane
108 
109  val = val / 2.0 + 0.5;
110  }
111  }
112 
113  Real amp = _inside - _outside;
114  val = amp * val + _outside;
115 
116  return val;
117 }
Point _bottom_left
Definition: PFCFreezingIC.h:44
MooseEnum _crystal_structure
Definition: PFCFreezingIC.h:42
unsigned int _icdim
Definition: PFCFreezingIC.h:51

Member Data Documentation

Point PFCFreezingIC::_bottom_left
private

Definition at line 44 of file PFCFreezingIC.h.

Referenced by value().

MooseEnum PFCFreezingIC::_crystal_structure
private

Definition at line 42 of file PFCFreezingIC.h.

Referenced by PFCFreezingIC(), and value().

unsigned int PFCFreezingIC::_icdim
private

Definition at line 51 of file PFCFreezingIC.h.

Referenced by PFCFreezingIC(), and value().

Real PFCFreezingIC::_inside
private

Definition at line 49 of file PFCFreezingIC.h.

Referenced by value().

Real PFCFreezingIC::_lc
private

Definition at line 41 of file PFCFreezingIC.h.

Referenced by value().

Real PFCFreezingIC::_max
private

Definition at line 48 of file PFCFreezingIC.h.

Real PFCFreezingIC::_min
private

Definition at line 48 of file PFCFreezingIC.h.

Referenced by value().

Real PFCFreezingIC::_outside
private

Definition at line 49 of file PFCFreezingIC.h.

Referenced by value().

Point PFCFreezingIC::_range
private

Definition at line 46 of file PFCFreezingIC.h.

Referenced by PFCFreezingIC().

Point PFCFreezingIC::_top_right
private

Definition at line 45 of file PFCFreezingIC.h.

Referenced by value().

Real PFCFreezingIC::_val_range
private

Definition at line 48 of file PFCFreezingIC.h.

Referenced by value().

Real PFCFreezingIC::_x1
private

Definition at line 33 of file PFCFreezingIC.h.

Real PFCFreezingIC::_x2
private

Definition at line 37 of file PFCFreezingIC.h.

Real PFCFreezingIC::_y1
private

Definition at line 34 of file PFCFreezingIC.h.

Real PFCFreezingIC::_y2
private

Definition at line 38 of file PFCFreezingIC.h.

Real PFCFreezingIC::_z1
private

Definition at line 35 of file PFCFreezingIC.h.

Real PFCFreezingIC::_z2
private

Definition at line 39 of file PFCFreezingIC.h.


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