Curved Beam#
|
Modelling a curved beam subjected to out-of-plane loading and evaluating its deflection:
Keywords:
curved beam arc line rectangular cross-section nodal load deflection |
from dlubal.api import rfem, common
from math import inf, pi, cos, sin
# -------------------------------------------------------
# This example demonstrates how to modelling a
# quarter-circle beam with a rectangular cross-section
# which is loaded by means of an out-of-plane force.
# While neglecting self-weight, the total deflection
# of the curved beam is retrieved.
# -------------------------------------------------------
# Editable parameters (SI units)
BEAM_RADIUS = 1
MATERIAL = 'S235'
CSS_WIDTH = 0.025
CSS_HEIGHT = 0.050
LOAD_FZ = 1000
def define_structure() -> list:
"""Define and return a list of structural objects."""
return [
rfem.structure_core.Material(
no=1,
name=MATERIAL,
),
# Cross-Sections
rfem.structure_core.CrossSection(
no=1,
material=1,
type=rfem.structure_core.CrossSection.TYPE_PARAMETRIC_MASSIVE_I,
b=CSS_WIDTH,
h=CSS_HEIGHT,
),
# Nodes
rfem.structure_core.Node(
no=1,
coordinate_1=0.0,
coordinate_2=0.0,
),
rfem.structure_core.Node(
no=2,
coordinate_1=BEAM_RADIUS,
coordinate_2=BEAM_RADIUS,
),
# Lines
rfem.structure_core.Line(
no=1,
type=rfem.structure_core.Line.TYPE_ARC,
definition_nodes=[1, 2],
arc_control_point=common.Vector3d(
x=BEAM_RADIUS + BEAM_RADIUS*cos(3*pi/4),
y=BEAM_RADIUS*sin(3*pi/4),
z=0
),
),
# Members
rfem.structure_core.Member(
no=1,
line=1,
cross_section_start=1,
rotation_specification_type=rfem.structure_core.Member.ROTATION_SPECIFICATION_TYPE_INSIDE,
),
# Nodal Supports
rfem.types_for_nodes.NodalSupport(
no=1,
specific_direction_enabled=True,
nodes=[1],
spring=common.Vector3d(x=inf, y=inf, z=inf),
rotational_restraint=common.Vector3d(x=inf, y=inf, z=inf),
axes_sequence=rfem.types_for_nodes.NodalSupport.AXES_SEQUENCE_ZYX,
rotated_about_angle_1=pi/2,
),
]
def define_loading() -> list:
"""Define and return a list of loading objects."""
return [
# Static Analysis Settings
rfem.loading.StaticAnalysisSettings(
no=1,
),
# Load Cases
rfem.loading.LoadCase(
no=1,
static_analysis_settings=1,
self_weight_active=False,
),
# Nodal Loads | LC1
rfem.loads.NodalLoad(
no=1,
load_type=rfem.loads.NodalLoad.LOAD_TYPE_COMPONENTS,
nodes=[2],
components_force=common.Vector3d(x=0, y=0, z=LOAD_FZ),
load_case=1,
),
]
# Connect to the RFEM application
with rfem.Application() as rfem_app:
app_info = rfem_app.get_application_info()
print(f"\nApplication Info:\n{app_info}")
# Modelling
rfem_app.create_model(name="curved_beam")
rfem_app.delete_all_objects()
rfem_app.create_object_list(define_structure() + define_loading())
# Calculation
calculation_info = rfem_app.calculate_all(
skip_warnings=True
)
print(f"\nCalculation Info:\n{calculation_info}")
# Results
member_deformation_df = rfem_app.get_results(
results_type=rfem.results.STATIC_ANALYSIS_MEMBERS_LOCAL_DEFORMATIONS
).data
# Maximum deflection
max_u_z = member_deformation_df["u_z"].abs().max()
print(f"Max |u_z|: {max_u_z}")
using Google.Protobuf;
using System.Globalization;
using System.Linq;
using Common = Dlubal.Api.Common;
using Rfem = Dlubal.Api.Rfem;
// -------------------------------------------------------
// This example demonstrates how to model a
// quarter-circle beam with a rectangular cross-section
// loaded by an out-of-plane force.
// While neglecting self-weight, the maximum member-local
// deflection |u_z| of the curved beam is retrieved.
// -------------------------------------------------------
// Editable parameters (SI units)
const string MODEL_NAME = "curved_beam";
const string MATERIAL = "S235";
const double BEAM_RADIUS = 1.0;
const double CROSS_SECTION_WIDTH = 0.025;
const double CROSS_SECTION_HEIGHT = 0.050;
const double LOAD_FZ = 1000.0;
static List<IMessage> DefineStructure()
{
return new List<IMessage>
{
new Rfem.StructureCore.Material
{
No = 1,
Name = MATERIAL,
},
new Rfem.StructureCore.CrossSection
{
No = 1,
Type = Rfem.StructureCore.CrossSection.Types.Type.ParametricMassiveI,
B = CROSS_SECTION_WIDTH,
H = CROSS_SECTION_HEIGHT,
Material = 1,
},
new Rfem.StructureCore.Node
{
No = 1,
Coordinate1 = 0.0,
Coordinate2 = 0.0,
},
new Rfem.StructureCore.Node
{
No = 2,
Coordinate1 = BEAM_RADIUS,
Coordinate2 = BEAM_RADIUS,
},
new Rfem.StructureCore.Line
{
No = 1,
DefinitionNodes = { 1, 2 },
ArcControlPoint = new Common.Vector3d
{
X = BEAM_RADIUS + BEAM_RADIUS * Math.Cos(3 * Math.PI / 4),
Y = BEAM_RADIUS * Math.Sin(3 * Math.PI / 4),
Z = 0.0,
},
},
new Rfem.StructureCore.Member
{
No = 1,
Line = 1,
CrossSectionStart = 1,
RotationSpecificationType = Rfem.StructureCore.Member.Types.RotationSpecificationType.Inside,
},
new Rfem.TypesForNodes.NodalSupport
{
No = 1,
SpecificDirectionEnabled = true,
Nodes = { 1 },
Spring = new Common.Vector3d { X = double.PositiveInfinity, Y = double.PositiveInfinity, Z = double.PositiveInfinity },
RotationalRestraint = new Common.Vector3d { X = double.PositiveInfinity, Y = double.PositiveInfinity, Z = double.PositiveInfinity },
RotatedAboutAngle1 = Math.PI / 2.0,
},
};
}
static List<IMessage> DefineLoading()
{
return new List<IMessage>
{
new Rfem.Loading.StaticAnalysisSettings
{
No = 1,
},
new Rfem.Loading.LoadCase
{
No = 1,
StaticAnalysisSettings = 1,
SelfWeightActive = false,
},
new Rfem.Loads.NodalLoad
{
No = 1,
LoadType = Rfem.Loads.NodalLoad.Types.LoadType.Components,
Nodes = { 2 },
ComponentsForce = new Common.Vector3d { X = 0.0, Y = 0.0, Z = LOAD_FZ },
LoadCase = 1,
},
};
}
static double ParseDoubleInvariant(object? value)
{
if (value is null) return double.NaN;
if (value is double d) return d;
return double.TryParse(
Convert.ToString(value, CultureInfo.InvariantCulture),
NumberStyles.Any,
CultureInfo.InvariantCulture,
out var parsed
)
? parsed
: double.NaN;
}
ApplicationRfem? rfemApp = null;
try
{
rfemApp = new ApplicationRfem();
var appInfo = rfemApp.get_application_info();
Console.WriteLine($"\nApplication Info:\n{appInfo}");
rfemApp.create_model(name: MODEL_NAME);
rfemApp.delete_all_objects();
rfemApp.create_object_list(
DefineStructure()
.Concat(DefineLoading())
.ToList()
);
var calculationInfo = rfemApp.calculate_all(skipWarnings: true);
Console.WriteLine($"\nCalculation Info:\n{calculationInfo}");
var memberDeformation = rfemApp.get_results(
resultsType: Rfem.Results.ResultsType.StaticAnalysisMembersLocalDeformations
);
var maxAbsUz = memberDeformation.Data.Rows
.Select(row => ParseDoubleInvariant(row["u_z"]))
.Where(v => !double.IsNaN(v))
.Select(Math.Abs)
.DefaultIfEmpty(double.NaN)
.Max();
Console.WriteLine($"Max |u_z|: {maxAbsUz}");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
finally
{
if (rfemApp != null) rfemApp.close_connection();
}