OpsGrillage#
This module contain the parent class OspGrillage which handles input information and outputs the grillage model instance or executable py file. This is done by wrapping OpenSeesPy commands for creating models (nodes/elements). This module also handles all load case assignment, analysis, and results by wrapping OpenSeesPy command for analysis
- create_grillage(**kwargs)#
User interface to create
OspGrillage
object.The constructor takes the following arguments:
- Parameters:
model_type (str) – Name string of model type - default is “beam”
bridge_name (str) – Name of bridge model and output .py file
long_dim (int or float) – Length of the model in the longitudinal direction (default: x axis)
width (int or float) – Width of the model in the transverse direction (default: z axis)
skew (int or float) – Skew angle of the start and end edges of model
num_long_grid (int) – Number of grid lines in longitudinal direction
num_trans_grid (int) – Number of grid lines in the transverse direction
edge_beam_dist (int or float) – Distance of edge beam node lines to exterior main beam node lines
mesh_type (string) – Type of mesh either “Ortho” or “Oblique” - default “Ortho”
kwargs – See below
- Keyword:
ext_to_int_dist: (Int or Float, or a List of Int or Float) distance between internal beams and
- exterior main beams. If list is provided (usually size 2), apply each distinct distance to left and right
side respectively.
Depending on the
model_type
argument, this function returns the relevant concrete class ofOspGrillage
.- Returns:
- class GrillageElement(member: str, nodes: List, tag: int, a: list)#
Bases:
object
Class to store grillage element data pertaining to generating ops.element() command. This class is handled by OspGrillage class to transfer information between GrillageMember, Mesh, and OspGrillage classes.
- class OspGrillage(bridge_name: str, long_dim: float, width: float, skew: list | float | int, num_long_grid: int, num_trans_grid: int, edge_beam_dist: list | float | int, mesh_type: str = 'Ortho', model: str = '3D', **kwargs)#
Bases:
object
Base class of grillage model.
Init the OspGrillage class
- Parameters:
bridge_name (str) – Name of bridge model and output .py file
long_dim (int or float) – Length of the model in the longitudinal direction (default: x axis)
width (int or float) – Width of the model in the transverse direction (default: z axis)
skew (int or float) – Skew angle of the start and end edges of model
num_long_grid (int) – Number of grid lines in longitudinal direction
num_trans_grid (int) – Number of grid lines in the transverse direction -
edge_beam_dist (int or float) – Distance of edge beam node lines to exterior main beam node lines
mesh_type (string) – Type of mesh either “Ortho” for orthogonal mesh or “Oblique” for oblique mesh
kwargs – See below
- Keyword:
beam_z_spacing: (list of int or float) Custom distance of longitudinal members (global z - direction). Note this parameter supercedes num_long_grid.
beam_x_spacing: (list of int or float) Custom distance of transverse members (global x - direction). Note this parameter supercedes num_trans_grid.
ext_to_int_dist: (Int or Float, or a List of Int or Float) distance between internal beams and exterior main beams. If list is provided (usually size 2), apply each distinct distance to left and right side respectively.
multi_span_dist_list: (List of Int/Float) List of distance (x dir) correspond to span length of each multi span
multi_span_num_points: (List of Int) Num of transverse member correspond to spans of each element in multi_span_dist_list If not specified, takes int var for num_trans_beam and assigns to all spans of multi_span_dist_list
continuous: (Bool) To set continuity of spans. Default True. If False, separate spans by non_cont_spacing_x
stitch_slab_elements: (Bool) To set stictch elements between spans. Elements are set using set_member() with member= “stich_elements”
non_cont_spacing_x: (float) sets spacing or length of stitch elements.
- Raises:
ValueError – If skew angle is greater than 90. If number of transverse grid line is less than 2.
- create_osp_model(pyfile: bool = False)#
Create model in OpenSees model space.
- Parameters:
pyfile (bool) – if True returns an executable py file instead of creating OpenSees instance of model.
- set_boundary_condition(edge_group_counter: int | None = None, new_restraint_vector: list | None = None)#
Set or modify customized support conditions of the Mesh
Note
Advanced version to set multispan feature to be available for future release.
- set_member(grillage_member_obj: GrillageMember, member: str | None = None, specific_group: int | None = None, specific_span: int | None = None)#
Set GrillageMember instance object to elements of grillage members.
- Parameters:
grillage_member_obj (GrillageMember) – GrillageMember class object
member (str) – str of member category - see below table for the available name strings
specific_group (int) – Specific member group particularly for interior main beams.
specific_span – Specific span number to assign member
- Raises:
ValueError If missing member
- set_spring_support(rotational_spring_stiffness: float, edge_num: int = 0, spring_direction=6)#
Sets a spring support value of rotational_spring_stiffness to all nodes of edge number.
- add_load_case(load_case_obj: LoadCase | MovingLoad, load_factor=1) None #
Function to add load cases to Ospllage grillage model. Function also adds moving load cases
- Parameters:
load_factor – Optional load factor for the prescribed load case. Default = 1
load_case_obj (LoadCase,MovingLoad) – LoadCase or MovingLoad object
- analyze(**kwargs) None #
Function to analyze defined load
- Keyword:
all (bool): If True, runs all load cases. If not provided, default to True.
load_case (‘list’ or ‘str’): String or list of name strings for selected load case to be analyzed.
set_verbose(bool): If True, incremental load case report is not printed to terminal (default True)
- Except:
raise ValueError if missing arguments for either load_case=, or all=
- add_load_combination(load_combination_name: str, load_case_and_factor_dict: dict)#
Function to add load combination to analysis. Load combinations are defined through a dict with load case name str to be included in combination as keys, and load factor (type float/int) as value of dict.
- Parameters:
load_combination_name (str) – Name string of load combination
load_case_and_factor_dict (str) – dict with name string of load cases within the combination as key, corresponding load factor as value.
Example format of input dict for add_load_combination:
load_comb = {"name_of_load_case_1":1.2, "name_of_load_case_2": 1.5}
Note
As of release 0.1.0, load combinations can be directly obtained (calculated on the fly) by specifying
combination
kwarg inget_results()
. Hence, add_combination is here for adding and storing information of load combination toOspGrillage
object.
- get_results(**kwargs)#
Function to get results from specific or all load cases. Alternatively, function process and returns load combination if “combina+tions” argument is provided. Result format is xarray DataSet. If a “save_file_name” is provided, saves xarray DataSet to NetCDF format to current working directory.
- Keyword:
- combinations (bool): If provided, returns a modified DataSet according to combinations defined. Format of argument is dict()
with keys of load case name string and values of load factors (int of float)
save_file_name (str): Name string of file name. Saves to NetCDF.
load_case (str): str or list of name string of specific load case to extract. Returned DataSet with the specified Load cases only
- Returns:
Xarray DataSet of analysis results - extracted based on keyword option specified. If combination is True, returns a list of DataSet, with each element correspond to a load combination.
- get_element(**kwargs) List[float] #
Function to query properties of elements in grillage model.
- Keyword:
options (`str): string for element data option. Either “elements” or “nodes” (default)
- z_group_num (int): group number [0 to N] for N is the number of groups within a specific grillage element group.
this is needed for interior beams, where users which to query specific group (e.g. 2nd group) within this “interior_main_beam” element group.
x_group_num (int): ditto for z_group_num but for x_group
edge_group_num(int): ditto for z_group_num but for edge groups
- Returns:
List of element data (tag)
- get_nodes(number: int | None = None) list #
Function to return all information for nodes in grillage model
- Returns:
dict contain node information
- class Analysis(analysis_name: str, ops_grillage_name: str, pyfile: bool, node_counter, ele_counter, analysis_type='Static', time_series_counter=1, pattern_counter=1, load_case: LoadCase | None = None, step: int = 1, **kwargs)#
Bases:
object
Main class to handle the run/execution of load case, including incremental load cases of a moving load analysis. Analysis class is created and handled by the OspGrillage class.
The following are the roles of Analysis object:
store information of ops commands for performing static (default) analysis of single/multiple load case(s).
execute the required ops commands to perform analysis using the OspGrillage model instance.
if flagged, writes an executable py file instead which performs the exact analysis as it would for an OspGrillage instance instead.
manages multiple load case’s ops.load() commands, applying the specified load factors to the load cases for load combinations
- extract_grillage_responses()#
Function that wraps OpenSeesPy nodeDisp() and eleResponse(), gets results of current analysis - model instance in OpenSees.
- Returns:
Stores results in global_ele_force and node_disp class variable
- class Results(mesh_obj: Mesh)#
Bases:
object
Main class to store results of an Analysis class object, process into data array output for post processing/plotting. Class object is accessed within OspGrillage class object.
- class OspGrillageBeam(bridge_name, long_dim, width, skew: list | float | int = 0, num_long_grid: int = 0, num_trans_grid: int = 0, edge_beam_dist: list | float | int = 1, mesh_type='Ortho', model='3D', **kwargs)#
Bases:
OspGrillage
Concrete class for beam grillage model type.
Init the OspGrillage class
- Parameters:
bridge_name (str) – Name of bridge model and output .py file
long_dim (int or float) – Length of the model in the longitudinal direction (default: x axis)
width (int or float) – Width of the model in the transverse direction (default: z axis)
skew (int or float) – Skew angle of the start and end edges of model
num_long_grid (int) – Number of grid lines in longitudinal direction
num_trans_grid (int) – Number of grid lines in the transverse direction -
edge_beam_dist (int or float) – Distance of edge beam node lines to exterior main beam node lines
mesh_type (string) – Type of mesh either “Ortho” for orthogonal mesh or “Oblique” for oblique mesh
kwargs – See below
- Keyword:
beam_z_spacing: (list of int or float) Custom distance of longitudinal members (global z - direction). Note this parameter supercedes num_long_grid.
beam_x_spacing: (list of int or float) Custom distance of transverse members (global x - direction). Note this parameter supercedes num_trans_grid.
ext_to_int_dist: (Int or Float, or a List of Int or Float) distance between internal beams and exterior main beams. If list is provided (usually size 2), apply each distinct distance to left and right side respectively.
multi_span_dist_list: (List of Int/Float) List of distance (x dir) correspond to span length of each multi span
multi_span_num_points: (List of Int) Num of transverse member correspond to spans of each element in multi_span_dist_list If not specified, takes int var for num_trans_beam and assigns to all spans of multi_span_dist_list
continuous: (Bool) To set continuity of spans. Default True. If False, separate spans by non_cont_spacing_x
stitch_slab_elements: (Bool) To set stictch elements between spans. Elements are set using set_member() with member= “stich_elements”
non_cont_spacing_x: (float) sets spacing or length of stitch elements.
- Raises:
ValueError – If skew angle is greater than 90. If number of transverse grid line is less than 2.
- class OspGrillageShell(bridge_name, long_dim, width, skew: list | float | int, num_long_grid: int, num_trans_grid: int, edge_beam_dist: list | float | int, mesh_type='Ortho', model='3D', **kwargs)#
Bases:
OspGrillage
Concrete class for shell model type
Init the OspGrillage class
- Parameters:
bridge_name (str) – Name of bridge model and output .py file
long_dim (int or float) – Length of the model in the longitudinal direction (default: x axis)
width (int or float) – Width of the model in the transverse direction (default: z axis)
skew (int or float) – Skew angle of the start and end edges of model
num_long_grid (int) – Number of grid lines in longitudinal direction
num_trans_grid (int) – Number of grid lines in the transverse direction -
edge_beam_dist (int or float) – Distance of edge beam node lines to exterior main beam node lines
mesh_type (string) – Type of mesh either “Ortho” for orthogonal mesh or “Oblique” for oblique mesh
kwargs – See below
- Keyword:
beam_z_spacing: (list of int or float) Custom distance of longitudinal members (global z - direction). Note this parameter supercedes num_long_grid.
beam_x_spacing: (list of int or float) Custom distance of transverse members (global x - direction). Note this parameter supercedes num_trans_grid.
ext_to_int_dist: (Int or Float, or a List of Int or Float) distance between internal beams and exterior main beams. If list is provided (usually size 2), apply each distinct distance to left and right side respectively.
multi_span_dist_list: (List of Int/Float) List of distance (x dir) correspond to span length of each multi span
multi_span_num_points: (List of Int) Num of transverse member correspond to spans of each element in multi_span_dist_list If not specified, takes int var for num_trans_beam and assigns to all spans of multi_span_dist_list
continuous: (Bool) To set continuity of spans. Default True. If False, separate spans by non_cont_spacing_x
stitch_slab_elements: (Bool) To set stictch elements between spans. Elements are set using set_member() with member= “stich_elements”
non_cont_spacing_x: (float) sets spacing or length of stitch elements.
- Raises:
ValueError – If skew angle is greater than 90. If number of transverse grid line is less than 2.
- create_osp_model(pyfile=False)#
Function to create model instance in OpenSees model space. If pyfile input is True, function creates an executable pyfile for generating the grillage model in OpenSees model space.
- Parameters:
pyfile (bool) – if True returns an executable py file instead of creating OpenSees instance of model.
- set_member(grillage_member_obj: GrillageMember, member: str | None = None, specific_group: int | None = None, specific_span: int | None = None)#
Function to set grillage member class object to elements of grillage members.
- Parameters:
grillage_member_obj (GrillageMember) – GrillageMember class object
member – str of member category - see below table for the available name strings
- Raises:
ValueError If missing argument for member=
- set_shell_members(grillage_member_obj: GrillageMember, quad=True, tri=False)#
Function to set shell/quad members across entire mesh grid.
- Parameters:
quad – Boolean to flag setting quad shell members
tri – Boolean to flag setting triangular shell members
grillage_member_obj (GrillageMember) – GrillageMember object
- Raises:
ValueError – If GrillageMember object was not specified for quad or shell element. Also raises this error if components of GrillageMember object (e.g. section or material) is not a valid property for the specific shell element type in accordance with OpenSees conventions.
Note
Feature to be updated with class segregation later on 0.1.1