Closing t_eval must increase monotonically #3325
Unanswered
akariwrynn
asked this question in
Q&A
Replies: 1 comment
-
You can just sort your array of times. I’m not sure if your example is complete, but i can’t see where you’re changing the current? |
Beta Was this translation helpful? Give feedback.
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Is there a way that I can close the feature of t_eval must increase monotonically? I am trying to apply multi sine waves at once not by using a for loop to calculate each frequency.
Here is my code:
import pybamm
import numpy as np
import math
pointsperperiod=64
fmin=-3
fmax=3
fspace=2
period=10
parameters={"Positive particle radius":5.2210**-6,"Positive electrode thickness":75.610**-6,"Negative particle radius":5.810**-6,"Negative electrode thickness":8.5210**-5,"Separator Bruggeman coefficient":1.5,"Positive electrode diffusivity":410**-15,"Negative electrode diffusivity":3.310**-14}
model=pybamm.lithium_ion.DFN()
parameters=dict(parameters)
mychemistry=pybamm.parameter_sets.Chen2020
params = pybamm.ParameterValues(mychemistry)
freq=np.logspace(fmin,fmax,fspace)
time_values=[]
for i in freq:
time_array= np.linspace(0, period/i, pointsperperiod*period)
time_values.append(time_array)
ones=np.ones(pointsperperiod//2)
def intersperse(lst, item):
result = [item] * (len(lst) * 2 - 1)
result[0::2] = lst
return result
intered_time_values=intersperse(time_values, ones)
all_time_values=np.concatenate(intered_time_values)
sim = pybamm.Simulation(model, parameter_values=params)
sim.solve(t_eval=all_time_values)
solution = sim.solution
V = solution["Terminal voltage [V]"]
C = solution["Current [A]"]
array_v=np.array(V.data)
array_c=np.array(C.data)_
Beta Was this translation helpful? Give feedback.
All reactions