Simulation
keyword arguments (var_pts, submesh_types, spatial_methods, solver)
that Ionworks stores on a Model or
Parameterized Model and re-applies every time
the model is simulated.
A model’s equations do not depend on the mesh or solver, but the settings a
fitted parameter set needs often do. A fitted solid diffusivity with a steep
near-surface gradient, for example, needs a refined, surface-clustered particle
mesh to solve accurately — and defaulting back to PyBaMM’s coarse grid would
give the wrong voltage. Simulation settings let you pin those requirements to
the model or parameter set once, so every downstream simulation runs on the
grid and solver the parameters were fit against.
When to use them
Attach simulation settings when either of these is true:- Your parameters were fit with a non-default mesh (for example, a refined
particle mesh with a
Chebyshev1DSubMesh) and you want that mesh applied automatically whenever the parameterized model runs. - A specific model configuration requires a particular solver or solver tolerance to be numerically stable.
simulation_settings unset (or None) and PyBaMM’s own
default_var_pts / default_submesh_types / default_spatial_methods /
default_solver are used.
What you can configure
All fields are optional. Any field you omit falls back to the model default.
Every class named in a stored block is checked against a static allowlist on
write, so a class that isn’t listed below is rejected with a
BAD_REQUEST
rather than stored and resolved later.
Allowed spatial variables for var_pts: x_n, x_s, x_p, r_n, r_p,
R_n, R_p, y, z, and their _prim / _sec variants for composite
electrodes. Values must be positive integers.
Allowed submesh classes: Uniform1DSubMesh, Exponential1DSubMesh,
Chebyshev1DSubMesh, UserSupplied1DSubMesh, SpectralVolume1DSubMesh,
SymbolicUniform1DSubMesh, SubMesh0D.
Allowed spatial-method classes: FiniteVolume, SpectralVolume,
ZeroDimensionalSpatialMethod.
Allowed solver classes: IDAKLUSolver, AlgebraicSolver, NonlinearSolver.
CasadiSolver and ScipySolver are deprecated in PyBaMM and cannot be
persisted. See Ionworks DAE Solver for the
fast default used behind ionworkspipeline.Simulation.
Precedence
At simulation time, Ionworks merges the persisted settings with a fixed precedence — higher layers win, per key:- Mesh keys (
var_pts,submesh_types,spatial_methods) merge per key — and per key over the model’s own PyBaMM defaults, so the map handed toSimulationis always complete. A parameterized model can therefore refine justr_nandr_pwithout restating the rest of the grid, and a runtimesimulation_kwargsthat names onlyr_poverrides that one entry rather than dropping the persistedr_n. solveris replaced wholesale by the highest layer that sets it — a partial solver is ambiguous.- An explicit per-run
simulation_kwargsoverride always wins, so debugging a single run never requires editing the persisted settings.
Pipeline design objectives are the one exception: only the resolved
var_pts and solver are folded into them. A persisted submesh_types or
spatial_methods is deliberately not applied there, because a design
objective needs the symbolic submesh the design-optimization converter
installs. Protocol simulations and the model/parameterized-model simulate path
apply all four keys.Attaching settings through the API
Bothclient.model and client.parameterized_model accept a
simulation_settings field on create and update. See the
Python API reference for the full sub-client surface.
On a model
On a parameterized model
Parameter-specific settings take precedence over the base model’s settings, so this is where fitted-parameter mesh refinements usually belong:"simulation_settings": None clears the field and inherits the base
model’s settings (or the PyBaMM defaults if the base model has none either).
Attaching settings in a pipeline
Theionworks_schema model classes (GITTModel,
MSMRFullCellModel, MSMRHalfCellModel, LumpedSPMR, LumpedSPMeR, ECM,
…) accept a simulation_settings argument that is serialized alongside the
model config when the pipeline is submitted:
MeshGenerator / BaseSolver objects to
their canonical JSON form automatically, so the same settings survive a round
trip through the API.
Serialized form
Under the hood, simulation settings are stored as a flat JSON dict — this is also whatclient.model.get(...).simulation_settings returns and what the
migration column holds. A typical block looks like:
SimulationSettings schema class and let to_config() produce the same
payload for you.