Skip to main content
Add a custom variable to an existing model

Path Parameters

model_id
string
required

Body

application/json

Request body for adding a custom variable to an existing model.

name
string
required

Display name of the custom variable.

Minimum string length: 1
expression
string
required

PyBaMM expression string (e.g. CoupledVariable('Voltage [V]') - Parameter('Offset')).

Response

Successful Response

Model with config loaded from database.

name
string
required

The name of the model.

id
string
required

The unique identifier for the model.

user_id
string
required

The ID of the user who created the model.

organization_id
string
required

The ID of the organization this model belongs to.

created_at
string<date-time>
required

Timestamp of when the model was created.

updated_at
string<date-time>
required

Timestamp of when the model was last updated.

config
Config · object
required

Model configuration stored as JSON.

is_custom_model
boolean
required
read-only

Check if this is a custom model (has compressed model data).

description
string | null

An optional description for the model.

pybamm_version
string | null

PyBaMM version used for this model. If not provided, will be read from pybamm.version.

chemistry
enum<string>
default:lithium_ion

Model chemistry kind: 'lithium_ion' (default — assumes pybamm lithium-ion conventions), 'lithium_sulfur', 'ecm', or 'generic' (no chemistry-specific enrichment).

Available options:
lithium_ion,
lithium_sulfur,
ecm,
generic
simulation_settings
Simulation Settings · object | null

Optional persistent simulation kwargs (var_pts / submesh_types / spatial_methods / geometry / solver) in the flat canonical form, re-applied at simulation time. None uses the model defaults.

created_by_email
string | null

Email of the user who created the model.