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 28 of file PFCFreezingIC.h.

Constructor & Destructor Documentation

◆ PFCFreezingIC()

PFCFreezingIC::PFCFreezingIC ( const InputParameters &  parameters)

Definition at line 46 of file PFCFreezingIC.C.

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

Member Function Documentation

◆ value()

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

Definition at line 81 of file PFCFreezingIC.C.

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

Member Data Documentation

◆ _bottom_left

Point PFCFreezingIC::_bottom_left
private

Definition at line 47 of file PFCFreezingIC.h.

Referenced by value().

◆ _crystal_structure

MooseEnum PFCFreezingIC::_crystal_structure
private

Definition at line 45 of file PFCFreezingIC.h.

Referenced by PFCFreezingIC(), and value().

◆ _icdim

unsigned int PFCFreezingIC::_icdim
private

Definition at line 54 of file PFCFreezingIC.h.

Referenced by PFCFreezingIC(), and value().

◆ _inside

Real PFCFreezingIC::_inside
private

Definition at line 52 of file PFCFreezingIC.h.

Referenced by value().

◆ _lc

Real PFCFreezingIC::_lc
private

Definition at line 44 of file PFCFreezingIC.h.

Referenced by value().

◆ _max

Real PFCFreezingIC::_max
private

Definition at line 51 of file PFCFreezingIC.h.

◆ _min

Real PFCFreezingIC::_min
private

Definition at line 51 of file PFCFreezingIC.h.

Referenced by value().

◆ _outside

Real PFCFreezingIC::_outside
private

Definition at line 52 of file PFCFreezingIC.h.

Referenced by value().

◆ _range

Point PFCFreezingIC::_range
private

Definition at line 49 of file PFCFreezingIC.h.

Referenced by PFCFreezingIC().

◆ _top_right

Point PFCFreezingIC::_top_right
private

Definition at line 48 of file PFCFreezingIC.h.

Referenced by value().

◆ _val_range

Real PFCFreezingIC::_val_range
private

Definition at line 51 of file PFCFreezingIC.h.

Referenced by value().

◆ _x1

Real PFCFreezingIC::_x1
private

Definition at line 36 of file PFCFreezingIC.h.

◆ _x2

Real PFCFreezingIC::_x2
private

Definition at line 40 of file PFCFreezingIC.h.

◆ _y1

Real PFCFreezingIC::_y1
private

Definition at line 37 of file PFCFreezingIC.h.

◆ _y2

Real PFCFreezingIC::_y2
private

Definition at line 41 of file PFCFreezingIC.h.

◆ _z1

Real PFCFreezingIC::_z1
private

Definition at line 38 of file PFCFreezingIC.h.

◆ _z2

Real PFCFreezingIC::_z2
private

Definition at line 42 of file PFCFreezingIC.h.


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