11 #include "MooseMesh.h"
12 #include "MooseVariable.h"
14 #include "libmesh/utility.h"
20 InputParameters params = validParams<InitialCondition>();
21 params.addRequiredParam<Real>(
"invalue",
"The variable value inside the circle");
22 params.addRequiredParam<Real>(
"outvalue",
"The variable value outside the circle");
23 params.addParam<Real>(
24 "int_width", 0.0,
"The interfacial width of the void surface. Defaults to sharp interface");
25 params.addParam<
bool>(
"3D_spheres",
true,
"in 3D, whether the objects are spheres or columns");
26 params.addParam<
bool>(
"zero_gradient",
28 "Set the gradient DOFs to zero. This can avoid "
29 "numerical problems with higher order shape "
30 "functions and overlapping circles.");
31 params.addParam<
unsigned int>(
"rand_seed", 12345,
"Seed value for the random number generator");
32 MooseEnum profileType(
"COS TANH",
"COS");
33 params.addParam<MooseEnum>(
34 "profile", profileType,
"Functional dependence for the interface profile");
39 : InitialCondition(parameters),
40 _mesh(_fe_problem.mesh()),
41 _invalue(parameters.get<Real>(
"invalue")),
42 _outvalue(parameters.get<Real>(
"outvalue")),
43 _int_width(parameters.get<Real>(
"int_width")),
44 _3D_spheres(parameters.get<bool>(
"3D_spheres")),
45 _zero_gradient(parameters.get<bool>(
"zero_gradient")),
46 _num_dim(_3D_spheres ? 3 : 2),
47 _profile(getParam<MooseEnum>(
"profile").getEnum<
ProfileType>())
49 _random.seed(_tid, getParam<unsigned int>(
"rand_seed"));
52 paramError(
"int_width",
53 "Interface width has to be strictly positive for the hyperbolic tangent profile");
64 mooseError(
"_center and _radii vectors are not the same size in the Circle IC");
67 mooseError(
"_center and _radii were not initialized in the Circle IC");
96 for (
unsigned int circ = 0; circ <
_centers.size(); ++circ)
112 Point l_center = center;
120 Real dist =
_mesh.minPeriodicDistance(_var.number(), l_p, l_center);
144 mooseError(
"Internal error.");
150 const Point & center,
153 Point l_center = center;
161 Real dist =
_mesh.minPeriodicDistance(_var.number(), l_p, l_center);
171 if (dist < radius + _int_width / 2.0 && dist > radius -
_int_width / 2.0)
176 (-std::sin(int_pos * libMesh::pi) * libMesh::pi) / 2.0;
182 (1.0 - Utility::pow<2>(std::tanh(4.0 * (radius - dist) /
_int_width)));
186 mooseError(
"Internal error.");
189 return _mesh.minPeriodicVector(_var.number(), center, p) * (DvalueDr / dist);