pymecht.SampleExperiment module
- class pymecht.SampleExperiment.SampleExperiment(mat_model, disp_measure, force_measure)[source]
Bases:
objectAn abstract class, which defines the sample geometry and experimental conditions. It also defines the coordinate system to be used.
- disp_controlled(inp, params=None)[source]
Simulates the experiment with the deformation measure as the input
- Parameters:
inp (scalar, list, or numpy array) – The input to the experiment. It can be a scalar, a list, or a numpy array
params (ParamDict or dict) – A dictionary of parameters. If None, the default parameters are used. The default is None.
- Returns:
The resulting force measure. It is a scalar if the input is a scalar, a list if the input is a list, and a numpy array if the input is a numpy array.
- Return type:
scalar, list, or numpy array
- force_controlled(forces, params=None, x0=None)[source]
Simulates the experiment with the force measure as the input (solves via Newton iteration)
- Parameters:
forces (scalar, list, or numpy array) – The input to the experiment. It can be a scalar, a list, or a numpy array
params (ParamDict or dict) – A dictionary of parameters. If None, the default parameters are used. The default is None.
x0 (scalar or numpy array) – The initial guess for the displacement. If None, the default is used. The default is None.
- Returns:
The resulting deformation measure. It is a scalar if the input is a scalar, a list if the input is a list, and a numpy array if the input is a numpy array.
- Return type:
scalar, list, or numpy array
- property parameters
Parameters of the sample and the material model(s) constituting it, as a ParamDict
- class pymecht.SampleExperiment.LinearSpring(mat_model=<class 'pymecht.MatModel.MatModel'>, disp_measure='stretch', force_measure='force')[source]
Bases:
SampleExperimentFor simulating a linear spring (can be used to apply Robin boundary condition)
Parameter
Description (default)
L0
Length of spring (1)
k0
Stiffness (1)
f0
Force (0)
A0
Cross-section area (1)
- Parameters:
mat_model (MatModel) – A material model object of type MatModel (not used), default MatModel()
disp_measure (str) –
The measure of displacement with the following options:
’stretch’ : Ratio of deformed to reference length (default)
’deltal’ : Change in length or radius
’length’ or ‘radius’ : Deformed length/radius
force_measure (str) –
The measure of force with the following options:
’force’ : Force acting on the spring (default)
’stress’ : The Cauchy stress
’pressure’ : The pressure
- class pymecht.SampleExperiment.UniaxialExtension(mat_model, disp_measure='stretch', force_measure='cauchy')[source]
Bases:
SampleExperimentFor simulating uniaxial extension of a sample
Parameter
Description (default)
L0
Length of sample (1)
A0
Cross-section area (1)
- Parameters:
mat_model (MatModel) – A material model object of type MatModel
disp_measure (str) –
The measure of displacement with the following options:
’stretch’ : The stretch ratio (default)
’strain’ : The Green-Lagrange strain
’deltal’ : The change in length
’length’ : The length
force_measure (str) –
The measure of force with the following options:
’force’ : The force per unit area
’cauchy’ : The Cauchy stress (default)
’1pk’ or ‘1stpk’ or ‘firstpk’ : The first Piola-Kirchhoff stress
’2pk’ or ‘2ndpk’ or ‘secondpk’ : The second Piola-Kirchhoff stress
- class pymecht.SampleExperiment.PlanarBiaxialExtension(mat_model, disp_measure='stretch', force_measure='cauchy')[source]
Bases:
SampleExperimentFor simulating planar biaxial extension of a planar sample
Parameter
Description (default)
L10
Ref length: 1st axis (1)
L20
Ref length: 2nd axis (1)
thick
Sample thicknesse (1)
- Parameters:
mat_model (MatModel) – A material model object of type MatModel
disp_measure (str) –
The measure of displacement with the following options:
’stretch’ : The stretch ratio (default)
’strain’ : The Green-Lagrange strain
’deltal’ : The change in length
’length’ : The length
force_measure (str) –
The measure of force with the following options:
’force’ : The force per unit area
’tension’ : The force per unit thickness
’cauchy’ : The Cauchy stress (default)
’1pk’ or ‘1stpk’ or ‘firstpk’ : The first Piola-Kirchhoff stress
’2pk’ or ‘2ndpk’ or ‘secondpk’ : The second Piola-Kirchhoff stress
- class pymecht.SampleExperiment.TubeInflation(mat_model, disp_measure='radius', force_measure='pressure')[source]
Bases:
SampleExperimentFor simulating uniform axisymmetric inflation of a tube
Parameter
Description (default)
Ri
Internal radius (1)
thick
Thickness (0.1)
omega
Opening angle (radians) (0)
L0
Length of sample (1)
lambdaZ
Longitudinal stretch (1)
- Parameters:
mat_model (MatModel) – A material model object of type MatModel
disp_measure (str) –
The measure of displacement with the following options:
’stretch’ : Ratio of deformed to reference internal radius
’deltar’ : Change in internal radius
’radius’ : Deformed internal radius (default)
’area’ : Deformed internal area
force_measure (str) –
The measure of force with the following options:
’force’ : Total force acting on the tube length
’pressure’ : Internal pressure acting on the tube (default)
- disp_controlled(inp, params=None)[source]
Simulates the experiment with the deformation measure as the input
- Parameters:
inp (scalar, list, or numpy array) – The input to the experiment. It can be a scalar, a list, or a numpy array
params (ParamDict or dict) – A dictionary of parameters. If None, the default parameters are used. The default is None.
- Returns:
The resulting force measure. It is a scalar if the input is a scalar, a list if the input is a list, and a numpy array if the input is a numpy array.
- Return type:
scalar, list, or numpy array
- outer_radius(inp, params)[source]
Computes the outer radius of the tube at the given deformed state
- Parameters:
inp (scalar, list, or numpy array) – Deformation measure at which the outer radius is to be computed
params (ParamDict or dict) – The parameters of the material model
- Returns:
The outer radius of the tube
- Return type:
scalar
- cauchy_stress(inp, params=None, n=10, pressure=None)[source]
Computes the Cauchy stress at the given inp points
- Parameters:
inp (scalar) – Deformation measure at which the stress is to be computed, scalar
params (ParamDict or dict) – A dictionary of parameters. If None, the default parameters are used. The default is None.
n (int) – The number of points along the thickness to report stresses at, default is 10
pressure (scalar) – The pressure corresponding to the deformed radius (optional: if not provided, it will be computed)
- Returns:
xi : Normalized thickness values at which the stresses are reported (n points)
Stresses : The Cauchy stress tensors at the thickness locations (nX3X3 array)
- Return type:
tuple (xi,Stresses)
- class pymecht.SampleExperiment.LayeredSamples(*samplesList)[source]
Bases:
objectAn abstract class that allows building samples with layers
- property parameters
Parameters of the layered sample and the material model(s) constituting each layer, as a ParamDict
- disp_controlled(inp, params=None)[source]
Simulates the experiment with the deformation measure as the input
- Parameters:
inp (scalar, list, or numpy array) – The input to the experiment. It can be a scalar, a list, or a numpy array
params (ParamDict or dict) – A dictionary of parameters. If None, the default parameters are used. The default is None.
- Returns:
The resulting force measure. It is a scalar if the input is a scalar, a list if the input is a list, and a numpy array if the input is a numpy array.
- Return type:
scalar, list, or numpy array
- force_controlled(forces, params=None, x0=None)[source]
Simulates the experiment with the force measure as the input (solves via Newton iteration)
- Parameters:
forces (scalar, list, or numpy array) – The input to the experiment. It can be a scalar, a list, or a numpy array
params (ParamDict or dict) – A dictionary of parameters. If None, the default parameters are used. The default is None.
x0 (scalar or numpy array) – The initial guess for the displacement. If None, the default is used. The default is None.
- Returns:
The resulting deformation measure. It is a scalar if the input is a scalar, a list if the input is a list, and a numpy array if the input is a numpy array.
- Return type:
scalar, list, or numpy array
- class pymecht.SampleExperiment.LayeredUniaxial(*samplesList)[source]
Bases:
LayeredSamplesA class for building layered uniaxial samples
- Parameters:
*samplesList (list of UniaxialExtension) – Any number of UniaxialExtension objects constituting the layers
Examples
>>> import pymecht as pmt >>> mat_model = pmt.MatModel('nh') >>> s1 = pmt.UniaxialExtension(mat_model) >>> s2 = pmt.UniaxialExtension(mat_model) >>> s3 = pmt.UniaxialExtension(mat_model) >>> layered_sample = pmt.LayeredUniaxial(s1,s2,s3)
- class pymecht.SampleExperiment.LayeredPlanarBiaxial(*samplesList)[source]
Bases:
LayeredSamplesA class for building layered biaxial samples
- Parameters:
*samplesList (list of PlanarBiaxialExtension) – Any number of PlanarBiaxialExtension objects constituting the layers
Examples
>>> import pymecht as pmt >>> mat_model = pmt.MatModel('nh') >>> s1 = pmt.PlanarBiaxialExtension(mat_model) >>> s2 = pmt.PlanarBiaxialExtension(mat_model) >>> s3 = pmt.PlanarBiaxialExtension(mat_model) >>> layered_sample = pmt.LayeredPlanarBiaxial(s1,s2,s3)
- class pymecht.SampleExperiment.LayeredTube(*samplesList)[source]
Bases:
LayeredSamplesA class for building layered tube samples
- Parameters:
*samplesList (list of TubeInflation) – Any number of TubeInflation objects constituting the layers
Examples
>>> import pymecht as pmt >>> mat_model = pmt.MatModel('nh') >>> s1 = pmt.TubeInflation(mat_model) >>> s2 = pmt.TubeInflation(mat_model) >>> s3 = pmt.TubeInflation(mat_model) >>> layered_sample = pmt.LayeredPlanarBiaxial(s1,s2,s3)
- disp_controlled(inp, params=None)[source]
Simulates the experiment with the deformation measure as the input
- Parameters:
inp (scalar, list, or numpy array) – The input to the experiment. It can be a scalar, a list, or a numpy array
params (ParamDict or dict) – A dictionary of parameters. If None, the default parameters are used. The default is None.
- Returns:
The resulting force measure. It is a scalar if the input is a scalar, a list if the input is a list, and a numpy array if the input is a numpy array.
- Return type:
scalar, list, or numpy array
- cauchy_stress(inp, params=None, n=10)[source]
Computes the Cauchy stress at the given inp points
- Parameters:
inp (scalar, list, or numpy array) – Deformation measure at which the stress is to be computed, scalar
params (ParamDict or dict) – The parameters of the material model
n (int) – The number of points along the thickness (of each layer) to report stresses at, default is 10
- Returns:
xi : Normalized thickness values at which the stresses are reported (n points)
Stresses : The Cauchy stress tensors at the thickness locations ((nXnlayers)X3X3 array)
- Return type:
tuple (xi,Stresses)
- pymecht.SampleExperiment.specify_single_fiber(sample, angle=0, degrees=True, verbose=True)[source]
Assign single fiber direction to all materials in a sample
- Parameters:
sample (SampleExperiment) – The sample to which fiber directions need to be assigned
angle (float or Param) –
The angle of the fiber direction, default 0
- for UniaxialExtension or PlanarBiaxialExtension
with respect to the x-axis and in the xy plane
- for TubeInflation
with respect to the theta-axis and in the theta-z plane
degrees (bool) – If True, the angle is asssumed to be in degrees. If False, it is assumed to be in radians; default True
verbose (bool) – If True, the function prints the angle after assigning, default True
- pymecht.SampleExperiment.specify_two_fibers(sample, angle, degrees=True, verbose=True)[source]
Assign two symmetric fiber directions to all materials in a sample
- Parameters:
sample (SampleExperiment) – The sample to which fiber directions need to be assigned
angle (float or Param) –
The angle of the fiber directions (assigned as \(\pm\) angle)
- for UniaxialExtension or PlanarBiaxialExtension
with respect to the x-axis and in the xy plane
- for TubeInflation
with respect to the theta-axis and in the theta-z plane
degrees (bool) – If True, the angle is asssumed to be in degrees. If False, it is assumed to be in radians; default True
verbose (bool) – If True, the function prints the angle after assigning, default True