Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonas Plewinski
pystencils
Commits
0ead004b
Commit
0ead004b
authored
Jan 28, 2019
by
Martin Bauer
Browse files
Grandchem generalization WIP
- started with generalized free energy formulation
parent
f925f890
Changes
1
Hide whitespace changes
Inline
Side-by-side
fd/finitedifferences.py
View file @
0ead004b
...
...
@@ -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")
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment