Models¶
Schemas for battery models supported by the pipeline. Mirrors
ionworkspipeline.models.
Schemas for models.
- class ionworks_schema.models.ECM(options=None, simulation_settings=None)¶
Bases:
BaseSchemaA class for the Equivalent Circuit Model.
Parameters¶
- optionsECMOptions or dict, optional
See
ECMOptionsfor the available keys.- simulation_settings
SimulationSettingsor dict, optional Persistent simulation settings (mesh + solver) re-applied at simulation time. When
Nonethe model defaults are used.
Extends:
ionworks_schema.base.BaseSchema- simulation_settings: Annotated[SimulationSettings | dict[str, Any], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])] | None¶
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks_schema.models.GITTModel(options=None, simulation_settings=None)¶
Bases:
BaseSchemaDiffusion-only model for fitting solid diffusivities to GITT or pulse data.
The model solves x-averaged spherical particle diffusion in each modelled electrode, with the surface flux set by the applied current, and computes the cell voltage from the electrode open-circuit potentials evaluated at the particle surface stoichiometries, minus an ohmic drop through a single lumped
"Ohmic resistance [Ohm]"parameter. There are no reaction kinetics (Butler-Volmer), no electrolyte dynamics, and no thermal effects; all parameters are constant except the open-circuit potentials.The
"working electrode"option selects the cell configuration:"both"(default): full cell. Both electrodes are modelled and the voltage is the difference of their open-circuit potentials minus the ohmic drop. A positive (discharge) current delithiates the negative electrode and lithiates the positive electrode."positive": half-cell against a lithium-metal counter electrode, following the pybamm half-cell convention. Only the working electrode is modelled (the counter electrode contributes no overpotential) and the voltage is its open-circuit potential minus the ohmic drop. A positive (discharge) current lithiates the working electrode. As in pybamm, anode-material half cells are also expressed with"positive"— rename the anode’s parameters to the positive convention first.
This is a fitting model intended for extracting solid-phase diffusivities (and the lumped ohmic resistance) from GITT or pulse-relaxation measurements — it is not a general-purpose simulation model. Each modelled electrode is parameterised with the standard full-cell parameter names (thickness, active material volume fraction, particle radius, diffusivity, OCP, maximum and initial concentrations) plus the current function, electrode cross-sectional area, initial temperature, and
"Ohmic resistance [Ohm]".Parameters¶
- optionsGITTModelOptions or dict, optional
See
GITTModelOptionsfor the available keys.- simulation_settings
SimulationSettingsor dict, optional Persistent simulation settings (mesh + solver) re-applied at simulation time. When
Nonethe model defaults are used.
Extends:
ionworks_schema.base.BaseSchema- simulation_settings: Annotated[SimulationSettings | dict[str, Any], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])] | None¶
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks_schema.models.LumpedSPMR(options=None, simulation_settings=None)¶
Bases:
BaseSchemaA class for the Lumped Single Particle Model with Resistance.
Extends:
ionworks_schema.base.BaseSchema- simulation_settings: Annotated[SimulationSettings | dict[str, Any], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])] | None¶
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks_schema.models.LumpedSPMeR(options=None, simulation_settings=None)¶
Bases:
BaseSchemaA class for the Lumped Single Particle Model with electrolyte and Resistance.
Extends:
ionworks_schema.base.BaseSchema- simulation_settings: Annotated[SimulationSettings | dict[str, Any], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])] | None¶
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks_schema.models.MSMRFullCellModel(negative_electrode_model, positive_electrode_model, options=None, simulation_settings=None)¶
Bases:
BaseSchemaFull-cell MSMR model of the open-circuit potential — pairs a negative and positive half-cell MSMR model into one full-cell OCV.
Use this with
MSMRFullCellto fit an MSMR description of a full cell from full-cell OCV data.Parameters¶
- negative_electrode_model
MSMRHalfCellModel MSMR model for the negative electrode.
- positive_electrode_model
MSMRHalfCellModel MSMR model for the positive electrode.
- optionsdict, optional
Extra options forwarded to the underlying model.
- simulation_settings
SimulationSettingsor dict, optional Persistent simulation settings (mesh + solver) re-applied at simulation time. When
Nonethe model defaults are used.
Extends:
ionworks_schema.base.BaseSchema- negative_electrode_model: Annotated[dict[str, Any] | BaseSchema, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]¶
- positive_electrode_model: Annotated[dict[str, Any] | BaseSchema, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]¶
- simulation_settings: Annotated[SimulationSettings | dict[str, Any], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])] | None¶
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- negative_electrode_model
- class ionworks_schema.models.MSMRHalfCellModel(electrode, options=None, simulation_settings=None)¶
Bases:
BaseSchemaHalf-cell MSMR (Multi-Species Multi-Reaction) model for one electrode’s open-circuit potential.
Parameters¶
- electrodestr
Electrode the model describes —
"positive"or"negative".- optionsMSMRHalfCellModelOptions or dict, optional
See
MSMRHalfCellModelOptionsfor the available keys.- simulation_settings
SimulationSettingsor dict, optional Persistent simulation settings (mesh + solver) re-applied at simulation time. When
Nonethe model defaults are used.
For a composite electrode (
particle phases="2") the lower excess may be given either as a per-phase split (Primary/Secondary: {Electrode} electrode lower excess capacity [A.h], summed) when it is known from another source, or as a single electrode-level{Electrode} electrode lower excess capacity [A.h]when it is not.Extends:
ionworks_schema.base.BaseSchema- simulation_settings: Annotated[SimulationSettings | dict[str, Any], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])] | None¶
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks_schema.models.SimulationSettings(var_pts=None, submesh_types=None, spatial_methods=None, geometry=None, solver=None)¶
Bases:
BaseSchemaPersistent simulation settings attached to a model or parameterized model.
A flat bag of pybamm
Simulationkeyword arguments that should be applied whenever this (parameterized) model is simulated. The fields mirror the pybamm kwargs exactly, so the serialized form is folded straight intosimulation_kwargsat solve time with no reshaping.The required settings are parameter-dependent: a fitted solid diffusivity with a steep near-surface gradient needs a refined, surface-clustered particle mesh (and sometimes a specific solver) that the model defaults do not provide. All fields are optional; a higher-precedence source merges over a lower one per key, so a parameterized model can refine just
r_n/r_p(or swap the solver) without restating everything.Parameters¶
- var_ptsdict of str to int, optional
Number of mesh points per spatial variable, e.g.
{"r_n": 16, "r_p": 16}. Stored as a plain JSON dict of ints.- submesh_typesdict, optional
Mapping of domain name (e.g.
"negative particle") to a serialized submesh — apybamm.MeshGenerator.to_config()payload ({"$type": "type", "class": ..., "submesh_params": {...}}). A live{domain: pybamm.MeshGenerator}mapping is accepted at construction and serialized to this form byto_config().- spatial_methodsdict, optional
Mapping of domain name to a serialized
pybamm.SpatialMethod.- geometrydict, optional
Serialized geometry override. Rarely needed; when absent the geometry is derived from the model.
- solverdict, optional
Serialized solver configuration (
pybamm.BaseSolver.to_config()form — the solver class name under"type"plus its tolerances/options). A livepybamm.BaseSolveris accepted and serialized byto_config().
Notes¶
to_config()emits the flat canonical form — plainvar_ptsints andsubmesh_typesas a flat per-domain map — with no"type"discriminator, so the block is a plain nested dict ready to use assimulation_kwargs.Extends:
ionworks_schema.base.BaseSchema- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks_schema.models.SingleElectrodeLumpedSPMR(options=None, simulation_settings=None)¶
Bases:
BaseSchemaA class for the single-electrode Lumped SPM with Resistance.
Extends:
ionworks_schema.base.BaseSchema- simulation_settings: Annotated[SimulationSettings | dict[str, Any], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])] | None¶
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].