Getting Started

Using LamAna with Jupyter (recommended)

LamAna was developed with visualization in mind.

LamAna works best with the Jupter Notebook 4.0+. The Jupyter Notebook is a powerful, browswer-based analytical tool that integrates with many computer languages and runs computations in separate cells . We use Jupyter and Python to make plots using a matplotlib backend.

The user starts by importing the desired Feature module, e.g. distributions, to plot stress or strain distributions.

Using LamAna from Commandline

If visualization is not important to you, you can alternatively run calcuations and export data from the commandline.

Important

As of lamana 0.4.9, the Jupyter notebook is not an official dependency and does not install automatically. Rather notebook is only frozen in the requirements.txt file. To install run conda install notebook.

Note

User inputs are handled through Feature modules that access the input_ module using the apply() method. Indirect access to lamana.input_ was decided because importing input_ first and then accessing a Feature module was cumbersome and awkward for the user. To reduce boilerpoint, the specific Feature module became the frontend while the input transactions were delegated as the backend.

We will now explore how the user can input data and generate plots using the distributions module.

User Setup

First we must input loading parameters and material properties. Secondly, we must invoke a selected laminate theory. The former requires knowlege of the specimen dimensions, the materials properties and loading configuration. For illustration, an schematic of laminate loading parameters is provided below.

Loading Parameters

Loading Parameters

A table is provided defining the illustrated parameters. These loading parameters are coded in a Python dictionary called load_params.

Parameter Units (SI) Definition
P N applied load
R m specimen radius
a m support radius
b m piston radius
r m radial distance from central loading
p
graphical points or DataFrame rows per layer

User Defined Parameters

Sample code is provided for setting up geometric dimensions, loading parameters and material properties.

In [3]:
# SETUP -----------------------------------------------------------------------

import lamana as la

# For plotting in Jupyter
%matplotlib inline

# Build dicts for loading parameters and material properties
load_params = {
    'P_a': 1,                                              # applied load
    'R': 12e-3,                                            # specimen radius
    'a': 7.5e-3,                                           # support radius
    'p': 4,                                                # points/layer
    'r': 2e-4,                                             # radial distance from center loading
}

mat_props = {
    'HA': [5.2e10, 0.25],                                  # modulus, Poissions
    'PSu': [2.7e9, 0.33],
}

# Build a list of geometry strings.
# Layer convention: 'outer - [{inner...-...}_i] - middle'
geos1 = ['400-400-400', '400-200-800', '400-350-500']      # eq. total thickness
geos2 = ['400-[400]-400', '400-[200,100]-800']             # eq. outer thickness
#------------------------------------------------------------------------------

Generate Data in 3 Lines

With the loading and material information, we can make stress distribution plots to define (reusable) test cases by implementing 3 simple steps.

  1. Instantiate a Feature object with loading and material parameters. This makes a user Case object.
  2. apply() a laminate theory model
  3. plot() the Case object

Within seconds, you can now build a case and simultaneiously plot stress distributions for an indefinite number of laminates that vary in compostion and dimension.

In [4]:
case1 = la.distributions.Case(load_params, mat_props)      # instantiate
case1.apply(geos1, model='Wilson_LT')                      # apply
case1.plot()                                               # plot
Converting mat_props to Standard Form.
User input geometries have been converted and set to Case.
_images/gettingstarted_6_1.png

Other Attributes

A case stores all of the laminate data for a particular set of parameters in two forms: a Python dictionary and a `pandas <http://pandas.pydata.org/>`__ DataFrame (see tutorial for details). Once a case is built, there are serveral covenient builtin attributes for accessing this data for further analysis and plotting them as `matplotlib <http://matplotlib.org/>`__ plots. These tools are powerful and open source.

# Case Attributes
case.geometries                                            # geometry object
case.total                                                 # total laminate thickness (all)
case.inner                                                 # layer thickness (all)
case.total_inner                                           # total layer type (all)
case.total_inner[0]                                        # slicing
case.total_inner_i                                         # total inner layers
case1.snapshot                                             # list of all geometry stacks (unique layers)
case1.frames                                               # list all DataFrames (all layers)

Extensibile

LamAna is extensible. Users can define custom or modified models based on laminate theory and apply these models to cases (see the Theories section for more details).

We can perform sepearate analyses by building different cases and applying different models (default model: “Wilson_LT” for circular disks in biaxial flexure).

# Classical Laminate Theory
case2 = la.distributions(load_params, mat_props)           # instantiate
case2.apply(geos2, model='Classic_LT')                     # apply model
case2.plot()

# Custom Biaxial Flexure Model
case3 = la.distributions(load_params, mat_props)           # instantiate
case3.apply(geos2, model='Wilson_LT')                      # custom model
case3.plot()