主要内容

batterySolverOptions

Mesh and solver options for battery P2D analysis

Since R2026a

    Description

    A batterySolverOptions object contains options used by the solvers when solving a battery P2D problem specified as a batteryP2DModel object. The batteryP2DModel object contains the batterySolverOptions object in its SolverOptions property.

    Creation

    Description

    options = batterySolverOptions(PropertyName=Value) creates a batterySolverOptions object and specifies properties for the mesh and the ODE solver settings. For example, you can specify the number of anode, cathode, and separator mesh elements, number of elements along particle radius, as well as the ODE solver to use and the tolerances for the internal solvers.

    example

    Properties

    expand all

    Mesh

    Number of anode mesh elements, specified as a positive integer.

    Data Types: double

    Number of separator mesh elements, specified as a positive integer.

    Data Types: double

    Number of cathode mesh elements, specified as a positive integer.

    Data Types: double

    Number of elements along the particle radius, specified as a positive integer.

    Data Types: double

    Element polynomial order, specified as "linear" or "quadratic".

    Data Types: string

    ODE Solver

    ODE solver to use, specified as "idas" or "ode15s". For more information about these ODE solvers, see Solver Control.

    Data Types: string

    Absolute tolerance for the internal ODE solver, specified as a positive number. The absolute tolerance is a threshold below which the value of the solution component is insignificant. This property determines the accuracy when the solution approaches zero.

    Data Types: double

    Relative tolerance for the internal ODE solver, specified as a positive number. The relative tolerance is a measure of the error relative to the size of each solution component. This property controls (roughly) the number of correct digits in all solution components, except those smaller than the threshold imposed by AbsoluteTolerance. The default value corresponds to 0.1% accuracy.

    Data Types: double

    Maximum step size, specified as a positive number. This property sets the upper bound on the size of any step taken by the solver.

    Data Types: double

    Suggested initial step size, specified as a positive number. This property sets the upper bound on the size of the first step taken by the solver.

    If you do not specify an initial step size, then the solver bases the initial step size on the slope of the solution at the initial time point of the integration. If the slope of all solution components is zero, then the solver might try a step size that is too large. If you know the initial step size is too large, or if you want to be sure that the solver resolves important behavior at the beginning of the integration, then use InitialStep to provide a suitable initial step size.

    Data Types: double

    Maximum order of the formula, specified as a positive integer not exceeding 5. Use this property to specify the maximum order of the formula used by the ode15s or idas solvers.

    Data Types: double

    Option to use backward differentiation formulas (BDFs) with the ode15s solver, specified as "off" or "on". The default numerical differentiation formulas (NDFs) are generally more efficient than BDFs, but the two are closely related.

    Data Types: string | char

    Minimum step size, specified as a positive number. This property sets the lower bound on the size of any step taken by the solver.

    Data Types: double

    Examples

    collapse all

    Create an object that specifies the mesh and solver options for the battery P2D analysis.

    options = batterySolverOptions( ...
        NumElementsAnode=15, ...
        NumElementsCathode=15, ...
        NumElementsSeparator=5, ...
        Solver="ode15s", ...
        AbsoluteTolerance=1.0000e-05);

    Create a battery pseudo-2D model using this object to specify the SolverOptions property of the model.

    model = batteryP2DModel( ...
    SolverOptions=options)
    model = 
      batteryP2DModel with properties:
    
       Components
                       Anode: [1×1 batteryElectrode]
                     Cathode: [1×1 batteryElectrode]
                   Separator: [1×1 batterySeparator]
                 Electrolyte: [1×1 batteryElectrolyte]
    
       Configurations
           InitialConditions: [1×1 batteryInitialConditions]
                 CyclingStep: [1×1 batteryCyclingStep]
               SolverOptions: [1×1 batterySolverOptions]
    
       Constants
             FaradayConstant: 96487
        UniversalGasConstant: 8.3140
    
    
    model.SolverOptions
    ans = 
      batterySolverOptions with properties:
    
       Mesh Settings
            NumElementsAnode: 15
        NumElementsSeparator: 5
          NumElementsCathode: 15
         NumElementsParticle: 3
              GeometricOrder: "quadratic"
    
       ODE Solver Settings
                      Solver: "ode15s"
           AbsoluteTolerance: 1.0000e-05
           RelativeTolerance: 1.0000e-03
                     MaxStep: []
                 InitialStep: []
                    MaxOrder: 5
                         BDF: "off"
                     MinStep: []
    
    

    Version History

    Introduced in R2026a