-
-
Notifications
You must be signed in to change notification settings - Fork 553
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2599 add idaklu solver to benchmarks
- Loading branch information
1 parent
fb36a84
commit f9a9fcc
Showing
3 changed files
with
90 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,42 @@ | ||
import pybamm | ||
|
||
parameters = ["Marquis2019", "Chen2020"] | ||
|
||
|
||
class TimeSPMSimulationCCCV: | ||
param_names = ["parameter"] | ||
params = parameters | ||
|
||
def time_setup_SPM_simulation(self, parameters): | ||
class TimeSimulation: | ||
param_names = ["experiment", "parameter", "model_class", "solver_class"] | ||
params = [ | ||
["CCCV", "GITT"], | ||
["Marquis2019", "Chen2020"], | ||
[pybamm.lithium_ion.SPM, pybamm.lithium_ion.DFN], | ||
[pybamm.CasadiSolver, pybamm.IDAKLUSolver], | ||
] | ||
experiment_descriptions = { | ||
"CCCV": [ | ||
"Discharge at C/5 for 10 hours or until 3.3 V", | ||
"Rest for 1 hour", | ||
"Charge at 1 A until 4.1 V", | ||
"Hold at 4.1 V until 10 mA", | ||
"Rest for 1 hour", | ||
], | ||
"GITT": [("Discharge at C/20 for 1 hour", "Rest for 1 hour")] * 20 | ||
} | ||
|
||
def setup(self, experiment, parameters, model_class, solver_class): | ||
self.param = pybamm.ParameterValues(parameters) | ||
self.model = pybamm.lithium_ion.SPM() | ||
exp = pybamm.Experiment( | ||
[ | ||
"Discharge at C/5 for 10 hours or until 3.3 V", | ||
"Rest for 1 hour", | ||
"Charge at 1 A until 4.1 V", | ||
"Hold at 4.1 V until 10 mA", | ||
"Rest for 1 hour", | ||
] | ||
self.model = model_class() | ||
self.solver = solver_class() | ||
self.exp = pybamm.Experiment(self.experiment_descriptions[experiment]) | ||
self.sim = pybamm.Simulation( | ||
self.model, parameter_values=self.param, experiment=self.exp, solver=self.solver | ||
) | ||
pybamm.Simulation(self.model, parameter_values=self.param, experiment=exp) | ||
|
||
def time_setup(self, experiment, parameters, model_class, solver_class): | ||
param = pybamm.ParameterValues(parameters) | ||
model = model_class() | ||
solver = solver_class() | ||
exp = pybamm.Experiment(self.experiment_descriptions[experiment]) | ||
pybamm.Simulation(model, parameter_values=param, experiment=exp, solver=solver) | ||
|
||
class TimeDFNSimulationCCCV: | ||
param_names = ["parameter"] | ||
params = parameters | ||
def time_solve(self, experiment, parameters, model_class, solver_class): | ||
self.sim.solve() | ||
|
||
def time_setup_SPM_simulation(self, parameters): | ||
self.param = pybamm.ParameterValues(parameters) | ||
self.model = pybamm.lithium_ion.DFN() | ||
exp = pybamm.Experiment( | ||
[ | ||
"Discharge at C/5 for 10 hours or until 3.3 V", | ||
"Rest for 1 hour", | ||
"Charge at 1 A until 4.1 V", | ||
"Hold at 4.1 V until 10 mA", | ||
"Rest for 1 hour", | ||
] | ||
) | ||
pybamm.Simulation(self.model, parameter_values=self.param, experiment=exp) | ||
|
||
|
||
class TimeSPMSimulationGITT: | ||
param_names = ["parameter"] | ||
params = parameters | ||
|
||
def time_setup_SPM_simulation(self, parameters): | ||
self.param = pybamm.ParameterValues(parameters) | ||
self.model = pybamm.lithium_ion.SPM() | ||
exp = pybamm.Experiment( | ||
[("Discharge at C/20 for 1 hour", "Rest for 1 hour")] * 20 | ||
) | ||
pybamm.Simulation(self.model, parameter_values=self.param, experiment=exp) | ||
|
||
|
||
class TimeDFNSimulationGITT: | ||
param_names = ["parameter"] | ||
params = parameters | ||
|
||
def time_setup_SPM_simulation(self, parameters): | ||
self.param = pybamm.ParameterValues(parameters) | ||
self.model = pybamm.lithium_ion.DFN() | ||
exp = pybamm.Experiment( | ||
[("Discharge at C/20 for 1 hour", "Rest for 1 hour")] * 20 | ||
) | ||
pybamm.Simulation(self.model, parameter_values=self.param, experiment=exp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters