From 0ead004b3c1586f58de701cd2edc4d6302f5f09c Mon Sep 17 00:00:00 2001 From: Martin Bauer <martin.bauer@fau.de> Date: Mon, 28 Jan 2019 18:17:51 +0100 Subject: [PATCH] Grandchem generalization WIP - started with generalized free energy formulation --- fd/finitedifferences.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/fd/finitedifferences.py b/fd/finitedifferences.py index fe093ec16..dfc2aab95 100644 --- a/fd/finitedifferences.py +++ b/fd/finitedifferences.py @@ -275,8 +275,9 @@ def grad(var, dim=3): This function takes a symbol and creates the gradient symbols according to convention above - :param var: symbol to take the gradient of - :param dim: dimension (length) of the gradient vector + Args: + var: symbol to take the gradient of + dim: dimension (length) of the gradient vector """ if hasattr(var, "__getitem__"): return [[sp.Symbol("%s^Delta^%d" % (v.name, i)) for v in var] for i in range(dim)] @@ -289,10 +290,12 @@ def discretize_center(term, symbols_to_field_dict, dx, dim=3): Expects term that contains given symbols and gradient components of these symbols and replaces them by field accesses. Gradients are replaced by centralized approximations: ``(upper neighbor - lower neighbor ) / ( 2*dx)`` - :param term: term where symbols and gradient(symbol) should be replaced - :param symbols_to_field_dict: mapping of symbols to Field - :param dx: width and height of one cell - :param dim: dimension + + Args: + term: term where symbols and gradient(symbol) should be replaced + symbols_to_field_dict: mapping of symbols to Field + dx: width and height of one cell + dim: dimension Example: >>> x = sp.Symbol("x") -- GitLab