pystencils merge requestshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests2020-01-16T10:57:24+01:00https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/126Fix failing interpolation tests on newer sympy versions2020-01-16T10:57:24+01:00Stephan SeitzFix failing interpolation tests on newer sympy versionsSome tests where failing on newer SymPy versions due two reasons:
- fmod was where it should be % (fix in code), affect mirror boundary handling for interpolation
- in rotation test: `mirror` and `wrap` boundary handling was failing due...Some tests where failing on newer SymPy versions due two reasons:
- fmod was where it should be % (fix in code), affect mirror boundary handling for interpolation
- in rotation test: `mirror` and `wrap` boundary handling was failing due two complex conjugate (mark test as xfail)https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/122SerialDataHandling: synchronization_function for tensor fields2020-01-16T10:57:16+01:00Michael Kuronmkuron@icp.uni-stuttgart.deSerialDataHandling: synchronization_function for tensor fieldsIt already worked on the CPU, just needed to remove the check. On the GPU, we use `itertools.product` to create the nested loop needed.It already worked on the CPU, just needed to remove the check. On the GPU, we use `itertools.product` to create the nested loop needed.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/125Fix {PyCuda,PyOpenCl}ArrayHandler.{zeros,ones,randn}2020-01-15T20:42:01+01:00Stephan SeitzFix {PyCuda,PyOpenCl}ArrayHandler.{zeros,ones,randn}https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/124Add dtype to DataHandling.add_arrays2020-01-15T13:32:17+01:00Stephan SeitzAdd dtype to DataHandling.add_arrayshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/123Make create_staggered_kernel work with OpenMP2020-01-14T15:54:40+01:00Michael Kuronmkuron@icp.uni-stuttgart.deMake create_staggered_kernel work with OpenMPIssue reported bey @alexander.reinauer. I broke this in !93.Issue reported bey @alexander.reinauer. I broke this in !93.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/93Reimplement create_staggered_kernel2020-01-14T15:46:47+01:00Michael Kuronmkuron@icp.uni-stuttgart.deReimplement create_staggered_kernel`create_staggered_kernel` now takes a list of assignments to staggered fields and otherwise behaves like `create_kernel`. I have included a diffusion equation test case in both D2Q5 and D2Q9. Putting vectorial/tensorial quantities on the...`create_staggered_kernel` now takes a list of assignments to staggered fields and otherwise behaves like `create_kernel`. I have included a diffusion equation test case in both D2Q5 and D2Q9. Putting vectorial/tensorial quantities on the staggered points also works.
This merge requests break API compatibility with the previous `create_staggered_kernel`.
Fixes #16. My next step is to implement automatic FV discretization.
Build of dependent projects (pygrandchem, pystencils_walberla) passes as per https://i10git.cs.fau.de/pycodegen/pycodegen/merge_requests/6.
Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/120Add DataHandling.add_arrays2020-01-14T14:09:15+01:00Stephan SeitzAdd DataHandling.add_arraysThis adds a function for lazy people who want to write
```python
dh = create_data_handling((20, 30))
x, y, z = dh.add_arrays('x, y(9), z')
```
instead of
```python
dh = create_data_handling((20, 30))
dh.add_array('x')
dh.a...This adds a function for lazy people who want to write
```python
dh = create_data_handling((20, 30))
x, y, z = dh.add_arrays('x, y(9), z')
```
instead of
```python
dh = create_data_handling((20, 30))
dh.add_array('x')
dh.add_array('y', values_per_cell=9)
dh.add_array('z')
```
because in most cases you want to use more than one array.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/121Automatic Finite Volume and Volume-of-Fluid discretization2020-01-14T14:08:05+01:00Michael Kuronmkuron@icp.uni-stuttgart.deAutomatic Finite Volume and Volume-of-Fluid discretizationI don't yet have a good test for volume-of-fluid and the source term, but @alexander.reinauer requested the code because he needs it now. I'll add the missing tests at some later point.I don't yet have a good test for volume-of-fluid and the source term, but @alexander.reinauer requested the code because he needs it now. I'll add the missing tests at some later point.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/119Opencl datahandling2020-01-10T10:22:59+01:00Stephan SeitzOpencl datahandlingSince the `target_dh_refactoring` was never merged, we decided to do the refactoring at smaller steps and recover the original OpenCL datahandling PR.
Refactoring to merge `target` and `backend` can be done later.Since the `target_dh_refactoring` was never merged, we decided to do the refactoring at smaller steps and recover the original OpenCL datahandling PR.
Refactoring to merge `target` and `backend` can be done later.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/118Allow functions for Field.coordinate_transform2020-01-09T20:20:23+01:00Stephan SeitzAllow functions for Field.coordinate_transformThis lets you quickly switch to polar coordinate systems:
```python
field.coordinate_transform = lambda x: sympy.Matrix((x.norm(), sympy.atan2(*x) / (2 * sympy.pi) * field.shape[1]))
```This lets you quickly switch to polar coordinate systems:
```python
field.coordinate_transform = lambda x: sympy.Matrix((x.norm(), sympy.atan2(*x) / (2 * sympy.pi) * field.shape[1]))
```https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/114Fix AssignmentCollection.{free_symbols,bound_symbols,defined_symbols} for non...2019-12-19T23:28:04+01:00Stephan SeitzFix AssignmentCollection.{free_symbols,bound_symbols,defined_symbols} for non-AssignmentsThis should allow to execute AssignmentCollection.{free_symbols,bound_symbols,symbols_defined} on AssignmentCollection that do not exclusively contain `pystencils.Assignments`.
Should fix lbmpy tests (let's see if that's true).This should allow to execute AssignmentCollection.{free_symbols,bound_symbols,symbols_defined} on AssignmentCollection that do not exclusively contain `pystencils.Assignments`.
Should fix lbmpy tests (let's see if that's true).https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/115:star: :star: :star: Add a star to correctly get atoms of InterpolatorAccess ...2019-12-19T15:40:16+01:00Stephan Seitz:star: :star: :star: Add a star to correctly get atoms of InterpolatorAccess :star: :star: :star:https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/109FiniteDifferenceStaggeredStencilDerivation must be applied to field access2019-12-18T21:15:21+01:00Michael Kuronmkuron@icp.uni-stuttgart.deFiniteDifferenceStaggeredStencilDerivation must be applied to field accessotherwise the index gets lost.
Also, fix the staggered field access prettyprinter. It was correct after !86 but printed wrong indices after !92. I have now added a test.otherwise the index gets lost.
Also, fix the staggered field access prettyprinter. It was correct after !86 but printed wrong indices after !92. I have now added a test.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/110Update AssignmentCollection.__repr__2019-12-18T21:14:57+01:00Stephan SeitzUpdate AssignmentCollection.__repr__`Assignment Collection for y[0,0,0]` is usually not very helpful.
New representation:
```
In [6]: forward_assignments = pystencils.AssignmentCollection({
...: z[0, 0]: x[0, 0] * sympy.log(x[0, 0] * y[0, 0]),
...: ...`Assignment Collection for y[0,0,0]` is usually not very helpful.
New representation:
```
In [6]: forward_assignments = pystencils.AssignmentCollection({
...: z[0, 0]: x[0, 0] * sympy.log(x[0, 0] * y[0, 0]),
...: y[0,0] : x[1,1] +1
...: })
In [7]: forward_assignments
Out[7]: AssignmentCollection: z_C, y_C <- f(x_C, x_NE)
```https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/92More staggered grid improvements2019-12-17T14:52:00+01:00Michael Kuronmkuron@icp.uni-stuttgart.deMore staggered grid improvements- Fix access to directions with mixed signs (`NW`, `(-1/2, 1/2)` and the like). They were previously mapped to the wrong cell.
- When storing fluxes on a staggered grid, the usual sign convention is that
fluxes point outward from the c...- Fix access to directions with mixed signs (`NW`, `(-1/2, 1/2)` and the like). They were previously mapped to the wrong cell.
- When storing fluxes on a staggered grid, the usual sign convention is that
fluxes point outward from the cell. Previously, we did not consistently respect that
(`staggered_access("E")` would return the same thing as `staggered_access("W")`
did when called from the eastern-next cell). Now, when a field is declared
as `STAGGERED_FLUX`, it returns an accessor with a prefactor of -1 in that
case. The previous behavior where sign is not reversed is still useful when
e.g. storing sums (e.g. mean values) instead of differenes (e.g. finite
difference fluxes) on the staggered grid.
- `staggered_vector_access` returns a vector/tensor full of `Access` objects corresponding to the shape (`index_shape[1:]`) of the staggered fieldMartin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/86Staggered field access and staggered fields with fluxes to edges/faces2019-12-17T14:52:00+01:00Michael Kuronmkuron@icp.uni-stuttgart.deStaggered field access and staggered fields with fluxes to edges/facesThe first index dimension is always used to identify the staggered point, any further ones can be used to store vectors/tensors at these points. `f.staggered_access("N")` or `f.staggered_access(0, sp.Rational(1, 2)))` is now supported. T...The first index dimension is always used to identify the staggered point, any further ones can be used to store vectors/tensors at these points. `f.staggered_access("N")` or `f.staggered_access(0, sp.Rational(1, 2)))` is now supported. The string representation of the resulting accessor is $`f_{(0,\frac{1}{2})}`$. Furthermore, staggered fields can now have more staggered points than spatial dimensions, i.e. to store fluxes to edge/face neighbors (e.g. `f.staggered_access("NE")`.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/108AssignmentCollection.__bool__2019-12-17T13:30:15+01:00Stephan SeitzAssignmentCollection.__bool__`AssignmentCollection` can be used in many cases where you could also use
a `List[Assignment]`. With `AssignmentCollection.__bool__`, an empty
AssignmentCollection is falsy and a non-empty one truthy.
So you can `assert assignments,...`AssignmentCollection` can be used in many cases where you could also use
a `List[Assignment]`. With `AssignmentCollection.__bool__`, an empty
AssignmentCollection is falsy and a non-empty one truthy.
So you can `assert assignments, 'must not be emtpy'`https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/107Allow `CUSTOM_FIELD`s to have a different size in transformations.py2019-12-17T13:16:06+01:00Stephan SeitzAllow `CUSTOM_FIELD`s to have a different size in transformations.pyhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/105Fix FiniteDifferenceStaggeredStencilDerivation on Sympy 1.12019-12-16T15:05:39+01:00Michael Kuronmkuron@icp.uni-stuttgart.deFix FiniteDifferenceStaggeredStencilDerivation on Sympy 1.1I broke it in !104I broke it in !104Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/104Minor improvements to FiniteDifferenceStaggeredStencilDerivation2019-12-06T20:20:51+01:00Michael Kuronmkuron@icp.uni-stuttgart.deMinor improvements to FiniteDifferenceStaggeredStencilDerivationMartin BauerMartin Bauer