Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Strain profile n my mz #161

Merged
Merged
Show file tree
Hide file tree
Changes from 77 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
2e70179
Draft initial structure for the concrete class
mortenengen Dec 13, 2022
b8f67bb
Update docstring of base material
mortenengen Dec 13, 2022
c299dcc
minimum reinforcement areas functions
DanielGMorenaFhecor Dec 15, 2022
59a04f5
raise ValueError test functions for min area
DanielGMorenaFhecor Dec 27, 2022
b7167aa
crack_min_steel_without_direct_calculation
DanielGMorenaFhecor Jan 12, 2023
7189d31
Commit
DanielGMorenaFhecor Jan 12, 2023
4a0fcfb
crack without direct calculation tests
DanielGMorenaFhecor Jan 12, 2023
84c0140
adjusted bond strength
DanielGMorenaFhecor Jan 12, 2023
e0f1baa
hc_eff_concrete_tension formulation and testing
DanielGMorenaFhecor Jan 12, 2023
f2cbb49
requiremets.txt updated
DanielGMorenaFhecor Jan 12, 2023
333dcbe
rho_p_eff
DanielGMorenaFhecor Jan 12, 2023
59f1198
kt load duration
DanielGMorenaFhecor Jan 12, 2023
34d85d2
strain diff formula
DanielGMorenaFhecor Jan 12, 2023
a8ab129
chapter completed
DanielGMorenaFhecor Jan 13, 2023
ce4e432
imports and renamed functions
DanielGMorenaFhecor Jan 13, 2023
938c0f5
removed duplicate file
DanielGMorenaFhecor Jan 13, 2023
6ba6dc9
removed testing file
DanielGMorenaFhecor Jan 13, 2023
a9c9263
test renaming and docstring corrections
DanielGMorenaFhecor Jan 16, 2023
50c65b7
pull from upstream
DanielGMorenaFhecor Feb 8, 2023
ea3552b
Merge branch 'dev' of https://github.com/fib-international/structural…
DanielGMorenaFhecor Mar 9, 2023
4fd8b7e
230309 requested changes applied
DanielGMorenaFhecor Mar 9, 2023
1cffa61
small lint fixes
DanielGMorenaFhecor Mar 9, 2023
b483d40
vscode config updated
DanielGMorenaFhecor Mar 9, 2023
e9d953d
Merge branch 'dev' of https://github.com/fib-international/structural…
DanielGMorenaFhecor May 26, 2023
182e538
Merge branch 'dev' of https://github.com/fib-international/structural…
DanielGMorenaFhecor Dec 18, 2023
e509fb9
Merge branch 'dev' of https://github.com/fib-international/structural…
DanielGMorenaFhecor Mar 4, 2024
d57f945
Merge branch 'dev' of https://github.com/fib-international/structural…
DanielGMorenaFhecor Apr 4, 2024
fed3b47
Examples 1 to 3. Section plots. SLS functios and issues to comment
MestreCarlos Jul 22, 2024
1c37827
External axial load error may be solved if origin in cg
MestreCarlos Jul 22, 2024
a388da7
tests, effective depth and fibre width
Jul 24, 2024
3222042
changes in EX2
Jul 24, 2024
9cc4fbf
comments and suggestions added
DanielGMorenaFhecor Jul 29, 2024
36cc8d3
minor changes
Jul 29, 2024
32103ea
Merge branch 'dev' into concrete_ec2_2023
DanielGMorenaFhecor Jul 29, 2024
1069898
Merge branch 'nb_examples' of https://github.com/DanielGMorenaFhecor/…
DanielGMorenaFhecor Jul 29, 2024
c8ce3fc
minor changes
DanielGMorenaFhecor Jul 29, 2024
a48150c
minor changes
DanielGMorenaFhecor Jul 29, 2024
bc049e4
Merge branch 'dev' of https://github.com/DanielGMorenaFhecor/structur…
DanielGMorenaFhecor Jul 30, 2024
0a3c341
demo file of sls methods
Jul 31, 2024
2a1e7b7
changes
DanielGMorenaFhecor Aug 20, 2024
17cdf47
Merge branch 'dev' of https://github.com/fib-international/structural…
DanielGMorenaFhecor Aug 20, 2024
6199164
Merge branch 'dev' into nb_examples
DanielGMorenaFhecor Aug 20, 2024
7a44d64
clarification in rotated section results
DanielGMorenaFhecor Aug 20, 2024
70d4a03
changes
DanielGMorenaFhecor Aug 20, 2024
961fd22
point 6 updated
DanielGMorenaFhecor Aug 21, 2024
31d81ac
auxiliar commit
Aug 26, 2024
42c7bf4
Merge branch 'nb_examples' of https://github.com/DanielGMorenaFhecor/…
Aug 26, 2024
cf181a4
Merge branch 'nb_examples' into strain_plane_for_NMyMz
Aug 26, 2024
8a2487c
initial commit
Aug 29, 2024
cb56795
auxiliar240916
Sep 16, 2024
2689f98
auxiliar240916
Sep 16, 2024
7af3304
cracked_propreties of reinforced concrete
Sep 16, 2024
0d785c3
delete auxiliar plots for sections
Sep 16, 2024
15fae3e
draft version calculate_strain_profile
Sep 16, 2024
11ada3a
delete axiliar plot functions
Sep 16, 2024
03791cf
.
Sep 17, 2024
7de4845
.
Sep 18, 2024
f8b97eb
adding usefull plots for sections
Sep 18, 2024
d7d331a
general plots functios for 2D diagrams
Sep 18, 2024
66dd033
draw_section_response is generic for biaxial
Sep 19, 2024
8abfe38
Merge branch 'plots' into full_cmg
Sep 20, 2024
10649d0
Merge branch 'strain_profile_NMyMz' into full_cmg
Sep 20, 2024
c032996
.
Sep 20, 2024
2feccf8
enhanced function and testing
Sep 23, 2024
1065f30
enhanced function and testing
Sep 23, 2024
6c9698f
enhancement to get cracking moments and optional input forces in sls
Sep 23, 2024
929ce66
Merge branch 'strain_profile_NMyMz' into full_cmg
Sep 23, 2024
631040e
Merge branch 'cracked_properties' into full_cmg
Sep 23, 2024
b9edc28
corrected errors in previous merge
Sep 23, 2024
0dcb1e4
enhancement of algorithm
Sep 24, 2024
375ea4d
fix: linting and cleaning
Sep 25, 2024
14618bb
cleaning auxiliar files
Sep 25, 2024
33ec3ee
Merge branch 'dev' of https://github.com/fib-international/structural…
Sep 25, 2024
6ee26da
Merge branch 'dev' into strain_profile_NMyMz
Sep 25, 2024
e4d135d
Revert changes
talledodiego Dec 20, 2024
828c168
Merge branch 'dev' into pr/161
talledodiego Dec 20, 2024
356f25e
iterative newton strainplane determination
talledodiego Dec 20, 2024
9b63fee
Describe new method in API docs
mortenengen Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@ cython_debug/
#.idea/

#Pyenv files
*.python-version
*.python-version
110 changes: 104 additions & 6 deletions structuralcodes/sections/_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import numpy as np
from numpy.typing import ArrayLike, NDArray
from scipy.linalg import lu_factor, lu_solve
from shapely import MultiPolygon
from shapely.ops import unary_union

Expand Down Expand Up @@ -337,7 +338,7 @@ def get_balanced_failure_strain(

def find_equilibrium_fixed_pivot(
self, geom: CompoundGeometry, n: float, yielding: bool = False
) -> t.Tuple[float, float, float]:
) -> t.List[float]:
"""Find the equilibrium changing curvature fixed a pivot.
The algorithm uses bisection algorithm between curvature
of balanced failure and 0. Selected the pivot point as
Expand All @@ -351,8 +352,8 @@ def find_equilibrium_fixed_pivot(
yielding (bool): ...

Returns:
Tuple(float, float, float): 3 floats: Axial strain at (0,0), and
curvatures of y* and z* axes. Note that being uniaxial bending,
List(float): 3 floats: Axial strain at (0,0), and curvatures of y*
and z* axes. Note that being uniaxial bending,
curvature along z* is 0.0.
"""
# Number of maximum iteration for the bisection algorithm
Expand All @@ -371,6 +372,10 @@ def find_equilibrium_fixed_pivot(
) = self.integrator.integrate_strain_response_on_geometry(
geom, strain, tri=self.triangulated_data, mesh_size=self.mesh_size
)
# save the triangulation data
if self.triangulated_data is None and tri is not None:
self.triangulated_data = tri

# Check if there is equilibrium with this strain distribution
chi_a = strain[1]
dn_a = n_int - n
Expand Down Expand Up @@ -416,9 +421,6 @@ def find_equilibrium_fixed_pivot(
s = f'Last iteration reached a unbalance of {dn_c}'
raise ValueError(f'Maximum number of iterations reached.\n{s}')
# Found equilibrium
# save the triangulation data
if self.triangulated_data is None and tri is not None:
self.triangulated_data = tri
# Return the strain distribution
return [eps_0, chi_c, 0]

Expand Down Expand Up @@ -1324,3 +1326,99 @@ def calculate_mm_interaction_domain(
res.strains[i, 2] = res_bend_strength.chi_z

return res

def calculate_strain_profile(
self,
n,
my,
mz,
initial: bool = False,
max_iter: int = 10,
tol: float = 1e-6,
) -> t.List[float]:
"""Get the strain plane for a given axial force and biaxial bending.

Args:
n (float): Axial load.
my (float): Bending moment around y-axis.
mz (float): Bending moment around z-axis.
initial (bool): If True the modified newton with initial tanget is
used (default = False).
max_iter (int): the maximum number of iterations in the iterative
process (default = 10).
tol (float): the tolerance for convergence test in terms of strain
increment.

Returns:
List(float): 3 floats: Axial strain at (0,0), and curvatures of the
section around y and z axes.
"""
# Get the gometry
geom = self.section.geometry

# Collect loads in a numpy array
loads = np.array([n, my, mz])

# Compute initial tangent stiffness matrix
stiffness_tangent, tri = (
self.integrator.integrate_strain_response_on_geometry(
geom,
[0, 0, 0],
integrate='modulus',
tri=self.triangulated_data,
)
)
# eventually save the triangulation data
if self.triangulated_data is None and tri is not None:
self.triangulated_data = tri

# Calculate strain plane with Newton Rhapson Iterative method
num_iter = 0
strain = np.zeros(3)

# Factorize once the stiffness matrix if using initial
if initial:
# LU factorization
# (maybe also Choelesky could work if matrix always SPD?)
lu, piv = lu_factor(stiffness_tangent)

# Do Newton loops
while True:
# Check if number of iterations exceeds the maximum
if num_iter > max_iter:
break

# Calculate response and residuals
response = np.array(self.integrate_strain_profile(strain=strain))
residual = loads - response

if initial:
# Solve using the decomposed matrix
delta_strain = lu_solve((lu, piv), residual)
else:
# Calculate the current tangent stiffness
stiffness_tangent, _ = (
self.integrator.integrate_strain_response_on_geometry(
geom,
strain,
integrate='modulus',
tri=self.triangulated_data,
)
)

# Solve using the current tangent stiffness
delta_strain = np.linalg.solve(stiffness_tangent, residual)

# Update the strain
strain += delta_strain

num_iter += 1

# Check for convergence:
if np.linalg.norm(delta_strain) < tol:
break

if num_iter >= max_iter:
raise StopIteration('Maximum number of iterations reached.')

return strain.tolist()
Loading
Loading