www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SpecifiedSmoothCircleIC Class Reference

SpecifiedsmoothCircleIC creates multiple SmoothCircles (number = size of x_positions) that are positioned in the set locations with the set radii. More...

#include <SpecifiedSmoothCircleIC.h>

Inheritance diagram for SpecifiedSmoothCircleIC:
[legend]

Public Member Functions

 SpecifiedSmoothCircleIC (const InputParameters &parameters)
 
virtual Real value (const Point &p)
 
virtual RealGradient gradient (const Point &p)
 
virtual void initialSetup ()
 

Protected Member Functions

virtual void computeCircleRadii ()
 
virtual void computeCircleCenters ()
 
virtual Real computeCircleValue (const Point &p, const Point &center, const Real &radius)
 
virtual RealGradient computeCircleGradient (const Point &p, const Point &center, const Real &radius)
 

Protected Attributes

std::vector< Real > _x_positions
 
std::vector< Real > _y_positions
 
std::vector< Real > _z_positions
 
std::vector< Real > _input_radii
 
MooseMesh & _mesh
 
Real _invalue
 
Real _outvalue
 
Real _int_width
 
bool _3D_spheres
 
bool _zero_gradient
 
unsigned int _num_dim
 
std::vector< Point > _centers
 
std::vector< Real > _radii
 
MooseRandom _random
 

Detailed Description

SpecifiedsmoothCircleIC creates multiple SmoothCircles (number = size of x_positions) that are positioned in the set locations with the set radii.

This is adapted from PolySpecifiedSmoothCircleIC from HYRAX by A.M. Jokisaari

Definition at line 24 of file SpecifiedSmoothCircleIC.h.

Constructor & Destructor Documentation

SpecifiedSmoothCircleIC::SpecifiedSmoothCircleIC ( const InputParameters &  parameters)

Definition at line 28 of file SpecifiedSmoothCircleIC.C.

29  : SmoothCircleBaseIC(parameters),
30  _x_positions(getParam<std::vector<Real>>("x_positions")),
31  _y_positions(getParam<std::vector<Real>>("y_positions")),
32  _z_positions(getParam<std::vector<Real>>("z_positions")),
33  _input_radii(getParam<std::vector<Real>>("radii"))
34 {
35 }
std::vector< Real > _input_radii
SmoothCircleBaseIC(const InputParameters &parameters)
std::vector< Real > _x_positions
std::vector< Real > _z_positions
std::vector< Real > _y_positions

Member Function Documentation

void SpecifiedSmoothCircleIC::computeCircleCenters ( )
protectedvirtual

Implements SmoothCircleBaseIC.

Definition at line 47 of file SpecifiedSmoothCircleIC.C.

48 {
49  _centers.resize(_x_positions.size());
50 
51  for (unsigned int circ = 0; circ < _x_positions.size(); ++circ)
52  {
53  _centers[circ](0) = _x_positions[circ];
54  _centers[circ](1) = _y_positions[circ];
55  _centers[circ](2) = _z_positions[circ];
56  }
57 }
std::vector< Point > _centers
std::vector< Real > _x_positions
std::vector< Real > _z_positions
std::vector< Real > _y_positions
RealGradient SmoothCircleBaseIC::computeCircleGradient ( const Point &  p,
const Point &  center,
const Real &  radius 
)
protectedvirtualinherited

Definition at line 127 of file SmoothCircleBaseIC.C.

Referenced by SmoothCircleBaseIC::gradient().

130 {
131  Point l_center = center;
132  Point l_p = p;
133  if (!_3D_spheres) // Create 3D cylinders instead of spheres
134  {
135  l_p(2) = 0.0;
136  l_center(2) = 0.0;
137  }
138  // Compute the distance between the current point and the center
139  Real dist = _mesh.minPeriodicDistance(_var.number(), l_p, l_center);
140 
141  Real DvalueDr = 0.0;
142 
143  if (dist < radius + _int_width / 2.0 && dist > radius - _int_width / 2.0)
144  {
145  Real int_pos = (dist - radius + _int_width / 2.0) / _int_width;
146  Real Dint_posDr = 1.0 / _int_width;
147  DvalueDr = Dint_posDr * (_invalue - _outvalue) *
148  (-std::sin(int_pos * libMesh::pi) * libMesh::pi) / 2.0;
149  }
150 
151  // Set gradient over the smooth interface
152  if (dist != 0.0)
153  return _mesh.minPeriodicVector(_var.number(), center, p) * (DvalueDr / dist);
154  else
155  return 0.0;
156 }
void SpecifiedSmoothCircleIC::computeCircleRadii ( )
protectedvirtual

Implements SmoothCircleBaseIC.

Definition at line 38 of file SpecifiedSmoothCircleIC.C.

39 {
40  _radii.resize(_input_radii.size());
41 
42  for (unsigned int circ = 0; circ < _input_radii.size(); ++circ)
43  _radii[circ] = _input_radii[circ];
44 }
std::vector< Real > _input_radii
std::vector< Real > _radii
Real SmoothCircleBaseIC::computeCircleValue ( const Point &  p,
const Point &  center,
const Real &  radius 
)
protectedvirtualinherited

Reimplemented in RndSmoothCircleIC.

Definition at line 100 of file SmoothCircleBaseIC.C.

Referenced by SmoothCircleBaseIC::gradient(), and SmoothCircleBaseIC::value().

101 {
102  Point l_center = center;
103  Point l_p = p;
104  if (!_3D_spheres) // Create 3D cylinders instead of spheres
105  {
106  l_p(2) = 0.0;
107  l_center(2) = 0.0;
108  }
109  // Compute the distance between the current point and the center
110  Real dist = _mesh.minPeriodicDistance(_var.number(), l_p, l_center);
111 
112  // Return value
113  Real value = _outvalue; // Outside circle
114 
115  if (dist <= radius - _int_width / 2.0) // Inside circle
116  value = _invalue;
117  else if (dist < radius + _int_width / 2.0) // Smooth interface
118  {
119  Real int_pos = (dist - radius + _int_width / 2.0) / _int_width;
120  value = _outvalue + (_invalue - _outvalue) * (1.0 + std::cos(int_pos * libMesh::pi)) / 2.0;
121  }
122 
123  return value;
124 }
virtual Real value(const Point &p)
RealGradient SmoothCircleBaseIC::gradient ( const Point &  p)
virtualinherited

Reimplemented in PolycrystalVoronoiVoidIC.

Definition at line 77 of file SmoothCircleBaseIC.C.

Referenced by PolycrystalVoronoiVoidIC::gradient().

78 {
79  if (_zero_gradient)
80  return 0.0;
81 
82  RealGradient gradient = 0.0;
83  Real value = _outvalue;
84  Real val2 = 0.0;
85 
86  for (unsigned int circ = 0; circ < _centers.size(); ++circ)
87  {
88  val2 = computeCircleValue(p, _centers[circ], _radii[circ]);
89  if ((val2 > value && _invalue > _outvalue) || (val2 < value && _outvalue > _invalue))
90  {
91  value = val2;
92  gradient = computeCircleGradient(p, _centers[circ], _radii[circ]);
93  }
94  }
95 
96  return gradient;
97 }
virtual Real computeCircleValue(const Point &p, const Point &center, const Real &radius)
std::vector< Real > _radii
std::vector< Point > _centers
virtual Real value(const Point &p)
virtual RealGradient computeCircleGradient(const Point &p, const Point &center, const Real &radius)
virtual RealGradient gradient(const Point &p)
void SmoothCircleBaseIC::initialSetup ( )
virtualinherited

Reimplemented in PolycrystalVoronoiVoidIC, LatticeSmoothCircleIC, and MultiSmoothCircleIC.

Definition at line 47 of file SmoothCircleBaseIC.C.

Referenced by LatticeSmoothCircleIC::initialSetup(), and MultiSmoothCircleIC::initialSetup().

48 {
49  // Compute radii and centers and initialize vector sizes
52 
53  if (_centers.size() != _radii.size())
54  mooseError("_center and _radii vectors are not the same size in the Circle IC");
55 
56  if (_centers.size() < 1)
57  mooseError("_center and _radii were not initialized in the Circle IC");
58 }
std::vector< Real > _radii
std::vector< Point > _centers
virtual void computeCircleRadii()=0
virtual void computeCircleCenters()=0
Real SmoothCircleBaseIC::value ( const Point &  p)
virtualinherited

Reimplemented in PolycrystalVoronoiVoidIC.

Definition at line 61 of file SmoothCircleBaseIC.C.

Referenced by RndSmoothCircleIC::computeCircleValue(), SmoothCircleBaseIC::computeCircleValue(), SmoothCircleBaseIC::gradient(), and PolycrystalVoronoiVoidIC::value().

62 {
63  Real value = _outvalue;
64  Real val2 = 0.0;
65 
66  for (unsigned int circ = 0; circ < _centers.size() && value != _invalue; ++circ)
67  {
68  val2 = computeCircleValue(p, _centers[circ], _radii[circ]);
69  if ((val2 > value && _invalue > _outvalue) || (val2 < value && _outvalue > _invalue))
70  value = val2;
71  }
72 
73  return value;
74 }
virtual Real computeCircleValue(const Point &p, const Point &center, const Real &radius)
std::vector< Real > _radii
std::vector< Point > _centers
virtual Real value(const Point &p)

Member Data Documentation

bool SmoothCircleBaseIC::_3D_spheres
protectedinherited
std::vector<Point> SmoothCircleBaseIC::_centers
protectedinherited
std::vector<Real> SpecifiedSmoothCircleIC::_input_radii
protected

Definition at line 36 of file SpecifiedSmoothCircleIC.h.

Referenced by computeCircleRadii().

Real SmoothCircleBaseIC::_int_width
protectedinherited
Real SmoothCircleBaseIC::_invalue
protectedinherited
MooseMesh& SmoothCircleBaseIC::_mesh
protectedinherited
unsigned int SmoothCircleBaseIC::_num_dim
protectedinherited

Definition at line 50 of file SmoothCircleBaseIC.h.

Real SmoothCircleBaseIC::_outvalue
protectedinherited
std::vector<Real> SmoothCircleBaseIC::_radii
protectedinherited
MooseRandom SmoothCircleBaseIC::_random
protectedinherited
std::vector<Real> SpecifiedSmoothCircleIC::_x_positions
protected

Definition at line 33 of file SpecifiedSmoothCircleIC.h.

Referenced by computeCircleCenters().

std::vector<Real> SpecifiedSmoothCircleIC::_y_positions
protected

Definition at line 34 of file SpecifiedSmoothCircleIC.h.

Referenced by computeCircleCenters().

std::vector<Real> SpecifiedSmoothCircleIC::_z_positions
protected

Definition at line 35 of file SpecifiedSmoothCircleIC.h.

Referenced by computeCircleCenters().

bool SmoothCircleBaseIC::_zero_gradient
protectedinherited

Definition at line 48 of file SmoothCircleBaseIC.h.

Referenced by SmoothCircleBaseIC::gradient().


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