Skip to content

Index

The micromechanical model command line interface, run with python -m micromechanical or micromechanical.

__all__ module-attribute

__all__ = [
    "AbaqusCLI",
    "abaqus",
    "CalibrationCLI",
    "calibration",
    "CleanCLI",
    "clean",
    "MicromechanicalCLI",
    "micromechanical",
    "PlotCLI",
    "plot",
    "PluginCLI",
    "plugin",
    "SchemaCLI",
    "schema",
]

micromechanical module-attribute

AbaqusCLI

Bases: AbqpyCLI

Abaqus command line interface.

subroutine instance-attribute

__init__

__init__()

Initialize the Abaqus command line interface.

job classmethod

job(
    *,
    output: str | PathLike,
    includes: str | None = None,
    script: str | PathLike | None = None,
    input: str | PathLike | None = None,
    user: str | PathLike | None = None,
    post: str | PathLike | None = None,
    vis: str | PathLike | None = None,
    overwrite: bool = False,
    compile: bool = False,
    clear: bool = False,
    job: str | None = None,
    submit: bool = True,
    analysis: Literal["select", "odb", "state", "all"] | None = None,
    datacheck: Literal["select", "odb", "state", "all"] | None = None,
    parametercheck: Literal["select", "odb", "state", "all"] | None = None,
    continue1: Literal["select", "odb", "state", "all"] | None = None,
    convert: Literal["select", "odb", "state", "all"] | None = None,
    recover: (
        Literal[
            "environment",
            "local",
            "memory",
            "release",
            "support",
            "system",
            "all",
        ]
        | None
    ) = None,
    syntaxcheck: (
        Literal[
            "environment",
            "local",
            "memory",
            "release",
            "support",
            "system",
            "all",
        ]
        | None
    ) = None,
    information: (
        Literal[
            "environment",
            "local",
            "memory",
            "release",
            "support",
            "system",
            "all",
        ]
        | None
    ) = None,
    uniquelibs: str | None = None,
    oldjob: str | None = None,
    fil: Literal["append", "new"] | None = None,
    globalmodel: str | None = None,
    cpus: int | None = None,
    parallel: Literal["domain", "loop"] | None = None,
    domains: int | None = None,
    dynamic_load_balancing: Literal["on", "off"] | None = None,
    mp_mode: Literal["mp", "threads"] | None = None,
    threads_per_mpi_process: int | None = None,
    standard_parallel: Literal["all", "solver"] | None = None,
    gpus: int | None = None,
    memory: str | None = None,
    interactive: bool = True,
    double: Literal["explicit", "both", "off", "constraint"] | None = None,
    scratch: str | None = None,
    output_precision: Literal["single", "full"] | None = None,
    resultsformat: Literal["odb", "sim", "both"] | None = None,
    port: int | None = None,
    host: str | None = None,
    csedirector: str | None = None,
    timeout: int | None = None,
    unconnected_regions: Literal["yes", "no"] | None = None,
    noFlexBody: bool | None = None,
    license_type: Literal["token", "credita"] | None = None,
    ssd_split: int | None = None,
    ssd_partition: int | None = None,
    **fmt_specs
)

Run an Abaqus simulation.

PARAMETER DESCRIPTION
output

Path to the output directory.

TYPE: str

includes

Paths to directories containing include files which will be added in the INCLUDE environment variable. Multiple directories should be separated by os.pathsep (; on Windows and : on Linux), relative paths will be resolved relative to the current working directory. For example, includes=".;eigen" will add the current working directory and the eigen directory to the INCLUDE environment variable.

TYPE: str DEFAULT: None

script

Path to the Abaqus/Python script to run before the simulation.

TYPE: str DEFAULT: None

input

Path to the Abaqus input file to run. If not specified, an input file will be searched for in the output directory, typically generated by the Abaqus/Python script specified by script.

TYPE: str DEFAULT: None

user

Path to the Abaqus user subroutine to compile and run.

TYPE: str DEFAULT: None

post

Path to the Abaqus/Python script to run after the simulation.

TYPE: str DEFAULT: None

vis

Path to the Python script to run after the simulation to visualize the results. Note that this script will be run with the local Python interpreter instead of the Abaqus/Python interpreter.

TYPE: str DEFAULT: None

overwrite

Whether to overwrite the files in the output directory.

TYPE: bool DEFAULT: False

compile

Whether to compile the user subroutine before running the simulation.

TYPE: bool DEFAULT: False

clear

Whether to remove temporary files after the simulation.

TYPE: bool DEFAULT: False

job

Name of the job.

TYPE: str DEFAULT: None

submit

Whether to submit the job to Abaqus.

TYPE: bool DEFAULT: True

analysis

See the Abaqus documentation for details.

TYPE: str DEFAULT: None

datacheck

See the Abaqus documentation for details.

TYPE: str DEFAULT: None

parametercheck

See the Abaqus documentation for details.

TYPE: str DEFAULT: None

continue1

See the Abaqus documentation for details.

TYPE: str DEFAULT: None

convert

See the Abaqus documentation for details.

TYPE: str DEFAULT: None

recover

See the Abaqus documentation for details.

TYPE: str DEFAULT: None

syntaxcheck

See the Abaqus documentation for details.

TYPE: str DEFAULT: None

information

See the Abaqus documentation for details.

TYPE: str DEFAULT: None

uniquelibs

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

oldjob

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

fil

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

globalmodel

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

cpus

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

parallel

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

domains

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

dynamic_load_balancing

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

mp_mode

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

threads_per_mpi_process

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

standard_parallel

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

gpus

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

memory

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

interactive

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

double

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

scratch

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

output_precision

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

resultsformat

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

port

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

host

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

csedirector

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

timeout

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

unconnected_regions

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

noFlexBody

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

license_type

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

ssd_split

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

ssd_partition

See the Abaqus documentation for details.

TYPE: str or int DEFAULT: None

fmt_specs

Specifications for formatting the files specified by script, inp, user, post, and vis with Jinja2.

DEFAULT: {}

CalibrationCLI

Bases: _CLIBase

Micromechanical model calibration command line interface.

Config classmethod

Config() -> Type[CalibrationConfig]

key classmethod

key() -> str

loadConfig classmethod

loadConfig(
    config: str | PathLike | None = None,
    base_config: str | PathLike | None = None,
    key: str = "",
) -> CalibrationConfig

run

run(
    config: str | PathLike | None = None,
    base_config: str | PathLike | None = None,
    key: str = "",
    *,
    overwrite: bool | None = None,
    skip: bool | None = None,
    overwrite_figures: bool | None = None,
    include_calibrations: List[str] | str | None = None,
    exclude_calibrations: List[str] | str | None = None,
    include_models: List[str] | str | None = None,
    exclude_models: List[str] | str | None = None,
    continue_last_unfinished_run: bool = False,
    continue_last_unfinished_run_outcmaes: str | None = None,
    continue_last_run: bool = False,
    logfile: str | None = None,
    maxiter: int | None = None,
    maxfun: int | None = None,
    return_initial_fitness: bool = False,
    **kwargs
) -> Dict[str, float] | None

Calibrate the micromechanical model.

PARAMETER DESCRIPTION
config

Configuration file, by default None. If None, search for the default configuration files.

TYPE: str | PathLike | None DEFAULT: None

base_config

Base configuration file to merge with the main configuration file, by default None

TYPE: str | PathLike | None DEFAULT: None

key

Key of the table in the configuration file, by default ""

TYPE: str DEFAULT: ''

overwrite

Overwrite existing calibration, by default False

TYPE: bool DEFAULT: None

skip

Skip calibration, by default False

TYPE: bool DEFAULT: None

overwrite_figures

Overwrite existing figures, by default False

TYPE: bool DEFAULT: None

include_calibrations

Include calibrations, by default None (all). Can be glob patterns.

TYPE: List[str] | str DEFAULT: None

exclude_calibrations

Exclude calibrations, by default None. Can be glob patterns.

TYPE: List[str] | str DEFAULT: None

include_models

Include models, by default None (all). Can be glob patterns.

TYPE: List[str] | str DEFAULT: None

exclude_models

Exclude models, by default None. Can be glob patterns.

TYPE: List[str] | str DEFAULT: None

continue_last_unfinished_run

Continue the last unfinished calibration, by default False

TYPE: bool DEFAULT: False

continue_last_unfinished_run_outcmaes

Override the path to the outcmaes folder to continue the last unfinished calibration, by default None

TYPE: str DEFAULT: None

continue_last_run

Continue the last calibration, by default False

TYPE: bool DEFAULT: False

logfile

Print the output to a log file, by default None

TYPE: str DEFAULT: None

maxiter

Overriding the maximum number of iterations, by default None

TYPE: int DEFAULT: None

maxfun

Overriding the maximum number of function evaluations, by default None

TYPE: int DEFAULT: None

return_initial_fitness

Return initial fitness for debugging, by default False

TYPE: bool DEFAULT: False

kwargs

Additional keyword arguments to pass to the calibrate method.

TYPE: Any DEFAULT: {}

section classmethod

section() -> str

CleanCLI

Clean up things.

cache classmethod

cache(subdirectory: str = 'python', root: str = 'micromechanical')

Clean up caches.

PARAMETER DESCRIPTION
subdirectory

The subdirectory under the root directory to clean up, by default "python"

TYPE: str DEFAULT: 'python'

root

The root directory to clean up, by default "micromechanical" which is the root of the current project

TYPE: str DEFAULT: 'micromechanical'

MicromechanicalCLI

Micromechanical model command line interface.

abaqus instance-attribute

abaqus: AbaqusCLI = AbaqusCLI()

Run abaqus command

calibration instance-attribute

calibration: CalibrationCLI = CalibrationCLI()

Perform micromechanical calibrations

clean instance-attribute

clean: CleanCLI = CleanCLI()

Clean up things

plot instance-attribute

plot: PlotCLI = PlotCLI()

Plot figures with micromechanical models

plugin instance-attribute

plugin: PluginCLI = PluginCLI()

Build C++ plugins

schema instance-attribute

schema: SchemaCLI = SchemaCLI()

Generate JSON schema files for configuration files

__call__

__call__(*, version: bool = False, include: bool = False)

Print project metadata

PARAMETER DESCRIPTION
version

Print the version number, by default False

TYPE: bool DEFAULT: False

include

Print the path to the C/C++ header files, by default False

TYPE: bool DEFAULT: False

__init__

__init__()

qtapp

qtapp(argv: List[str] = None, **kwargs)

Launch the Qt application.

PlotCLI

Bases: _CLIBase

Micromechanical plot command line interface.

Config classmethod

Config() -> Type[PlotConfig]

key classmethod

key() -> str

loadConfig classmethod

loadConfig(
    config: str | PathLike | None = None,
    base_config: str | PathLike | None = None,
    key: str = "",
) -> PlotConfig

run

run(
    config: str | PathLike | None = None,
    base_config: str | PathLike | None = None,
    key: str = "",
    *,
    overwrite: bool | None = None,
    include_plots: List[str] | str | None = None,
    exclude_plots: List[str] | str | None = None,
    include_models: List[str] | str | None = None,
    exclude_models: List[str] | str | None = None
)

Plotting command line interface.

PARAMETER DESCRIPTION
config

Configuration file, by default None. If None, search for the default configuration files.

TYPE: str | PathLike | None DEFAULT: None

base_config

Base configuration file to merge with the main configuration file, by default None

TYPE: str | PathLike | None DEFAULT: None

key

Key of the table in the configuration file, by default ""

TYPE: str DEFAULT: ''

overwrite

Overwrite existing figures, by default False

TYPE: bool DEFAULT: None

include_plots

Include plots, by default None (all). Can be glob patterns.

TYPE: List[str] | str DEFAULT: None

exclude_plots

Exclude plots, by default None. Can be glob patterns.

TYPE: List[str] | str DEFAULT: None

include_models

Include models, by default None (all). Can be glob patterns.

TYPE: List[str] | str DEFAULT: None

exclude_models

Exclude models, by default None. Can be glob patterns.

TYPE: List[str] | str DEFAULT: None

section classmethod

section() -> str

PluginCLI

Micromechanical model plugin command line interface.

make classmethod

make(
    *plugins: str,
    project: str = "micromechanical-plugin",
    working_directory: str = "micromechanical-plugin",
    includes: str | None = None,
    build: str = "build",
    build_type: str = "Release",
    cmake_minimum_required: str = "3.16",
    cxx_standard: str | int = 11,
    output_directory: str = "",
    cmake: str = "cmake",
    cmake_generate_args: str = "",
    cmake_build_args: str = ""
)

Build a micromechanical model plugin.

PARAMETER DESCRIPTION
plugins

The plugin source file.

TYPE: str DEFAULT: ()

project

The project name

TYPE: str DEFAULT: 'micromechanical-plugin'

working_directory

The working directory

TYPE: str DEFAULT: 'micromechanical-plugin'

includes

The include directories separated by os.pathsep, relative paths are resolved to be absolute

TYPE: str DEFAULT: None

build

The build directory relative to the working directory

TYPE: str DEFAULT: 'build'

build_type

The build type

TYPE: str DEFAULT: 'Release'

cmake_minimum_required

The minimum required CMake version

TYPE: str DEFAULT: '3.16'

cxx_standard

The C++ standard

TYPE: str or int DEFAULT: 11

output_directory

The output directory relative to the working directory

TYPE: str DEFAULT: ''

cmake

The CMake executable

TYPE: str DEFAULT: 'cmake'

cmake_generate_args

Additional arguments for the CMake generate step

TYPE: str DEFAULT: ''

cmake_build_args

Additional arguments for the CMake build step

TYPE: str DEFAULT: ''

SchemaCLI

Micromechanical model JSON Schema command line interface.

generate classmethod

generate(
    type: Literal["config", "labels", "calibrations", "plots"],
    output: str | PathLike,
    **kwargs
)

Generate the JSON Schema of the micromechanical configuration.

PARAMETER DESCRIPTION
type

Type of JSON schema to generate.

TYPE: Literal['config', 'labels', 'calibrations', 'plots']

output

Path to the output file.

TYPE: str | PathLike

kwargs

Additional keyword arguments passed to the pydantic model_json_schema method.

DEFAULT: {}