# 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)

  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: | a : float, optional Length (along the coordinate). b : float, optional Width (along the coordinate). r : float, optional Radius for cylindrical panels. alphadeg : float, optional Semi-vertex angle for conical panels. stack : list or tuple, optional A sequence representing the angles for each ply. plyt : float, optional Ply thickness. laminaprop : list or tuple, optional Orthotropic lamina properties: . mu : float, optional Material density. m, n : int, optional Number of terms for the approximation functions along and , respectively. offset : float, optional Laminate offset about panel mid-surface. The offset is measured along the normal () axis. y1, y2 : float, optional Define the lower and upper limit along for panel with incomplete domains.

  Methods

  `add_force`(x, y, fx, fy, fz[, cte]) | Add a punctual force with three components
  `bc_sfss`() |
  `bc_ssfs`() |
  `bc_ssss`() |
  `calc_cA`(aeromu[, silent, finalize]) | Calculate the aerodynamic damping matrix using the piston theory
  `calc_fext`([inc, silent]) | Calculates the external force vector
  `calc_k0`([size, row0, col0, silent, ...]) | Calculate the constitutive stiffness matrix
  `calc_kA`([size, row0, col0, silent, finalize]) | Calculate the aerodynamic matrix using the linear piston theory
  `calc_kG0`([size, row0, col0, silent, ...]) | Calculate the linear geometric stiffness matrix
  `calc_kM`([size, row0, col0, silent, finalize]) | Calculate the mass matrix
  `freq`([atype, tol, sparse_solver, silent, ...]) | Performs a natural frequency analysis
  `get_size`() | Calculates the size of the stiffness matrices
  `lb`([tol, sparse_solver, calc_kA, silent, ...]) | Performs a linear buckling analysis
  `plot`(c[, invert_y, vec, deform_u, ...]) | Contour plot for a Ritz constants vector.
  `save`() | Save the `Panel` object using `cPickle`
  `static`([NLgeom, silent]) | Static analysis for cones and cylinders
  `strain`(c[, xs, ys, gridx, gridy]) | Calculates the strain field
  `stress`(c[, xs, ys, gridx, gridy]) | Calculates the stress field
  `uvw`(c[, xs, ys, gridx, gridy]) | Calculates the displacement field

  `add_force`(x, y, fx, fy, fz, cte=True)

    Add a punctual force with three components

    Parameters: | x : float The position. y : float The position in radians. fx : float The component of the force vector. fy : float The component of the force vector. fz : float The component of the force vector. cte : bool, optional Constant forces are not incremented during the non-linear analysis.

  `calc_cA`(aeromu, silent=False, finalize=True)

    Calculate the aerodynamic damping matrix using the piston theory

  `calc_fext`(inc=1.0, silent=False)

    Calculates the external force vector

    Recall that:

    such that the terms in are constant and the terms in will be scaled by the parameter `inc`.

    Parameters: | inc : float, optional Since this function is called during the non-linear analysis, `inc` will multiply the terms . silent : bool, optional A boolean to tell whether the log messages should be printed.
    Returns: | fext : np.ndarray The external force vector

  `calc_k0`(size=None, row0=0, col0=0, silent=False, finalize=True, c=None, nx=None, ny=None, Fnxny=None)

    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.

    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: | size : int The size of the calculated sparse matrices. row0 and col0: int or None, optional Offset to populate the output sparse matrix (useful when assemblying panels). silent : bool, optional A boolean to tell whether the log messages should be printed. finalize : bool, optional Asserts validity of output data and makes the output matrix symmetric, should be `False` when assemblying. c : array-like or None, optional This must be the result of a static analysis, used to compute the non-linear term based on the actual displacement field. nx and ny : int or None, optional Number of integration points along and , respectively, for the Legendre-Gauss quadrature rule applied in the numerical integration. Only used when `c` is given. Fnxny : 4-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.

  `calc_kA`(size=None, row0=0, col0=0, silent=False, finalize=True)

    Calculate the aerodynamic matrix using the linear piston theory

  `calc_kG0`(size=None, row0=0, col0=0, silent=False, finalize=True, c=None, nx=None, ny=None, Fnxny=None)

    Calculate the linear geometric stiffness matrix

    When using `c`:

    - if you pass `row0` and `col0` the size of `c`

    should be the size of the whole assembly - if `row0=0` and `col0=0` the size of `c` should be the size of

    > the individual panel

    Parameters: | size : int, optional Size of the output squared sparse matrix (if the panel is used in an assembly this must be the size of the assembly). If `None` it will consider only the degrees-of-freedom of the individual panel. row0 and col0: int or None, optional Offset to populate the output sparse matrix (useful when assemblying panels). silent : bool, optional A boolean to tell whether the log messages should be printed. finalize : bool, optional Asserts validity of output data and makes the output matrix symmetric, should be `False` when assemblying. c : array-like or None, optional This must be the result of a static analysis, used to numerically compute based on the actual membrane-stress state. nx and ny : int or None, optional Number of integration points along and , respectively, for the Legendre-Gauss quadrature rule applied in the numerical integration. Only used when `c` is given. Fnxny : 4-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.

  `calc_kM`(size=None, row0=0, col0=0, silent=False, finalize=True)

    Calculate the mass matrix

  `freq`(atype=4, tol=0, sparse_solver=True, silent=False, sort=True, damping=False, reduced_dof=False)

    Performs a 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: | atype : int, 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 tol : float, optional A tolerance value passed to `scipy.sparse.linalg.eigs`. sparse_solver : bool, 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. silent : bool, optional A boolean to tell whether the log messages should be printed. sort : bool, optional Sort the output eigenvalues and eigenmodes. damping : bool, optinal If aerodynamic damping should be taken into account. reduced_dof : bool, optional Considers only the contributions of and 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 eigenvector in the `eigvecs[:, i-1]` parameter.

  `get_size`()

    Calculates 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 , the internal force vector and the external force vector .

    Returns: | size : int The size of the stiffness matrices.

  `lb`(tol=0, sparse_solver=True, calc_kA=False, silent=False, nx=10, ny=10, c=None, ckL=None, Fnxny=None)

    Performs a linear buckling analysis

    Note

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

    The following parameters will affect the linear buckling analysis:

    Parameters: | tol : float, optional A float tolerance passsed to the eigenvalue solver. sparse_solver : bool, optional Tells if solver `scipy.linalg.eigh()` or `scipy.sparse.linalg.eigsh()` should be used. calc_kA : bool, optional If the Aerodynamic matrix should be considered. silent : bool, optional A boolean to tell whether the log messages should be printed. c : array-like, optional A set of Ritz constants that will be use to compute KG. ckL : array-like, optional A set of Ritz constants that will be use to compute KL. nx and ny : int or None, optional Number of integration points along and , respectively, for the Legendre-Gauss quadrature rule applied in the numerical integration. Fnxny : 4-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 eigenvector in the `eigvecs[:, i-1]` parameter.

  `plot`(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, 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)

    Contour plot for a Ritz constants vector.

    Parameters: | c : np.ndarray The Ritz constants that will be used to compute the field contour. vec : str, 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_u : bool, optional If `True` the contour plot will look deformed. deform_u_sf : float, optional The scaling factor used to deform the contour. invert_y : bool, optional Inverts the axis of the plot. save : bool, optional Flag telling whether the contour should be saved to an image file. dpi : int, optional Resolution of the saved file in dots per inch. filename : str, optional The file name for the generated image file. If no value is given, the parameter of the `Panel` object will be used. ax : AxesSubplot, optional When `ax` is given, the contour plot will be created inside it. figsize : tuple, optional The figure size given by `(width, height)`. title : str, optional If any string is given it is added as title to the contour plot. colorbar : bool, optional If a colorbar should be added to the contour plot. cbar_nticks : int, optional Number of ticks added to the colorbar. cbar_format : [ None | format string | Formatter object ], optional See the `matplotlib.pyplot.colorbar` documentation. cbar_fontsize : int, optional Fontsize of the colorbar labels. cbar_title : str, optional Colorbar title. If `cbar_title == ''` no title is added. aspect : str, optional String that will be passed to the `AxesSubplot.set_aspect()` method. clean : bool, optional Clean axes ticks, grids, spines etc. xs : np.ndarray, optional The positions where to calculate the displacement field. Default is `None` and the method `_default_field` is used. ys : np.ndarray, optional The `y` positions where to calculate the displacement field. Default is `None` and the method `_default_field` is used. gridx : int, optional Number of points along the axis where to calculate the displacement field. gridy : int, optional Number of points along the where to calculate the displacement field. num_levels : int, optional Number of contour levels (higher values make the contour smoother). vecmin : float, optional Minimum value for the contour scale (useful to compare with other results). If not specified it will be taken from the calculated field. vecmax : float, optional Maximum value for the contour scale.
    Returns: | ax : matplotlib.axes.Axes The Matplotlib object that can be used to modify the current plot if needed.

  `save`()

    Save the `Panel` object using `cPickle`

    Notes

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

  `static`(NLgeom=False, silent=False)

    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: | NLgeom : bool Flag to indicate whether a linear or a non-linear analysis is to be performed. silent : bool, optional A boolean to tell whether the log messages should be printed.
    Returns: | cs : list 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`(c, xs=None, ys=None, gridx=300, gridy=300)

    Calculates the strain field

    Parameters: | c : np.ndarray The Ritz constants vector to be used for the strain field calculation. xs : np.ndarray, optional The coordinates where to calculate the strains. ys : np.ndarray, optional The coordinates where to calculate the strains, must have the same shape as `xs`. gridx : int, optional When `xs` and `ys` are not supplied, `gridx` and `gridy` are used. gridy : int, optional When `xs` and `ys` are not supplied, `gridx` and `gridy` are used.

  `stress`(c, xs=None, ys=None, gridx=300, gridy=300)

    Calculates the stress field

    Parameters: | c : np.ndarray The Ritz constants vector to be used for the strain field calculation. xs : np.ndarray, optional The coordinates where to calculate the strains. ys : np.ndarray, optional The coordinates where to calculate the strains, must have the same shape as `xs`. gridx : int, optional When `xs` and `ys` are not supplied, `gridx` and `gridy` are used. gridy : int, optional When `xs` and `ys` are not supplied, `gridx` and `gridy` are used.

  `uvw`(c, xs=None, ys=None, gridx=300, gridy=300)

    Calculates 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: | c : float The full set of Ritz constants xs : np.ndarray The positions where to calculate the displacement field. Default is `None` and the method `_default_field` is used. ys : np.ndarray The `y` positions where to calculate the displacement field. Default is `None` and the method `_default_field` is used. gridx : int Number of points along the axis where to calculate the displacement field. gridy : int Number of points along the where to calculate the displacement field.
    Returns: | out : tuple 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.