Skip to content

Commit

Permalink
Added if statement to set roughness to 1 if not in variables
Browse files Browse the repository at this point in the history
  • Loading branch information
DrSOKane committed Jun 21, 2022
1 parent fea7d4c commit 5b321a7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
32 changes: 22 additions & 10 deletions examples/notebooks/models/SEI-on-cracks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,31 @@
"metadata": {},
"outputs": [
{
"ename": "KeyError",
"evalue": "'Negative electrode roughness ratio'",
"name": "stderr",
"output_type": "stream",
"text": [
"At t = 0.00698581, , mxstep steps taken before reaching tout.\n"
]
},
{
"ename": "SolverError",
"evalue": "Could not solve for summary variables, run `sim.solve(calc_esoh=False)` to skip this step",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"Input \u001b[0;32mIn [2]\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m parameter_values \u001b[38;5;241m=\u001b[39m pybamm\u001b[38;5;241m.\u001b[39mParameterValues(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAi2020\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m----> 2\u001b[0m model1 \u001b[38;5;241m=\u001b[39m \u001b[43mpybamm\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlithium_ion\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mDFN\u001b[49m\u001b[43m(\u001b[49m\u001b[43m{\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mSEI\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43msolvent-diffusion limited\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m}\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 3\u001b[0m model2 \u001b[38;5;241m=\u001b[39m pybamm\u001b[38;5;241m.\u001b[39mlithium_ion\u001b[38;5;241m.\u001b[39mDFN({\n\u001b[1;32m 4\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mparticle mechanics\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mswelling and cracking\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 5\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSEI\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msolvent-diffusion limited\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 6\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSEI on cracks\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtrue\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 7\u001b[0m })\n\u001b[1;32m 8\u001b[0m experiment \u001b[38;5;241m=\u001b[39m pybamm\u001b[38;5;241m.\u001b[39mExperiment([\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDischarge at 1C until 3 V\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n",
"File \u001b[0;32m~/PyBaMM/pybamm/models/full_battery_models/lithium_ion/dfn.py:66\u001b[0m, in \u001b[0;36mDFN.__init__\u001b[0;34m(self, options, name, build)\u001b[0m\n\u001b[1;32m 63\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mset_li_metal_counter_electrode_submodels()\n\u001b[1;32m 65\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m build:\n\u001b[0;32m---> 66\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbuild_model\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 68\u001b[0m pybamm\u001b[38;5;241m.\u001b[39mcitations\u001b[38;5;241m.\u001b[39mregister(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDoyle1993\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
"File \u001b[0;32m~/PyBaMM/pybamm/models/full_battery_models/base_battery_model.py:863\u001b[0m, in \u001b[0;36mBaseBatteryModel.build_model\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 860\u001b[0m pybamm\u001b[38;5;241m.\u001b[39mlogger\u001b[38;5;241m.\u001b[39minfo(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mStart building \u001b[39m\u001b[38;5;132;01m{}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mformat(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mname))\n\u001b[1;32m 862\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_built_fundamental_and_external \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m:\n\u001b[0;32m--> 863\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbuild_fundamental_and_external\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 865\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuild_coupled_variables()\n\u001b[1;32m 867\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuild_model_equations()\n",
"File \u001b[0;32m~/PyBaMM/pybamm/models/full_battery_models/base_battery_model.py:751\u001b[0m, in \u001b[0;36mBaseBatteryModel.build_fundamental_and_external\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 745\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m submodel_name, submodel \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msubmodels\u001b[38;5;241m.\u001b[39mitems():\n\u001b[1;32m 746\u001b[0m pybamm\u001b[38;5;241m.\u001b[39mlogger\u001b[38;5;241m.\u001b[39mdebug(\n\u001b[1;32m 747\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mGetting fundamental variables for \u001b[39m\u001b[38;5;132;01m{}\u001b[39;00m\u001b[38;5;124m submodel (\u001b[39m\u001b[38;5;132;01m{}\u001b[39;00m\u001b[38;5;124m)\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mformat(\n\u001b[1;32m 748\u001b[0m submodel_name, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mname\n\u001b[1;32m 749\u001b[0m )\n\u001b[1;32m 750\u001b[0m )\n\u001b[0;32m--> 751\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mvariables\u001b[38;5;241m.\u001b[39mupdate(\u001b[43msubmodel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_fundamental_variables\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 753\u001b[0m \u001b[38;5;66;03m# Set the submodels that are external\u001b[39;00m\n\u001b[1;32m 754\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m sub \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moptions[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mexternal submodels\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n",
"File \u001b[0;32m~/PyBaMM/pybamm/models/submodels/interface/sei/no_sei.py:37\u001b[0m, in \u001b[0;36mNoSEI.get_fundamental_variables\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 33\u001b[0m zero \u001b[38;5;241m=\u001b[39m pybamm\u001b[38;5;241m.\u001b[39mFullBroadcast(\n\u001b[1;32m 34\u001b[0m pybamm\u001b[38;5;241m.\u001b[39mScalar(\u001b[38;5;241m0\u001b[39m), \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnegative electrode\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcurrent collector\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 35\u001b[0m )\n\u001b[1;32m 36\u001b[0m variables \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_standard_thickness_variables(zero, zero)\n\u001b[0;32m---> 37\u001b[0m variables\u001b[38;5;241m.\u001b[39mupdate(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_get_standard_concentration_variables\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariables\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 38\u001b[0m variables\u001b[38;5;241m.\u001b[39mupdate(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_standard_reaction_variables(zero, zero))\n\u001b[1;32m 39\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m variables\n",
"File \u001b[0;32m~/PyBaMM/pybamm/models/submodels/interface/sei/base_sei.py:230\u001b[0m, in \u001b[0;36mBaseModel._get_standard_concentration_variables\u001b[0;34m(self, variables)\u001b[0m\n\u001b[1;32m 228\u001b[0m L_inner_cr \u001b[38;5;241m=\u001b[39m variables[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mInner SEI on cracks thickness\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m 229\u001b[0m L_outer_cr \u001b[38;5;241m=\u001b[39m variables[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mOuter SEI on cracks thickness\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[0;32m--> 230\u001b[0m roughness \u001b[38;5;241m=\u001b[39m \u001b[43mvariables\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdomain\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m electrode roughness ratio\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 232\u001b[0m n_inner_cr \u001b[38;5;241m=\u001b[39m L_inner_cr \u001b[38;5;241m*\u001b[39m (roughness \u001b[38;5;241m-\u001b[39m \u001b[38;5;241m1\u001b[39m) \u001b[38;5;66;03m# inner SEI cracks concentration\u001b[39;00m\n\u001b[1;32m 233\u001b[0m n_outer_cr \u001b[38;5;241m=\u001b[39m L_outer_cr \u001b[38;5;241m*\u001b[39m (roughness \u001b[38;5;241m-\u001b[39m \u001b[38;5;241m1\u001b[39m) \u001b[38;5;66;03m# outer SEI cracks concentration\u001b[39;00m\n",
"\u001b[0;31mKeyError\u001b[0m: 'Negative electrode roughness ratio'"
"\u001b[0;31mSolverError\u001b[0m Traceback (most recent call last)",
"File \u001b[0;32m~/PyBaMM/pybamm/solvers/solution.py:918\u001b[0m, in \u001b[0;36mget_cycle_summary_variables\u001b[0;34m(cycle_solution, esoh_sim)\u001b[0m\n\u001b[1;32m 917\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 918\u001b[0m esoh_sol \u001b[38;5;241m=\u001b[39m \u001b[43mesoh_sim\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msolve\u001b[49m\u001b[43m(\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43minputs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minputs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msolver\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msolver\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 919\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m pybamm\u001b[38;5;241m.\u001b[39mSolverError: \u001b[38;5;66;03m# pragma: no cover\u001b[39;00m\n",
"File \u001b[0;32m~/PyBaMM/pybamm/simulation.py:710\u001b[0m, in \u001b[0;36mSimulation.solve\u001b[0;34m(self, t_eval, solver, check_model, save_at_cycles, calc_esoh, starting_solution, initial_soc, callbacks, **kwargs)\u001b[0m\n\u001b[1;32m 696\u001b[0m warnings\u001b[38;5;241m.\u001b[39mwarn(\n\u001b[1;32m 697\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 698\u001b[0m \u001b[38;5;124;03m The largest timestep in t_eval ({}) is larger than\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 707\u001b[0m pybamm\u001b[38;5;241m.\u001b[39mSolverWarning,\n\u001b[1;32m 708\u001b[0m )\n\u001b[0;32m--> 710\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_solution \u001b[38;5;241m=\u001b[39m \u001b[43msolver\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msolve\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbuilt_model\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mt_eval\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 712\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moperating_mode \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mwith experiment\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n",
"File \u001b[0;32m~/PyBaMM/pybamm/solvers/base_solver.py:1083\u001b[0m, in \u001b[0;36mBaseSolver.solve\u001b[0;34m(self, model, t_eval, external_variables, inputs, initial_conditions, nproc, calculate_sensitivities)\u001b[0m\n\u001b[1;32m 1082\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m ninputs \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[0;32m-> 1083\u001b[0m new_solution \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_integrate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1084\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1085\u001b[0m \u001b[43m \u001b[49m\u001b[43mt_eval_dimensionless\u001b[49m\u001b[43m[\u001b[49m\u001b[43mstart_index\u001b[49m\u001b[43m:\u001b[49m\u001b[43mend_index\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1086\u001b[0m \u001b[43m \u001b[49m\u001b[43mext_and_inputs_list\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1087\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1088\u001b[0m new_solutions \u001b[38;5;241m=\u001b[39m [new_solution]\n",
"File \u001b[0;32m~/PyBaMM/pybamm/solvers/casadi_algebraic_solver.py:184\u001b[0m, in \u001b[0;36mCasadiAlgebraicSolver._integrate\u001b[0;34m(self, model, t_eval, inputs_dict)\u001b[0m\n\u001b[1;32m 183\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m success:\n\u001b[0;32m--> 184\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m pybamm\u001b[38;5;241m.\u001b[39mSolverError(\n\u001b[1;32m 185\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not find acceptable solution: \u001b[39m\u001b[38;5;132;01m{}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mformat(message)\n\u001b[1;32m 186\u001b[0m )\n\u001b[1;32m 187\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28many\u001b[39m(np\u001b[38;5;241m.\u001b[39misnan(fun)):\n",
"\u001b[0;31mSolverError\u001b[0m: Could not find acceptable solution: .../casadi/core/rootfinder.cpp:280: rootfinder process failed. Set 'error_on_fail' option to false to ignore this error.",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mSolverError\u001b[0m Traceback (most recent call last)",
"Input \u001b[0;32mIn [2]\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 8\u001b[0m experiment \u001b[38;5;241m=\u001b[39m pybamm\u001b[38;5;241m.\u001b[39mExperiment([\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDischarge at 1C until 3 V\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n\u001b[1;32m 9\u001b[0m sim1 \u001b[38;5;241m=\u001b[39m pybamm\u001b[38;5;241m.\u001b[39mSimulation(model1, parameter_values\u001b[38;5;241m=\u001b[39mparameter_values, experiment\u001b[38;5;241m=\u001b[39mexperiment)\n\u001b[0;32m---> 10\u001b[0m sol1 \u001b[38;5;241m=\u001b[39m \u001b[43msim1\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msolve\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 11\u001b[0m sim2 \u001b[38;5;241m=\u001b[39m pybamm\u001b[38;5;241m.\u001b[39mSimulation(model2, parameter_values\u001b[38;5;241m=\u001b[39mparameter_values, experiment\u001b[38;5;241m=\u001b[39mexperiment)\n\u001b[1;32m 12\u001b[0m sol2 \u001b[38;5;241m=\u001b[39m sim2\u001b[38;5;241m.\u001b[39msolve()\n",
"File \u001b[0;32m~/PyBaMM/pybamm/simulation.py:858\u001b[0m, in \u001b[0;36mSimulation.solve\u001b[0;34m(self, t_eval, solver, check_model, save_at_cycles, calc_esoh, starting_solution, initial_soc, callbacks, **kwargs)\u001b[0m\n\u001b[1;32m 856\u001b[0m \u001b[38;5;66;03m# At the final step of the inner loop we save the cycle\u001b[39;00m\n\u001b[1;32m 857\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(steps) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m--> 858\u001b[0m cycle_sol \u001b[38;5;241m=\u001b[39m \u001b[43mpybamm\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmake_cycle_solution\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 859\u001b[0m \u001b[43m \u001b[49m\u001b[43msteps\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 860\u001b[0m \u001b[43m \u001b[49m\u001b[43mesoh_sim\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 861\u001b[0m \u001b[43m \u001b[49m\u001b[43msave_this_cycle\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msave_this_cycle\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 862\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 863\u001b[0m cycle_solution, cycle_sum_vars, cycle_first_state \u001b[38;5;241m=\u001b[39m cycle_sol\n\u001b[1;32m 864\u001b[0m all_cycle_solutions\u001b[38;5;241m.\u001b[39mappend(cycle_solution)\n",
"File \u001b[0;32m~/PyBaMM/pybamm/solvers/solution.py:812\u001b[0m, in \u001b[0;36mmake_cycle_solution\u001b[0;34m(step_solutions, esoh_sim, save_this_cycle)\u001b[0m\n\u001b[1;32m 808\u001b[0m cycle_solution\u001b[38;5;241m.\u001b[39mset_up_time \u001b[38;5;241m=\u001b[39m sum_sols\u001b[38;5;241m.\u001b[39mset_up_time\n\u001b[1;32m 810\u001b[0m cycle_solution\u001b[38;5;241m.\u001b[39msteps \u001b[38;5;241m=\u001b[39m step_solutions\n\u001b[0;32m--> 812\u001b[0m cycle_summary_variables \u001b[38;5;241m=\u001b[39m \u001b[43mget_cycle_summary_variables\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcycle_solution\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mesoh_sim\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 814\u001b[0m cycle_first_state \u001b[38;5;241m=\u001b[39m cycle_solution\u001b[38;5;241m.\u001b[39mfirst_state\n\u001b[1;32m 816\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m save_this_cycle:\n",
"File \u001b[0;32m~/PyBaMM/pybamm/solvers/solution.py:920\u001b[0m, in \u001b[0;36mget_cycle_summary_variables\u001b[0;34m(cycle_solution, esoh_sim)\u001b[0m\n\u001b[1;32m 918\u001b[0m esoh_sol \u001b[38;5;241m=\u001b[39m esoh_sim\u001b[38;5;241m.\u001b[39msolve([\u001b[38;5;241m0\u001b[39m], inputs\u001b[38;5;241m=\u001b[39minputs, solver\u001b[38;5;241m=\u001b[39msolver)\n\u001b[1;32m 919\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m pybamm\u001b[38;5;241m.\u001b[39mSolverError: \u001b[38;5;66;03m# pragma: no cover\u001b[39;00m\n\u001b[0;32m--> 920\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m pybamm\u001b[38;5;241m.\u001b[39mSolverError(\n\u001b[1;32m 921\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not solve for summary variables, run \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 922\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m`sim.solve(calc_esoh=False)` to skip this step\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 923\u001b[0m )\n\u001b[1;32m 924\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m var \u001b[38;5;129;01min\u001b[39;00m esoh_sim\u001b[38;5;241m.\u001b[39mbuilt_model\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m 925\u001b[0m cycle_summary_variables[var] \u001b[38;5;241m=\u001b[39m esoh_sol[var]\u001b[38;5;241m.\u001b[39mdata[\u001b[38;5;241m0\u001b[39m]\n",
"\u001b[0;31mSolverError\u001b[0m: Could not solve for summary variables, run `sim.solve(calc_esoh=False)` to skip this step"
]
}
],
Expand Down
5 changes: 4 additions & 1 deletion pybamm/models/submodels/interface/sei/base_sei.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ def _get_standard_concentration_variables(self, variables):
elif self.reaction == "SEI on cracks":
L_inner_cr = variables["Inner SEI on cracks thickness"]
L_outer_cr = variables["Outer SEI on cracks thickness"]
roughness = variables[self.domain + " electrode roughness ratio"]
if self.domain + " electrode roughness ratio" in variables:
roughness = variables[self.domain + " electrode roughness ratio"]
else:
roughness = 1

n_inner_cr = L_inner_cr * (roughness - 1) # inner SEI cracks concentration
n_outer_cr = L_outer_cr * (roughness - 1) # outer SEI cracks concentration
Expand Down

0 comments on commit 5b321a7

Please sign in to comment.