/home/runner/work/kynema/kynema/kynema/src/constraints/constraint_type.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/constraints/constraint_type.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
constraint_type.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5#include <Kokkos_Core.hpp>
6
7namespace kynema::constraints {
8
9enum class ConstraintType : std::uint8_t {
10 None = 0, //< No constraint -- default type
11 FixedBC = 1, //< Fixed boundary condition/clamped constraint -- all DOFs fixed at
12 //< the node where the constraint is applied
13 PrescribedBC = 2, //< Prescribed boundary condition -- displacement and orientation values
14 //< are specified => all DOFs are defined at the node
15 RigidJoint = 3, //< Rigid constraint between two nodes -- no relative motion permitted
16 //< between the nodes => all DOFs of target node are constrained
17 RevoluteJoint = 4, //< Target node rotates freely around a specified axis --
18 //< all but one DOFs are constrained
19 RotationControl = 5, //< A rotation is specified about a given axis and other DOFs
20 //< are constrained => all DOFs are constrained/specified
21 FixedBC3DOFs = 6, //< Fixed BC applied to a node with 3 DOFs
22 PrescribedBC3DOFs = 7, //< Prescribed BC applied to a node with 3 DOFs
23 RigidJoint6DOFsTo3DOFs = 8 //< Rigid joint with target node having 3 DOFs
24};
25
27KOKKOS_INLINE_FUNCTION
28constexpr size_t GetNumberOfNodes(ConstraintType t) {
29 // Rigid joint, Revolute joint, Rotation control constraints require two nodes
30 const auto has_two_nodes =
33
34 // Default is one node -- Fixed and Prescribed BCs
35 return 1U + static_cast<size_t>(has_two_nodes);
36}
37
39KOKKOS_INLINE_FUNCTION
40constexpr size_t NumColsForConstraint(ConstraintType type) {
41 // Fixed 3 DOFs on the target node
43 return 3U;
44 }
45
46 // 6 DOFs base node to 3 DOFs target node
48 return 9U;
49 }
50
51 // All other constraints have 12 columns
55 return 12U;
56 }
57
58 return 0U;
59}
60
62KOKKOS_INLINE_FUNCTION
63constexpr size_t NumRowsForConstraint(ConstraintType type) {
64 // 6 to 3 DOF constraints fix 3 DOFs on the target node
67 return 3U;
68 }
69
70 // A revolute joint constraint fixes 5 DOFs
72 return 5U;
73 }
74
75 // All other constraints fix 6 DOFs
76 if (type == ConstraintType::None || type == ConstraintType::FixedBC ||
79 return 6U;
80 }
81
82 return 0U;
83}
84
85} // namespace kynema::constraints
Definition calculate_constraint_output.hpp:8
ConstraintType
Definition constraint_type.hpp:9
KOKKOS_INLINE_FUNCTION constexpr size_t GetNumberOfNodes(ConstraintType t)
Returns the number of nodes used/required by the constraint type.
Definition constraint_type.hpp:28
KOKKOS_INLINE_FUNCTION constexpr size_t NumColsForConstraint(ConstraintType type)
Returns the number of degrees of freedom prescribed/fixed by the constraint type.
Definition constraint_type.hpp:40
KOKKOS_INLINE_FUNCTION constexpr size_t NumRowsForConstraint(ConstraintType type)
Returns the number of degrees of freedom prescribed/fixed by the constraint type.
Definition constraint_type.hpp:63