Base class for multidomain#
Multi-Domain semi-analytical method (panels.multidomain
)#
- class panels.multidomain.MultiDomain(panels, conn=None)#
Class for multi-domain semi-analytical approach
This class has some useful methods that will help plotting output for different panel groups within the multi-domain and so forth.
For more details about the theory involved, see Castro and Donadon (2017) [castro2017Multidomain] .
- Parameters:
- panelsiterable
A list, tuple etc of
Shell
objects.- conndict
A connectivity dictionary.
Methods
calc_damaged_stiffness
(dmg_index, k_i)Calculate the reduced stiffness given the damage index
calc_kC
([conn, c, silent, finalize, inc])Calculate the constitutive stiffness matrix of the assembly --- this is kP (made by diagonally assemblying kP_i from the MD paper)
calc_kG
([c, silent, finalize])Calculate the geometric stiffness matrix of the assembly
calc_k_dmg
(c, pA, pB, nr_x_gauss, ...[, ...])Calculate the damaged k_tsl and the damage index
calc_results
(c[, group, vec, gridx, gridy, ...])Contour plot for a Ritz constants vector.
calc_separation
(res_pan_top, res_pan_bot)Calculates the separation between two panels
calc_traction_stiffness
(kw_tsl, ...)Calculates traction for the approach where SB_TSL connection is used
force
(c, group, eval_panel[, x_cte_force, ...])Calculate the force along a line (xcte or ycte)
get_kC_conn
([conn, finalize, c, kw_tsl])Stiffness matrix due to the multidomain connectivities
get_size
()Size of K of a single panel
plot
([c, group, invert_y, vec, filename, ...])Contour plot for a Ritz constants vector.
strain
(c, group[, gridx, gridy, NLterms, ...])Calculate the strain field
stress
(c, group[, gridx, gridy, NLterms, ...])Calculate the stress field
update_TSL_history
(curr_max_dmg_index)Used to update the maximum del_d (over all loading histories) - this prevents exisiting damage from vanishing when the updated separation predicts there is less separation than what was present earlier (as badly modelled self-healing materials aren't part of this thesis :) )
uvw
(c, group[, gridx, gridy, nr_x_gauss, ...])Calculate the displacement field
calc_fext
calc_fint
calc_kM
calc_kT
force_out_plane
force_out_plane_damage
Notes
Concerning the conn dictionary, the key ‘func’ stands for the connection function that builds the compatibility relations between the panels.
- The connections functions available are:
‘SSycte’ : defines a skin-skin connection for const x and calls the following functions
fkCSSycte11
,fkCSSycte12
,fkCSSycte22
‘SSxcte’ : defines a skin-skin connection for const y and calls the following functions
fkCSSxcte11
,fkCSSxcte12
,fkCSSxcte22
‘SB’ : defines a skin-base connection and calls the following functions
fkCBFycte11
,fkCBFycte12
,fkCBFycte22
‘BFycte’: defines a base-flange connection and calls the following functions
fkCBFycte11
,fkCBFycte12
,fkCBFycte22
Explanations about the connetion functions are found in
connections
module.Examples
>>> panel_1 = Shell(*args) >>> panel_2 = Shell(*args) >>> panel_3 = Shell(*args) >>> panels = [panel_1, panel_2] >>> conn = [ dict(p1=panel_1, p2=panel_2, func='SSxcte', xcte1=0, xcte2=panel_2.a), dict(p1=panel_2, p2=panel_3, func='SSycte', ycte1=0, ycte2=panel_3.b) ] # A list of dictionary that indicates two connections: (panel_1-panel_2) and (panel_2-panel_3)
xcte1 = location (x const) in panel 1 which connects to panel 2 xcte2 = ……………………… 2 ………………….. 2
>>> md = MultiDomain(panels, conn)
Point or distributed forces or displacements can be easily added by using one of the methods:
With this, calculating the stiffness matrix, external force vector and solving the systems becomes straightforward:
>>> kC = md.calc_kC() >>> fext = md.calc_fext()
Solving with the Python module
structsolve
:>>> from structsolve import static >>> >>> incs, cs = static(k0, fext, silent=True)
And plotting the results for the group named
'skin'
.>>> md.plot(cs[0], 'skin', filename='tmp_cylinder_compression_lb_Nxx_cte.png')
The group name attribute belongs to each domain, and is passed while instantiating the :class:
.Shell
object. Furthermore, it is important to pass the correct relative position of each domain within the group for generating consistent plots. For examples on how to create complex multidomains, seecreate_cylinder()
andcreate_cylinder_blade_stiffened()
.- calc_damaged_stiffness(dmg_index, k_i)#
Calculate the reduced stiffness given the damage index
- Parameters:
- dmg_indexTYPE
DESCRIPTION.
- k_iTYPE, optional
DESCRIPTION. The default is None.
- Returns:
- None.
- calc_kC(conn=None, c=None, silent=True, finalize=True, inc=1.0)#
Calculate the constitutive stiffness matrix of the assembly — this is kP (made by diagonally assemblying kP_i from the MD paper)
- Parameters:
- conndict, optional
A connectivity dictionary. Optional if already defined for the assembly.
- 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.
- 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.- incfloat, optional
Dummy argument needed for non-linear analyses.
- calc_kG(c=None, silent=False, finalize=True)#
Calculate the geometric stiffness matrix of the assembly
- Parameters:
- 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.
- 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.
- calc_k_dmg(c, pA, pB, nr_x_gauss, nr_y_gauss, tsl_type, prev_max_dmg_index, k_i=None, tau_o=None, G1c=None)#
Calculate the damaged k_tsl and the damage index
- Input:
prev_max_dmg_index = Max damage index per integration point for the previous converged NR iteration
- NOTE: Currently this only works for 1 contact region bec of the way del_d is being stored in the
MD object. To ensure that it works for multiple connected domamins, it needs to be stored with the shell object instead and modify the rest accordingly
- calc_results(c, group=None, vec='w', gridx=50, gridy=50, nr_x_gauss=None, nr_y_gauss=None, eval_panel=None, x_cte_force=None, y_cte_force=None)#
Contour plot for a Ritz constants vector.
- Parameters:
- cnp.ndarray
The Ritz constants that will be used to compute the field contour.
- groupstr
A group to plot. Each panel in
panels
should contain an attributegroup
, which is used to identify which entities should be plotted together.- vecstr, optional
Variable that needs to be calculated 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'
- 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.
- use_gauss_pointsbool, optional
Uses the gauss integration points (x_gauss and y_gauss) to evaluate the fields
- nr_x_gauss, nr_y_gaussArray
Number of gauss sampling points along x and y respectively where the displacement field is to be calculated Either one of nr_x_gauss and nr_y_gauss needs to be specified or both When specified, stress_gauss_points and strain_gauss points are called instead
- eval_panelShell object
Used to evaluate results for a single panel (that is passed) instead of an entire group of panels
- x_cte_force or y_cte_forcefloat
Constant \(x\) or \(y\) coordinate of a line at which the force is to be calculated. Coordinates are relative to specific panel, i.e. \(0 \le x \le a\), \(0 \le y \le b\).
- calc_separation(res_pan_top, res_pan_bot)#
Calculates the separation between two panels
- INPUT ARGUMENTS:
res_pan_A,B
!!!!!! PANEL TOP NEEDS TO BE THE ONE ON THE TOP !!!!!!!
- calc_traction_stiffness(kw_tsl, corrected_max_del_d)#
Calculates traction for the approach where SB_TSL connection is used
- force(c, group, eval_panel, x_cte_force=None, y_cte_force=None, gridx=50, gridy=50, NLterms=True, nr_x_gauss=None, nr_y_gauss=None)#
Calculate the force along a line (xcte or ycte)
- Parameters:
- cfloat
The full set of Ritz constants
- groupstr
- Dummy variable in this function - just used to avoid changing the stress
function when results for a single panel need to be evaluated
- A group to plot. Each panel in
panels
should contain an attribute
group
, which is used to identify which entities should be plotted together.
- eval_panelShell object
Used to evaluate results for a single panel (that is passed) instead of an entire group of panels
- x_cte_force or y_cte_forcefloat
Constant \(x\) or \(y\) coordinate of a line at which the force is to be calculated. Coordinates are relative to specific panel, i.e. \(0 \le x \le a\), \(0 \le y \le b\).
- 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.
- NLtermsbool
Flag to indicate whether non-linear strain components should be considered.
- nr_x_gauss, nr_y_gaussint
Number of gauss sampling points along \(x\) and \(y\), respectively. The displacement field is to be calculated along either one of
nr_x_gauss
ornr_y_gauss
.
- Returns:
- outdict
A dict containing many
np.ndarrays
, with the keys:(Fxx, Fyy, Fxy)
.
- get_kC_conn(conn=None, finalize=True, c=None, kw_tsl=None)#
Stiffness matrix due to the multidomain connectivities
These are based on penalty stiffnesses, as detailed in Castro and Donadon (2017) [castro2017Multidomain] .
- conn = List of dicts
Each elem of the list = dict for a single connection pair Each dict contains info of that specific with connection pair
Example: conn = [dict(p1=top1, p2=top2, func=’SSxcte’, xcte1=top1.a, xcte2=0)]
- For func, possible options are:
‘SSxcte’ and ‘SSycte’ = between 2 skins along an edge ‘BFxcte’ and ‘BFycte’ = between stiffener base and flange ‘SB’ = btwn 2 skins connected over an area ‘SB_TSL’ = btwn 2 skins connected over an area with a TSL introduced
at the interface
- Required param:
tsl_type, nr_x_gauss, nr_x_gauss
- get_size()#
Size of K of a single panel
- plot(c=None, group=None, invert_y=False, vec='w', filename='', ax=None, figsize=(3.5, 2.0), save=True, title='', identify=False, show_boundaries=False, boundary_line='--k', boundary_linewidth=1.0, colorbar=False, cbar_nticks=10, cbar_format=None, cbar_title='', cbar_fontsize=7, colormap='jet', aspect='equal', clean=True, dpi=400, texts=[], xs=None, ys=None, gridx=50, gridy=50, num_levels=400, vecmin=None, vecmax=None, nr_x_gauss=None, nr_y_gauss=None, res=None, silent=True, display_zero=False, flip_plot=False, eval_panel=None)#
Contour plot for a Ritz constants vector.
- Parameters:
- cnp.ndarray or None
The Ritz constants that will be used to compute the field contour.
- groupstr or None
A group to plot. Each panel in
panels
should contain an attributegroup
, which is used to identify which entities should be plotted together.- 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'
- 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
Shell
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 a title is added to the contour plot.
- indentifybool, optional
If domains should be identified. If yes, the name of each panel is used.
- show_boundariesbool, optional
If boundaries between domains should be drawn.
- boundary_linestr, optional
Matplotlib string to define line type and color.
- boundary_linewidthfloat, optional
Matplotlib float to define line width.
- 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 isNone
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.
- calc_data_onlybool, optional
If only calculated data should be returned.
- nr_x_gauss, nr_y_gaussint
Number of gauss sampling points along x and y respectively where the displacement field is to be calculated Either one of nr_x_gauss and nr_y_gauss needs to be specified or both When specified, uvw_gauss_points, stress_gauss_points and strain_gauss points are called instead
- calc_res_field_onlybool, optional
Only calcuates the result fields and returns it back
- reswhatever data the stress, strain and uvw functions output, optional
Contains the results of a previous run. If results already exist, then they’re not computed again
- silentbool, optional
True = doesnt print any messages
- display_zerobool, optional
Decides whether 0 should be displayed as a tick in the colour bar or not
- flip_plotbool, optional
Flips plot so that x axis is now horizontal
- Returns:
- axmatplotlib.axes.Axes
The Matplotlib object that can be used to modify the current plot if needed.
- datadict
Data calculated during the plotting procedure.
- strain(c, group, gridx=50, gridy=50, NLterms=True, nr_x_gauss=None, nr_y_gauss=None, eval_panel=None)#
Calculate the strain field
The strain field consists of in-plane strains (\(\varepsilon_{xx}\), \(\varepsilon_{yy}\), \(\gamma_{xy}\)) and curvatures (\(\kappa_{xx}\), \(\kappa_{yy}\), \(\kappa_{xy}\)) at each point over the grid of interest. The size of the grid is defined using
gridx
andgridy
. In the multidomain assembly, each domain will have a corresponding grid defined by this amount of points.- Parameters:
- cfloat
The full set of Ritz constants
- groupstr
A group to plot. Each panel in
panels
should contain an attributegroup
, which is used to identify which entities that should be plotted together.- gridxint, optional
Number of points along the \(x\) axis, where the strain field is calculated.
- gridyint, optional
Number of points along the \(y\) axis, where the strain field is calculated.
- NLtermsbool
Flag to indicate whether non-linear strain components should be considered.
- nr_x_gauss, nr_y_gaussint
Number of gauss sampling points along x and y respectively where the field is to be calculated. Either one of
nr_x_gauss
ornr_y_gauss
needs to be specified, or both. They can be different.- eval_panelShell object
Used to evaluate results for a single panel (that is passed) instead of an entire group of panels.
- Returns:
- outdict
A dictionary of
np.ndarrays
with the keys:(x, y, exx, eyy, gxy, kxx, kyy, kxy)
. Each has the shape: (no_panels_in_group) x gridx x gridy
- stress(c, group, gridx=50, gridy=50, NLterms=True, nr_x_gauss=None, nr_y_gauss=None, eval_panel=None, x_cte_force=None, y_cte_force=None)#
Calculate the stress field
The stress field consists of in-plane distributed forces (Nxx, Nyy, Nxy) and distributed moments (Mxx, Myy, Mxy) at each point over the grid of interest. The size of the grid is defined using
gridx
andgridy
. In the multidomain assembly, each domain will have a corresponding grid defined by this amount of points.- Parameters:
- cfloat
The full set of Ritz constants
- groupstr
A group to plot. Each panel in
panels
should contain an attributegroup
, which is used to identify which entities should be plotted together.- 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.
- NLtermsbool
Flag to indicate whether non-linear strain components should be considered.
- nr_x_gauss, nr_y_gaussint
Number of gauss sampling points along x and y respectively where the displacement field is to be calculated Either one of nr_x_gauss and nr_y_gauss needs to be specified or both Both can be different
- eval_panelShell object
Used to evaluate results for a single panel (that is passed) instead of an entire group of panels
- Returns:
- outdict
A dict containing many
np.ndarrays
, with the keys:(x, y, Nxx, Nyy, Nxy, Mxx, Myy, Mxy)
.
- update_TSL_history(curr_max_dmg_index)#
Used to update the maximum del_d (over all loading histories) - this prevents exisiting damage from vanishing when the updated separation predicts there is less separation than what was present earlier (as badly modelled self-healing materials aren’t part of this thesis :) )
- uvw(c, group, gridx=50, gridy=50, nr_x_gauss=None, nr_y_gauss=None, eval_panel=None)#
Calculate the displacement field
For a given full set of Ritz constants
c
, the displacement field is calculated and stored in the parametersu
,v
,w
,phix
,phiy
of theShell
object.- Parameters:
- cfloat
The full set of Ritz constants
- groupstr
A group to plot. Each panel in
panels
should contain an attributegroup
, which is used to identify which entities should be plotted together.- 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.
- nr_x_gauss, nr_y_gaussint
Number of gauss sampling points along x and y respectively where the displacement field is to be calculated Either one of nr_x_gauss and nr_y_gauss needs to be specified or both Both can be different
- eval_panelShell object
Used to evaluate results for a single panel (that is passed) instead of an entire group of panels
- Returns:
- outtuple
A tuple of
np.ndarrays
containing(xs, ys, u, v, w, phix, phiy)
.
Notes
The returned values
u`
,v
,w
,phix
,phiy
are stored as parameters with the same name in theShell
object.