Skip to content

Commit

Permalink
update in doc
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierr committed Jan 18, 2024
1 parent 816dc38 commit 1cf181a
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 262 deletions.
32 changes: 15 additions & 17 deletions Documentation/intermediate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
Intermediate usage
==================

.. note::
This section is still under development.
.. _mergeJsonStructs:

Pseudo-Four-Dimensional (P4D) Model
===================================
Setup a P4D Model using :code:`mergeJsonStructs`
================================================

Let's build a pseudo-four-dimensional Li-ion battery model and explore more about how to mix-and-match |battmo| parameter definitions!

Expand Down Expand Up @@ -117,21 +116,23 @@ surface particle concentrations in both electrode at a given time step.
:target: _images/3dconc.png





Direct insertion using :code:`parseBattmoJson`
==============================================
File links and insertions with :code:`parseBattmoJson`
======================================================

There are two mechanisms which can be used to combine JSON input files:

#. Direct insertion using :code:`parseBattmoJson`
#. Merge function using :code:`mergeJsonStruct`
#. Direct insertion using :code:`parseBattmoJson`

We have just seen an example of the first mechanism, which can be used within Matlab when we setup the simulation.

The function :battmo:`parseBattmoJson` parses the JSON input to create the corresponding matlab structure, basically
relying on `jsondecode <https://se.mathworks.com/help/matlab/ref/jsondecode.html>`_. In this process the reserved
keyword properties :code:`isFile` combined with :code:`filename` are used to fetch and insert in place JSON data located
in separate files. Here is an example, taken from :battmofile:`lithium_ion_battery_nmc_graphite.json<ParameterData/BatteryCellParameters/LithiumIonBatteryCell/lithium_ion_battery_nmc_graphite.json>` where we have the following lines
The function :battmo:`parseBattmoJson` is used to parse a JSON input and create the corresponding matlab structure. It
basically relies on `jsondecode <https://se.mathworks.com/help/matlab/ref/jsondecode.html>`_.

In this process the reserved keyword properties :code:`isFile` combined with :code:`filename` are used to fetch and
insert in place JSON data located in separate files. Here is an example, taken from
:battmofile:`lithium_ion_battery_nmc_graphite.json<ParameterData/BatteryCellParameters/LithiumIonBatteryCell/lithium_ion_battery_nmc_graphite.json>`
where we have the following lines

.. code:: json
Expand Down Expand Up @@ -176,7 +177,4 @@ the :code:`jsonstruct` that is obtained is equivalent to the one where we would
"argumentlist" : ["cElectrode", "T", "cmax"]
}}},
.. _mergeJsonStructs:
Merge function using :code:`mergeJsonStructs`
---------------------------------------------
49 changes: 41 additions & 8 deletions Documentation/json.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

========================
JSON input specification
========================
Expand Down Expand Up @@ -26,6 +27,8 @@ schemas. Having separate schemas clarify the presentation and corresponds also t
input. We can easily switch between different geometrical models while keeping the same material properties. For that,
we use the :battmo:`mergeJsonStructs` function, see the example :ref:`here<mergeJsonStructs>`.

Here, we give an :ref:`Example<jsonexample:Json input example>`


Simulation Schema
=================
Expand All @@ -35,8 +38,9 @@ This is the main schema for the input json file. It uses other separate schemas
.. literalinclude:: ../Utilities/JsonSchemas/Simulation.schema.json
:language: json

The schemas are available in the directory :battmofile:`JsonSchemas<Utilities/JsonSchemas>`.
important schemas.
The schemas are available in the directory
:battmofile:`JsonSchemas<Utilities/JsonSchemas>`. :ref:`Here<jsonexample:Simulation>` is an example of the main input
file where the inputs are given in separate files using the :code:`isFile` key.


Material Parameters
Expand Down Expand Up @@ -64,6 +68,7 @@ It contains references to schemas that are written in separate files
* Separator
* Thermal Model

See json :ref:`input example<jsonexample:Battery>`.

Electrolyte
-----------
Expand All @@ -85,6 +90,8 @@ concentration and temperature, see examples :battmofile:`here<ParameterData/Mate
.. literalinclude:: ../Utilities/JsonSchemas/Electrolyte.schema.json
:language: json

See json :ref:`input example<jsonexample:Electrolyte>`.

Electrode
---------

Expand All @@ -93,6 +100,8 @@ The electrode input data contains essentially the input data for the coating and
.. literalinclude:: ../Utilities/JsonSchemas/Electrode.schema.json
:language: json

See json :ref:`input example<jsonexample:Negative Electrode>` and also :ref:`here<jsonexample:Positive Electrode>`.

Coating
-------

Expand All @@ -103,6 +112,8 @@ provide the data for the two active materials (:code:`ActiveMaterial1` and :code
.. literalinclude:: ../Utilities/JsonSchemas/Coating.schema.json
:language: json

See json :ref:`input example<jsonexample:Coating>`

Active Material
---------------

Expand All @@ -120,7 +131,9 @@ property :code:`diffusionModelType` is used to choose between the different diff

.. literalinclude:: ../Utilities/JsonSchemas/ActiveMaterial.schema.json
:language: json


See json :ref:`input example<jsonexample:Active Material>`

Interface
---------

Expand All @@ -132,6 +145,8 @@ functions.
.. literalinclude:: ../Utilities/JsonSchemas/Interface.schema.json
:language: json

See json :ref:`input example<jsonexample:Interface>`

Solid Diffusion
---------------

Expand All @@ -142,6 +157,8 @@ full diffusion model, we can provide a diffusion coefficient that depends on the
.. literalinclude:: ../Utilities/JsonSchemas/SolidDiffusionModel.schema.json
:language: json

See json :ref:`input example<jsonexample:Solid Diffusion>`

Full Solid Diffusion
--------------------

Expand All @@ -157,16 +174,20 @@ the guest stoichiometries and the saturation concentration.


.. literalinclude:: ../Utilities/JsonSchemas/FullSolidDiffusionModel.schema.json
:language: json

:language: json

See json :ref:`input example<jsonexample:Solid Diffusion>`

Binder
------

The conductivity of the binder and conductiving additive are used to compute the overall conductivity of the coating.

.. literalinclude:: ../Utilities/JsonSchemas/Binder.schema.json
:language: json


See json :ref:`input example<jsonexample:Binder>`

Conducting Additive
-------------------

Expand All @@ -175,12 +196,15 @@ The conductivity of the binder and conductiving additive are used to compute the
.. literalinclude:: ../Utilities/JsonSchemas/ConductingAdditive.schema.json
:language: json

See json :ref:`input example<jsonexample:Conducting Additive>`

Current Collector
-----------------

.. literalinclude:: ../Utilities/JsonSchemas/CurrentCollector.schema.json
:language: json

See json :ref:`input example<jsonexample:Current Collector>`

Separator
---------
Expand All @@ -190,6 +214,8 @@ The porosity of the separator gives the volume fraction of the electrolyte in th
.. literalinclude:: ../Utilities/JsonSchemas/Separator.schema.json
:language: json

See json :ref:`input example<jsonexample:Separator>`


Thermal Model
-------------
Expand All @@ -199,7 +225,8 @@ The thermal parameters are essentially the thermal conductivity and heat capacit
.. literalinclude:: ../Utilities/JsonSchemas/ThermalComponent.schema.json
:language: json


See json :ref:`input example<jsonexample:Thermal Model>`

.. _geometryschema:

Geometry Setup
Expand All @@ -214,6 +241,9 @@ For each design, the parameters are described in the schema.

.. literalinclude:: ../Utilities/JsonSchemas/Geometry.schema.json
:language: json

See json :ref:`input example<jsonexample:Geometry>`


Simulation Control Parameters
=============================
Expand All @@ -224,6 +254,8 @@ various control models can be read from the schema.
.. literalinclude:: ../Utilities/JsonSchemas/ControlModel.schema.json
:language: json

See json :ref:`input example<jsonexample:Control>`


Time Stepping Parameters
========================
Expand All @@ -233,7 +265,8 @@ The description of the time stepping parameters can be read from the schema. Def
.. literalinclude:: ../Utilities/JsonSchemas/TimeStepping.schema.json
:language: json


See json :ref:`input example<jsonexample:Time Stepping>`

Solver Parameters
=================

Expand Down
137 changes: 131 additions & 6 deletions Documentation/jsonexample.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,136 @@
remove stack.json from repo
:orphan:

==================
Json input example
==================

comment on volumeFraction entry in interface.json
In this page, we present an example of a json input

change density from interface to active material

fix nominal concentration
TODO
====

fix thermal property in electrolyte
* comment on volumeFraction entry in interface.json
* change density from interface to active material
* fix nominal concentration
* fix thermal property in electrolyte
* remove thermal model.

remove thermal model.
Simulation
==========

.. literalinclude:: scripts/jsonfiles/Example/simulation.json
:language: json

Battery
=======

.. literalinclude:: scripts/jsonfiles/Example/battery.json
:language: json

Negative Electrode
==================

.. literalinclude:: scripts/jsonfiles/Example/negativeElectrode.json
:language: json

Coating
=======

.. literalinclude:: scripts/jsonfiles/Example/coating.json
:language: json

Active Material
===============

.. literalinclude:: scripts/jsonfiles/Example/activeMaterial.json
:language: json

Interface
=========

.. literalinclude:: scripts/jsonfiles/Example/interface.json
:language: json

Solid Diffusion
===============

.. literalinclude:: scripts/jsonfiles/Example/solidDiffusion.json
:language: json

Binder
======

.. literalinclude:: scripts/jsonfiles/Example/binder.json
:language: json

Conducting Additive
===================

.. literalinclude:: scripts/jsonfiles/Example/conductingAdditive.json
:language: json

Current Collector
=================

.. literalinclude:: scripts/jsonfiles/Example/currentCollector.json
:language: json

Positive Electrode
==================

Here, we provide all the parameter in a single json structure without linking to other files.

.. literalinclude:: scripts/jsonfiles/Example/positiveElectrode.json
:language: json

Electrolyte
===========

.. literalinclude:: scripts/jsonfiles/Example/electrolyte.json
:language: json

Separator
=========

.. literalinclude:: scripts/jsonfiles/Example/electrolyte.json
:language: json

Thermal Model
=============

.. literalinclude:: scripts/jsonfiles/Example/thermalComponent.json
:language: json

Geometry
========

We consider the 3D demo model, see :ref:`here<3dgeometry>`

.. literalinclude:: scripts/jsonfiles/Example/geometry.json
:language: json

Model Specification
===================

.. literalinclude:: scripts/jsonfiles/Example/modelSpecification.json
:language: json

Control
=======

.. literalinclude:: scripts/jsonfiles/Example/control.json
:language: json

Time Stepping
=============

.. literalinclude:: scripts/jsonfiles/Example/timeStepping.json
:language: json

State Initialization
====================

.. literalinclude:: scripts/jsonfiles/Example/stateInitialization.json
:language: json

6 changes: 3 additions & 3 deletions Documentation/scripts/jsonfiles/Example/simulation.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"isFile" : true,
"filenames": ["modelSpecification.json",
"battery.json",
"control.json",
"filenames": ["battery.json",
"geometry.json",
"modelSpecification.json",
"control.json",
"timeStepping.json",
"stateInitialization.json"]
}
Loading

0 comments on commit 1cf181a

Please sign in to comment.