SecMesh#

class opstool.preprocessing.SecMesh(sec_name='My Section')[source]#

A class to mesh the cross-section with triangular fibers.

Parameters#

sec_namestr

Assign a name to the section.

Returns#

None

add_rebars(rebars_obj)[source]#

Add rebars.

Parameters#

rebars_objmesh obj

The instance of Rebars class.

Returns#

None

assign_group(group)[source]#

Assign the group dict for each mesh.

Parameters#

groupdict

A dict of name as key, geometry obj as value.

Returns#

instance

assign_group_color(colors)[source]#

Assign the color dict to plot the section.

Parameters#

colorsdict[str, str]

A dict of name as key, color as value.

assign_mesh_size(mesh_size)[source]#

Assign the mesh size dict for each mesh.

Parameters#

mesh_sizedict[str, float]

A dict of name as key, mesh size as value.

Returns#

instance

assign_ops_matTag(mat_tag)[source]#

Assign the mesh size dict for each mesh.

Parameters#

mat_tagdict[str, int]

A dict of name as key, opensees matTag previous defined as value.

Returns#

instance

centring()[source]#

Move the section centroid to (0, 0).

Returns#

None

get_fiber_data()[source]#

Return fiber data.

Returns#

Tuple(dict, dict)

fiber center dict, fiber area dict

get_sec_props(Eref=1.0, display_results=False, plot_centroids=False)[source]#

Solving Section Geometry Properties by Finite Element Method, by sectionproperties pacakge.

Parameters#

Eref: float, default=1.0

Reference modulus of elasticity, it is important to analyze the composite section. See sectionproperties doc

display_resultsbool, default=True

whether to display the results.

plot_centroidsbool, default=False

whether to plot centroids

Returns#

sec_props: dict

section props dict, including:

  • Cross-sectional area (A)

  • Shear area (Asy, Asz)

  • Elastic centroid (centroid)

  • Second moments of area about the centroidal axis (Iy, Iz, Iyz)

  • Torsion constant (J)

  • Principal axis angle (phi)

  • ratio of reinforcement (rho_rebar)

  • Effective elastic modulus: E_eff;

  • Effective shear modulus: G_eff;

  • Effective Poisson’s ratio: Nu_eff.

If materials are specified for the cross-section, the area, second moments of area and torsion constant are elastic modulus weighted.

mesh()[source]#

Mesh the section.

Returns#

None

opspy_cmds(secTag, GJ)[source]#

Generate openseespy fiber section command.

Parameters#

secTagint

The section tag assigned in OpenSees.

GJfloat

Torsion stiffness.

Returns#

None

rotate(theta=0)[source]#

Rotate the section clockwise.

Parameters#

thetafloat, default=0

Rotation angle, unit: degree.

Returns#

None

to_file(output_path, secTag, GJ)[source]#

Output the opensees fiber code to file.

Parameters#

output_pathstr

The filepath to save, e.g., r”my_dir/my_section.py”

secTagint

The section tag assigned in OpenSees.

GJfloat

Torsion stiffness.

Returns#

None

Notes#

Notes that output_path must be endswith .py or .tcl, function will create the file by a right style.

view(fill=True, engine='plotly', save_html='SecMesh.html', on_notebook=False)[source]#

Display the section mesh.

Parameters#

fillbool, default=True

Whether to fill the trangles.

engine: str, default=’plotly’

Plot engine, optional “plotly” or “matplotlib”.

save_html: str, default=”SecMesh.html”

If set, the figure will save as a html file, only useful for engine=”plotly”. If False or None, this parameter will be ignored.

on_notebook: bool, default=False

If True, the figure will display in a notebook.

Returns#

None

Example#

import opstool as opst

outlines = [[0, 0], [2, 0], [2, 2], [0, 2]]
obj = opst.add_polygon(outlines)
sec = opst.SecMesh(sec_name='plain section')
sec.assign_group(dict(sec=obj))
sec.assign_mesh_size(dict(sec=0.1))
sec.mesh()
sec_props = sec.get_sec_props(display_results=True, plot_centroids=False)
sec.centring()
# sec.rotate(45)
sec.view(fill=True, engine='matplotlib')
                    Section Properties                    
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Symbol     Value           Definition                ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ A          4.000           Cross-sectional area      │
│ Asy        3.333           Shear area y-axis         │
│ Asz        3.333           Shear area z-axis         │
│ centroid   (1.000, 1.000)  Elastic centroid          │
│ Iy         1.333           Moment of inertia y-axis  │
│ Iz         1.333           Moment of inertia z-axis  │
│ Iyz        0.000           Product of inertia        │
│ J          2.249           Torsion constant          │
│ phi        0.000           Principal axis angle      │
│ rho_rebar  0.000           Ratio of reinforcement    │
│ E_eff      1.000           Effective elastic modulus │
│ G_eff      0.500           Effective shear modulus   │
│ Nu_eff     0.000           Effective Poisson’s ratio │
└───────────┴────────────────┴───────────────────────────┘
../../_images/sec.SecMesh_0_7.png