Error in simulation #2831
Unanswered
kumaryash7
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have defined electrolyte diffusivity and conductivity equations and also defined interpolation functions for negative electrode ocp and positive electrode ocp as follows:-
x_pos ,y_pos and x_neg and y_neg are numpy arrays defined as :-
_pos
x_pos ==> array([[0.40287624, 0.41599842, 0.4297446 , 0.44031858, 0.45194996,
0.46463874, 0.47627013, 0.4921311 , 0.50481988, 0.51750866,
0.53294668, 0.54478954, 0.5576898 , 0.57037858, 0.58200997,
0.59639058, 0.60738753, 0.62060501, 0.63382249, 0.64915476,
0.66131484, 0.6742151 , 0.6866924 , 0.70001562, 0.71453723,
0.72793094, 0.74220582, 0.75838401, 0.77445647, 0.78820265,
0.80237179, 0.8178098 , 0.83367078, 0.84530216, 0.85693354,
0.86962233, 0.88231111, 0.89711468, 0.91297566, 0.92460704,
0.93993932, 0.9520994 , 0.96478818, 0.97747696, 0.98593615,
0.99122314, 0.99439533, 0.99651013, 0.99862493, 0.99863493,
0.99958793]])
y_pos==>array([4.2879116 , 4.25454591, 4.22392693, 4.19562757, 4.1714262 ,
4.1478434 , 4.12232758, 4.09139932, 4.06839643, 4.04384712,
4.01655293, 3.9966042 , 3.97541834, 3.95608817, 3.93907763,
3.92005675, 3.90474726, 3.8892058 , 3.87412828, 3.85673113,
3.84397322, 3.8319112 , 3.82077702, 3.8105707 , 3.79912724,
3.79062197, 3.7825033 , 3.77252893, 3.76355974, 3.75640758,
3.74933274, 3.74190995, 3.73379128, 3.72799223, 3.72180658,
3.71593021, 3.70827547, 3.69899699, 3.6885587 , 3.67928022,
3.66768212, 3.65469225, 3.63984669, 3.61618657, 3.58804185,
3.54590209, 3.48211255, 3.41484357, 3.33133727, 3.29672217,
3.24519774])
x_neg==>array([0. , 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1 ,
0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2 , 0.21,
0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3 , 0.31, 0.32,
0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4 , 0.41, 0.42, 0.43,
0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5 , 0.51, 0.52, 0.53, 0.54,
0.55, 0.56, 0.57, 0.58, 0.59, 0.6 , 0.61, 0.62, 0.63, 0.64, 0.65,
0.66, 0.67, 0.68, 0.69, 0.7 , 0.71, 0.72, 0.73, 0.74, 0.75, 0.76,
0.77, 0.78, 0.79, 0.8 , 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87,
0.88, 0.89, 0.9 , 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98])
y_neg==> array([2.78118661, 1.52089322, 0.89392261, 0.58128441, 0.42452844,
0.3448958 , 0.30314634, 0.27957807, 0.26409309, 0.25134785,
0.23858838, 0.22480316, 0.21029436, 0.19640859, 0.18462419,
0.17518816, 0.16737331, 0.16045211, 0.15402541, 0.14794852,
0.142215 , 0.13688271, 0.13203311, 0.12774757, 0.12409162,
0.12110339, 0.11878567, 0.11710232, 0.11598021, 0.11531705,
0.11499397, 0.11489011, 0.11488628, 0.11488462, 0.11487307,
0.1148249 , 0.11464473, 0.11437261, 0.11401795, 0.11359371,
0.11311133, 0.11257585, 0.11198025, 0.11129768, 0.11047015,
0.10939308, 0.10790059, 0.10576964, 0.10278332, 0.09889031,
0.09439156, 0.08992107, 0.08611241, 0.08326532, 0.08132625,
0.08007489, 0.07928329, 0.07877877, 0.0784477 , 0.07822043,
0.07805564, 0.07792911, 0.07782656, 0.0777394 , 0.07766223,
0.07759147, 0.07752456, 0.07745946, 0.07739446, 0.07732793,
0.07725834, 0.07718408, 0.0771035 , 0.07701485, 0.07691626,
0.07680571, 0.07668104, 0.07653992, 0.07637984, 0.07619809,
0.0759917 , 0.07575737, 0.07549129, 0.07518881, 0.07484398,
0.07444865, 0.07399118, 0.07345447, 0.07281299, 0.07202872,
0.07104543, 0.069781 , 0.06811622, 0.0658746 , 0.06277087,
0.0582539 , 0.05107579, 0.03879007, 0.02017219])
def ocp_negative(sto):
return pb.Interpolant(x_neg, y_neg, sto, interpolator="cubic")
param["Negative electrode OCP [V]"] = ocp_negative
def ocp_positive(sto):
return pb.Interpolant(x_pos, y_pos, sto, interpolator="cubic")
param["Positive electrode OCP [V]"] = ocp_positive
And functions for electrolyte conductivity and diffusivity are :-
def electrolyte_diffusivity(c_e,T):
def conductivity(c_e,T):
return (0.1c_e(-10.5+0.074T-6.9610**(-5)T*(2)+0.668c_e-0.0178c_eT+2.810**(-5)c_eT**(2)+0.494c_e**(2)-8.8610**(-4)c_e*(2)*T)**(2))
param['Electrolyte conductivity [S.m-1]']=conductivity
param['Electrolyte diffusivity [m2.s-1]']=electrolyte_diffusivity
And my experiment is defined as follows:-
experiment = pb.Experiment(
[
(
"Charge at 0.5 C until 4.2 V",
"Hold at 4.2 V until C/10",
)
sim = pb.Simulation(model, experiment=experiment, parameter_values=param)
sim.solve(solver=pb.CasadiSolver(mode="safe"))
sim.plot(
[
'Terminal voltage [V]',
'Discharge capacity [A.h]',
)
I have many errors in simluations including :--
2023-03-29 17:08:42.982 - [NOTICE] callbacks.on_cycle_start(174): Cycle 1/1 (62.300 us elapsed) --------------------
2023-03-29 17:08:42.983 - [NOTICE] callbacks.on_step_start(182): Cycle 1/1, step 1/3: Charge at 0.5 C until 4.2 V
CasADi - WARNING("roots:g failed: Inf detected for output x, at (row 30, col 0).") [.../casadi/core/oracle_function.cpp:265]
CasADi - WARNING("roots:g failed: Inf detected for output x, at (row 30, col 0).") [.../casadi/core/oracle_function.cpp:265]
CasADi - WARNING("roots:g failed: Inf detected for output x, at (row 30, col 0).") [.../casadi/core/oracle_function.cpp:265]
AND other errors also
SolverError Traceback (most recent call last)
File ~\env\lib\site-packages\pybamm\solvers\base_solver.py:642, in BaseSolver.calculate_consistent_state(self, model, time, inputs)
641 try:
--> 642 root_sol = self.root_method._integrate(model, np.array([time]), inputs)
643 except pybamm.SolverError as e:
File ~\env\lib\site-packages\pybamm\solvers\casadi_algebraic_solver.py:143, in CasadiAlgebraicSolver._integrate(self, model, t_eval, inputs_dict)
142 elif not success:
--> 143 raise pybamm.SolverError(
144 "Could not find acceptable solution: {}".format(message)
145 )
146 elif any(np.isnan(fun)):
SolverError: Could not find acceptable solution: .../casadi/core/rootfinder.cpp:280: rootfinder process failed. Set 'error_on_fail' option to false to ignore this error.
Beta Was this translation helpful? Give feedback.
All reactions