-
Notifications
You must be signed in to change notification settings - Fork 0
/
units.html
295 lines (259 loc) · 20.4 KB
/
units.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Units — BattMo documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/sphinx_collapse.css" type="text/css" />
<link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
<link rel="shortcut icon" href="_static/battmologo.ico"/>
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Thermal Simulation" href="thermal.html" />
<link rel="prev" title="Parameter sets" href="parsets.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
BattMo
<img src="_static/battmologo.png" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="basicusage.html">Basic Usage</a><ul>
<li class="toctree-l2"><a class="reference internal" href="basicusage.html#a-first-battmo-model">A First <strong>BattMo</strong> Model</a><ul>
<li class="toctree-l3"><a class="reference internal" href="basicusage.html#define-parameters">Define Parameters</a></li>
<li class="toctree-l3"><a class="reference internal" href="basicusage.html#run-simulation">Run Simulation</a></li>
<li class="toctree-l3"><a class="reference internal" href="basicusage.html#show-the-dashboard">Show the Dashboard</a></li>
<li class="toctree-l3"><a class="reference internal" href="basicusage.html#explore-the-output">Explore the Output</a></li>
<li class="toctree-l3"><a class="reference internal" href="basicusage.html#explore-the-grid">Explore the Grid</a></li>
<li class="toctree-l3"><a class="reference internal" href="basicusage.html#explore-the-states">Explore the States</a></li>
<li class="toctree-l3"><a class="reference internal" href="basicusage.html#plot-a-result">Plot a Result</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="basicusage.html#change-control-parameters">Change Control Parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="basicusage.html#change-structural-parameters">Change Structural Parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="basicusage.html#change-material-parameters">Change Material Parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="basicusage.html#notebooks">Notebooks</a></li>
<li class="toctree-l2"><a class="reference internal" href="basicusage.html#next-steps">Next Steps</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="intermediate.html">Intermediate usage</a><ul>
<li class="toctree-l2"><a class="reference internal" href="intermediate.html#setup-a-p4d-model-using-mergejsonstructs">Setup a P4D Model using <code class="code docutils literal notranslate"><span class="pre">mergeJsonStructs</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="intermediate.html#define-parameters">Define Parameters</a></li>
<li class="toctree-l3"><a class="reference internal" href="intermediate.html#run-simulation">Run Simulation</a></li>
<li class="toctree-l3"><a class="reference internal" href="intermediate.html#visualize-results">Visualize Results</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="intermediate.html#file-links-and-insertions-with-parsebattmojson">File links and insertions with <code class="code docutils literal notranslate"><span class="pre">parseBattmoJson</span></code></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="architecture.html">BattMo Model Architecture</a></li>
<li class="toctree-l1"><a class="reference internal" href="json.html">JSON input specification</a><ul>
<li class="toctree-l2"><a class="reference internal" href="json.html#simulation-schema">Simulation Schema</a></li>
<li class="toctree-l2"><a class="reference internal" href="json.html#material-parameters">Material Parameters</a><ul>
<li class="toctree-l3"><a class="reference internal" href="json.html#electrolyte">Electrolyte</a></li>
<li class="toctree-l3"><a class="reference internal" href="json.html#electrode">Electrode</a></li>
<li class="toctree-l3"><a class="reference internal" href="json.html#coating">Coating</a></li>
<li class="toctree-l3"><a class="reference internal" href="json.html#active-material">Active Material</a></li>
<li class="toctree-l3"><a class="reference internal" href="json.html#interface">Interface</a></li>
<li class="toctree-l3"><a class="reference internal" href="json.html#solid-diffusion">Solid Diffusion</a></li>
<li class="toctree-l3"><a class="reference internal" href="json.html#full-solid-diffusion">Full Solid Diffusion</a></li>
<li class="toctree-l3"><a class="reference internal" href="json.html#binder">Binder</a></li>
<li class="toctree-l3"><a class="reference internal" href="json.html#conducting-additive">Conducting Additive</a></li>
<li class="toctree-l3"><a class="reference internal" href="json.html#current-collector">Current Collector</a></li>
<li class="toctree-l3"><a class="reference internal" href="json.html#separator">Separator</a></li>
<li class="toctree-l3"><a class="reference internal" href="json.html#thermal-model">Thermal Model</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="json.html#geometry-setup">Geometry Setup</a></li>
<li class="toctree-l2"><a class="reference internal" href="json.html#simulation-control-parameters">Simulation Control Parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="json.html#time-stepping-parameters">Time Stepping Parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="json.html#solver-parameters">Solver Parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="json.html#output-parameters">Output Parameters</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="geometryinput.html">Battery Geometries</a><ul>
<li class="toctree-l2"><a class="reference internal" href="geometryinput.html#batterygeneratorp2d">BatteryGeneratorP2D</a></li>
<li class="toctree-l2"><a class="reference internal" href="geometryinput.html#batterygeneratorp3d">BatteryGeneratorP3D</a></li>
<li class="toctree-l2"><a class="reference internal" href="geometryinput.html#batterygeneratorp4d">BatteryGeneratorP4D</a></li>
<li class="toctree-l2"><a class="reference internal" href="geometryinput.html#spiralbatterygenerator">SpiralBatteryGenerator</a></li>
<li class="toctree-l2"><a class="reference internal" href="geometryinput.html#coincellbatterygenerator">CoinCellBatteryGenerator</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="reference internal" href="advancedtopics.html">Advanced Usage</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="modelinitialisation.html">The Battery Simulation Model</a><ul>
<li class="toctree-l3"><a class="reference internal" href="modelinitialisation.html#initialisation-of-a-battery-simulation-model">Initialisation of a battery simulation model</a></li>
<li class="toctree-l3"><a class="reference internal" href="modelinitialisation.html#inspection-of-the-model">Inspection of the model</a></li>
<li class="toctree-l3"><a class="reference internal" href="modelinitialisation.html#computing-and-inspecting-some-standard-static-properties-of-the-model">Computing and inspecting some standard static properties of the model</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="controlinput.html">Control models</a><ul>
<li class="toctree-l3"><a class="reference internal" href="controlinput.html#json-input-control-interface">Json input control interface</a></li>
<li class="toctree-l3"><a class="reference internal" href="controlinput.html#control-model-description">Control model description</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="soliddiffusion.html">Solid Diffusion Models</a></li>
<li class="toctree-l2"><a class="reference internal" href="parsets.html">Parameter sets</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Units</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#converting-units-in-battmo">Converting units in BattMo</a></li>
<li class="toctree-l3"><a class="reference internal" href="#units-and-json-input">Units and JSON input</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="thermal.html">Thermal Simulation</a></li>
<li class="toctree-l2"><a class="reference internal" href="optimisation.html">Optimization</a><ul>
<li class="toctree-l3"><a class="reference internal" href="optimisation.html#parameter-identification-example">Parameter identification example</a></li>
<li class="toctree-l3"><a class="reference internal" href="optimisation.html#optimization-example">Optimization example</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="juliabridge.html">BattMo Julia bridge</a><ul>
<li class="toctree-l2"><a class="reference internal" href="juliabridge.html#introduction">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="juliabridge.html#setup-and-use">Setup and Use</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="publishedExamples/runElectrolyser.html">Electrolyser simulation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="publishedExamples/runElectrolyser.html#load-mrst-modules">Load MRST modules</a></li>
<li class="toctree-l2"><a class="reference internal" href="publishedExamples/runElectrolyser.html#setup-input">Setup input</a></li>
<li class="toctree-l2"><a class="reference internal" href="publishedExamples/runElectrolyser.html#setup-model">Setup model</a></li>
<li class="toctree-l2"><a class="reference internal" href="publishedExamples/runElectrolyser.html#setup-the-initial-condition">Setup the initial condition</a></li>
<li class="toctree-l2"><a class="reference internal" href="publishedExamples/runElectrolyser.html#setup-the-schedule-with-the-time-discretization">Setup the schedule with the time discretization</a></li>
<li class="toctree-l2"><a class="reference internal" href="publishedExamples/runElectrolyser.html#setup-the-non-linear-solver">Setup the non-linear solver</a></li>
<li class="toctree-l2"><a class="reference internal" href="publishedExamples/runElectrolyser.html#run-the-simulation">Run the simulation</a></li>
<li class="toctree-l2"><a class="reference internal" href="publishedExamples/runElectrolyser.html#visualize-the-results">Visualize the results</a></li>
<li class="toctree-l2"><a class="reference internal" href="publishedExamples/runElectrolyser.html#ph-distribution-plot">pH distribution plot</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="seealso.html">See Also</a><ul>
<li class="toctree-l2"><a class="reference internal" href="seealso.html#mrst">MRST</a><ul>
<li class="toctree-l3"><a class="reference internal" href="seealso.html#id1">Visualization Tutorial</a></li>
<li class="toctree-l3"><a class="reference internal" href="seealso.html#id2">Grid Factory Tutorial</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="seealso.html#fair-data">FAIR Data</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="bibliography.html">References</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">BattMo</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="advancedtopics.html">Advanced Usage</a></li>
<li class="breadcrumb-item active">Units</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/units.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="units">
<h1>Units<a class="headerlink" href="#units" title="Link to this heading"></a></h1>
<p>BattMo is designed to use SI units in all its calculations. However, to make things easier for the user we provide utilities for converting various common units to SI. The full list of common units can be found here: <a class="reference external" href="https://github.com/SINTEF-AppliedCompSci/MRST/tree/main/core/utils/units">Supported Units</a> .</p>
<p>The list also includes common unit prefixes such as milli, kilo etc.</p>
<section id="converting-units-in-battmo">
<h2>Converting units in BattMo<a class="headerlink" href="#converting-units-in-battmo" title="Link to this heading"></a></h2>
<p>Some examples of using unit conversions in BattMo are shown below.</p>
<div class="highlight-matlab notranslate"><div class="highlight"><pre><span></span><span class="o">>></span><span class="w"> </span><span class="n">cElectrolyte</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="mf">5e-1</span><span class="o">*</span><span class="n">mol</span><span class="o">/</span><span class="n">litre</span>
<span class="n">cElectrolyte</span><span class="w"> </span><span class="p">=</span>
<span class="w"> </span><span class="mf">500.0000</span>
<span class="o">>></span><span class="w"> </span><span class="n">I</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="mf">0.62</span><span class="o">*</span><span class="n">ampere</span><span class="o">/</span><span class="p">(</span><span class="mi">1</span><span class="o">*</span><span class="n">centi</span><span class="o">*</span><span class="n">meter</span><span class="p">)</span>^<span class="mi">3</span>
<span class="n">I</span><span class="w"> </span><span class="p">=</span>
<span class="w"> </span><span class="mf">6.2000e+05</span>
</pre></div>
</div>
</section>
<section id="units-and-json-input">
<h2>Units and JSON input<a class="headerlink" href="#units-and-json-input" title="Link to this heading"></a></h2>
<p>When a value is given in a json input file without a corresponding unit string, or a value is given directly in BattMo, the value is assumed to be in SI units.</p>
<p>Values can be given in the json input as a value and unit pair as shown below. In this case the value will be converted to SI before use.</p>
<div class="highlight-JSON notranslate"><div class="highlight"><pre><span></span><span class="nt">"density"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nt">"value"</span><span class="p">:</span><span class="w"> </span><span class="mf">1.1</span><span class="p">,</span>
<span class="w"> </span><span class="nt">"unit"</span><span class="p">:</span><span class="w"> </span><span class="s2">"gram/((centi*meter)^3)"</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Unit conversion is demonstrated below.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This conversion happens automatically inside <a class="reference external" href="https://github.com/BattMoTeam/BattMo/blob/dev/Battery/BatteryInputParams.m">BatteryInputParams</a>, the code below is just for demonstration purposes.</p>
</div>
<div class="highlight-matlab notranslate"><div class="highlight"><pre><span></span><span class="o">>></span><span class="w"> </span><span class="n">json</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="s">'{"density": {"value": 1.1,"unit": "gram/((centi*meter)^3)"}}'</span><span class="p">;</span>
<span class="o">>></span><span class="w"> </span><span class="n">jsonstruct</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="nb">jsondecode</span><span class="p">(</span><span class="n">json</span><span class="p">);</span>
<span class="o">>></span><span class="w"> </span><span class="n">jsonstruct</span><span class="p">.</span><span class="n">density</span>
<span class="nb">ans</span><span class="w"> </span><span class="p">=</span>
<span class="w"> </span><span class="nb">struct</span><span class="w"> </span><span class="n">with</span><span class="w"> </span><span class="n">fields</span><span class="p">:</span>
<span class="w"> </span><span class="n">value</span><span class="p">:</span><span class="w"> </span><span class="mf">1.1000</span>
<span class="w"> </span><span class="n">unit</span><span class="p">:</span><span class="w"> </span><span class="s">'gram/((centi*meter)^3)'</span>
<span class="o">>></span><span class="w"> </span><span class="p">[</span><span class="n">val</span><span class="p">,</span><span class="n">isconverted</span><span class="p">]</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">convertUnitBattMo</span><span class="p">(</span><span class="n">jsonstruct</span><span class="p">.</span><span class="n">density</span><span class="p">)</span>
<span class="n">val</span><span class="w"> </span><span class="p">=</span>
<span class="w"> </span><span class="mf">1.1000e+03</span>
<span class="n">isconverted</span><span class="w"> </span><span class="p">=</span>
<span class="w"> </span><span class="nb">logical</span>
<span class="w"> </span><span class="mi">1</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If a string is given which is not supported, BattMo will return an error. However, care must be taken as all supported strings will work, even if they are used by mistake. i.e. make sure you do not write milli if you mean centi!</p>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="parsets.html" class="btn btn-neutral float-left" title="Parameter sets" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="thermal.html" class="btn btn-neutral float-right" title="Thermal Simulation" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>© Copyright 2021-2023.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>