Skip to content

Commit

Permalink
now using geometry shape functions values
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroCornejo committed Dec 2, 2024
1 parent 9a5cd88 commit d8d5303
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void LinearTrussElement<TDimension, TNNodes>::GetShapeFunctionsValuesZ(
rN.resize(SystemSize, false);

rN.clear();

if constexpr (Dimension == 3) {
array_1d<double, NNodes> base_N;
noalias(base_N) = GetBaseShapeFunctions(xi);
Expand Down Expand Up @@ -862,18 +862,12 @@ void LinearTrussElement<TDimension, TNNodes>::load(Serializer& rSerializer)
/***********************************************************************************/

template <SizeType TDimension, SizeType TNNodes>
array_1d<double, TNNodes> LinearTrussElement<TDimension, TNNodes>::GetBaseShapeFunctions(const double xi) const
Vector LinearTrussElement<TDimension, TNNodes>::GetBaseShapeFunctions(const double xi) const
{
array_1d<double, TNNodes> N;

if constexpr (NNodes == 2) {
N[0] = 0.5 * (1.0 - xi);
N[1] = 0.5 * (1.0 + xi);
} else {
N[0] = 0.5 * xi * (xi - 1.0);
N[1] = 0.5 * xi * (xi + 1.0);
N[2] = (1.0 - std::pow(xi, 2));
}
Vector coord(3), N(NNodes);
coord.clear();
coord[0] = xi;
N = GetGeometry().ShapeFunctionsValues(N, coord);
return N;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) LinearTrussElement
/**
* @brief This method returns the base shape functions in a reduced size vector (2 or 3 entries)
*/
array_1d<double, TNNodes> GetBaseShapeFunctions(const double xi) const;
Vector GetBaseShapeFunctions(const double xi) const;

/**
* @brief Returns a n component vector including the values of the DoFs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ KratosStructuralMechanicsApplication::KratosStructuralMechanicsApplication()
mCableElement3D2N(0, Element::GeometryType::Pointer(new Line3D2<NodeType >(Element::GeometryType::PointsArrayType(2)))),
mLinearTrussElement2D2N(0, Element::GeometryType::Pointer(new Line2D2<NodeType >(Element::GeometryType::PointsArrayType(2)))),
mLinearTrussElement2D3N(0, Element::GeometryType::Pointer(new Line2D3<NodeType >(Element::GeometryType::PointsArrayType(3)))),
mLinearTrussElement3D2N(0, Element::GeometryType::Pointer(new Line2D2<NodeType >(Element::GeometryType::PointsArrayType(2)))),
mLinearTrussElement3D3N(0, Element::GeometryType::Pointer(new Line2D3<NodeType >(Element::GeometryType::PointsArrayType(3)))),
mLinearTrussElement3D2N(0, Element::GeometryType::Pointer(new Line3D2<NodeType >(Element::GeometryType::PointsArrayType(2)))),
mLinearTrussElement3D3N(0, Element::GeometryType::Pointer(new Line3D3<NodeType >(Element::GeometryType::PointsArrayType(3)))),
// Adding the beam elements
mCrBeamElement3D2N(0, Element::GeometryType::Pointer(new Line3D2<NodeType >(Element::GeometryType::PointsArrayType(2)))),
mCrLinearBeamElement3D2N(0, Element::GeometryType::Pointer(new Line3D2<NodeType >(Element::GeometryType::PointsArrayType(2)))),
Expand Down

0 comments on commit d8d5303

Please sign in to comment.