femlabpy.matlab#
Packaged legacy benchmark decks and MATLAB-style convenience wrappers.
Workflow role#
This module preserves the original classroom problem names and data layouts so existing FemLab examples remain easy to recognize. Some functions simply return the benchmark data, while others keep the old wrapper behavior for users who want the Python port to feel close to the source MATLAB material.
What lives here#
benchmark data loaders such as
bar01,square,hole, andcanti,compatibility wrappers such as
nlbar,plastps, andplastpe,small translation helpers that normalize the old tables into typed Python dictionaries.
Functions#
|
Return the packaged input deck corresponding to |
|
Return the packaged input deck corresponding to |
|
Return the packaged input deck corresponding to |
|
Return the original |
|
Solve a linear 2D elasticity problem following the original |
|
Return the original |
|
Solve a Q4 potential problem following the original |
|
Solve a T3 potential problem following the original |
|
Return the packaged input deck corresponding to |
|
Solve a nonlinear truss problem through the legacy |
|
Solve a plane-strain elastoplastic Q4 problem following |
|
Solve a plane-stress elastoplastic Q4 problem following |
|
Return the packaged input deck corresponding to |
Function Reference#
- femlabpy.matlab.bar01() dict[str, ndarray | int][source]#
Return the packaged input deck corresponding to
bar01.m.The returned dictionary contains the original truss geometry, material table, constraints, loads, and nonlinear load-stepping controls exported from the classroom MATLAB benchmark.
- femlabpy.matlab.bar02() dict[str, ndarray | int][source]#
Return the packaged input deck corresponding to
bar02.m.This is the spatial three-dimensional nonlinear truss benchmark used by the legacy
nlbar.mteaching script.
- femlabpy.matlab.bar03() dict[str, ndarray | int][source]#
Return the packaged input deck corresponding to
bar03.m.Notes
bar03.mis a historically difficult 12-bar benchmark. It is exposed for compatibility and regression work even though the legacy load-stepping method can exceed its restart guard on this case.
- femlabpy.matlab.canti() dict[str, ndarray | int][source]#
Return the original
canti.mcantilever benchmark input deck.- Returns:
- dict
Result dictionary containing
u,q,S,E,R, the normalizeddatadictionary, and an optionalfigureslist.
- femlabpy.matlab.elastic(T, X, G, C, P, *, etype: str | None = None, dof: int | None = None, plot: bool = False, scale: float = 5.0) dict[str, Any][source]#
Solve a linear 2D elasticity problem following the original
elastic.mworkflow.- Parameters:
- T, X, G, C, P:
Legacy FemLab topology, coordinates, material data, prescribed displacements, and nodal loads.
- etype:
Element family used by the topology table. Supported values are
"q4"and"t3". When omitted, the wrapper infers the type from the number of nodes per element.- dof:
Degrees of freedom per node. Defaults to
X.shape[1].- plot:
When
True, return Matplotlib figures for the geometry and the first stress component.- scale:
Displacement magnification factor used only for the deformed plot.
- Returns:
- dict
Linear elastic solution, recovered stresses and strains, reactions, normalized input data, and optional Matplotlib figures.
- femlabpy.matlab.flow() dict[str, ndarray | int][source]#
Return the original
flow.mpotential-flow benchmark data.The returned dictionary contains both the Q4 topology
T1and the T3 topologyT2used by the legacyflowq4.mandflowt3.mdrivers.
- femlabpy.matlab.flowq4(T1=None, X=None, G=None, C=None, P=None, *, dof: int = 1, plot: bool = False) dict[str, Any][source]#
Solve a Q4 potential problem following the original
flowq4.mdriver.- Parameters:
- T1, X, G, C, P:
Legacy FemLab topology, coordinates, material data, prescribed potentials, and optional nodal loads. When omitted, the packaged
flow.mbenchmark data is used.- dof:
Degrees of freedom per node. The legacy flow examples use
dof=1.- plot:
When
True, return a single four-panel Matplotlib figure matching the original classroom driver.
- femlabpy.matlab.flowt3(T2=None, X=None, G=None, C=None, P=None, *, dof: int = 1, plot: bool = False) dict[str, Any][source]#
Solve a T3 potential problem following the original
flowt3.mdriver.- Parameters:
- T2, X, G, C, P:
Legacy FemLab topology, coordinates, material data, prescribed potentials, and optional nodal loads. When omitted, the packaged
flow.mbenchmark data is used.- dof:
Degrees of freedom per node. The legacy flow examples use
dof=1.- plot:
When
True, return a single four-panel Matplotlib figure matching the original classroom driver.
- femlabpy.matlab.hole(*, plane_strain: bool = False) dict[str, ndarray | int][source]#
Return the packaged input deck corresponding to
hole.m.
- femlabpy.matlab.nlbar(T, X, G, C, P, *, no_loadsteps: int, i_max: int, i_d: int, plotdof: int, tol: float = 1e-08, plot: bool = False, plotaxis=None, elaxis=None) dict[str, Any][source]#
Solve a nonlinear truss problem through the legacy
nlbar.mdriver logic.- Parameters:
- T, X, G, C, P:
Legacy FemLab topology, coordinates, material data, displacement constraints, and nodal loads.
- no_loadsteps, i_max, i_d, plotdof:
Legacy load-stepping controls used by the orthogonal residual method.
plotdofis interpreted as the original 1-based degree-of-freedom index.- tol:
Convergence tolerance used by
femlabpy.solve_nlbar().- plot:
When
True, return a load-displacement figure and a deformed-geometry figure.- plotaxis, elaxis:
Optional MATLAB-style axis vectors kept for API compatibility.
- femlabpy.matlab.plastpe(T, X, G, C, P, *, no_loadsteps: int, i_max: int, i_d: int, plotdof: int, tol: float = 1e-08, mattype: int = 1, plot: bool = False, strainaxis=None, elaxis=None) dict[str, Any][source]#
Solve a plane-strain elastoplastic Q4 problem following
plastpe.m.- Parameters:
- T, X, G, C, P:
Legacy FemLab topology, coordinates, material data, displacement constraints, and nodal loads.
- no_loadsteps, i_max, i_d, plotdof:
Orthogonal-residual load-stepping controls.
plotdofis interpreted in the original 1-based numbering.- tol:
Convergence tolerance passed to
femlabpy.solve_plastic().- mattype:
1for von Mises and2for Drucker-Prager, matching FemLab.- plot:
When
True, return a load-displacement figure and an equivalent plastic-strain contour plot in the deformed geometry.- strainaxis, elaxis:
Optional MATLAB-style axis vectors kept for API compatibility.
- femlabpy.matlab.plastps(T, X, G, C, P, *, no_loadsteps: int, i_max: int, i_d: int, plotdof: int, tol: float = 1e-08, mattype: int = 1, plot: bool = False, strainaxis=None, elaxis=None) dict[str, Any][source]#
Solve a plane-stress elastoplastic Q4 problem following
plastps.m.- Parameters:
- T, X, G, C, P:
Legacy FemLab topology, coordinates, material data, displacement constraints, and nodal loads.
- no_loadsteps, i_max, i_d, plotdof:
Orthogonal-residual load-stepping controls.
plotdofis interpreted in the original 1-based numbering.- tol:
Convergence tolerance passed to
femlabpy.solve_plastic().- mattype:
1for von Mises and2for Drucker-Prager, matching FemLab.- plot:
When
True, return a load-displacement figure and an equivalent plastic-strain contour plot in the deformed geometry.- strainaxis, elaxis:
Optional MATLAB-style axis vectors kept for API compatibility.