Semi-analytical Models for Panels (compmech.panel)

class compmech.panel.panel.Panel(a=None, b=None, r=None, alphadeg=None, stack=None, plyt=None, laminaprop=None, mu=None, m=11, n=11, offset=0.0, y1=None, y2=None, **kwargs)[source]

General Panel class

It works for both flat plates, cylindrical and conical panels. The right model is selected according to parameters r (radius) and alphadeg (semi-vertex angle).

The approximation functions for the displacement fields are built using Bardell’s functions.

Parameters
afloat, optional

Length (along the x coordinate).

bfloat, optional

Width (along the y coordinate).

rfloat, optional

Radius for cylindrical panels.

alphadegfloat, optional

Semi-vertex angle for conical panels.

stacklist or tuple, optional

A sequence representing the angles for each ply.

plytfloat, optional

Ply thickness.

laminaproplist or tuple, optional

Orthotropic lamina properties: E_1, E_2, \nu_{12}, G_{12}, G_{13}, G_{23}.

mufloat, optional

Material density.

m, nint, optional

Number of terms for the approximation functions along x and y, respectively.

offsetfloat, optional

Laminate offset about panel mid-surface. The offset is measured along the normal (z) axis.

y1, y2float, optional

Define the lower and upper limit along y for panel with incomplete domains.

Methods

add_force(self, x, y, fx, fy, fz[, cte])

Add a punctual force with three components

calc_cA(self, aeromu[, silent, finalize])

Calculate the aerodynamic damping matrix using the piston theory

calc_fext(self[, inc, size, col0, silent])

Calculate the external force vector \{F_{ext}\}

calc_fint(self, c[, size, col0, silent, nx, …])

Calculate the internal force vector \{F_{int}\}

calc_k0(self[, size, row0, col0, silent, …])

Calculate the constitutive stiffness matrix

calc_kA(self[, size, row0, col0, silent, …])

Calculate the aerodynamic matrix using the linear piston theory

calc_kG0(self[, size, row0, col0, silent, …])

Calculate the linear geometric stiffness matrix

calc_kM(self[, size, row0, col0, silent, …])

Calculate the mass matrix

freq(self[, atype, tol, sparse_solver, …])

Natural frequency analysis

get_size(self)

Calculate the size of the stiffness matrices

lb(self[, tol, sparse_solver, calc_kA, …])

Linear buckling analysis

plot(self, c[, invert_y, vec, deform_u, …])

Contour plot for a Ritz constants vector.

save(self)

Save the Panel object using pickle

static(self[, NLgeom, silent])

Static analysis for cones and cylinders

strain(self, c[, xs, ys, gridx, gridy, NLterms])

Calculate the strain field

stress(self, c[, F, xs, ys, gridx, gridy, …])

Calculate the stress field

uvw(self, c[, xs, ys, gridx, gridy])

Calculate the displacement field

calc_kT

add_force(self, x, y, fx, fy, fz, cte=True)[source]

Add a punctual force with three components

Parameters
xfloat

The x position.

yfloat

The y position in radians.

fxfloat

The x component of the force vector.

fyfloat

The y component of the force vector.

fzfloat

The z component of the force vector.

ctebool, optional

Constant forces are not incremented during the non-linear analysis.

calc_cA(self, aeromu, silent=False, finalize=True)[source]

Calculate the aerodynamic damping matrix using the piston theory

calc_fext(self, inc=1.0, size=None, col0=0, silent=False)[source]

Calculate the external force vector \{F_{ext}\}

Recall that:

\{F_{ext}\}=\{{F_{ext}}_0\} + \{{F_{ext}}_\lambda\}

such that the terms in \{{F_{ext}}_0\} are constant and the terms in \{{F_{ext}}_\lambda\} will be scaled by the parameter inc.

Parameters
incfloat, optional

Since this function is called during the non-linear analysis, inc will multiply the terms \{{F_{ext}}_\lambda\}.

silentbool, optional

A boolean to tell whether the log messages should be printed.

Returns
fextnp.ndarray

The external force vector

calc_fint(self, c, size=None, col0=0, silent=False, nx=None, ny=None, Fnxny=None, inc=None)[source]

Calculate the internal force vector \{F_{int}\}

Parameters
cnp.ndarray

The Ritz constants vector to be used for the internal forces calculation.

sizeint, optional

The size of the internal force vector. Can be the size of a global internal force vector of an assembly.

col0int, optional

Offset in a global internal forcce vector of an assembly.

silentbool, optional

A boolean to tell whether the log messages should be printed.

nxint, optional

Number of integration points along x.

nyint, optional

Number of integration points along y.

Fnxnynp.ndarray, optional

Laminate stiffness for each integration point, if not supplied it will assume constant properties over the panel domain.

incfloat, optional

Load increment.

Returns
fintnp.ndarray

The internal force vector

calc_k0(self, size=None, row0=0, col0=0, silent=False, finalize=True, c=None, nx=None, ny=None, Fnxny=None, inc=None, NLgeom=False)[source]

Calculate the constitutive stiffness matrix

If c is not given it calculates the linear constitutive stiffness matrix, otherwise the large displacement linear constitutive stiffness matrix is calculated. When using c``the size of ``c must be the same as size.

In assemblies of semi-analytical models the sparse matrices that are calculated may have the size of the assembled global model, and the current constitutive matrix being calculated starts at position row0 and col0.

Parameters
sizeint

The size of the calculated sparse matrices.

row0, col0: int or None, optional

Offset to populate the output sparse matrix (useful when assemblying panels).

silentbool, optional

A boolean to tell whether the log messages should be printed.

finalizebool, optional

Asserts validity of output data and makes the output matrix symmetric, should be False when assemblying.

carray-like or None, optional

This must be the result of a static analysis, used to compute non-linear terms based on the actual displacement field.

nx, nyint or None, optional

Number of integration points along x and y, respectively, for the Legendre-Gauss quadrature rule applied in the numerical integration. Only used when c is given.

Fnxny4-D array-like or None, optional

The constitutive relations for the laminate at each integration point. Must be a 4-D array of shape (nx, ny, 6, 6) when using classical laminated plate theory models.

NLgeombool, optional

Flag to indicate if geometrically non-linearities should be considered.

calc_kA(self, size=None, row0=0, col0=0, silent=False, finalize=True)[source]

Calculate the aerodynamic matrix using the linear piston theory

calc_kG0(self, size=None, row0=0, col0=0, silent=False, finalize=True, c=None, nx=None, ny=None, Fnxny=None, NLgeom=False)[source]

Calculate the linear geometric stiffness matrix

See Panel.calc_k0() for details on each parameter.

calc_kM(self, size=None, row0=0, col0=0, silent=False, finalize=True)[source]

Calculate the mass matrix

freq(self, atype=4, tol=0, sparse_solver=True, silent=False, sort=True, damping=False, reduced_dof=False)[source]

Natural frequency analysis

Note

This will be deprecated soon, use compmech.analysis.freq().

The following parameters of the will affect the linear buckling analysis:

Parameters
atypeint, optional

Tells which analysis type should be performed:

  • 1 : considers k0, kA and kG0 (and cA depending on ‘damping’)

  • 2 : considers k0 and kA (and cA depending on ‘damping’)

  • 3 : considers k0 and kG0

  • 4 : considers k0 only

tolfloat, optional

A tolerance value passed to scipy.sparse.linalg.eigs.

sparse_solverbool, optional

Tells if solver scipy.linalg.eig() or scipy.sparse.linalg.eigs() should be used.

Note

It is recommended sparse_solver=False, because it was verified that the sparse solver becomes unstable for some cases, though the sparse solver is faster.

silentbool, optional

A boolean to tell whether the log messages should be printed.

sortbool, optional

Sort the output eigenvalues and eigenmodes.

dampingbool, optinal

If aerodynamic damping should be taken into account.

reduced_dofbool, optional

Considers only the contributions of v and w to the stiffness matrix and accelerates the run. Only effective when sparse_solver=False.

Notes

The extracted eigenvalues are stored in the eigvals parameter and the i^{th} eigenvector in the eigvecs[:, i-1] parameter.

get_size(self)[source]

Calculate the size of the stiffness matrices

The size of the stiffness matrices can be interpreted as the number of rows or columns, recalling that this will be the size of the Ritz constants’ vector \{c\}, the internal force vector \{F_{int}\} and the external force vector \{F_{ext}\}.

Returns
sizeint

The size of the stiffness matrices.

lb(self, tol=0, sparse_solver=True, calc_kA=False, silent=False, nx=10, ny=10, c=None, ckL=None, Fnxny=None)[source]

Linear buckling analysis

Note

This will be deprecated soon, use compmech.analysis.lb().

The following parameters will affect the linear buckling analysis:

Parameters
tolfloat, optional

A float tolerance passsed to the eigenvalue solver.

sparse_solverbool, optional

Tells if solver scipy.linalg.eigh() or scipy.sparse.linalg.eigsh() should be used.

calc_kAbool, optional

If the Aerodynamic matrix should be considered.

silentbool, optional

A boolean to tell whether the log messages should be printed.

carray-like, optional

A set of Ritz constants that will be use to compute KG.

ckLarray-like, optional

A set of Ritz constants that will be use to compute KL.

nx and nyint or None, optional

Number of integration points along x and y, respectively, for the Legendre-Gauss quadrature rule applied in the numerical integration.

Fnxny4-D array-like or None, optional

The constitutive relations for the laminate at each integration point. Must be a 4-D array of shape (nx, ny, 6, 6) when using classical laminated plate theory models.

Notes

The extracted eigenvalues are stored in the eigvals parameter of the Panel object and the i^{th} eigenvector in the eigvecs[:, i-1] parameter.

plot(self, c, invert_y=False, vec='w', deform_u=False, deform_u_sf=100.0, filename='', ax=None, figsize=(3.5, 2.0), save=True, title='', colorbar=False, cbar_nticks=2, cbar_format=None, cbar_title='', cbar_fontsize=10, colormap='jet', aspect='equal', clean=True, dpi=400, texts=[], xs=None, ys=None, gridx=300, gridy=300, num_levels=400, vecmin=None, vecmax=None, plotoffsetxs=0.0, plotoffsetys=0.0)[source]

Contour plot for a Ritz constants vector.

Parameters
cnp.ndarray

The Ritz constants that will be used to compute the field contour.

vecstr, optional

Can be one of the components:

  • Displacement: 'u', 'v', 'w', 'phix', 'phiy'

  • Strain: 'exx', 'eyy', 'gxy', 'kxx', 'kyy', 'kxy', 'gyz', 'gxz'

  • Stress: 'Nxx', 'Nyy', 'Nxy', 'Mxx', 'Myy', 'Mxy', 'Qy', 'Qx'

deform_ubool, optional

If True the contour plot will look deformed.

deform_u_sffloat, optional

The scaling factor used to deform the contour.

invert_ybool, optional

Inverts the y axis of the plot.

savebool, optional

Flag telling whether the contour should be saved to an image file.

dpiint, optional

Resolution of the saved file in dots per inch.

filenamestr, optional

The file name for the generated image file. If no value is given, the name parameter of the Panel object will be used.

axAxesSubplot, optional

When ax is given, the contour plot will be created inside it.

figsizetuple, optional

The figure size given by (width, height).

titlestr, optional

If any string is given it is added as title to the contour plot.

colorbarbool, optional

If a colorbar should be added to the contour plot.

cbar_nticksint, optional

Number of ticks added to the colorbar.

cbar_format[ None | format string | Formatter object ], optional

See the matplotlib.pyplot.colorbar documentation.

cbar_titlestr, optional

Colorbar title. If cbar_title == '' no title is added.

cbar_fontsizeint, optional

Fontsize of the colorbar labels.

colormapstring, optional

Name of a matplotlib available colormap.

aspectstr, optional

String that will be passed to the AxesSubplot.set_aspect() method.

cleanbool, optional

Clean axes ticks, grids, spines etc.

xsnp.ndarray, optional

The x positions where to calculate the displacement field. Default is None and the method _default_field is used.

ysnp.ndarray, optional

The y positions where to calculate the displacement field. Default is None and the method _default_field is used.

gridxint, optional

Number of points along the x axis where to calculate the displacement field.

gridyint, optional

Number of points along the y where to calculate the displacement field.

num_levelsint, optional

Number of contour levels (higher values make the contour smoother).

vecminfloat, optional

Minimum value for the contour scale (useful to compare with other results). If not specified it will be taken from the calculated field.

vecmaxfloat, optional

Maximum value for the contour scale.

Returns
axmatplotlib.axes.Axes

The Matplotlib object that can be used to modify the current plot if needed.

save(self)[source]

Save the Panel object using pickle

Notes

The pickled file will have the name stored in Panel.name followed by a '.Panel' extension.

static(self, NLgeom=False, silent=False)[source]

Static analysis for cones and cylinders

Note

This will be deprecated soon, use compmech.analysis.static().

The analysis can be linear or geometrically non-linear. See Analysis for further details about the parameters controlling the non-linear analysis.

Parameters
NLgeombool

Flag to indicate whether a linear or a non-linear analysis is to be performed.

silentbool, optional

A boolean to tell whether the log messages should be printed.

Returns
cslist

A list containing the Ritz constants for each load increment of the static analysis. The list will have only one entry in case of a linear analysis.

Notes

The returned cs is stored in self.analysis.cs. The actual increments used in the non-linear analysis are stored in the self.analysis.increments parameter.

strain(self, c, xs=None, ys=None, gridx=300, gridy=300, NLterms=True)[source]

Calculate the strain field

Parameters
cnp.ndarray

The Ritz constants vector to be used for the strain field calculation.

xsnp.ndarray, optional

The x coordinates where to calculate the strains.

ysnp.ndarray, optional

The y coordinates where to calculate the strains, must have the same shape as xs.

gridxint, optional

When xs and ys are not supplied, gridx and gridy are used.

gridyint, optional

When xs and ys are not supplied, gridx and gridy are used.

NLtermsbool

Flag to indicate whether non-linear strain components should be considered.

Returns
resdict

A dictionary of np.ndarrays with the keys: (x, y, exx, eyy, gxy, kxx, kyy, kxy)

stress(self, c, F=None, xs=None, ys=None, gridx=300, gridy=300, NLterms=True)[source]

Calculate the stress field

Parameters
cnp.ndarray

The Ritz constants vector to be used for the strain field calculation.

Fnp.ndarray, optional

The laminate stiffness matrix. Can be a 6 x 6 (ABD) matrix for homogeneous laminates over the whole domain.

xsnp.ndarray, optional

The x coordinates where to calculate the strains.

ysnp.ndarray, optional

The y coordinates where to calculate the strains, must have the same shape as xs.

gridxint, optional

When xs and ys are not supplied, gridx and gridy are used.

gridyint, optional

When xs and ys are not supplied, gridx and gridy are used.

NLtermsbool

Flag to indicate whether non-linear strain components should be considered.

Returns
resdict

A dictionary of np.ndarrays with the keys: (x, y, Nxx, Nyy, Nxy, Mxx, Myy, Mxy)

uvw(self, c, xs=None, ys=None, gridx=300, gridy=300)[source]

Calculate the displacement field

For a given full set of Ritz constants c, the displacement field is calculated and stored in the parameters u, v, w, phix, phiy of the Panel object.

Parameters
cfloat

The full set of Ritz constants

xsnp.ndarray

The x positions where to calculate the displacement field. Default is None and the method _default_field is used.

ysnp.ndarray

The y positions where to calculate the displacement field. Default is None and the method _default_field is used.

gridxint

Number of points along the x axis where to calculate the displacement field.

gridyint

Number of points along the y where to calculate the displacement field.

Returns
outtuple

A tuple of np.ndarrays containing (u, v, w, phix, phiy).

Notes

The returned values u`, v, w, phix, phiy are stored as parameters with the same name in the Panel object.