Member Stiffness Modification#
|
Modelling a concrete frame with member stiffness modifications to check impact on the deflection:
Keywords:
frame member stiffness modification structure modification load combination member deformation |
from math import inf
from dlubal.api import common, rfem
# -------------------------------------------------------
# Parametric concrete portal frame with member stiffness
# modifications:
# - beam: 0.35 * EI
# - columns: 0.70 * EI
#
# Assumptions:
# - single-bay 2D frame in the global XZ plane
# - Z-up coordinate system
# - fixed supports at column bases
# - C30/37 rectangular cross-sections for columns and beam
# - stiffness reduction is applied to both local bending axes
# - two ULS design situations are generated:
# 1) unreduced stiffness
# 2) reduced stiffness from the structure modification
# -------------------------------------------------------
# Editable parameters (SI units)
MODEL_NAME = "member_stiffness_modification"
FRAME_SPAN = 6.0
FRAME_HEIGHT = 3.5
MATERIAL = "C30/37"
COLUMN_CSS_WIDTH = 0.30
COLUMN_CSS_HEIGHT = 0.30
COLUMN_EI_FACTOR = 0.70
BEAM_CSS_WIDTH = 0.30
BEAM_CSS_HEIGHT = 0.60
BEAM_EI_FACTOR = 0.35
SELF_WEIGHT_ACTIVE = True
BEAM_DISTRIBUTED_LOAD = -20_000.0 # N/m, global Z direction
def define_structure() -> list:
"""Define and return the frame geometry, material, sections, and supports."""
return [
rfem.structure_core.Material(
no=1,
name=MATERIAL,
),
rfem.structure_core.CrossSection(
no=1,
type=rfem.structure_core.CrossSection.TYPE_PARAMETRIC_MASSIVE_I,
material=1,
b=COLUMN_CSS_WIDTH,
h=COLUMN_CSS_HEIGHT,
),
rfem.structure_core.CrossSection(
no=2,
type=rfem.structure_core.CrossSection.TYPE_PARAMETRIC_MASSIVE_I,
material=1,
b=BEAM_CSS_WIDTH,
h=BEAM_CSS_HEIGHT,
),
# Nodes
rfem.structure_core.Node(no=1, coordinate_1=0.0, coordinate_2=0.0, coordinate_3=0.0),
rfem.structure_core.Node(no=2, coordinate_1=FRAME_SPAN, coordinate_2=0.0, coordinate_3=0.0),
rfem.structure_core.Node(no=3, coordinate_1=0.0, coordinate_2=0.0, coordinate_3=FRAME_HEIGHT),
rfem.structure_core.Node(no=4, coordinate_1=FRAME_SPAN, coordinate_2=0.0, coordinate_3=FRAME_HEIGHT),
# Lines
rfem.structure_core.Line(no=1, definition_nodes=[1, 3]),
rfem.structure_core.Line(no=2, definition_nodes=[2, 4]),
rfem.structure_core.Line(no=3, definition_nodes=[3, 4]),
# Members: 1-2 columns, 3 beam
rfem.structure_core.Member(no=1, line=1, cross_section_start=1),
rfem.structure_core.Member(no=2, line=2, cross_section_start=1),
rfem.structure_core.Member(no=3, line=3, cross_section_start=2),
rfem.types_for_nodes.NodalSupport(
no=1,
nodes=[1, 2],
spring=common.Vector3d(x=inf, y=inf, z=inf),
rotational_restraint=common.Vector3d(x=inf, y=inf, z=inf),
),
]
def member_stiffness_modification(no: int, name: str, factor: float):
"""Create a member stiffness modification for bending stiffness EI."""
return rfem.types_for_members.MemberStiffnessModification(
no=no,
user_defined_name_enabled=True,
name=name,
type=rfem.types_for_members.MemberStiffnessModification.TYPE_PARTIAL_STIFFNESSES_FACTORS,
factor_of_axial_stiffness=1.0,
factor_of_bending_y_stiffness=factor,
factor_of_bending_z_stiffness=factor,
partial_stiffness_factor_of_shear_y_stiffness=1.0,
partial_stiffness_factor_of_shear_z_stiffness=1.0,
partial_stiffness_factor_of_torsion_stiffness=1.0,
partial_stiffness_factor_of_weight=1.0,
)
def define_stiffness_modification() -> list:
"""Define member modifications and assign them to columns and beam."""
return [
member_stiffness_modification(
no=1,
name=f"Columns: {COLUMN_EI_FACTOR:.2f} EI",
factor=COLUMN_EI_FACTOR,
),
member_stiffness_modification(
no=2,
name=f"Beam: {BEAM_EI_FACTOR:.2f} EI",
factor=BEAM_EI_FACTOR,
),
rfem.structure_advanced.StructureModification(
no=1,
user_defined_name_enabled=True,
name="Reduced member bending stiffness",
modify_stiffnesses_members=True,
modify_stiffnesses_member_table=rfem.structure_advanced.StructureModification.ModifyStiffnessesMemberTable(
rows=[
rfem.structure_advanced.StructureModification.ModifyStiffnessesMemberTableRow(
no=1,
description=f"Columns {COLUMN_EI_FACTOR:.2f} EI",
member_modification=1,
members=[1, 2],
),
rfem.structure_advanced.StructureModification.ModifyStiffnessesMemberTableRow(
no=2,
description=f"Beam {BEAM_EI_FACTOR:.2f} EI",
member_modification=2,
members=[3],
),
]
),
),
]
def define_loading() -> list:
"""Define loads, combination wizards, and two ULS design situations."""
return [
rfem.loading.StaticAnalysisSettings(
no=1,
analysis_type=rfem.loading.StaticAnalysisSettings.ANALYSIS_TYPE_GEOMETRICALLY_LINEAR,
),
rfem.loading.LoadCase(
no=1,
name="Permanent loads",
action_category=rfem.loading.LoadCase.ACTION_CATEGORY_PERMANENT_G,
static_analysis_settings=1,
self_weight_active=SELF_WEIGHT_ACTIVE,
),
rfem.loads.MemberLoad(
no=1,
load_case=1,
members=[3],
load_type=rfem.loads.MemberLoad.LOAD_TYPE_FORCE,
load_distribution=rfem.loads.MemberLoad.LOAD_DISTRIBUTION_UNIFORM,
load_direction=rfem.loads.MemberLoad.LOAD_DIRECTION_GLOBAL_Z_OR_USER_DEFINED_W_TRUE_LENGTH,
magnitude=BEAM_DISTRIBUTED_LOAD,
),
rfem.loading.CombinationWizard(
no=1,
user_defined_name_enabled=True,
name="Combinations - unreduced stiffness",
static_analysis_settings=1,
generate_combinations=rfem.loading.CombinationWizard.GENERATE_COMBINATIONS_LOAD_COMBINATIONS,
),
rfem.loading.CombinationWizard(
no=2,
user_defined_name_enabled=True,
name="Combinations - reduced stiffness",
static_analysis_settings=1,
generate_combinations=rfem.loading.CombinationWizard.GENERATE_COMBINATIONS_LOAD_COMBINATIONS,
structure_modification_enabled=True,
structure_modification=1,
),
rfem.loading.DesignSituation(
no=1,
user_defined_name_enabled=True,
name="ULS - unreduced stiffness",
design_situation_type=rfem.loading.DesignSituation.DESIGN_SITUATION_TYPE_STR_PERMANENT_AND_TRANSIENT_6_10,
combination_wizard=1,
active=True,
),
rfem.loading.DesignSituation(
no=2,
user_defined_name_enabled=True,
name="ULS - reduced stiffness",
design_situation_type=rfem.loading.DesignSituation.DESIGN_SITUATION_TYPE_STR_PERMANENT_AND_TRANSIENT_6_10,
combination_wizard=2,
active=True,
),
]
with rfem.Application() as rfem_app:
print(f"\nCreating model: {MODEL_NAME}")
rfem_app.create_model(name=MODEL_NAME)
base_data = rfem_app.get_base_data()
base_data.main.surfaces_active = False
base_data.combinations_settings.combination_wizard_active = True
base_data.general_settings.global_axes_orientation = (
rfem.BaseData.GeneralSettings.GLOBAL_AXES_ORIENTATION_ZUP
)
rfem_app.set_base_data(base_data=base_data)
rfem_app.delete_all_objects()
rfem_app.create_object_list(
define_structure()
+ define_stiffness_modification()
+ define_loading()
)
rfem_app.generate_combinations()
load_combinations = rfem_app.get_object_list([rfem.loading.LoadCombination()])
print("\nGenerated Load Combinations:")
for load_combination in load_combinations:
structure_modification = (
load_combination.structure_modification
if load_combination.structure_modification_enabled
else "none"
)
print(
f"CO{load_combination.no}: "
f"{load_combination.name}, "
f"structure modification: {structure_modification}"
)
calculation_info = rfem_app.calculate_all(skip_warnings=True)
print(f"\nCalculation Succeeded:\n{calculation_info.succeeded}")
print("\nMaximum vertical member deflection by load combination:")
for load_combination in load_combinations:
member_deformation_df = rfem_app.get_results(
results_type=rfem.results.STATIC_ANALYSIS_MEMBERS_LOCAL_DEFORMATIONS,
filters=[
rfem.results.ResultsFilter(
column_id="loading",
filter_expression=f"CO{load_combination.no}",
),
],
).data
max_u_z = member_deformation_df["u_z"].abs().max()
print(f"CO{load_combination.no}: Max |u_z|: {max_u_z}")
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Common = Dlubal.Api.Common;
using Google.Protobuf;
using Rfem = Dlubal.Api.Rfem;
// -------------------------------------------------------
// Parametric concrete portal frame with member stiffness
// modifications:
// - beam: 0.35 * EI
// - columns: 0.70 * EI
//
// Assumptions:
// - single-bay 2D frame in the global XZ plane
// - Z-up coordinate system
// - fixed supports at column bases
// - C30/37 rectangular cross-sections for columns and beam
// - stiffness reduction is applied to both local bending axes
// - two ULS design situations are generated:
// 1) unreduced stiffness
// 2) reduced stiffness from the structure modification
// -------------------------------------------------------
// Editable parameters (SI units)
const string MODEL_NAME = "member_stiffness_modification";
const double FRAME_SPAN = 6.0;
const double FRAME_HEIGHT = 3.5;
const string MATERIAL = "C30/37";
const double COLUMN_CSS_WIDTH = 0.30;
const double COLUMN_CSS_HEIGHT = 0.30;
const double COLUMN_EI_FACTOR = 0.70;
const double BEAM_CSS_WIDTH = 0.30;
const double BEAM_CSS_HEIGHT = 0.60;
const double BEAM_EI_FACTOR = 0.35;
const bool SELF_WEIGHT_ACTIVE = true;
const double BEAM_DISTRIBUTED_LOAD = -20_000.0; // N/m, global Z direction
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,
Material = 1,
B = COLUMN_CSS_WIDTH,
H = COLUMN_CSS_HEIGHT,
},
new Rfem.StructureCore.CrossSection
{
No = 2,
Type = Rfem.StructureCore.CrossSection.Types.Type.ParametricMassiveI,
Material = 1,
B = BEAM_CSS_WIDTH,
H = BEAM_CSS_HEIGHT,
},
// Nodes
new Rfem.StructureCore.Node
{
No = 1,
Coordinate1 = 0.0,
Coordinate2 = 0.0,
Coordinate3 = 0.0,
},
new Rfem.StructureCore.Node
{
No = 2,
Coordinate1 = FRAME_SPAN,
Coordinate2 = 0.0,
Coordinate3 = 0.0,
},
new Rfem.StructureCore.Node
{
No = 3,
Coordinate1 = 0.0,
Coordinate2 = 0.0,
Coordinate3 = FRAME_HEIGHT,
},
new Rfem.StructureCore.Node
{
No = 4,
Coordinate1 = FRAME_SPAN,
Coordinate2 = 0.0,
Coordinate3 = FRAME_HEIGHT,
},
// Lines
new Rfem.StructureCore.Line
{
No = 1,
DefinitionNodes = { 1, 3 },
},
new Rfem.StructureCore.Line
{
No = 2,
DefinitionNodes = { 2, 4 },
},
new Rfem.StructureCore.Line
{
No = 3,
DefinitionNodes = { 3, 4 },
},
// Members: 1-2 columns, 3 beam
new Rfem.StructureCore.Member
{
No = 1,
Line = 1,
CrossSectionStart = 1,
},
new Rfem.StructureCore.Member
{
No = 2,
Line = 2,
CrossSectionStart = 1,
},
new Rfem.StructureCore.Member
{
No = 3,
Line = 3,
CrossSectionStart = 2,
},
new Rfem.TypesForNodes.NodalSupport
{
No = 1,
Nodes = { 1, 2 },
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 },
},
};
}
static Rfem.TypesForMembers.MemberStiffnessModification MemberStiffnessModification(int no, string name, double factor)
{
return new Rfem.TypesForMembers.MemberStiffnessModification
{
No = no,
UserDefinedNameEnabled = true,
Name = name,
Type = Rfem.TypesForMembers.MemberStiffnessModification.Types.Type.PartialStiffnessesFactors,
FactorOfAxialStiffness = 1.0,
FactorOfBendingYStiffness = factor,
FactorOfBendingZStiffness = factor,
PartialStiffnessFactorOfShearYStiffness = 1.0,
PartialStiffnessFactorOfShearZStiffness = 1.0,
PartialStiffnessFactorOfTorsionStiffness = 1.0,
PartialStiffnessFactorOfWeight = 1.0,
};
}
static List<IMessage> DefineStiffnessModification()
{
return new List<IMessage>
{
MemberStiffnessModification(
no: 1,
name: $"Columns: {COLUMN_EI_FACTOR:F2} EI",
factor: COLUMN_EI_FACTOR
),
MemberStiffnessModification(
no: 2,
name: $"Beam: {BEAM_EI_FACTOR:F2} EI",
factor: BEAM_EI_FACTOR
),
new Rfem.StructureAdvanced.StructureModification
{
No = 1,
UserDefinedNameEnabled = true,
Name = "Reduced member bending stiffness",
ModifyStiffnessesMembers = true,
ModifyStiffnessesMemberTable = new Rfem.StructureAdvanced.StructureModification.Types.ModifyStiffnessesMemberTable
{
Rows =
{
new Rfem.StructureAdvanced.StructureModification.Types.ModifyStiffnessesMemberTableRow
{
No = 1,
Description = $"Columns {COLUMN_EI_FACTOR:F2} EI",
MemberModification = 1,
Members = { 1, 2 },
},
new Rfem.StructureAdvanced.StructureModification.Types.ModifyStiffnessesMemberTableRow
{
No = 2,
Description = $"Beam {BEAM_EI_FACTOR:F2} EI",
MemberModification = 2,
Members = { 3 },
},
},
},
},
};
}
static List<IMessage> DefineLoading()
{
return new List<IMessage>
{
new Rfem.Loading.StaticAnalysisSettings
{
No = 1,
AnalysisType = Rfem.Loading.StaticAnalysisSettings.Types.AnalysisType.GeometricallyLinear,
},
new Rfem.Loading.LoadCase
{
No = 1,
Name = "Permanent loads",
ActionCategory = Rfem.Loading.LoadCase.Types.ActionCategory.PermanentG,
StaticAnalysisSettings = 1,
SelfWeightActive = SELF_WEIGHT_ACTIVE,
},
new Rfem.Loads.MemberLoad
{
No = 1,
LoadCase = 1,
Members = { 3 },
LoadType = Rfem.Loads.MemberLoad.Types.LoadType.Force,
LoadDistribution = Rfem.Loads.MemberLoad.Types.LoadDistribution.Uniform,
LoadDirection = Rfem.Loads.MemberLoad.Types.LoadDirection.GlobalZOrUserDefinedWTrueLength,
Magnitude = BEAM_DISTRIBUTED_LOAD,
},
new Rfem.Loading.CombinationWizard
{
No = 1,
UserDefinedNameEnabled = true,
Name = "Combinations - unreduced stiffness",
StaticAnalysisSettings = 1,
GenerateCombinations = Rfem.Loading.CombinationWizard.Types.GenerateCombinations.LoadCombinations,
},
new Rfem.Loading.CombinationWizard
{
No = 2,
UserDefinedNameEnabled = true,
Name = "Combinations - reduced stiffness",
StaticAnalysisSettings = 1,
GenerateCombinations = Rfem.Loading.CombinationWizard.Types.GenerateCombinations.LoadCombinations,
StructureModificationEnabled = true,
StructureModification = 1,
},
new Rfem.Loading.DesignSituation
{
No = 1,
UserDefinedNameEnabled = true,
Name = "ULS - unreduced stiffness",
DesignSituationType = Rfem.Loading.DesignSituation.Types.DesignSituationType.StrPermanentAndTransient610,
CombinationWizard = 1,
Active = true,
},
new Rfem.Loading.DesignSituation
{
No = 2,
UserDefinedNameEnabled = true,
Name = "ULS - reduced stiffness",
DesignSituationType = Rfem.Loading.DesignSituation.Types.DesignSituationType.StrPermanentAndTransient610,
CombinationWizard = 2,
Active = true,
},
};
}
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();
Console.WriteLine($"\nCreating model: {MODEL_NAME}");
rfemApp.create_model(name: MODEL_NAME);
var baseData = rfemApp.get_base_data();
baseData.Main.SurfacesActive = false;
baseData.CombinationsSettings.CombinationWizardActive = true;
baseData.GeneralSettings.GlobalAxesOrientation = Rfem.BaseData.Types.GeneralSettings.Types.GlobalAxesOrientation.Zup;
rfemApp.set_base_data(baseData: baseData);
rfemApp.delete_all_objects();
rfemApp.create_object_list(
DefineStructure()
.Concat(DefineStiffnessModification())
.Concat(DefineLoading())
.ToList()
);
rfemApp.generate_combinations();
var loadCombinations = rfemApp.get_object_list(new List<IMessage> { new Rfem.Loading.LoadCombination() })
.OfType<Rfem.Loading.LoadCombination>()
.ToList();
Console.WriteLine("\nGenerated Load Combinations:");
foreach (var loadCombination in loadCombinations)
{
var structureModification = loadCombination.StructureModificationEnabled
? loadCombination.StructureModification.ToString(CultureInfo.InvariantCulture)
: "none";
Console.WriteLine(
$"CO{loadCombination.No}: {loadCombination.Name}, structure modification: {structureModification}"
);
}
var calculationInfo = rfemApp.calculate_all(skipWarnings: true);
Console.WriteLine($"\nCalculation Succeeded:\n{calculationInfo.Succeeded}");
Console.WriteLine("\nMaximum vertical member deflection by load combination:");
foreach (var loadCombination in loadCombinations)
{
var memberDeformation = rfemApp.get_results(
resultsType: Rfem.Results.ResultsType.StaticAnalysisMembersLocalDeformations,
filters: new List<Rfem.Results.ResultsFilter>
{
new Rfem.Results.ResultsFilter
{
ColumnId = "loading",
FilterExpression = $"CO{loadCombination.No}",
},
}
);
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($"CO{loadCombination.No}: Max |u_z|: {maxAbsUz}");
}
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
finally
{
if (rfemApp != null) rfemApp.close_connection();
}