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

PFCFreezingIC creates an initial 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 initial 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 27 of file PFCFreezingIC.h.

Constructor & Destructor Documentation

◆ PFCFreezingIC()

PFCFreezingIC::PFCFreezingIC ( const InputParameters &  parameters)

Definition at line 44 of file PFCFreezingIC.C.

45  : RandomICBase(parameters),
46  _x1(getParam<Real>("x1")),
47  _y1(getParam<Real>("y1")),
48  _z1(getParam<Real>("z1")),
49  _x2(getParam<Real>("x2")),
50  _y2(getParam<Real>("y2")),
51  _z2(getParam<Real>("z2")),
52  _lc(getParam<Real>("lc")),
53  _crystal_structure(getParam<MooseEnum>("crystal_structure")),
55  _top_right(_x2, _y2, _z2),
57  _min(getParam<Real>("min")),
58  _max(getParam<Real>("max")),
59  _val_range(_max - _min),
60  _inside(getParam<Real>("inside")),
61  _outside(getParam<Real>("outside"))
62 {
63  _console << "MooseEnum? " << _crystal_structure << std::endl;
64 
65  for (unsigned int i = 0; i < LIBMESH_DIM; i++)
66  mooseAssert(_range(i) >= 0.0, "x1, y1 or z1 is not less than x2, y2 or z2");
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 }

Member Function Documentation

◆ value()

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 * generateRandom();
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 }

Member Data Documentation

◆ _bottom_left

Point PFCFreezingIC::_bottom_left
private

Definition at line 46 of file PFCFreezingIC.h.

Referenced by value().

◆ _crystal_structure

MooseEnum PFCFreezingIC::_crystal_structure
private

Definition at line 44 of file PFCFreezingIC.h.

Referenced by PFCFreezingIC(), and value().

◆ _icdim

unsigned int PFCFreezingIC::_icdim
private

Definition at line 53 of file PFCFreezingIC.h.

Referenced by PFCFreezingIC(), and value().

◆ _inside

Real PFCFreezingIC::_inside
private

Definition at line 51 of file PFCFreezingIC.h.

Referenced by value().

◆ _lc

Real PFCFreezingIC::_lc
private

Definition at line 43 of file PFCFreezingIC.h.

Referenced by value().

◆ _max

Real PFCFreezingIC::_max
private

Definition at line 50 of file PFCFreezingIC.h.

◆ _min

Real PFCFreezingIC::_min
private

Definition at line 50 of file PFCFreezingIC.h.

Referenced by value().

◆ _outside

Real PFCFreezingIC::_outside
private

Definition at line 51 of file PFCFreezingIC.h.

Referenced by value().

◆ _range

Point PFCFreezingIC::_range
private

Definition at line 48 of file PFCFreezingIC.h.

Referenced by PFCFreezingIC().

◆ _top_right

Point PFCFreezingIC::_top_right
private

Definition at line 47 of file PFCFreezingIC.h.

Referenced by value().

◆ _val_range

Real PFCFreezingIC::_val_range
private

Definition at line 50 of file PFCFreezingIC.h.

Referenced by value().

◆ _x1

Real PFCFreezingIC::_x1
private

Definition at line 35 of file PFCFreezingIC.h.

◆ _x2

Real PFCFreezingIC::_x2
private

Definition at line 39 of file PFCFreezingIC.h.

◆ _y1

Real PFCFreezingIC::_y1
private

Definition at line 36 of file PFCFreezingIC.h.

◆ _y2

Real PFCFreezingIC::_y2
private

Definition at line 40 of file PFCFreezingIC.h.

◆ _z1

Real PFCFreezingIC::_z1
private

Definition at line 37 of file PFCFreezingIC.h.

◆ _z2

Real PFCFreezingIC::_z2
private

Definition at line 41 of file PFCFreezingIC.h.


The documentation for this class was generated from the following files:
PFCFreezingIC::_y2
Real _y2
Definition: PFCFreezingIC.h:40
PFCFreezingIC::_y1
Real _y1
Definition: PFCFreezingIC.h:36
PFCFreezingIC::_x1
Real _x1
Definition: PFCFreezingIC.h:35
PFCFreezingIC::_max
Real _max
Definition: PFCFreezingIC.h:50
PFCFreezingIC::_min
Real _min
Definition: PFCFreezingIC.h:50
PFCFreezingIC::_crystal_structure
MooseEnum _crystal_structure
Definition: PFCFreezingIC.h:44
PFCFreezingIC::_val_range
Real _val_range
Definition: PFCFreezingIC.h:50
PFCFreezingIC::_z1
Real _z1
Definition: PFCFreezingIC.h:37
PFCFreezingIC::_lc
Real _lc
Definition: PFCFreezingIC.h:43
PFCFreezingIC::_inside
Real _inside
Definition: PFCFreezingIC.h:51
PFCFreezingIC::_top_right
Point _top_right
Definition: PFCFreezingIC.h:47
PFCFreezingIC::_outside
Real _outside
Definition: PFCFreezingIC.h:51
PFCFreezingIC::_bottom_left
Point _bottom_left
Definition: PFCFreezingIC.h:46
PFCFreezingIC::_icdim
unsigned int _icdim
Definition: PFCFreezingIC.h:53
PFCFreezingIC::_x2
Real _x2
Definition: PFCFreezingIC.h:39
PFCFreezingIC::_z2
Real _z2
Definition: PFCFreezingIC.h:41
PFCFreezingIC::_range
Point _range
Definition: PFCFreezingIC.h:48