Added energy and power density to output#80
Added energy and power density to output#80mglasser16 wants to merge 19 commits intocoresresearch:mainfrom
Conversation
upstream has needed file
rebasing for fitting
decaluwe
left a comment
There was a problem hiding this comment.
Thanks, @mglasser16 -- this is very close. There is a main question of what we want to do with these numbers (how we want to save them). Really there is just a single number for the energy and power density, which isn't really amenable to saving with the solution vectors.
Two options:
- We could calculate those single numbers and save them in some separate text / ascii file.
- We could save the cumulative power / energy densities at each time step (I think this is what you currently have for energy density, but not for power density), and save them with the solution vector arrays. Then the number we actually want is just the final number, but maybe someone would be interested with how it evolves, as well?
I'm good with either. The 2nd option might be simpler / more direct.
electrode_models/air_electrode.py
Outdated
| # current = params['i_ext'] | ||
| # # Split the current from the units: | ||
| # i_ext, units = current.split() | ||
| self.surf_to_volume = 1.23224E-11 |
There was a problem hiding this comment.
a. Is this setable from the input file?
b. This number seems like it is inverted. A/V should be proportional to 1/r, no?
There was a problem hiding this comment.
I'm not using this for anything, so I'll remove this line
simulations/CC_cycle.py
Outdated
| cycle_number = int(i+1-equil)*np.ones_like(solution.values.t) | ||
| cycle_capacity = 0.1*solution.values.t*abs(i_data)/3600 | ||
| voltage = solution.values.y.T[-7] | ||
| power_density = voltage*i_data |
There was a problem hiding this comment.
This should be a single number in the end, which is a time-weighted average of each of these values.
Also, I think you can do the work below without a loop, by just slicing the arrays.
delta_t = solution.values.t[1:] = solution.values.t[:-1]
energy_density = np.sum(voltage[1:],delta_t)*currents[I]/3600 # should be mAh/cm2, but please check my math
power_density = 3600*energy_density / solution.values.t[-1] #Again, check my unit conversion.One question is: how do we want to store/save these? It doesn't really fit in the array of solution vectors.
Maybe write a txt file or a separate csv that has metrics like this?
| # vector at each time step into a single data array. | ||
| SV = np.vstack((solution.values.t+data_out[0,-1], cycle_number, | ||
| i_data, cycle_capacity, solution.values.y.T)) | ||
| i_data, cycle_capacity, power_density, energy_density, solution.values.y.T)) |
There was a problem hiding this comment.
See above - there is just one power density and one energy density, really, per simulation. Do we store them separately?
Another idea is we just calculate the cumulative power and energy densities, as a function of time, and the final value in this array is the single number that I calculate above. Then we can store it with the solution, and the "final number" is easily extractable as the last element in the array...
There was a problem hiding this comment.
Note, if we do save the cumulative values, I think the power density still requires some editing from what you currently have. But it likely would involve a for loop, so my current approach doesn't work either. More like a blend of our two approaches.
| # (2) cycle number, (3) current density(A/cm2) , and (4) Capacity (mAh/cm2) | ||
| SV_offset = 4 | ||
| # (2) cycle number, (3) current density(A/cm2) , (4) Capacity (mAh/cm2) and (5) power density and (6) energy density | ||
| SV_offset = 6 |
There was a problem hiding this comment.
Depending how we answer above, either keep this as is (if we store cumulative densities), or re-set to 4.
Also allows setting the radius for each current individually. Still messy, not for merging into main batcan.