Skip to content

Commit

Permalink
Domain coordinates should be real (#156)
Browse files Browse the repository at this point in the history
At the moment the domain coordinates are Sympy symbols but we don't
specify them to be real.

Consequently when we take the real part of a complex expression of the
coordinates, the resulting symbolic expression includes the imaginary
part of the coordinate and eventually Pyccel throws an error.

Besides, setting the symbols to real simplifies considerably the
expressions.

---------

Co-authored-by: Martin Campos Pinto <[email protected]>
  • Loading branch information
e-moral-sanchez and campospinto authored Jul 11, 2024
1 parent 27358bf commit 31ffec7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sympde/topology/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ def __new__(cls, name, dim, min_coords, max_coords):
raise ValueError("Min coordinates must be smaller than max")

coord_names = 'x1:{}'.format(dim + 1)
coordinates = symbols(coord_names)
coordinates = symbols(coord_names, real=True)

# Choose which type to use:
# a) if dim <= 3, use Line, Square or Cube;
Expand Down
2 changes: 1 addition & 1 deletion sympde/topology/tests/test_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from sympy import Tuple
from sympy import symbols

x1, x2, x3 = symbols('x1, x2, x3')
x1, x2, x3 = symbols('x1, x2, x3', real=True)

from sympde.topology import Interval, ProductDomain, InteriorDomain, Domain
from sympde.topology import Line, Square, Cube, NCubeInterior
Expand Down

0 comments on commit 31ffec7

Please sign in to comment.