Skip to content

feat: implement driver functions for shear formulas in EC2 2004#352

Open
sanvik02 wants to merge 3 commits into
fib-international:devfrom
sanvik02:add-shear-driver
Open

feat: implement driver functions for shear formulas in EC2 2004#352
sanvik02 wants to merge 3 commits into
fib-international:devfrom
sanvik02:add-shear-driver

Conversation

@sanvik02

@sanvik02 sanvik02 commented Apr 27, 2026

Copy link
Copy Markdown

Implemented driver functions for the shear formulas in 6.2.2 and 6.2.3 in EC2 2004.

@sanvik02 sanvik02 marked this pull request as ready for review May 4, 2026 08:33
@mortenengen mortenengen added the enhancement New feature or request label May 4, 2026
@mortenengen mortenengen moved this to Under review 👀 in PR tracker May 4, 2026
Comment on lines +85 to +87
concretebounds = srf_geoms.polygon.bounds
h = concretebounds[3] - concretebounds[1]
bw = concretebounds[2] - concretebounds[0]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make it slightly more explicit, consider rewriting to the following:

xmin, ymin, xmax, ymax = srf_geoms.polygon.bounds
h = ymax - ymin
bw = xmax - xmin

Comment on lines +91 to +93
if abs(concretebounds[1] - bar.point.bounds[1]) < abs(
concretebounds[3] - bar.point.bounds[1]
):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref. the comment above, this line could be written slightly more explicit as:

if abs(ymin - bar.point.y) < abs(ymax - bar.point.y):

Comment on lines +97 to +99
for bar in reinf_bars:
avg_reinf_height += bar.point.bounds[1]
avg_reinf_height /= len(reinf_bars)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider simplifying this with a list comprehension:

avg_reinf_height = sum(bar.point.y for bar in reinf_bars) / len(reinf_bars)

for bar in reinf_bars:
avg_reinf_height += bar.point.bounds[1]
avg_reinf_height /= len(reinf_bars)
d = h + concretebounds[1] - avg_reinf_height

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref. the first comment, please consider slightly rewriting:

d = h + ymin - avg_reinf_height

Comment on lines +103 to +105
Asl = 0
for bar in reinf_bars:
Asl += bar.area

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a list comprehension here:

Asl = sum(bar.area for bar in reinf_bars)

Comment on lines +112 to +131
design_value = VRdc(
fck,
d,
Asl,
bw,
NEd,
Ac,
fcd,
k1=k1,
gamma_c=gamma_c,
)

max_allowable_shearforce = VEdmax_unreinf(
bw,
d,
fck,
fcd,
)

return design_value, max_allowable_shearforce

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment about naming. To guide the user with interpreting what is returned, please consider renaming the variables to e.g.:

shear_tension_capacity = VRdc(...)

shear_compression_capacity = VEdmax_unreinf(...)

return shear_tension_capacity, shear_compression_capacity

And also use this wording in the description of the returns in the docstring.

limit_fyd (bool): Flag to indicate if the design yield stress is
limited to 0.8 * fyk or not. This controls whether the stress
reduction factor of concrete is given by Eq. (6.6) (False) or
(6.10) (True). Default value is False.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we should also note that simply setting limit_fyd=True only influences the strength reduction factor of concrete when calculating the shear compression capacity. The actual limiting of the design yield strength of the stirrups is obtained by setting the correct values of gamma_s and fyk in the reinforcement material of the ShearReinforcement object that is passed to the function.

Comment on lines +173 to +194
concretebounds = srf_geoms.polygon.bounds
h = concretebounds[3] - concretebounds[1]
bw = concretebounds[2] - concretebounds[0]
# Assume tensile reinforcement is in the lower half of the section
reinf_bars = []
for bar in section.geometry.point_geometries:
if abs(concretebounds[1] - bar.point.bounds[1]) < abs(
concretebounds[3] - bar.point.bounds[1]
):
reinf_bars.append(bar)
# Calculate d as the average height of the tensile reinforcement
avg_reinf_height = 0
for bar in reinf_bars:
avg_reinf_height += bar.point.bounds[1]
avg_reinf_height /= len(reinf_bars)
d = h + concretebounds[1] - avg_reinf_height
z = 0.9 * d

Ac = section.gross_properties.area
Asl = 0
for bar in reinf_bars:
Asl += bar.area

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider the comments above, and since this code block is re-used several times, please consider factoring it out to a separate private function. The function call could be on the form:

bw, h, d, Ac, Asl = _calculate_geometry_props(geometry=section.geometry)

section: BeamSection,
material: ReinforcementEC2_2004,
VEd: float,
theta: float = 21.8, # Gir cot theta = 2.5

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the word "Gir".

Comment on lines +240 to +241
diameter: float = 10,
n: int = 2,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should avoid providing default values for diameter and n.

Comment on lines +273 to +288
concretebounds = srf_geoms.polygon.bounds
h = concretebounds[3] - concretebounds[1]
# Assume tensile reinforcement is in the lower half of the section
reinf_bars = []
for bar in section.geometry.point_geometries:
if abs(concretebounds[1] - bar.point.bounds[1]) < abs(
concretebounds[3] - bar.point.bounds[1]
):
reinf_bars.append(bar)
# Calculate d as the average height of the tensile reinforcement
avg_reinf_height = 0
for bar in reinf_bars:
avg_reinf_height += bar.point.bounds[1]
avg_reinf_height /= len(reinf_bars)
d = h + concretebounds[1] - avg_reinf_height
z = 0.9 * d

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above, please factor out to a separate private function.

Comment on lines +371 to +372
fctk_5 = srf_geoms.material.fctk_5
fctd = alpha_ct * fctk_5 / gamma_c # Should be taken from concrete class

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the latest updates on the dev branch, these lines can be replaced with the following:

fctd = srf_geoms.material.fctd()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please undo the changes in this file so that we can fix the public API in a separate PR after merging this PR 😃

@mortenengen mortenengen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this very useful contribution! I have left a couple of comments for you to consider while finalizing.

@talledodiego do you have anything to add?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Under review 👀

Development

Successfully merging this pull request may close these issues.

2 participants