Skip to content

Commit

Permalink
Merge pull request #1464 from priyanshuone6/rename_folders
Browse files Browse the repository at this point in the history
Rename lead-acid and lithium-ion
  • Loading branch information
valentinsulzer committed Apr 28, 2021
2 parents be0c33d + d413205 commit be327ab
Show file tree
Hide file tree
Showing 260 changed files with 148 additions and 99 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ KLU_module_deps
# setup
setup.log

# test
test.c

# tox
.tox/

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
- Perform more automatic simplifications of the expression tree ([#1449](https://github.com/pybamm-team/PyBaMM/pull/1449))
- Reduce time taken to hash a sparse `Matrix` object ([#1449](https://github.com/pybamm-team/PyBaMM/pull/1449))

## Bug fixes

## Breaking changes
- Renamed `lithium-ion` folder to `lithium_ion` and `lead-acid` folder to `lead_acid` in parameters ([#1464](https://github.com/pybamm-team/PyBaMM/pull/1464))

# [v0.4.0](https://github.com/pybamm-team/PyBaMM/tree/v0.4.0) - 2021-03-28

This release introduces:
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/add-parameter-values.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Adding a set of parameters values
---------------------------------

Parameter sets are split by material into ``negative_electrodes``, ``separators``, ``positive_electrodes``, ``electrolytes``, ``cells`` (for cell geometries and thermal properties) and ``experiments`` (for initial conditions and charge/discharge rates).
To add a new parameter set in one of these subcategories, first create a new folder in the appropriate chemistry folder: for example, to add a new negative electrode chemistry for lithium-ion, add a subfolder ``input/parameters/lithium-ion/negative_electrodes/new_negative_electrode_chemistry_AuthorYear``.
To add a new parameter set in one of these subcategories, first create a new folder in the appropriate chemistry folder: for example, to add a new negative electrode chemistry for lithium-ion, add a subfolder ``input/parameters/lithium_ion/negative_electrodes/new_negative_electrode_chemistry_AuthorYear``.
This subfolder should then contain:

- a csv file ``parameters.csv`` with all the relevant scalar parameters. The expected structure of the csv file is:
Expand All @@ -39,7 +39,7 @@ Empty lines, and lines starting with ``#``, will be ignored.
- python files for any functions, which should be referenced from the ``parameters.csv`` file (see ``Adding a Function`` below)
- csv files for any data to be interpolated, which should be referenced from the ``parameters.csv`` file (see ``Adding data for interpolation`` below)

The easiest way to start is to copy an existing file (e.g. ````input/parameters/lithium-ion/negative_electrodes/graphite_mcmb2528_Marquis2019``) and replace all entries in all files as appropriate
The easiest way to start is to copy an existing file (e.g. ````input/parameters/lithium_ion/negative_electrodes/graphite_mcmb2528_Marquis2019``) and replace all entries in all files as appropriate

Adding a function
-----------------
Expand Down Expand Up @@ -110,7 +110,7 @@ If you have added a whole new set of parameters, then you can create a new param
.. code-block:: python
AuthorYear = {
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "new_cell_AuthorYear",
"negative electrode": "new_negative_electrode_AuthorYear",
"separator": "new_separator_AuthorYear",
Expand All @@ -133,7 +133,7 @@ It's also possible to add parameters for a single material (e.g. negative electr
param = pybamm.ParameterValues(
chemistry={
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "kokam_Marquis2019",
"negative electrode": "new_negative_electrode_chemistry_AuthorYear",
"separator": "separator_Marquis2019",
Expand Down
65 changes: 33 additions & 32 deletions examples/notebooks/parameter-management.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"The `input/parameters` directory is organised as follows:\n",
"```\n",
"input/parameters\n",
" lithium-ion/ # chemistry\n",
" lithium_ion/ # chemistry\n",
" negative_electrodes/ # Component\n",
" graphite_Chen2020/ # parameter set\n",
" parameters.csv\n",
Expand All @@ -34,7 +34,7 @@
" seis/\n",
" separators/\n",
" experiments/\n",
" lead-acid/\n",
" lead_acid/\n",
" ...\n",
"```"
]
Expand Down Expand Up @@ -63,9 +63,9 @@
{
"data": {
"text/plain": [
"['/home/ferranbrosa/PyBaMM',\n",
" '/home/ferranbrosa/PyBaMM/examples/notebooks',\n",
" '/home/ferranbrosa/PyBaMM/pybamm/input/parameters']"
"['/home/priyanshu/work/PyBaMM',\n",
" '/home/priyanshu/work/notebooks',\n",
" '/home/priyanshu/work/PyBaMM/pybamm/input/parameters']"
]
},
"execution_count": 1,
Expand Down Expand Up @@ -109,14 +109,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Directory lithium-ion does not exist.\n"
"Directory lithium_ion does not exist.\n"
]
}
],
"source": [
"%%bash\n",
"if [[ ! -d \"lithium-ion\" ]]; then\n",
"echo \"Directory lithium-ion does not exist.\"\n",
"if [[ ! -d \"lithium_ion\" ]]; then\n",
"echo \"Directory lithium_ion does not exist.\"\n",
"fi"
]
},
Expand All @@ -127,14 +127,14 @@
"outputs": [],
"source": [
"%%bash\n",
"pybamm_edit_parameter lithium-ion"
"pybamm_edit_parameter lithium_ion"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The above commands will create a `lithium-ion` directory in the current directory, populated with copies of the default parameters, for editing:"
"The above commands will create a `lithium_ion` directory in the current directory, populated with copies of the default parameters, for editing:"
]
},
{
Expand All @@ -149,23 +149,24 @@
"cells\n",
"electrolytes\n",
"experiments\n",
"lithium_platings\n",
"negative_electrodes\n",
"positive_electrodes\n",
"SEIs\n",
"seis\n",
"separators\n"
]
}
],
"source": [
"%%bash\n",
"ls lithium-ion"
"ls lithium_ion"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As an example, let's create a new parameter file for the `cell` component, for the `lithium-ion` chemistry. We first create a new directory `my_new_param_set`:"
"As an example, let's create a new parameter file for the `cell` component, for the `lithium_ion` chemistry. We first create a new directory `my_new_param_set`:"
]
},
{
Expand All @@ -175,7 +176,7 @@
"outputs": [],
"source": [
"%%bash\n",
"mkdir lithium-ion/cells/my_new_param_set"
"mkdir lithium_ion/cells/my_new_param_set"
]
},
{
Expand All @@ -192,7 +193,7 @@
"outputs": [],
"source": [
"# Create example parameter file\n",
"f = open(\"lithium-ion/cells/my_new_param_set/param_file.csv\", \"w+\")\n",
"f = open(\"lithium_ion/cells/my_new_param_set/param_file.csv\", \"w+\")\n",
"f.write(\n",
"\"\"\"\n",
"Name [units],Value\n",
Expand Down Expand Up @@ -221,10 +222,10 @@
{
"data": {
"text/plain": [
"['lithium-ion/cells/my_new_param_set',\n",
" '/home/ferranbrosa/PyBaMM',\n",
" '/home/ferranbrosa/PyBaMM/examples/notebooks',\n",
" '/home/ferranbrosa/PyBaMM/pybamm/input/parameters']"
"['lithium_ion/cells/my_new_param_set',\n",
" '/home/priyanshu/work/PyBaMM',\n",
" '/home/priyanshu/work/notebooks',\n",
" '/home/priyanshu/work/PyBaMM/pybamm/input/parameters']"
]
},
"execution_count": 7,
Expand All @@ -233,7 +234,7 @@
}
],
"source": [
"pybamm.PARAMETER_PATH.insert(0, \"lithium-ion/cells/my_new_param_set\")\n",
"pybamm.PARAMETER_PATH.insert(0, \"lithium_ion/cells/my_new_param_set\")\n",
"pybamm.PARAMETER_PATH"
]
},
Expand Down Expand Up @@ -293,7 +294,7 @@
"source": [
"%%bash\n",
"# pybamm_add_parameter <dir> <chemistry> <component>\n",
"pybamm_add_parameter lithium-ion/cells/my_new_param_set lithium-ion cells"
"pybamm_add_parameter lithium_ion/cells/my_new_param_set lithium_ion cells"
]
},
{
Expand All @@ -311,9 +312,9 @@
{
"data": {
"text/plain": [
"['/home/ferranbrosa/PyBaMM',\n",
" '/home/ferranbrosa/PyBaMM/examples/notebooks',\n",
" '/home/ferranbrosa/PyBaMM/pybamm/input/parameters']"
"['/home/priyanshu/work/PyBaMM',\n",
" '/home/priyanshu/work/notebooks',\n",
" '/home/priyanshu/work/PyBaMM/pybamm/input/parameters']"
]
},
"execution_count": 10,
Expand All @@ -322,7 +323,7 @@
}
],
"source": [
"pybamm.PARAMETER_PATH.remove(\"lithium-ion/cells/my_new_param_set\")\n",
"pybamm.PARAMETER_PATH.remove(\"lithium_ion/cells/my_new_param_set\")\n",
"pybamm.PARAMETER_PATH"
]
},
Expand All @@ -345,7 +346,7 @@
}
],
"source": [
"pybamm.ParameterValues(\"lithium-ion/cells/my_new_param_set/param_file.csv\")"
"pybamm.ParameterValues(\"lithium_ion/cells/my_new_param_set/param_file.csv\")"
]
},
{
Expand All @@ -362,14 +363,14 @@
"outputs": [],
"source": [
"%%bash\n",
"pybamm_rm_parameter -f lithium-ion/cells/my_new_param_set lithium-ion cells"
"pybamm_rm_parameter -f lithium_ion/cells/my_new_param_set lithium_ion cells"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's remove the local lithium-ion directory to leave this directory as we found it"
"Let's remove the local lithium_ion directory to leave this directory as we found it"
]
},
{
Expand All @@ -379,7 +380,7 @@
"outputs": [],
"source": [
"%%bash\n",
"rm -rf lithium-ion"
"rm -rf lithium_ion"
]
},
{
Expand Down Expand Up @@ -413,9 +414,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "PyBaMM development (env)",
"display_name": "Python 3",
"language": "python",
"name": "pybamm-dev"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -427,7 +428,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.8.8"
}
},
"nbformat": 4,
Expand Down
22 changes: 11 additions & 11 deletions pybamm/parameters/parameter_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
#

NCA_Kim2011 = {
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "Kim2011",
"negative electrode": "graphite_Kim2011",
"separator": "separator_Kim2011",
Expand All @@ -104,7 +104,7 @@
}

Ecker2015 = {
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "kokam_Ecker2015",
"negative electrode": "graphite_Ecker2015",
"separator": "separator_Ecker2015",
Expand All @@ -116,7 +116,7 @@
}

Yang2017 = {
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "Yang2017",
"negative electrode": "graphite_Yang2017",
"separator": "separator_Yang2017",
Expand All @@ -130,7 +130,7 @@


Marquis2019 = {
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "kokam_Marquis2019",
"negative electrode": "graphite_mcmb2528_Marquis2019",
"separator": "separator_Marquis2019",
Expand All @@ -142,7 +142,7 @@
}

Chen2020 = {
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "LGM50_Chen2020",
"negative electrode": "graphite_Chen2020",
"separator": "separator_Chen2020",
Expand All @@ -154,7 +154,7 @@
}

Chen2020_plating = {
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "LGM50_Chen2020",
"negative electrode": "graphite_Chen2020_plating",
"separator": "separator_Chen2020",
Expand All @@ -167,7 +167,7 @@
}

Mohtat2020 = {
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "UMBL_Mohtat2020",
"negative electrode": "graphite_UMBL_Mohtat2020",
"separator": "separator_Mohtat2020",
Expand All @@ -179,7 +179,7 @@
}

Ramadass2004 = {
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "sony_Ramadass2004",
"negative electrode": "graphite_Ramadass2004",
"separator": "separator_Ecker2015", # no values found, relevance?
Expand All @@ -191,7 +191,7 @@
}

Prada2013 = {
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "A123_Lain2019",
"negative electrode": "graphite_Chen2020",
"separator": "separator_Chen2020",
Expand All @@ -202,7 +202,7 @@
}

Ai2020 = {
"chemistry": "lithium-ion",
"chemistry": "lithium_ion",
"cell": "Enertech_Ai2020",
"negative electrode": "graphite_Ai2020",
"separator": "separator_Ai2020",
Expand All @@ -218,7 +218,7 @@
#

Sulzer2019 = {
"chemistry": "lead-acid",
"chemistry": "lead_acid",
"cell": "BBOXX_Sulzer2019",
"negative electrode": "lead_Sulzer2019",
"separator": "agm_Sulzer2019",
Expand Down
2 changes: 1 addition & 1 deletion pybamm/parameters/parameter_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ParameterValues:
>>> param = pybamm.ParameterValues(values)
>>> param["some parameter"]
1
>>> file = "input/parameters/lithium-ion/cells/kokam_Marquis2019/parameters.csv"
>>> file = "input/parameters/lithium_ion/cells/kokam_Marquis2019/parameters.csv"
>>> values_path = pybamm.get_parameters_filepath(file)
>>> param = pybamm.ParameterValues(values=values_path)
>>> param["Negative current collector thickness [m]"]
Expand Down
2 changes: 1 addition & 1 deletion pybamm/parameters/update_parameter_sets_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def generate_ps_doc(parameter_set_dict):
for ps_chemistry in sorted(parameter_set_dict.keys()):
output_list.append("")
ps_citations = parameter_set_dict[ps_chemistry]
chem_name = ps_chemistry.capitalize() + " " + "parameter sets"
chem_name = ps_chemistry.capitalize().replace("_", "-") + " " + "parameter sets"
output_list.append(chem_name)
dashes = "-" * len(ps_chemistry) + "-" * 15
output_list.append(dashes)
Expand Down
Loading

0 comments on commit be327ab

Please sign in to comment.