21 params.
addRequiredParam<Point>(
"position",
"Start position of axis in 3-D space [m]");
24 "Direction of axis from start position to end position (no need to normalize)");
25 params.
addParam<
Real>(
"rotation", 0.0,
"Angle of rotation about the x-axis [degrees]");
26 params.
addRequiredParam<std::vector<Real>>(
"length",
"Length of each axial section [m]");
28 "Number of elements in each axial section");
34 : _position(moose_object->parameters().
get<Point>(
"position")),
36 _dir(initializeDirectionVector(_dir_unnormalized)),
37 _rotation(moose_object->parameters().
get<
Real>(
"rotation")),
38 _lengths(moose_object->parameters().
get<
std::vector<
Real>>(
"length")),
39 _length(
std::accumulate(_lengths.begin(), _lengths.end(), 0.0)),
40 _n_elems(moose_object->parameters().
get<
std::vector<unsigned
int>>(
"n_elems")),
41 _n_elem(
std::accumulate(_n_elems.begin(), _n_elems.end(), 0)),
42 _n_sections(_lengths.size()),
43 _section_end(_n_sections),
45 _R(computeDirectionTransformationTensor(_dir)),
46 _Rx(computeXRotationTransformationTensor(_rotation)),
49 _moose_object_name_dlsi(moose_object->
name())
54 mooseError(
"The parameters 'length' and 'n_elems' must have the same number of entries.");
57 unsigned int k_section_begin = 0;
62 for (
unsigned int i = 0; i <
_n_elems[
j]; i++)
64 const unsigned int k = k_section_begin + i;
76 return dir_unnormalized / dir_unnormalized.
norm();
78 mooseError(
"The parameter 'orientation' must not be the zero vector.");
85 mooseError(
"The direction vector must not be the zero vector.");
87 const auto dir_normalized = dir / dir.
norm();
88 const Real theta = acos(dir_normalized(2));
89 const Real aphi = atan2(dir_normalized(1), dir_normalized(0));
99 const Real rotation_rad = M_PI * rotation / 180.;
115 " has an invalid axial coordinate (",
117 "). Valid axial coordinates are in the range (0,",
128 return v.cross(
_dir).norm();
139 mooseError(
"No axial section index was found.");
146 for (
unsigned int i = 0; i <
_n_elem; ++i)
150 mooseError(
"No axial element index was found.");
159 return R * (Rx * p) + position;
174 return Rx_inv * R_inv * (p - position);
207 const Real & rotation,
208 const std::vector<Real> & lengths,
209 const std::vector<unsigned int> & n_elems)
216 else if (
axis ==
"y")
218 else if (
axis ==
"z")
226 const unsigned int n_elems_total = std::accumulate(n_elems.begin(), n_elems.end(), 0);
227 const unsigned int n_sections = lengths.size();
229 unsigned int i_section_start = 0;
230 Real section_start_ref_position = 0.0;
231 std::vector<Real> element_boundary_coordinates(n_elems_total + 1);
232 element_boundary_coordinates[0] =
234 for (
unsigned int j = 0;
j < n_sections; ++
j)
236 const Real section_dx = lengths[
j] / n_elems[
j];
237 for (
unsigned int k = 0;
k < n_elems[
j]; ++
k)
239 const unsigned int i = i_section_start +
k + 1;
240 const Real ref_position = section_start_ref_position + section_dx *
k;
241 const Point ref_point = Point(ref_position, 0, 0);
242 element_boundary_coordinates[i] =
246 section_start_ref_position += lengths[
j];
247 i_section_start += n_elems[
j];
250 return element_boundary_coordinates;
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sin(_arg) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tan
auto norm() const -> decltype(std::norm(Real()))
Real _length
Total axial length.
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
void mooseError(Args &&... args)
Real computeAxialCoordinate(const Point &p) const
unsigned int getAxialSectionIndex(const Point &p) const
static RealTensorValue computeXRotationTransformationTensor(const Real &rotation)
Computes the rotation transformation tensor.
const RealTensorValue _Rx_inv
Inverse rotational transformation tensor about x-axis.
std::vector< Real > _lengths
Length of each axial section.
static RealTensorValue computeDirectionTransformationTensor(const RealVectorValue &dir)
Computes the direction transformation tensor.
static const std::string axis
bool areParallelVectors(const RealVectorValue &a, const RealVectorValue &b, const Real &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Tests if two real-valued vectors are parallel within some absolute tolerance.
const Real & _rotation
Angle of rotation about the x-axis.
const RealVectorValue _dir
Normalized direction of axis from start position to end position.
TensorValue< Real > RealTensorValue
std::vector< Real > _section_end
Axial coordinate of the end of each axial section using the line 'position' as the origin...
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template cos(_arg) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(cos
bool absoluteFuzzyLessThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
const unsigned int _n_sections
Number of axial sections.
const Point & _position
Start position of axis in 3-D space.
Real computeRadialCoordinate(const Point &p) const
Point computeReferencePointFromRealPoint(const Point &p) const
Computes point in reference space from a point in 3-D space.
static InputParameters validParams()
static const std::string R
const std::vector< unsigned int > & _n_elems
Number of elements in each axial section.
const unsigned int _n_elem
Total number of axial elements.
const RealTensorValue _R_inv
Inverse direction transformation tensor.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
const RealTensorValue _Rx
Rotational transformation tensor about x-axis.
const RealTensorValue _R
Direction transformation tensor.
MooseEnum getAlignmentAxis() const
Gets an axis MooseEnum for the axis the component is aligned with.
bool absoluteFuzzyLessEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
unsigned int getAxialElementIndex(const Point &p_center) const
const std::string _moose_object_name_dlsi
Name of the MOOSE object.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
DiscreteLineSegmentInterface(const MooseObject *moose_object)
static RealVectorValue initializeDirectionVector(const RealVectorValue &dir_unnormalized)
Computes a normalized direction vector or reports an error if the zero vector is provided.
std::vector< Real > getElementBoundaryCoordinates() const
Gets the element boundary coordinates for the aligned axis.
Point computeRealPointFromReferencePoint(const Point &p) const
Computes point in 3-D space from a point in reference space.
static const std::string k
std::vector< Real > _x_centers
Center axial coordinate of each axial element.
void ErrorVector unsigned int
const Elem & get(const ElemType type_in)
bool absoluteFuzzyGreaterThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)