Field outputs, plots and files#
The solvers return the Ritz constants \(\boldsymbol{c}\), from which the fields are calculated at points or over a grid, plotted, and saved with the model.
Field outputs#
object |
displacements, strains, stress resultants |
other outputs |
|---|---|---|
|
|
|
|
|
|
|
|
The methods of Shell store the fields in the dictionary
Shell.fields and the coordinates of the points in Shell.plot_mesh;
the strains and stress resultants include the non-linear terms of the
strains of the model by default. Those of MultiDomain evaluate
the domains of a group, or one domain eval_panel, at a grid or at
the Gauss-Legendre points, and MultiDomain.force() integrates the
stress resultants along a line of constant \(x\) or \(y\). The eigenvalues,
eigenvectors and Ritz constants of an analysis may be kept in the
dictionary Shell.results, which is saved with the shell.
Plots#
plot_shell(): contour plot of one field of aShell, withmatplotlib;MultiDomain.plot(): contour plot of the domains of a group, each domain placed atx0,y0in the plane of the group;MultiDomain.plot3d(): interactive 3D plot of the deformed assembly with plotly, which must be installed, each domain placed in the global coordinate system byx0,y0,z0,point_xandpoint_xy, seeShell.global_frame();StiffPanelBay.plot_skin()andStiffPanelBay.plot_stiffener(): contour plots of a bay.
Saving and loading#
Shell.save(), StiffPanelBay.save() and
MultiDomain.save() write a zip file with the inputs in JSON and the
arrays, e.g. the fields and the results, in NumPy’s format, and
panels.shell.load(), panels.stiffpanelbay.load() and
panels.multidomain.load() read it back; the matrices are not stored
and are calculated again. File objects, e.g. io.BytesIO, are
accepted in place of file names. The format and the attributes stored are
described in panels.json_io.
Examples#
A shell saved after a linear buckling and a static analysis, with the eigenpairs, the Ritz constants and the stress resultants, gives the same matrices and results once loaded:
def _shell(model='plate_clpt_donnell', **kwargs):
kw = dict(a=0.6, b=0.4, stack=[0, 45, -45, 90], plyt=0.2e-3,
laminaprop=LAMINAPROP, rho=1600., m=7, n=6, model=model)
if 'cylshell' in model:
kw['r'] = 0.8
kw.update(kwargs)
s = Shell(**kw)
s.Nxx = -1.
s.y1w = 1.
s.add_point_load(0.3, 0.2, 0, 0, -10.)
s.add_point_load(0.6, 0.2, -5., 0, 0, cte=False)
s.add_pressure_load(-1.e3, x1=0.1, follower=False)
s.add_point_pd(0.2, 0.1, 1.e6, 0., 1.e6, 0., 1.e6, 1.e-4)
return s
@pytest.mark.parametrize('model', SHELL_MODELS)
def test_shell_after_analysis(model):
s = _shell(model)
kC, kG, eigvals, eigvecs = _shell_lb(s)
s.results['eigvals'] = eigvals
s.results['eigvecs'] = eigvecs
c = _shell_static(s)
s.increments = [0.5, 1.]
s.results['c'] = c
s.stress(c, gridx=7, gridy=5)
data = _save(s)
# the saved object is not modified
assert s.matrices['kC'] is not None
assert s.lam is not None
s2 = load_shell(io.BytesIO(data))
for k in ('eigvals', 'eigvecs', 'c'):
assert s2.results[k].dtype == s.results[k].dtype
assert_array_equal(s2.results[k], s.results[k])
assert s2.increments == [0.5, 1.]
for k, v in s.fields.items():
if v is None:
assert s2.fields[k] is None
else:
assert s2.fields[k].shape == v.shape == (5, 7)
assert_array_equal(s2.fields[k], v)
for k, v in s.plot_mesh.items():
assert_array_equal(s2.plot_mesh[k], v)
assert all(v is None for v in s2.matrices.values())
kC2, kG2, eigvals2, eigvecs2 = _shell_lb(s2)
_assert_same_matrices(kC2, kC)
_assert_same_eigenpairs(eigvals2, eigvecs2, eigvals, eigvecs)
assert_array_equal(_shell_static(s2), c)
s2.stress(c, gridx=7, gridy=5)
for k, v in s.fields.items():
if v is not None:
assert_array_equal(s2.fields[k], v)
A contour plot of the bending moment Mxx of a Shell with the
options of plot_shell():
def test_plot_shell_options(shell_c, tmp_path):
s, c = shell_c
filename = tmp_path / 'shell.png'
ax = plot_shell(s, c, vec='Mxx', deform_u=True, deform_u_sf=10.,
colorbar=True, cbar_title='Mxx', invert_y=True,
title='title', clean=False, colormap=1,
texts=[dict(x=0.1, y=0.1, s='text')],
filename=str(filename), dpi=20,
gridx=8, gridy=6, num_levels=5)
assert filename.exists()
assert ax.get_title() == 'title'
assert ax.yaxis_inverted()