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

refactor: release fixes #86

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ea285d0
refactor: prep release fixes
justinngan92 Apr 24, 2024
25ef2ba
refactor: version bump
justinngan92 Apr 24, 2024
e182b24
feat: transient analysis
justinngan92 Jun 7, 2024
ab6abff
refactor and feat: mass functions
justinngan92 Jun 13, 2024
3e1776a
fix test fail
justinngan92 Jun 13, 2024
4f3a0f6
fix: element mass input
justinngan92 Jun 14, 2024
70335b9
fix test
justinngan92 Jul 3, 2024
45ccd8f
feat: VBI pre-requisite functions
justinngan92 Jul 3, 2024
357b55e
fix: time increment for transient analysis
justinngan92 Jul 9, 2024
582a660
feat: add velocity and accelerations to Result's Xarray
justinngan92 Jul 10, 2024
47d9c79
feat: modify arbitrary displacement function
justinngan92 Jul 10, 2024
e660277
refactor: prep release fixes
justinngan92 Apr 24, 2024
1ad9577
refactor: version bump
justinngan92 Apr 24, 2024
9dc7d40
feat: transient analysis
justinngan92 Jun 7, 2024
6a32066
refactor and feat: mass functions
justinngan92 Jun 13, 2024
727f454
fix test fail
justinngan92 Jun 13, 2024
70d04a6
fix: element mass input
justinngan92 Jun 14, 2024
568a6d8
fix test
justinngan92 Jul 3, 2024
489f009
feat: VBI pre-requisite functions
justinngan92 Jul 3, 2024
0405fd9
fix: time increment for transient analysis
justinngan92 Jul 9, 2024
3b0a50f
feat: add velocity and accelerations to Result's Xarray
justinngan92 Jul 10, 2024
7af52f3
feat: modify arbitrary displacement function
justinngan92 Jul 10, 2024
bf0af9e
Merge remote-tracking branch 'origin/release_prep' into release_prep
justinngan92 Jul 22, 2024
622ab3c
fix pyproject dependencies
justinngan92 Aug 6, 2024
2e6ec43
fix pyproject dependencies
justinngan92 Aug 6, 2024
3cf7ab3
fix pyproject dependencies
justinngan92 Aug 6, 2024
c169676
fix pyproject dependencies
justinngan92 Aug 6, 2024
cfdc213
refactor: remove interp2d usage
justinngan92 Aug 7, 2024
86606f0
numpy 2.0 compatibility
justinngan92 Aug 8, 2024
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
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"sphinx.ext.githubpages",
# "recommonmark",
"nbsphinx",
"sphinx.ext.napoleon",
]

autodoc_member_order = "bysource"
Expand Down
8 changes: 4 additions & 4 deletions docs/source/notebooks/mesh_showcase.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
"oblique_grillage.create_osp_model(\n",
" pyfile=False\n",
") \n",
"og.opsplt.plot_model(\"nodes\")"
"og.opsplt.plot_model(show_nodes=\"yes\",show_nodetags=\"yes\",)"
]
},
{
Expand Down Expand Up @@ -330,7 +330,7 @@
"ortho_grillage.create_osp_model(\n",
" pyfile=False\n",
") \n",
"og.opsplt.plot_model(\"nodes\")"
"og.opsplt.plot_model(show_nodes=\"yes\",show_nodetags=\"yes\",)"
]
},
{
Expand Down Expand Up @@ -422,7 +422,7 @@
"varied_edge_angle_grillage.create_osp_model(\n",
" pyfile=False\n",
") \n",
"og.opsplt.plot_model(\"nodes\")"
"og.opsplt.plot_model(show_nodes=\"yes\",show_nodetags=\"yes\",)"
]
},
{
Expand Down Expand Up @@ -458,7 +458,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/source/notebooks/multi_span.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/source/notebooks/super_t_analysis_workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
"simple_grid.create_osp_model(\n",
" pyfile=False\n",
") # pyfile will not (False) be generated for further analysis (should be create_osp?)\n",
"og.opsplt.plot_model(\"nodes\") # plotting using Get_rendering\n",
"og.opsplt.plot_model(show_nodes=\"yes\",show_nodetags=\"yes\") # plotting using vfo\n",
"og.opsv.plot_model(az_el=(-90, 0)) # plotting using ops_vis\n",
"og.plt.show()"
]
Expand Down
2 changes: 1 addition & 1 deletion docs/source/rst/ModelTemplates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Table 1 outlines the specific variables for beam link model.


.. note::
As of release 0.1.0, `OpenSeesPy` visualization module ops_vis is unable to visualize the joint offsets.
As of release 0.1.0, `OpenSeesPy` visualization module `vfo` and `opsvis` is unable to visualize the joint offsets.

.. _shell hybrid model:

Expand Down
2 changes: 1 addition & 1 deletion docs/source/rst/Module description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ Therefore, one can run access `ops_vis` by running the following code line and a

.. code-block:: python

og.opsplt.plot_model("nodes") # using Get Rendering module
og.opsplt.plot_model(show_nodes="yes",show_nodetags="yes") # using Vfo module
og.opsv.plot_model(az_el=(-90, 0)) # using osp_vis

Whilst all nodes will be visualized, only the assigned members are visualized.
Expand Down
6 changes: 3 additions & 3 deletions docs/source/rst/ModuleDoc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ In tandem with this, the :class:`~ospgrillage.mesh.EdgeControlPoints` class will
are only recognized as end supports - catering to current meshing procedures for single span configuration.

The developers also acknowledges that there are conflicts between the adopted coordinate system of *ospgrillage* and the default
coordinate system for the OpenSees's `ops_vis` module. The `ops_vis` module default isotropic angle is x - y with z axis plane
coordinate system for the OpenSees's `opsvis` module. The `opsvis` module default isotropic angle is x - y with z axis plane
being the model plane of a 2-D model in 3-D space. Currently it is not easy to alter the coordinate system of
*ospgrillage*. However, the developers are hoping that `ops_vis` can cater to
*ospgrillage*. However, the developers are hoping that `opsvis` can cater to
multi isotropic views of the model space as oppose to the current fixed coordinate system.
It would require substantial rework of the entire *ospgrillage* module if one decides to "fit"
*ospgrillage* 's coordinate system to `ops_vis` - since the module assume the model plane of the 2D grillage is the
*ospgrillage* 's coordinate system to `opsvis` - since the module assume the model plane of the 2D grillage is the
y axis.

18 changes: 9 additions & 9 deletions docs/source/rst/PostProcessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,15 @@ Plotting results of DataArrays
Current limitation of `OpenSees` visualization module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

`OpenSeesPy`'s visualization module - `ops_vis` - offers comprehensive visualization analysis results in `OpenSees`.
However, `ops_vis` operates only for a single model instance (and analysis) in `OpenSees`
framework.
In other words, results from `xarray` DataSet (of :func:`~ospgrillage.osp_grillage.OspGrillage.get_results`) cannot be plotted using the current visualization module.
Additionally, `ops_vis` does not contain enveloping feature across multiple analysis - especially for moving load analysis comprise of multiple incremental load case for each moving load position.

If needed, users can still utilize `ops_vis` however only in a specific condition i.e. only a single load case is defined and :func:`~ospgrillage.osp_grillage.OspGrillage.analyze` in the `OpenSees` framework.
With only a single load case and analysis, users can directly access the model results and plot using `ops_vis`.
The following code example plots the results of the **current analysis instance** using `ops_vis`:
`OpenSeesPy`'s visualization module uses either `vfo` or `opsvis`.
However both modules requires the model instance been created in `OpenSeesPy` model space.

In other words, results from `xarray` DataSet (of :func:`~ospgrillage.osp_grillage.OspGrillage.get_results`) cannot be plotted using the current visualization modules.
Additionally, `opsvis` and `vfo` does not contain enveloping feature across multiple analysis - especially for moving load analysis comprise of multiple incremental load case for each moving load position.

If needed, users can still utilize `opsvis` however only in a specific condition i.e. only a single load case is defined and :func:`~ospgrillage.osp_grillage.OspGrillage.analyze` in the `OpenSees` framework.
With only a single load case and analysis, users can directly access the model results and plot using `opsvis`.
The following code example plots the results of the **current analysis instance** using `opsvis`:

.. code-block:: python

Expand Down
14 changes: 7 additions & 7 deletions examples/workshop/super-t_example-final.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@
"tags": []
},
"source": [
"Plot using the *opsplt* `GetRendering` library."
"Plot using the *opsplt* `Vfo` library."
]
},
{
Expand Down Expand Up @@ -600,7 +600,7 @@
}
],
"source": [
"og.opsplt.plot_model(\"nodes\");"
"og.opsplt.plot_model(show_nodes=\"yes\",show_nodetags=\"yes\",);"
]
},
{
Expand All @@ -613,7 +613,7 @@
"tags": []
},
"source": [
"Plot using `ops_vis` library"
"Plot using `opsvis` library"
]
},
{
Expand Down Expand Up @@ -6296,7 +6296,7 @@
"tags": []
},
"source": [
"Plot the model using `GetRendering` - currently `ops_vis` is not able to visualize mix element model (shell + beam)"
"Plot the model using `Vfo` - currently `opsvis` is not able to visualize mix element model (shell + beam)"
]
},
{
Expand Down Expand Up @@ -7279,9 +7279,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:civil]",
"display_name": "env",
"language": "python",
"name": "conda-env-civil-py"
"name": "env"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -7293,7 +7293,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions src/ospgrillage/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from ospgrillage.static import *
from ospgrillage.utils import *
from ospgrillage.mesh import *
from ospgrillage.load import *
from ospgrillage.material import *
from ospgrillage.members import *
from ospgrillage.osp_grillage import *
from ospgrillage.postprocessing import *

__version__ = "0.3.1"
__version__ = "0.3.2"
74 changes: 38 additions & 36 deletions src/ospgrillage/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,35 +667,32 @@ def _define_patch_edge_lines(self):
# create equation of plane from four straight lines

# create interpolate object f
p = np.array(
[
[self.load_point_1.p, self.load_point_2.p],
[self.load_point_3.p, self.load_point_4.p],
]
)

x = np.array(
[
[self.load_point_1.x, self.load_point_2.x],
[self.load_point_3.x, self.load_point_4.x],
self.load_point_1.x,
self.load_point_2.x,
self.load_point_3.x,
self.load_point_4.x,
]
)
z = np.array(
[
[self.load_point_1.z, self.load_point_2.z],
[self.load_point_3.z, self.load_point_4.z],
self.load_point_1.z,
self.load_point_2.z,
self.load_point_3.z,
self.load_point_4.z,
]
)

# create function to get interpolation of p
self.patch_mag_interpolate = interpolate.interp2d(x, z, p)
mod_list = [ls for ls in self.point_list if ls is not None]
self.patch_min_dim = min(
p = np.array(
[
get_distance(p1, p2)
for (p1, p2) in zip(mod_list, mod_list[1:] + [mod_list[0]])
if all([p1 is not None, p2 is not None])
self.load_point_1.p,
self.load_point_2.p,
self.load_point_3.p,
self.load_point_4.p,
]
)

elif self.load_point_4 is None:
# update line 3
self.line_3 = LineLoading(
Expand All @@ -704,35 +701,28 @@ def _define_patch_edge_lines(self):

# TODO create equation of plane from 3 points
# create interpolate object f
p = np.array(
[
[self.load_point_1.p, self.load_point_2.p],
[self.load_point_3.p, self.load_point_4.p],
]
)
x = np.array(
[
[self.load_point_1.x, self.load_point_2.x],
[self.load_point_3.x, self.load_point_4.x],
self.load_point_1.x,
self.load_point_2.x,
self.load_point_3.x,
]
)
z = np.array(
[
[self.load_point_1.z, self.load_point_2.z],
[self.load_point_3.z, self.load_point_4.z],
self.load_point_1.z,
self.load_point_2.z,
self.load_point_3.z,
]
)

# create function to get interpolation of p
self.patch_mag_interpolate = interpolate.interp2d(x, z, p)
mod_list = [ls for ls in self.point_list if ls is not None]
self.patch_min_dim = min(
p = np.array(
[
get_distance(p1, p2)
for (p1, p2) in zip(mod_list, mod_list[1:] + [mod_list[0]])
if all([p1 is not None, p2 is not None])
self.load_point_1.p,
self.load_point_2.p,
self.load_point_3.p,
]
)

elif self.load_point_8 is not None:
# TODO
# point 1 2 3
Expand All @@ -745,6 +735,18 @@ def _define_patch_edge_lines(self):
raise ValueError(
"Patch load points for patch load {} not valid".format(self.name)
)
# create function to get interpolation of p
self.patch_mag_interpolate = interpolate.LinearNDInterpolator(
list(zip(x, z)), p
)
mod_list = [ls for ls in self.point_list if ls is not None]
self.patch_min_dim = min(
[
get_distance(p1, p2)
for (p1, p2) in zip(mod_list, mod_list[1:] + [mod_list[0]])
if all([p1 is not None, p2 is not None])
]
)


# ---------------------------------------------------------------------------------------------------------------
Expand Down
10 changes: 6 additions & 4 deletions src/ospgrillage/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

# if TYPE_CHECKING:
# from material import Material
g = 9.81
mm = 1e3


def create_section(**kwargs):
Expand Down Expand Up @@ -233,7 +235,7 @@ def __init__(
self.section_command_flag = False #

# determine mass from section area and material density
self.mass = self.section.A * self.material.density
self.mass = self.section.A * self.material.density * mm # kg/mm
elif any(
[
self.section.op_ele_type == "ShellMITC4",
Expand Down Expand Up @@ -423,7 +425,7 @@ def get_element_command_str(
ele_str = None
if self.section.op_ele_type == "ElasticTimoshenkoBeam":
section_input = self.get_member_prop_arguments(ele_width)
ele_str = 'ops.element("{type}", {tag}, *{node_tag_list}, *{memberprop}, {transftag}, {mass})\n'.format(
ele_str = 'ops.element("{type}", {tag}, *{node_tag_list}, *{memberprop}, {transftag},"-mass", {mass})\n'.format(
type=self.section.op_ele_type,
tag=ele_tag,
node_tag_list=node_tag_list,
Expand All @@ -433,7 +435,7 @@ def get_element_command_str(
)
elif self.section.op_ele_type == "elasticBeamColumn":
section_input = self.get_member_prop_arguments(ele_width)
ele_str = 'ops.element("{type}", {tag}, *{node_tag_list}, *{memberprop}, {transftag}, {mass})\n'.format(
ele_str = 'ops.element("{type}", {tag}, *{node_tag_list}, *{memberprop}, {transftag}, "-mass", {mass})\n'.format(
type=self.section.op_ele_type,
tag=ele_tag,
node_tag_list=node_tag_list,
Expand All @@ -442,7 +444,7 @@ def get_element_command_str(
mass=self.mass,
)
elif self.section.op_ele_type == "nonlinearBeamColumn":
ele_str = 'ops.element("{type}",{tag},*{node_tag_list},{num_int_pt},{sectag},{transftag},{mass})\n'.format(
ele_str = 'ops.element("{type}",{tag},*{node_tag_list},{num_int_pt},{sectag},{transftag},"-mass", {mass})\n'.format(
type=self.section.op_ele_type,
tag=ele_tag,
node_tag_list=node_tag_list,
Expand Down
6 changes: 3 additions & 3 deletions src/ospgrillage/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
import math

from ospgrillage.static import *
from ospgrillage.utils import *
from collections import namedtuple


Expand Down Expand Up @@ -1486,7 +1486,7 @@ def _get_geo_transform_tag(self, ele_nodes: list, offset=None):
node_i = self.node_spec[ele_nodes[0]]["coordinate"]
node_j = self.node_spec[ele_nodes[1]]["coordinate"]
vxz = self._get_vector_xz(node_i, node_j)
vxz = [np.round(num, decimals=self.decimal_lim) for num in vxz]
vxz = [np.round(num, decimals=self.decimal_lim).tolist() for num in vxz]
tag_value = self.transform_dict.setdefault(
repr(vxz) + "|" + repr(offset), self.transform_counter + 1
)
Expand Down Expand Up @@ -2178,7 +2178,7 @@ def _get_geo_transform_tag(self, ele_nodes, offset=None):
global_offset_i = [a + b for a, b in zip(node_i, local_offset)]
global_offset_j = [a - b for a, b in zip(node_j, local_offset)]
global_offset = [global_offset_i, global_offset_j]
vxz = [np.round(num, decimals=self.decimal_lim) for num in vxz]
vxz = [np.round(num, decimals=self.decimal_lim).tolist() for num in vxz]
tag_value = self.transform_dict.setdefault(
repr(vxz) + "|" + repr(global_offset), self.transform_counter + 1
)
Expand Down
Loading
Loading