-
-
Notifications
You must be signed in to change notification settings - Fork 577
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into telemetry
- Loading branch information
Showing
21 changed files
with
599 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
327 changes: 327 additions & 0 deletions
327
docs/source/examples/notebooks/parameterization/sensitivities_and_data_fitting.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import pybamm | ||
|
||
from pybamm.type_definitions import DomainType | ||
|
||
|
||
class CoupledVariable(pybamm.Symbol): | ||
""" | ||
A node in the expression tree representing a variable whose equation is set by a different model or submodel. | ||
Parameters | ||
---------- | ||
name : str | ||
name of the node | ||
domain : iterable of str | ||
list of domains that this coupled variable is valid over | ||
""" | ||
|
||
def __init__( | ||
self, | ||
name: str, | ||
domain: DomainType = None, | ||
) -> None: | ||
super().__init__(name, domain=domain) | ||
|
||
def _evaluate_for_shape(self): | ||
""" | ||
Returns the scalar 'NaN' to represent the shape of a parameter. | ||
See :meth:`pybamm.Symbol.evaluate_for_shape()` | ||
""" | ||
return pybamm.evaluate_for_shape_using_domain(self.domains) | ||
|
||
def create_copy(self): | ||
"""Creates a new copy of the coupled variable.""" | ||
new_coupled_variable = CoupledVariable(self.name, self.domain) | ||
return new_coupled_variable | ||
|
||
@property | ||
def children(self): | ||
return self._children | ||
|
||
@children.setter | ||
def children(self, expr): | ||
self._children = expr | ||
|
||
def set_coupled_variable(self, symbol, expr): | ||
"""Sets the children of the coupled variable to the expression passed in expr. If the symbol is not the coupled variable, then it searches the children of the symbol for the coupled variable. The coupled variable will be replaced by its first child (symbol.children[0], which should be expr) in the discretisation step.""" | ||
if self == symbol: | ||
symbol.children = [ | ||
expr, | ||
] | ||
else: | ||
for child in symbol.children: | ||
self.set_coupled_variable(child, expr) | ||
symbol.set_id() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.