Skip to content

fix: add last point to complete domain in nm_interaction_domain#342

Merged
mortenengen merged 1 commit intodevfrom
complete-domain-last-point
Apr 7, 2026
Merged

fix: add last point to complete domain in nm_interaction_domain#342
mortenengen merged 1 commit intodevfrom
complete-domain-last-point

Conversation

@talledodiego
Copy link
Copy Markdown
Collaborator

Added the last point in nm_interaction_domain when setting complete_domain=True.
Indeed without this modification the following code:

import numpy as np
import matplotlib.pyplot as plt
from structuralcodes.geometry import RectangularGeometry
from structuralcodes.materials.basic import ElasticMaterial
from structuralcodes.sections import BeamSection

width = 200
height = 400
E = 10000
eps_u = 0.01

def elastic_rec_section() -> BeamSection:
    """Create a simple rectangular section with known properties."""
    # Square section centered at (0, 0)
    mat = ElasticMaterial(E=E, density=700, ultimate_strain=eps_u)

    geo = RectangularGeometry(width, height, mat)

    # It should not be concrete
    assert not geo.concrete

    return BeamSection(geo, integrator="marin")

sec = elastic_rec_section()
nm_domain_pos = sec.section_calculator.calculate_nm_interaction_domain()
nm_domain_neg = sec.section_calculator.calculate_nm_interaction_domain(theta=np.pi)
nm_domain_all = sec.section_calculator.calculate_nm_interaction_domain(complete_domain=True)

fig, axs = plt.subplots(1, 2, figsize=(12, 6))
axs[0].plot(nm_domain_pos.n * 1e-3, -nm_domain_pos.m_y * 1e-6, label="N-M Interaction Domain")
axs[0].plot(nm_domain_neg.n * 1e-3, -nm_domain_neg.m_y * 1e-6, label="N-M Interaction Domain (Negative)",)
axs[0].set_xlabel("N [kN]")
axs[0].set_ylabel("M_y [kNm]")
axs[0].legend()
axs[1].plot(nm_domain_all.n * 1e-3, -nm_domain_all.m_y * 1e-6, label="Complete N-M Interaction Domain",)
axs[1].set_xlabel("N [kN]")
axs[1].set_ylabel("M_y [kNm]")
axs[1].legend()
plt.show()

would produce the following picture (the full domain on the right plot is not closed).

image

After this PR the same code produces the following:

image

@mortenengen mortenengen added the enhancement New feature or request label Apr 7, 2026
Copy link
Copy Markdown
Member

@mortenengen mortenengen left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

@mortenengen mortenengen changed the title add last point to complete domain in nm_interaction_domain fix: add last point to complete domain in nm_interaction_domain Apr 7, 2026
@mortenengen mortenengen merged commit 778cc11 into dev Apr 7, 2026
4 checks passed
@github-project-automation github-project-automation bot moved this to Done 🚀 in PR tracker Apr 7, 2026
@mortenengen mortenengen deleted the complete-domain-last-point branch April 7, 2026 05:41
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: Done 🚀

Development

Successfully merging this pull request may close these issues.

2 participants