Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 src/loadbearing_wall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
The wall model is parameterizable and can represent any material
"""

__version__ = "0.3.1"
__version__ = "0.4.0"

from loadbearing_wall.wall_model import LinearWallModel
from loadbearing_wall import *
11 changes: 8 additions & 3 deletions src/loadbearing_wall/linear_reactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class LinearReactionString:
magnitude_end_key: str
location_start_key: str
location_end_key: str
reverse_reaction_direction: bool = True

@classmethod
def from_projected_loads(
Expand All @@ -72,28 +73,32 @@ def from_projected_loads(
magnitude_end_key: str,
location_start_key: str,
location_end_key: str,
reverse_reaction_direction: bool = True,
):
w0 = magnitude_start_key
w1 = magnitude_end_key
x0 = location_start_key
x1 = location_end_key
reverse_direction = -1 if reverse_reaction_direction else 1
linear_reaction_components = {}
for load_dir, load_cases in projected_loads.items():
linear_reaction_components.setdefault(load_dir, {})
for load_case, applied_loads in load_cases.items():
linear_reaction_components[load_dir].setdefault(load_case, [])
for applied_load in applied_loads:
linear_reaction = LinearReaction(
applied_load[w0],
applied_load.get(w1),
applied_load[w0] * reverse_direction,
applied_load.get(w1) * reverse_direction,
applied_load[x0],
applied_load.get(x1),
)

linear_reaction_components[load_dir][load_case].append(
linear_reaction
)
return cls(linear_reaction_components, w0, w1, x0, x1)
return cls(
linear_reaction_components, w0, w1, x0, x1, reverse_reaction_direction
)

def extract_reaction_string(self, xa: float, xb: float, case: str, dir: str):
"""
Expand Down
1 change: 1 addition & 0 deletions src/loadbearing_wall/wall_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ def get_reactions(
self.magnitude_end_key,
self.location_start_key,
self.location_end_key,
self.reverse_reaction_force_direction,
)
return lrs.consolidate_reactions(
flatten=flattened, dir_key=direction_key, case_key=case_key
Expand Down
28 changes: 16 additions & 12 deletions tests/test_wall_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,24 @@ def test_wall_model_runs(WM0, WM1):


def test_no_spread(WM0):
rxn = WM0.get_reactions(flattened=False)
assert rxn["Fz"]["D"] == [
{"dir": "Fz", "case": "D", "w1": -1 * 10.0, "w2": -1 * 10.0, "x1": 1.00, "x2": 1.75},
{"dir": "Fz", "case": "D", "w1": -1 * 210.0, "w2": -1 * 210.0, "x1": 1.750000000001, "x2": 2.249999999999},
{"dir": "Fz", "case": "D", "w1": -1 * 10.0, "w2": -1 * 10.0, "x1": 2.250000000001, "x2": 3.0},
]
assert rxn["Fz"]["L"] == [
{"dir": "Fz", "case": "L", "w1": -1 * 15.0, "w2": -1 * 15.0, "x1": 0.00, "x2": 1.75},
{"dir": "Fz", "case": "L", "w1": -1 * 215.0, "w2": -1 * 215.0, "x1": 1.750000000001, "x2": 2.00},
{"dir": "Fz", "case": "L", "w1": -1 * 200.0, "w2": -1 * 200.0, "x1": 2.00, "x2": 2.249999999999},
]
WM0.reverse_reaction_force_direction = False
rxn = WM0.get_reactions(flattened=False)
assert rxn["Fz"]["D"] == [
{"dir": "Fz", "case": "D", "w1": 10.0, "w2": 10.0, "x1": 1.00, "x2": 1.75},
{"dir": "Fz", "case": "D", "w1": 210.0, "w2": 210.0, "x1": 1.750000000001, "x2": 2.249999999999},
{"dir": "Fz", "case": "D", "w1": 10.0, "w2": 10.0, "x1": 2.250000000001, "x2": 3.0},
]
assert rxn["Fz"]["L"] == [
{"dir": "Fz", "case": "L", "w1": 15.0, "w2": 15.0, "x1": 0.00, "x2": 1.75},
{"dir": "Fz", "case": "L", "w1": 215.0, "w2": 215.0, "x1": 1.750000000001, "x2": 2.00},
{"dir": "Fz", "case": "L", "w1": 200.0, "w2": 200.0, "x1": 2.00, "x2": 2.249999999999},

# {"dir": "Fz", "case": "L", "w1": 100.0, "x1": 0.5},
# {"dir": "Fz", "case": "L", "w1": 15.0, "w2": 15.0, "x1": 0.0, "x2": 2.0},
]


def test_45_spread(WM1):
Expand All @@ -68,8 +72,8 @@ def test_45_spread(WM1):
{
"dir": "Fz",
"case": "D",
"w1": 30.0,
"w2": 30.0,
"w1": -1 * 30.0,
"w2": -1 * 30.0,
"x1": 0.0,
"x2": 4.0,
},
Expand All @@ -79,8 +83,8 @@ def test_45_spread(WM1):
{
"dir": "Fz",
"case": "L",
"w1": 32.5,
"w2": 32.5,
"w1": -1 * 32.5,
"w2": -1 * 32.5,
"x1": 0.0,
"x2": 4.0,
},
Expand Down