Coder Social home page Coder Social logo

cap's Introduction

Cap

Cap is an open-source software library for modeling energy storage devices. To get started, checkout the documentation.

Continuous Integration Status

Provider Service Status
Read the Docs documentation Documentation Status
Travis CI unit tests Build Status
Codecov coverage codecov
Gitter messaging Gitter
Waffle project management Stories in Ready

NEW - Escape dependency hell

No need to build Cap and its third-party libraries from source. Just pull the latest image with Docker, run it, and launch numerical simulations via your web browser. PyCap makes it possible to create and manipulate Cap EnergyStorageDevice objects and execute algorithms (Charge, Discharge, etc.) from an interactive Python command-line interpreter, without the need to constantly recompile.

Docker Pulls Image Layers

Authors

Acknowledgments

Cap has been supported by the Department of Energy (DOE) DiaMonD project.

cap's People

Contributors

dalg24 avatar rombur avatar waffle-iron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cap's Issues

Make diff-clang-format.py runnable from source directory

At the moment, it fails with

Traceback (most recent call last):
  File "/home/xap/bin/diff-clang-format.py", line 111, in <module>
    copy(config, getcwd() + '/' + '.clang-format')
  File "/usr/lib64/python2.7/shutil.py", line 119, in copy
    copyfile(src, dst)
  File "/usr/lib64/python2.7/shutil.py", line 69, in copyfile
    raise Error("`%s` and `%s` are the same file" % (src, dst))
shutil.Error: `/home/xap/code/trilinos/dtk/DataTransferKit/.clang-format` and `/home/xap/code/dtk/DataTransferKit/.clang-format` are the same file

I have the following hack in place

diff --git a/diff-clang-format.py b/diff-clang-format.py
index 120700c..f2b7c8f 100755
--- a/diff-clang-format.py
+++ b/diff-clang-format.py
@@ -17,7 +17,7 @@ Option:
 from docopt import docopt
 from subprocess import Popen, PIPE
 from os import walk, getcwd, remove, rename
-from shutil import copy
+from shutil import copy, Error
 
 def diff_with_formatted_source(original_file, command, patch):
     '''Compute the diff between the C++ source code and its formatted version
@@ -104,9 +104,13 @@ if __name__ == '__main__':
     patch = args['--apply-patch']
     command = [args['--binary']]
     if style:
-      command.append('-style='+style)
+        command.append('-style='+style)
+
     if config:
-        copy(config, getcwd()+'/'+'.clang-format')
+        try:
+            copy(config, getcwd() + '/' + '.clang-format')
+        except Error:
+            pass
 
     diffs = run(paths, extensions, command, patch)
     if diffs:

but it probably suppresses other useful Errors.

Python coverage on the plotting utilities

In PR #213 (commit b6f67f3) I commented out Python tests that were calling pyplot.figure() to get read of Tinker errors related to the display being unavailable.
We need to find a way of calling the routines without getting these errors. The solution might be to change Matplotlib's backend in these tests. See here.

Dead kernel while running notebook

Got the error dead kernel while running EIS measurement.
After investigation turned out the solver was not able to converge.
Material properties and geometry departed from nominal values that were previously used.
The "default" solver settings need adjustments.

Improvements

Some improvements that I want to do when I have time:

  • use higher-order finite elements
  • use higher-order time integrator

Python tests

The following functions need to be tested:

  • charge_discharge.py:
    • charge_mode = constant_power
    • discharge_mode = constant_current
    • discharge_mode = constant_voltage
    • discharge_mode = constant_load
    • CyclicChargeDischarge
  • data_helpers.py:
    • plot_data
    • open_file_in_write_mode
  • impedance_spectroscopy.py: plot_bode
  • voltammetry.py: plot_cyclic_voltammogram

CPP tests

The following tests need to be improved:

  • test_energy_storage_device does not test ParallelRC (only SerialRC is tested)
  • test_ragone_chart does not test discharge with constant_load, discharge with constant_current and SeriesRC, discharge with constant_power and SeriesRC
  • test_resistor_capacitor_data does not test SeriesRC

The following functions need to be tested:

  • in deal.II/geometry.templates.h: foo<3>
  • in deal.II/post_processor.cc: extract_duration_and_average_power
  • in deal.II/post_processor.templates.h:
    • get(std::string const &key)
    • get_vector_keys()
    • check that the debug quantities and the debug solution are needed or if they can be removed. They are not currently tested.
  • in deal.II/supercapacitor.cc: no test in 3D
  • in deal.II/supercapacitor.h: SuperCapacitorInspector
  • in resistor_capacitor.cc:
    • reset x2
    • evolve_one_time_step_linear_current x2
    • evolve_one_time_step_linear_power x2
    • evolve_one_time_step_linear_power x2

Geometry

The following things are left to do in the geometry:

  • either do not allow to choose the number of cells in the (dim-1) direction or find a smart way to deal with it. In 3D, the y division also needs to be the same everywhere.
  • equivalent-circuit and post-processor requires data directly from the database. These data should come from geometry. This would simplifies the input file.

Refactor input for geometry

  • set geometric_area rather than sandwich_height and sandwich_depth
  • use word thickness rather than width
  • values given in units of cm

Warning with new supercapacitor class

I got the following warning with Clang-3.7.1

In file included from <snip>/cap/cpp/source/deal.II/new_supercapacitor.cc:8:
<snip>/cap/source/cap/cpp/source/deal.II/dummy/cap/new_supercapacitor.templates.h:269:1: warning: all paths through this function will call
      itself [-Winfinite-recursion]
{
^
<snip>/cap/cpp/source/deal.II/new_supercapacitor.cc:38:16: note: in instantiation of member function
      'cap::New_SuperCapacitor<2>::evolve_one_time_step_linear_load' requested here
template class New_SuperCapacitor<2>;

Refactor material properties

  • pores_characteristic_dimension in cm
  • mass_density in g per cm3
  • differential_capacitance in microF per cm2
  • exchange_current_density in A per cm2
  • specific_electrical_resistivity in ohm cm rather than electrical_conductivity in siemens per cm-
  • electrolyte_specific_resistance in ohm cm

suppress warnings

Now that jenkins shows the warnings we may want to clean up the code to suppress these warnings.

Add CapConfig.cmake

We should export all the flags used to create libcap.so in a way that CMake can understand (similar to what is done in deal.II). This would simplify a lot compiling C++ code.

Update pre-built image

The goal of this issue is to put together a wish list for the next cap-stack. Please feel free to edit.

  • ubuntu:16.04 as base image
  • use package manager to install mpi/python
  • install cppcheck
  • upgrade trilinos to 12.6.3
  • upgrade boost to 1.61.0

Document inputs

Right now, the only way to know what are the possible inputs of Cap is to grep the code. The inputs should be documented somewhere.

cpp tests spring cleaning

  • butler_volmer_kinetics
    • only checks that F/RT==1/k_bT and plots linearized kinetics vs exponential form
    • integrate into material properties test or remove
  • charge_curve
  • discharge_curve
  • cyclic_voltammetry
  • leakage_current (measures both direct leakage current and self discharge)
  • lissajous_curve
  • impedance_spectroscopy (requires GSL)
    • these are not checking anything, they are more examples
  • impedance_spectroscopy-2 (checks analytical solution for equivalent circuits)
  • ragone_chart
    • not checking anything, just a driver to measure the device performance
  • ragone_chart-2
    • checks against analytical solution for series and parallel rc circuits
  • discrete_fourier_transform (compares GSL fft with NumPy)
  • resistor_capacitor_circuit (tests series and parallel rc circuits)
  • resistor_capacitor_circuit-2
    • measures impedance spectra but doesn't assert anything
    • compares step versus ramp
  • geometry
  • mp_values
  • postprocessor (checks approximation of integral with trapezoidal rule and compute power/energy)
    • move into deal.II directory
  • dirichlet_boundary_operator
    • boundary op is not used...
  • uq (uses TASMANIAN)
  • exact_transient_solution
  • exact_transient_solution-2
  • equivalent_circuit-2 (computes equiv circuit to a supercap and plots CCD)
    • we need to revisit this test
  • energy_storage_device
  • supercapacitor
  • parse_params
    • multiple checks all related to property trees
  • multi_stage

Bug in 3D

Cap doesn't seems to work for 3D if the mesh is not very coarse. The code crashes in the first iteration of CG with a residual equal to NaN.

Bode plot

This need to be updated to the new interface.
The main problem is that currently there is now way to specify in which figure to plot in plot_bode.
I am not sure how to do that with subfigures...

Docker enhancements

  • Check the error code for create_container in docker-run.py. If it is not successful do not continue executing
  • Add an option to postpone tearing down the container if something goes wrong so one could login into it and investigate
  • Add an option to commit the container at the end of successful execution of docker-run
  • Allow usage of local docker images

Headers in EC-Lab output

This is a feature request by Frank.

  • Compute total interfacial area in the electrode
  • Print it in the EC-Lab file
  • Print some of the input parameters as well
  • Also put git commit hash somewhere

Equation system

solid_potential_component and liquid_potential_component seem to be one of the last things that need to be removed from the default supercap input file.

I'd like to evaluate whether some class that would help manage the equation system would be beneficial.
Notably it would help post processors and operators selecting components in the solution field.
Here is how the ptree to build it could look like

components 2
component_0 {
    name pressure
    component_id 0
}
component_1 {
    name velocity
    component_id 1,2,3
}

Error catch within ragone_plot.py

def run_discharge(device, ptree):
    data = initialize_data()

    # (re)charge the device
    initial_voltage = ptree.get_double('initial_voltage')

When the RagoneAnalysis object calls run_discharge, that method tries to get two values from PropertyTree.

except RuntimeError:
      print('Failed to discharge at {0} watt'.format(
                discharge_power))
      break

RagoneAnalysis catches that potential RuntimeError, but only with the assumption that it was caused by a failed constant-power discharge, so the user is not notified that they are missing PropertyTree entries.

Destructor called twice

Running the example scaling.cc shows that the destruction of SuperCapacitor is called twice. This may be due to the cast of the unique_ptr to a shared_ptr.

Compilation of Cap depends on the name of branch

I wish I was joking but if I name my branch ORNL-CESS/Cap#185 Cap won't compile. It works fine if the branch is called tmp.

- Boost version: 1.60.0
-- Found the following Boost libraries:
--   python
--   mpi
--   serialization
--   unit_test_framework
--   chrono
--   timer
--   system
--   filesystem
MPI4PY_INCLUDE_DIR=/home/bt2/.local/lib/python2.7/site-packages/mpi4py/include

-- Using the deal.II-8.4.0 installation found at /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_pickup_tests.cmake
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_setup_target.cmake
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_add_test.cmake
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_initialize_cached_variables.cmake
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_query_git_information.cmake
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_invoke_autopilot.cmake
Cap version: 0.1.0
Build type: Debug
GIT_HEAD_REF=refs/heads/ORNL-CEES/Cap#185
GIT_COMMIT_HASH=f490b4fb4909ea3fb3165a58e4018798fc01f4b5
GIT_BRANCH=ORNL-CEES/Cap#185
[email protected]:rombur/Cap.git
-- Found clang-format: /home/bt2/Documents/bin/clang-format
-- Found autopep8: /home/bt2/.local/bin/autopep8
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bt2/Documents/Cap/build_debug
make[2]: *** No rule to make target '../.git/refs/heads/ORNL-CEES/Cap', needed by 'cpp/source/version.cc'.  Stop.
CMakeFiles/Makefile2:323: recipe for target 'CMakeFiles/version.cc.dir/all' failed
make[1]: *** [CMakeFiles/version.cc.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

Here is the same build but the branch is called tmp

-- Boost version: 1.60.0
-- Found the following Boost libraries:
--   python
--   mpi
--   serialization
--   unit_test_framework
--   chrono
--   timer
--   system
--   filesystem
MPI4PY_INCLUDE_DIR=/home/bt2/.local/lib/python2.7/site-packages/mpi4py/include

-- Using the deal.II-8.4.0 installation found at /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_pickup_tests.cmake
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_setup_target.cmake
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_add_test.cmake
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_initialize_cached_variables.cmake
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_query_git_information.cmake
-- Include macro /home/bt2/Documents/software/gcc-5.2__openmpi-1.10.2/dealii-8.4.0/install_debug/share/deal.II/macros/macro_deal_ii_invoke_autopilot.cmake
Cap version: 0.1.0
Build type: Debug
GIT_HEAD_REF=refs/heads/tmp
GIT_COMMIT_HASH=f490b4fb4909ea3fb3165a58e4018798fc01f4b5
GIT_BRANCH=tmp
[email protected]:rombur/Cap.git
-- Found clang-format: /home/bt2/Documents/bin/clang-format
-- Found autopep8: /home/bt2/.local/bin/autopep8
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bt2/Documents/Cap/build_debug
[  1%] Built target version.cc
[  2%] Built target diff-clang-format_py
Scanning dependencies of target Cap
[  3%] Building CXX object cpp/CMakeFiles/Cap.dir/source/version.cc.o

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.