model
ExperimentsType
module-attribute
ExperimentsType = Union[
Experiment, List[Experiment], Dict[str, Experiment], str, List[str]
]
CalibrationModel
Bases: IOModel
Calibration manager for the micromechanical model.
calibrate
calibrate(
x0: Dict[str | CalibrationKey, float] | None = None,
*,
experiments: ExperimentsType | None = None,
includes: List[str | CalibrationKey] | None = None,
include_additions: List[str | CalibrationKey] | None = None,
excludes: List[str | CalibrationKey] | None = None,
experiment_specific_parameters: List[str] | None = None,
lognormal_parameters: List[str | CalibrationKey] = None,
fitness: Union["FitnessBase", Type["FitnessBase"], str, None] = None,
phase_steps: Dict[str, int] | None = None,
experiment_options: Dict[str, Dict[str, Any]] | None = None,
experiment_weights: Dict[str, float] = None,
experiment_includes: List[str] | None = None,
experiment_excludes: List[str] | None = None,
line_additions: Dict[str, Tuple[str, str]] = None,
line_experiment_additions: (
Dict[str, Dict[str, Tuple[str, str]]] | None
) = None,
line_weights: Dict[str, float] = None,
line_experiment_weights: Dict[str, Dict[str, float]] | None = None,
line_includes: List[str] | None = None,
line_experiment_includes: Dict[str, List[str]] | None = None,
line_excludes: List[str] | None = None,
line_experiment_excludes: Dict[str, List[str]] | None = None,
line_xptps: Dict[str, float] | None = None,
line_experiment_xptps: Dict[str, Dict[str, float]] | None = None,
line_yptps: Dict[str, float] | None = None,
line_experiment_yptps: Dict[str, Dict[str, float]] | None = None,
line_override_xydata: (
Dict[str, Tuple[List[float], List[float]]] | None
) = None,
line_experiment_override_xydata: (
Dict[str, Dict[str, Tuple[List[float], List[float]]]] | None
) = None,
line_ensure_increasing_xdata: List[str] | None = None,
line_experiment_ensure_increasing_xdata: Dict[str, List[str]] | None = None,
line_clip_state_variables: Dict[str, Tuple[float, float]] | None = None,
line_experiment_clip_state_variables: (
Dict[str, Dict[str, Tuple[float, float]]] | None
) = None,
error_fitness: float = 10000000000.0,
similarity_method: Literal[
"interpolate", "pcm", "area", "frechet-dist", "curve-length", "dtw"
] = "interpolate",
data_get_kwargs: Dict[str, Any] | None = None,
check_smoothness: bool = False,
smoothness_threshold: float = 0.05,
method: str = "PYCMA-CMAES",
bounds: Dict[str | CalibrationKey, Tuple[float, float]] | None = None,
stds: Dict[str | CalibrationKey, float] | None = None,
save_to: str | None = None,
save_to_kwargs: Dict | None = None,
**kwargs
) -> Tuple[Dict[str, float], OptimizerResult]
Calibrate the model parameters to the experiments.
PARAMETER | DESCRIPTION |
---|---|
x0
|
Initial guess for the parameters
TYPE:
|
experiments
|
Experiments to evaluate the fitness, by default None which means all experiments in the manager
TYPE:
|
includes
|
Parameters to include in the calibration, by default None which means all parameters
TYPE:
|
include_additions
|
Additional parameters to include in the calibration, by default None
TYPE:
|
excludes
|
Parameters to exclude from the calibration, by default None
TYPE:
|
experiment_specific_parameters
|
Optimization parameters that are specific to each experiment, by default None |
lognormal_parameters
|
Parameters to be distributed in the lognormal space
TYPE:
|
fitness
|
Custom fitness object or class or the full name of the class, by default None
TYPE:
|
phase_steps
|
Override the number of steps for each load phase, by default None |
experiment_options
|
Override the options for each experiment, by default None |
experiment_weights
|
Weights for the experiments, by default None |
experiment_includes
|
Experiments to include in the calibration, by default None |
experiment_excludes
|
Experiments to exclude in the calibration, by default None |
line_additions
|
Additional lines that can be expressions of the existing lines, by default None |
line_experiment_additions
|
Additional lines for each experiment, by default None |
line_weights
|
Weights for the lines, by default None |
line_experiment_weights
|
Weights for the lines for each experiment, by default None |
line_to
|
Lines to to include in the calibration, by default None
|
line_experiment_to
|
Lines to to include for each experiment, by default None
|
line_excludes
|
Lines to exclude in the calibration, by default None |
line_experiment_excludes
|
Lines to exclude for each experiment, by default None |
line_xptps
|
Point-to-point x-axis distances for the lines, by default None |
line_experiment_xptps
|
Point-to-point x-axis distances for the lines for each experiment, by default None |
line_yptps
|
Point-to-point y-axis distances for the lines, by default None |
line_experiment_yptps
|
Point-to-point y-axis distances for the lines for each experiment, by default None |
line_override_xydata
|
Override the experiment data, by default None
TYPE:
|
line_experiment_override_xydata
|
Override the experiment data for each experiment, by default None
TYPE:
|
line_ensure_increasing_xdata
|
Ensure xdata is increasing by reconstructing the data with positive differences between every two points, by default None |
line_experiment_ensure_increasing_xdata
|
Ensure xdata is increasing by reconstructing the data with positive differences between every two points for each experiment, by default None |
line_clip_state_variables
|
Clip the state variables to the given range, by default None |
line_experiment_clip_state_variables
|
Clip the state variables for each experiment to the given range, by default None
TYPE:
|
error_fitness
|
Fitness value to return if the simulation fails, by default 1e10
TYPE:
|
similarity_method
|
Similarity method to use for the fitness calculation, by default "interpolate"
TYPE:
|
data_get_kwargs
|
Keyword arguments for the |
check_smoothness
|
Whether to check if the data is smooth
TYPE:
|
smoothness_threshold
|
Smooth threshold
TYPE:
|
method
|
Optimization method, by default "PYCMA-CMAES"
TYPE:
|
bounds
|
Bounds for the parameters, by default None
TYPE:
|
stds
|
Standard deviations for the parameters, by default None
TYPE:
|
save_to
|
Save the calibration results to a file, by default None
TYPE:
|
save_to_kwargs
|
Extra keyword arguments for the save_to method, by default None
TYPE:
|
kwargs
|
Fitness or optimizer keyword arguments, if the fitness has attributes with the same name, the value will be set to the attribute, and other arguments will be passed to the optimizer
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
Tuple[Dict[str, float], OptimizerResult]
|
Optimized parameters and the optimization result |
fitness
fitness(
x0: Dict[str | CalibrationKey, float] | None = None,
*,
experiments: ExperimentsType | None = None,
fitness: Union["FitnessBase", Type["FitnessBase"], str, None] = None,
phase_steps: Dict[str, int] | None = None,
experiment_options: Dict[str, Dict[str, Any]] | None = None,
experiment_weights: Dict[str, float] = None,
experiment_includes: List[str] | None = None,
experiment_excludes: List[str] | None = None,
line_additions: Dict[str, Tuple[str, str]] = None,
line_experiment_additions: (
Dict[str, Dict[str, Tuple[str, str]]] | None
) = None,
line_weights: Dict[str, float] = None,
line_experiment_weights: Dict[str, Dict[str, float]] | None = None,
line_includes: List[str] | None = None,
line_experiment_includes: Dict[str, List[str]] | None = None,
line_excludes: List[str] | None = None,
line_experiment_excludes: Dict[str, List[str]] | None = None,
line_xptps: Dict[str, float] | None = None,
line_experiment_xptps: Dict[str, Dict[str, float]] | None = None,
line_yptps: Dict[str, float] | None = None,
line_experiment_yptps: Dict[str, Dict[str, float]] | None = None,
line_override_xydata: (
Dict[str, Tuple[List[float], List[float]]] | None
) = None,
line_experiment_override_xydata: (
Dict[str, Dict[str, Tuple[List[float], List[float]]]] | None
) = None,
line_ensure_increasing_xdata: List[str] | None = None,
line_experiment_ensure_increasing_xdata: Dict[str, List[str]] | None = None,
line_clip_state_variables: Dict[str, Tuple[float, float]] | None = None,
line_experiment_clip_state_variables: (
Dict[str, Dict[str, Tuple[float, float]]] | None
) = None,
error_fitness: float = 10000000000.0,
similarity_method: Literal[
"interpolate", "pcm", "area", "frechet-dist", "curve-length", "dtw"
] = "interpolate",
data_get_kwargs: Dict[str, Any] | None = None,
check_smoothness: bool = False,
smoothness_threshold: float = 0.05,
lognormal_parameters: List[str | CalibrationKey] = None,
**kwargs
) -> float
Calculate the fitness of the model to the experiments.
PARAMETER | DESCRIPTION |
---|---|
x0
|
Parameters to set before calculating the fitness, by default None
TYPE:
|
experiments
|
Experiments to evaluate the fitness, by default None which means all experiments in the manager
TYPE:
|
fitness
|
Custom fitness object or class or the full name of the class, by default None
TYPE:
|
phase_steps
|
Override the number of steps for each load phase, by default None |
experiment_options
|
Override the options for each experiment, by default None |
experiment_weights
|
Weights for the experiments, by default None |
experiment_includes
|
Experiments to include in the calibration, by default None |
experiment_excludes
|
Experiments to exclude in the calibration, by default None |
line_additions
|
Additional lines that can be expressions of the existing lines, by default None |
line_experiment_additions
|
Additional lines for each experiment, by default None |
line_weights
|
Weights for the lines, by default None |
line_experiment_weights
|
Weights for the lines for each experiment, by default None |
line_to
|
Lines to to include in the calibration, by default None
|
line_experiment_to
|
Lines to to include for each experiment, by default None
|
line_excludes
|
Lines to exclude in the calibration, by default None |
line_experiment_excludes
|
Lines to exclude for each experiment, by default None |
line_xptps
|
Point-to-point x-axis distances for the lines, by default None |
line_experiment_xptps
|
Point-to-point x-axis distances for the lines for each experiment, by default None |
line_yptps
|
Point-to-point y-axis distances for the lines, by default None |
line_experiment_yptps
|
Point-to-point y-axis distances for the lines for each experiment, by default None |
line_override_xydata
|
Override the experiment data, by default None
TYPE:
|
line_experiment_override_xydata
|
Override the experiment data for each experiment, by default None
TYPE:
|
line_ensure_increasing_xdata
|
Ensure xdata is increasing by reconstructing the data with positive differences between every two points, by default None |
line_experiment_ensure_increasing_xdata
|
Ensure xdata is increasing by reconstructing the data with positive differences between every two points for each experiment, by default None |
line_clip_state_variables
|
Clip the state variables to the given range, by default None |
line_experiment_clip_state_variables
|
Clip the state variables for each experiment to the given range, by default None
TYPE:
|
error_fitness
|
Fitness value to return if the simulation fails, by default 1e10
TYPE:
|
similarity_method
|
Similarity method to use for the fitness calculation, by default "interpolate"
TYPE:
|
data_get_kwargs
|
Keyword arguments for the |
check_smoothness
|
Whether to check if the data is smooth
TYPE:
|
smoothness_threshold
|
Smooth threshold
TYPE:
|
lognormal_parameters
|
Parameters to be distributed in the lognormal space
TYPE:
|
kwargs
|
Additional keyword arguments to pass to the fitness object
DEFAULT:
|
select_parameters
select_parameters(
x0: Dict[str | CalibrationKey, float] | None = None,
*,
includes: List[str | CalibrationKey] | None = None,
include_additions: List[str | CalibrationKey] | None = None,
excludes: List[str | CalibrationKey] | None = None,
experiments: ExperimentsType | None = None,
experiment_specific_parameters: List[str] | None = None,
bounds: Dict[str | CalibrationKey, Tuple[float, float]] | None = None,
stds: Dict[str | CalibrationKey, float] | None = None,
lognormal_parameters: List[str | CalibrationKey] = None
) -> Tuple[List[str | CalibrationKey], Dict, Dict, Dict]
Select the parameters for the calibration.
PARAMETER | DESCRIPTION |
---|---|
x0
|
Initial guess for the parameters
TYPE:
|
experiments
|
Experiments to evaluate the fitness, by default None which means all experiments in the manager
TYPE:
|
includes
|
Parameters to include in the calibration, by default None which means all parameters
TYPE:
|
include_additions
|
Additional parameters to include in the calibration, by default None
TYPE:
|
excludes
|
Parameters to exclude from the calibration, by default None
TYPE:
|
experiment_specific_parameters
|
Optimization parameters that are specific to each experiment, by default None |
bounds
|
Bounds for the parameters, by default None
TYPE:
|
stds
|
Standard deviations for the parameters, by default None
TYPE:
|
lognormal_parameters
|
Parameters to be distributed in the lognormal space
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tuple[List[str | CalibrationKey], Dict, Dict, Dict]
|
The keys, initial values, bounds, and standard deviations of the parameters |
ContactModel
Bases: ModelBase
Contact manager for the micromechanical model.
plotContactYieldSurface
plotContactYieldSurface(
xscale: float = 1.0,
yscale: float = 1.0,
*,
type: Literal["contour", "surface", "trisurf", "wireframe"] = "contour",
experiments: ExperimentsType | None = None,
simulate_experiment_kwargs: dict | None = None,
xmin: float | None = None,
xmax: float | None = None,
xnum: int = 500,
ymin: float | None = None,
ymax: float | None = None,
ynum: int = 500,
relative: bool = False,
no_contours_error: Literal["ignore", "warn", "raise"] = "warn",
plot_force_state: bool = False,
force_state_scatter_kwargs: dict | None = None,
force_state_line_kwargs: dict | None = None,
phase: int | slice | Iterable[int] = slice(None),
step: int | slice | Iterable[int] = slice(None),
idx: int | slice | Iterable[int] = slice(None),
label: str = "Step: {step}, idx: {idx}",
data: SVExporter | YieldFunction | None = None,
data_get_kwargs: Dict[str, Any] | None = None,
on: Plottable | None = None,
same_axes: bool = False,
ncols: int = 2,
backend: Literal["matplotlib", "bokeh"] | str | None = None,
subplots_kwargs: dict | None = None,
line_kwargs: Iterable[Dict[str, Any]] | None = None,
props: Dict[str, Any] | None = None,
bokeh_show: bool = False,
tight_layout: bool = True,
**kwargs
) -> Union["MplFigure", "BkGridPlot"]
Plot yield surface for the contact law.
Notes
The following placeholders are supported for arguments label
, kwargs
, and line_kwargs
:
- material parameters (
model.parameters
) {step}
for the step index{idx}
,{beta}
and{gamma}
for contact variables
PARAMETER | DESCRIPTION |
---|---|
xscale
|
Scale for x-axis, by default 1.0.
TYPE:
|
yscale
|
Scale for y-axis, by default 1.0.
TYPE:
|
type
|
Type of the plot, by default "contour"
TYPE:
|
xmin
|
Minimum x value, by default None which means the minimum value in the data
TYPE:
|
xmax
|
Maximum x value, by default None which means the maximum value in the data
TYPE:
|
xnum
|
Number of x values, by default 500
TYPE:
|
ymin
|
Minimum y value, by default None which means the minimum value in the data
TYPE:
|
ymax
|
Maximum y value, by default None which means the maximum value in the data
TYPE:
|
ynum
|
Number of y values, by default 500
TYPE:
|
relative
|
Whether the minimum and maximum values are relative to the data, by default False
TYPE:
|
no_contours_error
|
Whether to raise an error if no contours are found, by default "warn"
TYPE:
|
plot_force_state
|
Whether to plot the current force state with scatter, by default False
TYPE:
|
force_state_scatter_kwargs
|
Keyword arguments for plotting the force state scatter, by default color and edgecolors are set to the color of the corresponding yield surface
TYPE:
|
force_state_line_kwargs
|
Keyword arguments for plotting the force state line, by default None
TYPE:
|
phase
|
An integer or a slice indicates index of the phase. |
step
|
An integer or a slice indicates index of the step. |
idx
|
An integer or a slice indicates index of the integration point for contact variables. |
label
|
Format string for the label in the legend, by default "Step: {step}, idx: {idx}"
TYPE:
|
data
|
State variables to plot, if not specified, the simulation will be run, by default None
TYPE:
|
data_get_kwargs
|
Extra keyword arguments for the |
on
|
Axes to plot on, by default None
TYPE:
|
same_axes
|
Whether to use the same axes for all lines, by default False
TYPE:
|
ncols
|
Number of columns in the figure grid, by default 2
TYPE:
|
backend
|
Backend to use, by default None which means the backend set in the environment variable
TYPE:
|
subplots_kwargs
|
Keyword arguments for creating the subplots, by default None
TYPE:
|
line_kwargs
|
Line-specific keyword arguments, by default None |
props
|
Properties passed to the |
bokeh_show
|
Whether to show the figure in the browser, by default False
TYPE:
|
tight_layout
|
Whether to use tight layout in the matplotlib figure, by default True
TYPE:
|
kwargs
|
Keyword arguments for
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
Figure | GridPlot
|
The matplotlib figure or bokeh gridplot |
IOModel
Bases: IntegrationModel
, LoadModel
, MaterialModel
, ContactModel
Simulation manager for the micromechanical model.
fromJson
classmethod
Load the model from a JSON file or a JSON string.
fromToml
classmethod
Load the model from a TOML file or a TOML string.
fromYaml
classmethod
Load the model from a YAML file or a YAML string.
IntegrationModel
Bases: ModelBase
Integration manager for the micromechanical model.
argbeta
The indices of the azimuthal angles of the integration points in the y-z plane.
PARAMETER | DESCRIPTION |
---|---|
unit
|
The unit of the angles, by default "deg"
TYPE:
|
lb
|
The lower bound of the angles, by default 0.0
TYPE:
|
ub
|
The upper bound of the angles, by default 180.0
TYPE:
|
arggamma
The indices of the azimuthal angles of the integration points x-axis.
PARAMETER | DESCRIPTION |
---|---|
unit
|
The unit of the angles, by default "deg"
TYPE:
|
lb
|
The lower bound of the angles, by default 0.0
TYPE:
|
ub
|
The upper bound of the angles, by default 180.0
TYPE:
|
beta
beta(
*,
unit: Literal["rad", "deg"] = "deg",
lb: float = 0.0,
ub: float = 180.0,
func: Callable = None
) -> ndarray
The azimuthal angles of the integration points in the y-z plane, an array of shape (n,).
PARAMETER | DESCRIPTION |
---|---|
unit
|
The unit of the angles, by default "deg"
TYPE:
|
lb
|
The lower bound of the angles, by default 0.0
TYPE:
|
ub
|
The upper bound of the angles, by default 180.0
TYPE:
|
func
|
The function to apply to the angles, by default None
TYPE:
|
gamma
gamma(
*,
unit: Literal["rad", "deg"] = "deg",
lb: float = 0.0,
ub: float = 180.0,
func: Callable = None
) -> ndarray
The azimuthal angles of the integration points x-axis, an array of shape (n,).
PARAMETER | DESCRIPTION |
---|---|
unit
|
The unit of the angles, by default "deg"
TYPE:
|
lb
|
The lower bound of the angles, by default 0.0
TYPE:
|
ub
|
The upper bound of the angles, by default 180.0
TYPE:
|
func
|
The function to apply to the angles, by default None
TYPE:
|
indexOf
indexOf(
*,
beta: float | ndarray | Iterable[float] = None,
gamma: float | ndarray | Iterable[float] = None,
beta_apply: Callable = None,
gamma_apply: Callable = None,
union: bool = False,
tol: float = 0.5,
unit: Literal["rad", "deg"] = "deg",
sort: (
Literal["beta", "gamma", "idx"] | List[Literal["beta", "gamma"]]
) = None,
drop_duplicates: bool = False
) -> ndarray
The contact indices for the given beta and gamma.
PARAMETER | DESCRIPTION |
---|---|
beta
|
The angle between the projection of the azimuth on the YZ plane and the Y axis |
gamma
|
The angle between the azimuth and the X axis |
beta_apply
|
The function to apply to the beta angles, by default None
TYPE:
|
gamma_apply
|
The function to apply to the gamma angles, by default None
TYPE:
|
union
|
If true, return the union of beta and gamma indices, else return the intersection, by default False
TYPE:
|
tol
|
The tolerance for the comparison of the angles, by default 0.5
TYPE:
|
unit
|
The unit of the angles, by default "deg"
TYPE:
|
sort
|
Sort the indices by beta, gamma or idx, by default None |
drop_duplicates
|
Drop the duplicated beta and (or) gamma, by default False
TYPE:
|
integrationplot
integrationplot(
*, ax: Union["MplAxes3D", None] = None, **kwargs
) -> "MplAxes3D"
Plot the integration points.
setAnisotropicParameters
setAnisotropicParameters(
type: AvailableFabricTypes = "chang1990-ext",
evolution: AvailableFabricEvolutionTypes = "zhao2020",
coefs: Dict[str, float] = None,
**kwargs
)
Set the anisotropic parameters.
PARAMETER | DESCRIPTION |
---|---|
type
|
The type of the anisotropic parameter.
TYPE:
|
evolution
|
The evolution type of the anisotropic parameter.
TYPE:
|
coefs
|
The coefficients of the anisotropic parameter. |
kwargs
|
More coefficients of the anisotropic parameter.
DEFAULT:
|
setGauss37
setGauss37(full: bool = False)
Set the Gauss37 integration points.
PARAMETER | DESCRIPTION |
---|---|
full
|
Full 37*2 integration points.
TYPE:
|
setGauss61
setGauss61(full: bool = False)
Set the Gauss61 integration points.
PARAMETER | DESCRIPTION |
---|---|
full
|
Full 61*2 integration points.
TYPE:
|
setIntegrationParameters
setNPVFromNormalizedPackingDensity
setNPVFromNormalizedPackingDensity(rho: float)
Set the number of contacts per unit volume from the normalized packing density with the following equation:
PARAMETER | DESCRIPTION |
---|---|
rho
|
normalized packing density
TYPE:
|
LoadModel
Bases: ModelBase
Load manager for the micromechanical model.
MaterialModel
Bases: ModelBase
Material manager for the micromechanical model.
setMaterialAnisotropicParameters
setMaterialAnisotropicParameters(
key: str,
type: AvailableFabricTypes = "chang1990-ext",
evolution: AvailableFabricEvolutionTypes = "zhao2020",
coefs: Dict[str, float] = None,
**kwargs
)
Set the anisotropic parameters for a material property.
PARAMETER | DESCRIPTION |
---|---|
key
|
The name of the material property.
TYPE:
|
type
|
The type of the anisotropic parameter.
TYPE:
|
evolution
|
The evolution type of the anisotropic parameter.
TYPE:
|
coefs
|
The coefficients of the anisotropic parameter. |
kwargs
|
More coefficients of the anisotropic parameter.
DEFAULT:
|
Model
Bases: VisualizationModel
A micromechanical model manager.
Notes
The main calculation of the micromechanical model is done in the model
attribute, which is an instance of the
pure Python/numba/C++
micromechanical model, depending on the backend. Setting the following environment
variables to change the backend:
MICROMECHANICAL_BACKEND=cpp
: use the C++ backendMICROMECHANICAL_BACKEND=python;NUMBA_DISABLE_JIT=1
: use the pure Python backendMICROMECHANICAL_BACKEND=python;NUMBA_DISABLE_JIT=0
: use the numba backend
For the cpp
and numba
backends, the environment variable MICROMECHANICAL_PRECISION
can be set to
single
or double
to change the precision, the default is double
Examples:
Create the micromechanical model object:
Set up the loading phases:
>>> model.addIsotropicPhase(sigc=-100, steps=100)
>>> model.addDrainedTriaxialPhase(sigc=-100, epsa_max=-0.3, steps=100)
Set up the plastic method for the local contact law:
Set up integration points:
>>> model.setIntegrationParameters(npv=1e9, radius=0.65e-3)
>>> model.setAnisotropicParameters(type="chang1990-ext", evolution="wan2004", chi=0)
Set up material parameters:
Evaluate the model:
sv
is a micromechanical.SVExporter
object, which can be used to get the state variables, plot the results,
and export the results to a file.
>>> sv.to_csv("data.csv")
Saving state variables to DataFrame
>>> p, q, epsa, epsv = sv.get("-p"), sv.q, 100 * sv["epsa"], sv["100 * epsv"] # the tensile stress is positive
>>> model.plot("-p", "q", data=sv) # if data is omitted, model.run() will be called
<Figure size ... with 1 Axes>
__init__
__init__(
*model_types: Union[
MicromechanicalBase,
type,
str | PathLike,
AvailableModels,
AvailableMicromechanicalModels,
AvailableContactModels,
],
args: tuple = (),
kwargs: dict = None,
no_stop: bool = False,
backend: Literal["python", "cpp"] = backend,
**options
)
Constructor for the micromechanical model manager base class.
PARAMETER | DESCRIPTION |
---|---|
model_types
|
The micromechanical model to use. If no positional arguments are provided, the model will not be initialized. If one positional argument is provided, it should be:
If two positional arguments are provided, they should be:
In C++ backend, the micromechanical model type and contact law type can be a string of the file path to the compiled shared library. For example, the following usages are valid:
TYPE:
|
args
|
The positional arguments for the micromechanical model if the supplied model is a class.
TYPE:
|
kwargs
|
The keyword arguments for the micromechanical model if the supplied model is a class.
TYPE:
|
no_stop
|
Whether to stop the calculation when an error occurs.
TYPE:
|
backend
|
The backend to use, default is the configured backend.
TYPE:
|
options
|
The calculation options for the micromechanical model, the contact law, or the material.
DEFAULT:
|
ModelBase
Base class for micromechanical model managers.
best_fit_strain_averaging
class-attribute
instance-attribute
best_fit_strain_averaging: bool = property(
fget=lambda self: best_fit_strain_averaging,
fset=lambda self, value: setattr(
options, "best_fit_strain_averaging", value
),
doc="Whether to use the best-fit strain averaging",
)
cache
class-attribute
instance-attribute
cache: bool = property(
fget=lambda self: cache,
fset=lambda self, value: setattr(options, "cache", value),
doc="Whether to cache contact variables",
)
cache_precision
class-attribute
instance-attribute
cache_precision: int = property(
fget=lambda self: cache_precision,
fset=lambda self, value: setattr(options, "cache_precision", value),
doc="Cache contact variables precision",
)
contact
property
writable
The contact law.
contact_check_convergence
class-attribute
instance-attribute
contact_check_convergence: bool = property(
fget=lambda self: contact_check_convergence,
fset=lambda self, value: setattr(
options, "contact_check_convergence", value
),
doc="Check the convergence of contact",
)
contact_check_plastic_multiplier
class-attribute
instance-attribute
contact_check_plastic_multiplier: bool = property(
fget=lambda self: contact_check_plastic_multiplier,
fset=lambda self, value: setattr(
options, "contact_check_plastic_multiplier", value
),
doc="Whether to check the sign of plastic multiplier",
)
contact_ensure_force_state_on_yield_surface
class-attribute
instance-attribute
contact_ensure_force_state_on_yield_surface: bool = property(
fget=lambda self: contact_ensure_force_state_on_yield_surface,
fset=lambda self, value: setattr(
options, "contact_ensure_force_state_on_yield_surface", value
),
doc="Whether to ensure the force state is on the yield surface",
)
contact_friction_angle_combined
class-attribute
instance-attribute
contact_friction_angle_combined: bool = property(
fget=lambda self: contact_friction_angle_combined,
fset=lambda self, value: setattr(
options, "contact_friction_angle_combined", value
),
doc="Whether to combine the friction angle from different criteria",
)
contact_friction_angle_weight_mises
class-attribute
instance-attribute
contact_friction_angle_weight_mises: float = property(
fget=lambda self: contact_friction_angle_weight_mises,
fset=lambda self, value: setattr(
options, "contact_friction_angle_weight_mises", value
),
doc="Weight for Von Mises criterion in the friction angle",
)
contact_friction_angle_weight_mohr_coulomb
class-attribute
instance-attribute
contact_friction_angle_weight_mohr_coulomb: float = property(
fget=lambda self: contact_friction_angle_weight_mohr_coulomb,
fset=lambda self, value: setattr(
options, "contact_friction_angle_weight_mohr_coulomb", value
),
doc="Weight for Mohr-Coulomb criterion in the friction angle",
)
contact_friction_angle_weight_smp
class-attribute
instance-attribute
contact_friction_angle_weight_smp: float = property(
fget=lambda self: contact_friction_angle_weight_smp,
fset=lambda self, value: setattr(
options, "contact_friction_angle_weight_smp", value
),
doc="Weight for SMP criterion in the friction angle",
)
contact_friction_angle_weight_tresca
class-attribute
instance-attribute
contact_friction_angle_weight_tresca: float = property(
fget=lambda self: contact_friction_angle_weight_tresca,
fset=lambda self, value: setattr(
options, "contact_friction_angle_weight_tresca", value
),
doc="Weight for Tresca criterion in the friction angle",
)
contact_linear_critical_state_line
class-attribute
instance-attribute
contact_linear_critical_state_line: bool = property(
fget=lambda self: contact_linear_critical_state_line,
fset=lambda self, value: setattr(
options, "contact_linear_critical_state_line", value
),
doc="Whether to use linear critical state line for the OSIMSAND contact law",
)
contact_max_increment
class-attribute
instance-attribute
contact_max_increment: float = property(
fget=lambda self: contact_max_increment,
fset=lambda self, value: setattr(options, "contact_max_increment", value),
doc="Maximum stress ratio in one increment",
)
contact_max_iterations
class-attribute
instance-attribute
contact_max_iterations: int = property(
fget=lambda self: contact_max_iterations,
fset=lambda self, value: setattr(options, "contact_max_iterations", value),
doc="Maximum number of iterations, only for CPA or CPPM",
)
contact_min_normal_force
class-attribute
instance-attribute
contact_min_normal_force: float = property(
fget=lambda self: contact_min_normal_force,
fset=lambda self, value: setattr(
options, "contact_min_normal_force", value
),
doc="The minimum normal force",
)
contact_plastic_method_multiplier
class-attribute
instance-attribute
contact_plastic_method_multiplier: float = property(
fget=lambda self: contact_plastic_method_multiplier,
fset=lambda self, value: setattr(
options, "contact_plastic_method_multiplier", value
),
doc="Multiplier for the contact plastic method",
)
contact_sanisand_constant_hardening_parameter
class-attribute
instance-attribute
contact_sanisand_constant_hardening_parameter: bool = property(
fget=lambda self: contact_sanisand_constant_hardening_parameter,
fset=lambda self, value: setattr(
options, "contact_sanisand_constant_hardening_parameter", value
),
doc="Whether to use constant hardening parameter h for the SANISAND contact law",
)
contact_sanisand_maintain_yield_surface
class-attribute
instance-attribute
contact_sanisand_maintain_yield_surface: bool = property(
fget=lambda self: contact_sanisand_maintain_yield_surface,
fset=lambda self, value: setattr(
options, "contact_sanisand_maintain_yield_surface", value
),
doc="Whether to maintain yield surface for the SANISAND contact law",
)
contact_tolerance
class-attribute
instance-attribute
contact_tolerance: float = property(
fget=lambda self: contact_tolerance,
fset=lambda self, value: setattr(options, "contact_tolerance", value),
doc="Contact tolerance",
)
dataset_dirs
class-attribute
instance-attribute
dataset_dirs: List[Path] = list(
set([absolute() for d in dataset_dirs + [parents[1] / "datasets"]])
)
directories to search for datasets
debug
class-attribute
instance-attribute
debug: bool = property(
fget=lambda self: debug,
fset=lambda self, value: setattr(options, "debug", value),
doc="Debug mode",
)
disp_steps
class-attribute
instance-attribute
disp_steps: int = property(
fget=lambda self: disp_steps,
fset=lambda self, value: setattr(options, "disp_steps", value),
doc="Display the information per steps",
)
ignore_distractions
class-attribute
instance-attribute
ignore_distractions: bool = property(
fget=lambda self: ignore_distractions,
fset=lambda self, value: setattr(options, "ignore_distractions", value),
doc="Whether to ignore distractions",
)
ignore_fabric_evolution_for_isotropic_loading
class-attribute
instance-attribute
ignore_fabric_evolution_for_isotropic_loading: bool = property(
fget=lambda self: ignore_fabric_evolution_for_isotropic_loading,
fset=lambda self, value: setattr(
options, "ignore_fabric_evolution_for_isotropic_loading", value
),
doc="Whether to ignore fabric evolution for isotropic loading",
)
ignore_fabric_rotations_for_isotropic_loading
class-attribute
instance-attribute
ignore_fabric_rotations_for_isotropic_loading: bool = property(
fget=lambda self: ignore_fabric_rotations_for_isotropic_loading,
fset=lambda self, value: setattr(
options, "ignore_fabric_rotations_for_isotropic_loading", value
),
doc="Whether to ignore fabric rotations for isotropic loading",
)
increment_plastic_displacement
class-attribute
instance-attribute
increment_plastic_displacement: bool = property(
fget=lambda self: increment_plastic_displacement,
fset=lambda self, value: setattr(
options, "increment_plastic_displacement", value
),
doc="Increment plastic displacement to the total displacement",
)
integration_absolute_tolerance
class-attribute
instance-attribute
integration_absolute_tolerance: float = property(
fget=lambda self: integration_absolute_tolerance,
fset=lambda self, value: setattr(
options, "integration_absolute_tolerance", value
),
doc="Absolute tolerance for macro-micro integration",
)
integration_check_absolute_convergence
class-attribute
instance-attribute
integration_check_absolute_convergence: bool = property(
fget=lambda self: integration_check_absolute_convergence,
fset=lambda self, value: setattr(
options, "integration_check_absolute_convergence", value
),
doc="Whether to check absolute contact integration error instead of the relative error",
)
integration_check_convergence
class-attribute
instance-attribute
integration_check_convergence: bool = property(
fget=lambda self: integration_check_convergence,
fset=lambda self, value: setattr(
options, "integration_check_convergence", value
),
doc="Converge the macro-micro integration algorithm when the number of iterations reaches the maximum",
)
integration_loading_ratio
class-attribute
instance-attribute
integration_loading_ratio: float = property(
fget=lambda self: integration_loading_ratio,
fset=lambda self, value: setattr(
options, "integration_loading_ratio", value
),
doc="Macro-micro integration loading ratio for the contact force and displacement",
)
integration_max_iterations
class-attribute
instance-attribute
integration_max_iterations: int = property(
fget=lambda self: integration_max_iterations,
fset=lambda self, value: setattr(
options, "integration_max_iterations", value
),
doc="Maximum number of iterations for macro-micro integration",
)
integration_max_substepping_ratio
class-attribute
instance-attribute
integration_max_substepping_ratio: float = property(
fget=lambda self: integration_max_substepping_ratio,
fset=lambda self, value: setattr(
options, "integration_max_substepping_ratio", value
),
doc="Maximum macro-micro integration substepping ratio",
)
integration_min_substepping_ratio
class-attribute
instance-attribute
integration_min_substepping_ratio: float = property(
fget=lambda self: integration_min_substepping_ratio,
fset=lambda self, value: setattr(
options, "integration_min_substepping_ratio", value
),
doc="Minimum macro-micro integration substepping ratio",
)
integration_relative_tolerance
class-attribute
instance-attribute
integration_relative_tolerance: float = property(
fget=lambda self: integration_relative_tolerance,
fset=lambda self, value: setattr(
options, "integration_relative_tolerance", value
),
doc="Relative tolerance for macro-micro integration",
)
integration_substepping_relative_to_increment
class-attribute
instance-attribute
integration_substepping_relative_to_increment: bool = property(
fget=lambda self: integration_substepping_relative_to_increment,
fset=lambda self, value: setattr(
options, "integration_substepping_relative_to_increment", value
),
doc="Whether to use the macro-micro integration substepping relative to the increment of last step",
)
kinematic_hypothesis
class-attribute
instance-attribute
kinematic_hypothesis: bool = property(
fget=lambda self: kinematic_hypothesis,
fset=lambda self, value: setattr(options, "kinematic_hypothesis", value),
doc="Whether to use the kinematic hypothesis",
)
mixed_load_absolute_tolerance
class-attribute
instance-attribute
mixed_load_absolute_tolerance: float = property(
fget=lambda self: mixed_load_absolute_tolerance,
fset=lambda self, value: setattr(
options, "mixed_load_absolute_tolerance", value
),
doc="Absolute tolerance for mixed load control",
)
mixed_load_check_absolute_convergence
class-attribute
instance-attribute
mixed_load_check_absolute_convergence: bool = property(
fget=lambda self: mixed_load_check_absolute_convergence,
fset=lambda self, value: setattr(
options, "mixed_load_check_absolute_convergence", value
),
doc="Whether to check absolute tolerance for the mixed load",
)
mixed_load_check_convergence
class-attribute
instance-attribute
mixed_load_check_convergence: bool = property(
fget=lambda self: mixed_load_check_convergence,
fset=lambda self, value: setattr(
options, "mixed_load_check_convergence", value
),
doc="Converge the mixed load control algorithm when the number of iterations reaches the maximum",
)
mixed_load_check_strain_convergence
class-attribute
instance-attribute
mixed_load_check_strain_convergence: bool = property(
fget=lambda self: mixed_load_check_strain_convergence,
fset=lambda self, value: setattr(
options, "mixed_load_check_strain_convergence", value
),
doc="Check the convergence of mixed load strain",
)
mixed_load_max_iterations
class-attribute
instance-attribute
mixed_load_max_iterations: int = property(
fget=lambda self: mixed_load_max_iterations,
fset=lambda self, value: setattr(
options, "mixed_load_max_iterations", value
),
doc="Maximum number of iterations",
)
mixed_load_max_larger_steps
class-attribute
instance-attribute
mixed_load_max_larger_steps: int = property(
fget=lambda self: mixed_load_max_larger_steps,
fset=lambda self, value: setattr(
options, "mixed_load_max_larger_steps", value
),
doc="Allowable steps for the convergence of mixed load control and macro-micro integration",
)
mixed_load_relative_tolerance
class-attribute
instance-attribute
mixed_load_relative_tolerance: float = property(
fget=lambda self: mixed_load_relative_tolerance,
fset=lambda self, value: setattr(
options, "mixed_load_relative_tolerance", value
),
doc="Relative tolerance for mixed load control",
)
npv
class-attribute
instance-attribute
npv: float = property(
fget=lambda self: npv,
fset=lambda self, value: setattr(integration, "npv", value),
doc="Number of contacts per unit volume",
)
precise_incremental_volumetric_strain
class-attribute
instance-attribute
precise_incremental_volumetric_strain: bool = property(
fget=lambda self: precise_incremental_volumetric_strain,
fset=lambda self, value: setattr(
options, "precise_incremental_volumetric_strain", value
),
doc="Whether to use the precise incremental volumetric strain to update void ratio",
)
radius
class-attribute
instance-attribute
radius: float = property(
fget=lambda self: radius,
fset=lambda self, value: setattr(integration, "radius", value),
doc="Particle radius",
)
run_contact_integration_steps
class-attribute
instance-attribute
run_contact_integration_steps: int = property(
fget=lambda self: run_contact_integration_steps,
fset=lambda self, value: setattr(
options, "run_contact_integration_steps", value
),
doc="Number of macro-micro integration iterations to run",
)
run_mixed_load_steps
class-attribute
instance-attribute
run_mixed_load_steps: int = property(
fget=lambda self: run_mixed_load_steps,
fset=lambda self, value: setattr(options, "run_mixed_load_steps", value),
doc="Number of mixed load iterations to run",
)
run_steps
class-attribute
instance-attribute
run_steps: int = property(
fget=lambda self: run_steps,
fset=lambda self, value: setattr(options, "run_steps", value),
doc="Number of steps to run",
)
separate_mean_deviatoric_stress_strain
class-attribute
instance-attribute
separate_mean_deviatoric_stress_strain: bool = property(
fget=lambda self: separate_mean_deviatoric_stress_strain,
fset=lambda self, value: setattr(
options, "separate_mean_deviatoric_stress_strain", value
),
doc="Whether to apply mean stress and deviatoric stress/strain separately in the mixed load control algorithm",
)
type
class-attribute
instance-attribute
type: str = property(
fget=lambda self: f"{name}-{name}",
fset=lambda self, value: setattr(
self, "model", MicromechanicalModel(*split("-"))
),
doc="The type of the model.",
)
update_fabric_coefs
class-attribute
instance-attribute
update_fabric_coefs: bool = property(
fget=lambda self: update_fabric_coefs,
fset=lambda self, value: setattr(options, "update_fabric_coefs", value),
doc="Whether to update fabric coefficients",
)
update_npv
class-attribute
instance-attribute
update_npv: bool = property(
fget=lambda self: update_npv,
fset=lambda self, value: setattr(options, "update_npv", value),
doc="Whether to update npv based on the coordination number and particle radius",
)
update_void_ratio_from_after_isotropic_loading_to_before
class-attribute
instance-attribute
update_void_ratio_from_after_isotropic_loading_to_before: bool = property(
fget=lambda self: update_void_ratio_from_after_isotropic_loading_to_before,
fset=lambda self, value: setattr(
options,
"update_void_ratio_from_after_isotropic_loading_to_before",
value,
),
doc="Whether to update the void ratio after the isotropic loading to the void ratio before the isotropicloading, useful if the initial void ratio is given after the isotropic loading",
)
use_isotropic_fabric_tensor_in_strain_averaging
class-attribute
instance-attribute
use_isotropic_fabric_tensor_in_strain_averaging: bool = property(
fget=lambda self: use_isotropic_fabric_tensor_in_strain_averaging,
fset=lambda self, value: setattr(
options, "use_isotropic_fabric_tensor_in_strain_averaging", value
),
doc="Whether to use the isotropic fabric tensor in strain averaging",
)
use_isotropic_fabric_tensor_in_stress_localization
class-attribute
instance-attribute
use_isotropic_fabric_tensor_in_stress_localization: bool = property(
fget=lambda self: use_isotropic_fabric_tensor_in_stress_localization,
fset=lambda self, value: setattr(
options, "use_isotropic_fabric_tensor_in_stress_localization", value
),
doc="Whether to use the isotropic fabric tensor in stress localization",
)
use_plastic_strain_in_fabric_evolution
class-attribute
instance-attribute
use_plastic_strain_in_fabric_evolution: bool = property(
fget=lambda self: use_plastic_strain_in_fabric_evolution,
fset=lambda self, value: setattr(
options, "use_plastic_strain_in_fabric_evolution", value
),
doc="Whether to use plastic strain in fabric evolution",
)
verbose
class-attribute
instance-attribute
verbose: bool = property(
fget=lambda self: verbose,
fset=lambda self, value: setattr(options, "verbose", value),
doc="Whether to print verbose information",
)
__init__
__init__(
*model_types: Union[
MicromechanicalBase,
type,
str | PathLike,
AvailableModels,
AvailableMicromechanicalModels,
AvailableContactModels,
],
args: tuple = (),
kwargs: dict = None,
no_stop: bool = False,
backend: Literal["python", "cpp"] = backend,
**options
)
Constructor for the micromechanical model manager base class.
PARAMETER | DESCRIPTION |
---|---|
model_types
|
The micromechanical model to use. If no positional arguments are provided, the model will not be initialized. If one positional argument is provided, it should be:
If two positional arguments are provided, they should be:
In C++ backend, the micromechanical model type and contact law type can be a string of the file path to the compiled shared library. For example, the following usages are valid:
TYPE:
|
args
|
The positional arguments for the micromechanical model if the supplied model is a class.
TYPE:
|
kwargs
|
The keyword arguments for the micromechanical model if the supplied model is a class.
TYPE:
|
no_stop
|
Whether to stop the calculation when an error occurs.
TYPE:
|
backend
|
The backend to use, default is the configured backend.
TYPE:
|
options
|
The calculation options for the micromechanical model, the contact law, or the material.
DEFAULT:
|
defaultParameters
classmethod
The default parameters.
defaultStandardDeviations
classmethod
The default standard deviations.
filterExperiments
filterExperiments(
*args: str,
experiments: ExperimentsType | None = None,
method: Literal[
"equal", "startswith", "endswith", "contains", "glob"
] = "glob",
strategy: Literal["include", "exclude"] = "include",
inplace: bool = False,
strict: bool = True,
**kwargs
) -> Dict[str, Experiment] | None
Filter the experiments by the name of the experiments.
PARAMETER | DESCRIPTION |
---|---|
args
|
Arguments to filter the experiments by the name.
TYPE:
|
experiments
|
Experiments to filter, by default None which means all experiments in the manager
TYPE:
|
method
|
The method to filter the experiments, by default "glob"
TYPE:
|
strategy
|
The strategy to filter the experiments, by default "include"
TYPE:
|
inplace
|
Whether to filter the experiments in place, only used to replace the experiments in the manager, by default False
TYPE:
|
strict
|
If true, notes and options must match exactly with kwargs, otherwise, only items in options and notes are checked with kwargs for equality, by default True
TYPE:
|
kwargs
|
Additional notes or options that should be matched with the experiments
DEFAULT:
|
iterateExperiments
iterateExperiments(
experiments: ExperimentsType | None = None,
) -> Generator[Experiment]
Iterate over the experiments.
loadCalibration
Load parameters, options, and experiments from a calibration file.
loadExperiments
loadExperiments(
filename: str | AvailableDatasets | PathLike,
) -> Dict[str, Experiment]
Load the experiments from a file and add them to the current experiments.
loadOptions
loadOptions(
filePath: str | Path,
*,
key: str = "options",
type: Literal["json", "toml", "yaml", "infer"] = "infer"
)
Load the calculation options from a JSON/TOML/YAML file.
loadParameters
loadParameters(
filePath: str | Path,
*,
key: str = "parameters",
type: Literal["json", "toml", "yaml", "infer"] = "infer"
)
Load the material parameters from a JSON/TOML/YAML file.
readExperiments
readExperiments(
filename: str | AvailableDatasets | PathLike,
) -> Dict[str, Experiment]
Read the experiments from a file or from the existing datasets.
readParameters
classmethod
readParameters(
filePath: str | Path,
*,
key: str = "parameters",
type: Literal["json", "toml", "yaml", "infer"] = "infer"
) -> dict[str, float]
Read the material parameters from a JSON/TOML/YAML file.
requiredParameters
classmethod
The required parameters.
run
run(experiment_name: str = '', **options) -> SVExporter
Run the model, return the cached state variables if the calculation is already done before with the same string representation of model exporter.
PARAMETER | DESCRIPTION |
---|---|
experiment_name
|
The name of the experiment for error printing.
TYPE:
|
options
|
The calculation options for the micromechanical model, the contact law, or the material.
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
stateVar
|
The state variables' exporter.
TYPE:
|
saveExperiments
saveExperiments(
filename: str | PathLike,
indent: int = 4,
model_dump_kwargs: Dict | None = None,
**json_dump_kwargs
)
Save the experiments to a file.
setDebug
setDebug(debug: bool = True)
Set the debug mode.
PARAMETER | DESCRIPTION |
---|---|
debug
|
The debug mode.
TYPE:
|
setOptions
Set the calculation options for the micromechanical model, the contact law, or the material.
PARAMETER | DESCRIPTION |
---|---|
opts
|
The calculation options for the micromechanical model, the contact law, the integration, or the material. |
options
|
The calculation options for the micromechanical model, the contact law, the integration, or the material. |
setParameters
setParameters(
params: Dict[str, float] = None, experiment_name: str = "", **kwargs: float
) -> None
Set the material parameters. Keys can be in the form of module:qualname(key1,key2)
to set the specialized
parameters.
PARAMETER | DESCRIPTION |
---|---|
experiment_name
|
The name of the experiment for experiment-specific parameters.
TYPE:
|
params
|
The parameters to set. |
kwargs
|
The parameters to set. |
setupDebugVariable
setupDebugVariable(
mixed_load_error: bool = None,
mixed_loads: bool = None,
sigx: bool = None,
epsx: bool = None,
integration_error: bool = None,
integrations: bool = None,
sigi: bool = None,
sig: bool = None,
eps: bool = None,
dsig: bool = None,
deps: bool = None,
force: bool = None,
disp: bool = None,
yield_function: bool = None,
dfdforce: bool = None,
dgdforce: bool = None,
hardening: bool = None,
kp: bool = None,
dlambda: bool = None,
ddisp: bool = None,
ddispp: bool = None,
**kwargs
)
Setup the debug information, whether to enable debug information for specific fields.
simulateExperiments
simulateExperiments(
experiments: ExperimentsType | None = None,
*,
phase_steps: dict[str, int] | None = None
) -> SVExporter | Dict[str, SVExporter] | List[SVExporter]
Simulate the experiments.
PARAMETER | DESCRIPTION |
---|---|
experiments
|
The experiments to simulate.
TYPE:
|
phase_steps
|
Override the number of steps for each load phase, by default None |
ParameterKey
VisualizationModel
Bases: CalibrationModel
Visualization manager for the micromechanical model.
fabricplot
fabricplot(
n_theta: int = N_THETA_DEFAULT,
n_phi: int = N_PHI_DEFAULT,
*,
phase: int | slice | Iterable[int] = slice(None),
step: int | slice | Iterable[int] = slice(None),
data: SVExporter | None = None,
force: bool = False,
on: Plottable | None = None,
ncols: int = 2,
backend: Literal["matplotlib", "bokeh"] | str | None = None,
subplots_kwargs: dict | None = None,
props: Dict[str, Any] | None = None,
bokeh_show: bool = False,
tight_layout: bool = True,
**kwargs
) -> Union["MplFigure", "BkGridPlot"]
Plot evolution of fabric tensors.
macroplot
macroplot(
*args: str,
x: str | Literal["first", "auto"] = "auto",
experiments: ExperimentsType | None = None,
simulate_experiment_kwargs: dict | None = None,
phase: int | slice | Iterable[int] = slice(None),
step: int | slice | Iterable[int] = slice(None),
idx: int | slice | Iterable[int] = slice(None),
col: int | slice | Iterable[int] = slice(None),
label: str = "{x} vs {y}",
data: SVExporter | None = None,
on: Plottable | None = None,
ncols: int = 2,
backend: Literal["matplotlib", "bokeh"] | str | None = None,
subplots_kwargs: dict | None = None,
line_kwargs: Iterable[Dict[str, Any]] | None = None,
props: Dict[str, Any] | None = None,
bokeh_show: bool = False,
tight_layout: bool = True,
**kwargs
) -> Union["MplFigure", "BkGridPlot"]
Plot macroscopic curves. Equivalent to
model.plot("100*epsa", "q", "-p", "q", "100*epsa", "100*epsva", "-p", "e", ...)
.
- material parameters (
model.parameters
) {x}
and{y}
for the name of the variable
See Also
microplot: Plot microscopic curves
PARAMETER | DESCRIPTION |
---|---|
args
|
State variables to plot. If the number of arguments is an even number, multiple curves will be plotted
with every two arguments as a pair of
if you specify
or any other string:
If you want to use a different strategy for the x-axis, you can specify it with
Multiple x-axis can also be specified. If both x and y have multiple variables, the number of x-axis must be equal to the number of y-axis.
TYPE:
|
x
|
Variable to plot on x-axis, by default "auto".
TYPE:
|
experiments
|
The experiments to plot, only one experiment is allowed.
TYPE:
|
simulate_experiment_kwargs
|
Keyword arguments for the
TYPE:
|
phase
|
An integer or a slice indicates index of the phase. |
step
|
An integer or a slice indicates index of the step. |
idx
|
An integer or a slice indicates index of the integration point for contact variables. |
col
|
An integer or a slice indicates index of the column for variables with multiple columns, this argument
will be ignored if the variable has only one column or the column index is already specified in |
label
|
Format string for the label in the legend, by default "{x} vs {y}"
TYPE:
|
data
|
State variables to plot, if not specified, the simulation will be run, by default None
TYPE:
|
on
|
Axes to plot on, by default None
TYPE:
|
ncols
|
Number of columns in the figure grid, by default 2
TYPE:
|
backend
|
Backend to use, by default None which means the backend set in the environment variable
TYPE:
|
subplots_kwargs
|
Keyword arguments for creating the subplots, by default None
TYPE:
|
line_kwargs
|
Line-specific keyword arguments, by default None |
props
|
Properties passed to the |
bokeh_show
|
Whether to show the figure in the browser, by default False
TYPE:
|
tight_layout
|
Whether to use tight layout in the matplotlib figure, by default True
TYPE:
|
kwargs
|
Keyword arguments for
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
Figure | GridPlot
|
The matplotlib figure or bokeh grid plot of the macroscopic curves |
microplot
microplot(
*args: str,
experiments: ExperimentsType | None = None,
simulate_experiment_kwargs: dict | None = None,
beta: float = None,
gamma: float = None,
unit: Literal["rad", "deg"] = "rad",
smooth: bool = False,
data: SVExporter = None,
phase: int | slice | Iterable[int] = slice(None),
step: int | slice | Iterable[int] = slice(None),
idx: int | slice | Iterable[int] = slice(None),
col: int | slice | Iterable[int] = slice(None),
label: str = "Step {step}",
return_handles: bool = False,
on: Plottable | None = None,
ncols: int = 2,
subplots_kwargs: dict | None = None,
props: Dict[str, Any] | None = None,
tight_layout: bool = True,
**kwargs
) -> Figure | Tuple[Figure, List[Line2D]]
Plot microscopic curves. Specify one (and only one) of beta
or gamma
to plot data of a specific
azimuth, the other angle will be used for the x-axis.
Notes
The following placeholders are supported for arguments label
and kwargs
:
- material parameters (
model.parameters
) {name}
for the name of the variable{step}
for the step index{idx}
,{beta}
and{gamma}
for contact variables
See Also
microplot: Plot microscopic curves
PARAMETER | DESCRIPTION |
---|---|
args
|
Names of the variables to plot
TYPE:
|
experiments
|
The experiments to plot, only one experiment is allowed.
TYPE:
|
simulate_experiment_kwargs
|
Keyword arguments for the
TYPE:
|
beta
|
The angle between the projection of the azimuth on the YZ plane and the Y axis
TYPE:
|
gamma
|
The angle between the azimuth and the X axis
TYPE:
|
unit
|
Unit of the angles, by default
TYPE:
|
smooth
|
Whether to smooth the data, by default True
TYPE:
|
data
|
State variables to plot, if not specified, the simulation will be run, by default None
TYPE:
|
phase
|
An integer or a slice indicates index of the phase. |
step
|
Steps to plot |
idx
|
Index of the integration point to plot, by default slice(None) |
col
|
An integer or a slice indicates index of the column for variables with multiple columns, this argument
will be ignored if the variable has only one column or the column index is already specified in |
label
|
Label for the legend, by default "Step {step}"
TYPE:
|
return_handles
|
Whether to return the handles of the plotted lines, by default False
TYPE:
|
on
|
Axes to plot on, by default None
TYPE:
|
ncols
|
Number of columns in the figure grid, by default 2
TYPE:
|
subplots_kwargs
|
Keyword arguments for creating the subplots, by default None
TYPE:
|
props
|
Properties passed to the |
tight_layout
|
Whether to use tight layout in the matplotlib figure, by default True
TYPE:
|
kwargs
|
Keyword arguments for
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
Figure
|
Figure with microscopic curves |
List[Line2D]
|
Handles of the plotted lines, only returned if |
microplots
microplots(
*,
experiments: ExperimentsType | None = None,
simulate_experiment_kwargs: dict | None = None,
beta: float = None,
gamma: float = None,
unit: Literal["rad", "deg"] = "rad",
smooth: bool = False,
data: SVExporter = None,
phase: int | slice | Iterable[int] = slice(None),
step: int | slice | Iterable[int] = slice(None),
idx: int | slice | Iterable[int] = slice(None),
col: int | slice | Iterable[int] = slice(None),
label: str = "Step {step}",
on: Plottable | None = None,
ncols: int = 2,
subplots_kwargs: dict | None = None,
props: Dict[str, Any] | None = None,
tight_layout: bool = True,
**kwargs
) -> Figure
Plot microscopic curves for normal force, shear force, normal displacement, and shear displacement.
plot
plot(
*args: str,
x: str | Literal["first", "auto"] = "auto",
experiments: ExperimentsType | None = None,
simulate_experiment_kwargs: dict | None = None,
phase: int | slice | Iterable[int] = slice(None),
step: int | slice | Iterable[int] = slice(None),
idx: int | slice | Iterable[int] = slice(None),
col: int | slice | Iterable[int] = slice(None),
label: str = "{x} vs {y}",
data: SVExporter | YieldFunction | None = None,
data_get_kwargs: Dict[str, Any] | None = None,
normalize: bool | Literal["max", "mean", "x"] | float = False,
normalize_x: float | None = None,
on: Plottable | None = None,
ncols: int = 2,
backend: Literal["matplotlib", "bokeh"] | str | None = None,
subplots_kwargs: dict | None = None,
line_kwargs: Iterable[Dict[str, Any]] | None = None,
props: Dict[str, Any] | None = None,
bokeh_show: bool = False,
tight_layout: bool = True,
**kwargs
) -> Union["MplFigure", "BkGridPlot"]
Plot one (or multiple) line(s) of the simulation.
Notes
The following placeholders are supported for arguments label
, kwargs
and line_kwargs
:
- material parameters (
model.parameters
) {x}
and{y}
for the name of the variable{idx}
,{beta}
and{gamma}
for contact variables
PARAMETER | DESCRIPTION |
---|---|
args
|
State variables to plot. If the number of arguments is an even number, multiple curves will be plotted
with every two arguments as a pair of
if you specify
or any other string:
If you want to use a different strategy for the x-axis, you can specify it with
Multiple x-axis can also be specified. If both x and y have multiple variables, the number of x-axis must be equal to the number of y-axis.
TYPE:
|
x
|
Variable to plot on x-axis, by default "auto".
TYPE:
|
experiments
|
The experiments to plot, only one experiment is allowed.
TYPE:
|
simulate_experiment_kwargs
|
Keyword arguments for the
TYPE:
|
phase
|
An integer or a slice indicates index of the phase. |
step
|
An integer or a slice indicates index of the step. |
idx
|
An integer or a slice indicates index of the integration point for contact variables. |
col
|
An integer or a slice indicates index of the column for variables with multiple columns, this argument
will be ignored if the variable has only one column or the column index is already specified in |
label
|
Format string for the label in the legend, supported placeholders, by default "{x} vs {y}"
TYPE:
|
data
|
State variables to plot, if not specified, the simulation will be run, by default None
TYPE:
|
data_get_kwargs
|
Extra keyword arguments for the |
normalize
|
Whether to normalize the data variables. If True or "max", normalize by the maximum value. If "mean",
normalize by the mean value, if "x", normalize by the value corresponding to this angle specified by
|
normalize_x
|
The x value to normalize the yield function.
TYPE:
|
on
|
Axes to plot on, by default None
TYPE:
|
ncols
|
Number of columns in the figure grid, by default 2
TYPE:
|
backend
|
Backend to use, by default None which means the backend set in the environment variable
TYPE:
|
subplots_kwargs
|
Keyword arguments for creating the subplots, by default None
TYPE:
|
line_kwargs
|
Line-specific keyword arguments, by default None |
props
|
Properties passed to the |
bokeh_show
|
Whether to show the figure in the browser, by default False
TYPE:
|
tight_layout
|
Whether to use tight layout in the matplotlib figure, by default True
TYPE:
|
kwargs
|
Keyword arguments for
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
Figure | GridPlot
|
The matplotlib figure or bokeh gridplot |
plotComparisons
plotComparisons(
*args: str,
experiment_kwargs: Dict[str, Any] | None = None,
simulation_kwargs: Dict[str, Any] | None = None,
x: str | Literal["first", "auto"] = "auto",
experiments: ExperimentsType | None = None,
phase_steps: dict[str, int] | None = None,
phase: int | slice | Iterable[int] = slice(None),
step: int | slice | Iterable[int] = slice(None),
idx: int | slice | Iterable[int] = slice(None),
col: int | slice | Iterable[int] = slice(None),
normalize: bool | Literal["max", "mean", "x"] | float = False,
normalize_x: float | None = None,
label: str = "{experiment}",
data: (
List[SVExporter]
| SVExporter
| List[YieldFunction]
| YieldFunction
| None
) = None,
data_set_experiment_options: bool = False,
data_get_kwargs: Dict[str, Any] | None = None,
experiment_get_kwargs: Dict[str, Any] | None = None,
experiment_data_multipliers: Dict[str, float] | None = None,
on: Plottable | None = None,
ncols: int = 2,
backend: Literal["matplotlib", "bokeh"] | str | None = None,
subplots_kwargs: dict | None = None,
method: Literal["plot", "scatter"] | None = None,
line_kwargs: Iterable[Dict[str, Any]] | None = None,
line_kwargs_each: Literal["experiment", "line"] = "experiment",
props: Dict[str, Any] | None = None,
bokeh_show: bool = False,
tight_layout: bool = True,
**kwargs
) -> Union["MplFigure", "BkGridPlot"]
Plot the comparisons between experiments and simulations.
plotExperiments
plotExperiments(
*args: str,
x: str | Literal["first", "auto"] = "auto",
experiments: ExperimentsType | None = None,
normalize: bool | Literal["max", "mean", "x"] | float = False,
normalize_x: float | None = None,
label: str = "{experiment}",
experiment_get_kwargs: Dict[str, Any] | None = None,
experiment_data_multipliers: Dict[str, float] | None = None,
on: Plottable | None = None,
ncols: int = 2,
backend: Literal["matplotlib", "bokeh"] | str | None = None,
subplots_kwargs: dict | None = None,
method: Literal["plot", "scatter"] | None = None,
line_kwargs: Iterable[Dict[str, Any]] | None = None,
line_kwargs_each: Literal["experiment", "line"] = "experiment",
props: Dict[str, Any] | None = None,
bokeh_show: bool = False,
tight_layout: bool = True,
**kwargs
) -> Union["MplFigure", "BkGridPlot"]
Plot the experiments.
plotSimulations
plotSimulations(
*args: str,
x: str | Literal["first", "auto"] = "auto",
experiments: ExperimentsType | None = None,
phase_steps: dict[str, int] | None = None,
phase: int | slice | Iterable[int] = slice(None),
step: int | slice | Iterable[int] = slice(None),
idx: int | slice | Iterable[int] = slice(None),
col: int | slice | Iterable[int] = slice(None),
normalize: bool | Literal["max", "mean", "x"] | float = False,
normalize_x: float | None = None,
label: str = "{experiment}",
data: (
List[SVExporter]
| SVExporter
| List[YieldFunction]
| YieldFunction
| None
) = None,
data_set_experiment_options: bool = False,
data_get_kwargs: Dict[str, Any] | None = None,
experiment_get_kwargs: Dict[str, Any] | None = None,
experiment_data_multipliers: Dict[str, float] | None = None,
on: Plottable | None = None,
ncols: int = 2,
backend: Literal["matplotlib", "bokeh"] | str | None = None,
subplots_kwargs: dict | None = None,
method: Literal["plot", "scatter"] | None = None,
line_kwargs: Iterable[Dict[str, Any]] | None = None,
line_kwargs_each: Literal["experiment", "line"] = "experiment",
props: Dict[str, Any] | None = None,
bokeh_show: bool = False,
tight_layout: bool = True,
**kwargs
) -> Union["MplFigure", "BkGridPlot"]
Plot the simulations.
plotof
plotof(
*args: str,
x: str | Literal["first", "auto"] = "auto",
type: Literal["experiment", "simulation"] = "experiment",
experiments: ExperimentsType | None = None,
phase_steps: dict[str, int] | None = None,
phase: int | slice | Iterable[int] = slice(None),
step: int | slice | Iterable[int] = slice(None),
idx: int | slice | Iterable[int] = slice(None),
col: int | slice | Iterable[int] = slice(None),
normalize: bool | Literal["max", "mean", "x"] | float = False,
normalize_x: float | None = None,
label: str = "{experiment}",
data: (
List[SVExporter]
| SVExporter
| List[YieldFunction]
| YieldFunction
| None
) = None,
data_set_experiment_options: bool = False,
data_get_kwargs: Dict[str, Any] | None = None,
experiment_get_kwargs: Dict[str, Any] | None = None,
experiment_data_multipliers: Dict[str, float] | None = None,
on: Plottable | None = None,
ncols: int = 2,
backend: Literal["matplotlib", "bokeh"] | str | None = None,
subplots_kwargs: dict | None = None,
method: Literal["plot", "scatter"] | None = None,
line_kwargs: Iterable[Dict[str, Any]] | None = None,
line_kwargs_each: Literal["experiment", "line"] = "experiment",
props: Dict[str, Any] | None = None,
bokeh_show: bool = False,
tight_layout: bool = True,
**kwargs
) -> Union["MplFigure", "BkGridPlot"]
Plot the experiments and/or simulations.
Notes
The following placeholders are supported for arguments label
, kwargs
and line_kwargs
:
- material parameters (
model.parameters
) - experiment options (
experiment.options
) and notes (experiment.notes
) {x}
and{y}
for the name of the variable{idx}
,{beta}
and{gamma}
for contact variables{experiment}
for the name of the experiment{type}
for the type of the data, either "experiment" or "simulation"
PARAMETER | DESCRIPTION |
---|---|
args
|
State variables to plot. If the number of arguments is an even number, multiple curves will be plotted
with every two arguments as a pair of
if you specify
or any other string:
If you want to use a different strategy for the x-axis, you can specify it with
TYPE:
|
x
|
Variable to plot on x-axis, by default "auto".
TYPE:
|
type
|
The type of the plot, by default "experiment"
TYPE:
|
experiments
|
The experiments to plot, by default None which means all experiments in the manager
TYPE:
|
phase_steps
|
Override the number of steps for each load phase, by default None |
phase
|
An integer or a slice indicates index of the phase. |
step
|
An integer or a slice indicates index of the step. |
idx
|
An integer or a slice indicates index of the integration point for contact variables. |
col
|
An integer or a slice indicates index of the column for variables with multiple columns, this argument
will be ignored if the variable has only one column or the column index is already specified in |
normalize
|
Whether to normalize the data variables. If True or "max", normalize by the maximum value. If "mean",
normalize by the mean value, if "x", normalize by the value corresponding to this angle specified by
|
normalize_x
|
The x value to normalize the yield function.
TYPE:
|
label
|
Format string for the label in the legend, by default
TYPE:
|
data
|
State variables to plot, if not specified, the simulation will be run, by default None
TYPE:
|
data_set_experiment_options
|
Whether to set the experiment options to the data, by default False
TYPE:
|
data_get_kwargs
|
Extra keyword arguments for the |
experiment_get_kwargs
|
Extra keyword arguments for the |
experiment_data_multipliers
|
Multipliers for the experiment data, by default None |
on
|
Axes to plot on, by default None
TYPE:
|
ncols
|
Number of columns in the figure grid, by default 2
TYPE:
|
backend
|
Backend to use, by default None which means the backend set in the environment variable
TYPE:
|
subplots_kwargs
|
Keyword arguments for creating the subplots, by default None
TYPE:
|
method
|
Method to use for plotting, by default
TYPE:
|
line_kwargs
|
Keyword arguments for the lines, by default None |
line_kwargs_each
|
Whether to use the line kwargs for each line or for each experiment, by default "experiment"
TYPE:
|
props
|
Properties passed to the |
bokeh_show
|
Whether to show the figure in the browser, by default False
TYPE:
|
tight_layout
|
Whether to use tight layout in the matplotlib figure, by default True
TYPE:
|
kwargs
|
Keyword arguments for
DEFAULT:
|
_figure_postprocess
_figure_postprocess(
axes: AxesType | List[AxesType] | List[List[AxesType | None]],
*,
backend: Literal["matplotlib", "bokeh"] | str | None = None,
tight_layout: bool = True,
ncols: int = 2,
props: Dict[str, Any] | None = None,
bokeh_show: bool = False
) -> Union["MplFigure", "BkGridPlot"]