Skip to content
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3cd2b73
change compilation flags for M4
campospinto Feb 13, 2026
acadab7
update gitignore for profiling and temp pyccel folders
campospinto Feb 13, 2026
0ceb382
use 2 patch for maxwell_2d_2_patch test
campospinto Feb 13, 2026
1430b70
use coarser and less grids in tests
campospinto Feb 13, 2026
9c17a52
Merge branch 'devel' into shorter_CI
campospinto Feb 13, 2026
79dc5b0
Merge branch 'devel' into shorter_CI
yguclu Feb 13, 2026
1fa1eb2
Merge branch 'devel' into shorter_CI
campospinto Feb 19, 2026
7282712
Update psydac/api/tests/test_2d_multipatch_mapping_maxwell.py
campospinto Feb 25, 2026
830e047
clean multipatch tests
campospinto Feb 26, 2026
2f598dd
update comment
campospinto Feb 26, 2026
88bfbde
revert changes to settings.py
campospinto Feb 26, 2026
121ea3a
add poisson test with bretzel domain
campospinto Feb 26, 2026
4b3ed90
Require Pyccel version >= 2.2.1
yguclu Mar 2, 2026
cafd8cd
Update build requirement on pyccel >= 2.2.1
yguclu Mar 3, 2026
2b06c44
Update psydac/api/tests/build_domain.py
campospinto Mar 3, 2026
238bab8
Update psydac/api/tests/build_domain.py
campospinto Mar 3, 2026
ff7ef79
Update psydac/api/tests/build_domain.py
campospinto Mar 3, 2026
55003eb
Update psydac/feec/multipatch_domain_utilities.py
campospinto Mar 3, 2026
b5b7ef9
Require Pyccel >= 2.2.2 at build and runtime
yguclu Mar 9, 2026
098ceba
clean build_domain.py
campospinto Mar 9, 2026
323f8ca
Merge branch 'devel' into shorter_CI
yguclu Mar 9, 2026
ca381ff
Import correct domain-building functions in API unit tests after name…
yguclu Mar 9, 2026
5e702c9
Fix parentheses in connectivities of test_2d_multipatch_poisson.py
yguclu Mar 10, 2026
7bc8654
Clean up test_2d_multipatch_poisson.py
yguclu Mar 10, 2026
e92ba5f
use expected conv order in projector tests
campospinto Mar 10, 2026
73eab39
Move prints from unit tests to manual run in test_global_projectors.py
yguclu Mar 10, 2026
9d4528f
use f2 and f3 in 3D projector tests
campospinto Mar 13, 2026
62807d9
accept small errors (tol = 1e-13) in convergence tests
campospinto Mar 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*.so
*.lock
__psydac__/
__*pyccel__/
__*pyccel__*/
docs/source/modules/STUBDIR/*

build
Expand All @@ -13,6 +13,7 @@ build
*dist*
usr
*cache*
prof

*.swp
*.log
Expand Down
34 changes: 27 additions & 7 deletions psydac/api/tests/build_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
from sympde.topology import Square, Domain
from sympde.topology import IdentityMapping, PolarMapping, AffineMapping, Mapping

# remove after sympde PR #155 is merged and call Domain.join instead
from psydac.feec.multipatch_domain_utilities import sympde_Domain_join

#==============================================================================
# small extension to SymPDE:
class TransposedPolarMapping(Mapping):
Expand Down Expand Up @@ -65,10 +62,34 @@ def flip_axis(name='no_name', c1=0., c2=0.):

#==============================================================================

def build_2_patch_domain():
"""
build simple 2-patch domain domain
"""
bounds1 = (0.5, 1.)
bounds2_A = (0, np.pi/2)
bounds2_B = (np.pi/2, np.pi)

A = Square('A',bounds1=bounds1, bounds2=bounds2_A)
B = Square('B',bounds1=bounds1, bounds2=bounds2_B)

mapping_1 = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)
mapping_2 = PolarMapping('M2',2, c1= 0., c2= 0., rmin = 0., rmax=1.)

D1 = mapping_1(A)
D2 = mapping_2(B)

connectivity = [((0,1,1), (1,1,-1), 1)]
patches = [D1, D2]

domain = Domain.join(patches, connectivity, '2_patch_domain')

return domain

# todo: use build_multipatch_domain instead
def build_pretzel(domain_name='pretzel', r_min=None, r_max=None):
"""
design pretzel-like domain
build pretzel-like domain
"""

if r_min is None:
Expand Down Expand Up @@ -222,8 +243,7 @@ def build_pretzel(domain_name='pretzel', r_min=None, r_max=None):
[(domain_12, axis_0, ext_0), (domain_14, axis_0, ext_1), 1],
]

# domain = Domain.join(patches, connectivity, name=domain_name)
domain = sympde_Domain_join(patches, connectivity, name=domain_name)

domain = Domain.join(patches, connectivity, name=domain_name)

return domain

27 changes: 5 additions & 22 deletions psydac/api/tests/test_2d_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

from psydac.api.discretization import discretize
from psydac.api.settings import PSYDAC_BACKEND_GPYCCEL
from psydac.api.tests.build_domain import build_2_patch_domain

# Get the mesh directory
import psydac.cad.mesh as mesh_mod
Expand Down Expand Up @@ -154,11 +155,6 @@ def run_poisson_2d(solution, f, domain, ncells=None, degree=None, filename=None,

kappa = 10**3

#expr_I =- dot(grad(plus(u)),nn)*minus(v) + dot(grad(minus(v)),nn)*plus(u) - kappa*plus(u)*minus(v)\
# + dot(grad(minus(u)),nn)*plus(v) - dot(grad(plus(v)),nn)*minus(u) - kappa*plus(v)*minus(u)\
# - dot(grad(plus(v)),nn)*plus(u) + kappa*plus(u)*plus(v)\
# - dot(grad(minus(v)),nn)*minus(u) + kappa*minus(u)*minus(v)

expr_I =- 0.5*dot(grad( plus(u)), nn) * minus(v) + 0.5*dot(grad(minus(v)), nn) * plus(u) - kappa * plus(u)*minus(v)\
+ 0.5*dot(grad(minus(u)), nn) * plus(v) - 0.5*dot(grad( plus(v)), nn) * minus(u) - kappa * plus(v)*minus(u)\
- 0.5*dot(grad(minus(v)), nn) * minus(u) - 0.5*dot(grad(minus(u)), nn) * minus(v) + kappa *minus(u)*minus(v)\
Expand Down Expand Up @@ -460,7 +456,8 @@ def test_complex_helmholtz_2d(plot_sol=False):
assert( abs(l2_error - expected_l2_error) < 1.e-7)
assert( abs(h1_error - expected_h1_error) < 1.e-7)

def test_maxwell_2d_2_patch_dirichlet_2():
def test_maxwell_2d_1_patch_dirichlet_2():

# This test solve the maxwell problem with non-homogeneous dirichlet condition with penalization on the border of the exact solution
domain = Square('domain', bounds1=(0, 1), bounds2=(0, 1))
x,y = domain.coordinates
Expand All @@ -480,23 +477,9 @@ def test_maxwell_2d_2_patch_dirichlet_2():

@pytest.mark.mpi
def test_maxwell_2d_2_patch_dirichlet_parallel_0():
# This test solve the maxwell problem with non-homogeneous dirichlet condition with penalization on the border of the exact solution

bounds1 = (0.5, 1.)
bounds2_A = (0, np.pi/2)
bounds2_B = (np.pi/2, np.pi)

A = Square('A', bounds1=bounds1, bounds2=bounds2_A)
B = Square('B', bounds1=bounds1, bounds2=bounds2_B)

mapping_1 = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)
mapping_2 = PolarMapping('M2',2, c1= 0., c2= 0., rmin = 0., rmax=1.)

D1 = mapping_1(A)
D2 = mapping_2(B)

domain = Domain.join([D1, D2], [((0, 1, 1), (1, 1, -1))], 'domain')

# This test solve the maxwell problem with non-homogeneous dirichlet condition with penalization on the border of the exact solution
domain = build_2_patch_domain()
x, y = domain.coordinates

omega = 1.5
Expand Down
56 changes: 4 additions & 52 deletions psydac/api/tests/test_2d_multipatch_mapping_maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from sympde.expr.equation import find, EssentialBC

from psydac.api.discretization import discretize
from psydac.api.tests.build_domain import build_pretzel
from psydac.api.tests.build_domain import build_pretzel, build_2_patch_domain
from psydac.fem.basic import FemField
from psydac.api.settings import PSYDAC_BACKEND_GPYCCEL
from psydac.feec.pull_push import pull_2d_hcurl
Expand Down Expand Up @@ -113,23 +113,7 @@ def run_maxwell_2d(uex, f, alpha, domain, *, ncells=None, degree=None, filename=
#------------------------------------------------------------------------------
def test_maxwell_2d_2_patch_dirichlet_0():

bounds1 = (0.5, 1.)
bounds2_A = (0, np.pi/2)
bounds2_B = (np.pi/2, np.pi)

A = Square('A',bounds1=bounds1, bounds2=bounds2_A)
B = Square('B',bounds1=bounds1, bounds2=bounds2_B)

mapping_1 = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)
mapping_2 = PolarMapping('M2',2, c1= 0., c2= 0., rmin = 0., rmax=1.)

D1 = mapping_1(A)
D2 = mapping_2(B)

connectivity = [((0,1,1),(1,1,-1))]
patches = [D1,D2]
domain = Domain.join(patches, connectivity, 'domain')

domain = build_2_patch_domain()
x,y = domain.coordinates

omega = 1.5
Expand All @@ -144,26 +128,9 @@ def test_maxwell_2d_2_patch_dirichlet_0():

assert abs(l2_error - expected_l2_error) < 1e-7

#------------------------------------------------------------------------------
def test_maxwell_2d_2_patch_dirichlet_1():

domain = build_pretzel()
x,y = domain.coordinates

omega = 1.5
alpha = -omega**2
Eex = Tuple(sin(pi*y), sin(pi*x)*cos(pi*y))
f = Tuple(alpha*sin(pi*y) - pi**2*sin(pi*y)*cos(pi*x) + pi**2*sin(pi*y),
alpha*sin(pi*x)*cos(pi*y) + pi**2*sin(pi*x)*cos(pi*y))

l2_error, Eh = run_maxwell_2d(Eex, f, alpha, domain, ncells=[2**2, 2**2], degree=[2,2])

expected_l2_error = 1.5941322657006822

assert abs(l2_error - expected_l2_error) < 1e-7

#------------------------------------------------------------------------------
def test_maxwell_2d_2_patch_dirichlet_2():
def test_maxwell_2d_2_patch_dirichlet_1():

filename = os.path.join(mesh_dir, 'multipatch/square_repeated_knots.h5')
domain = Domain.from_file(filename)
Expand All @@ -190,22 +157,7 @@ def test_maxwell_2d_2_patch_dirichlet_2():
@pytest.mark.mpi
def test_maxwell_2d_2_patch_dirichlet_parallel_0():

bounds1 = (0.5, 1.)
bounds2_A = (0, np.pi/2)
bounds2_B = (np.pi/2, np.pi)

A = Square('A',bounds1=bounds1, bounds2=bounds2_A)
B = Square('B',bounds1=bounds1, bounds2=bounds2_B)

mapping_1 = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)
mapping_2 = PolarMapping('M2',2, c1= 0., c2= 0., rmin = 0., rmax=1.)

D1 = mapping_1(A)
D2 = mapping_2(B)

connectivity = [((0,1,1),(1,1,-1))]
patches = [D1,D2]
domain = Domain.join(patches, connectivity, 'domain')
domain = build_2_patch_domain()
x,y = domain.coordinates

omega = 1.5
Expand Down
67 changes: 25 additions & 42 deletions psydac/api/tests/test_2d_multipatch_mapping_poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from sympde.expr.equation import find, EssentialBC

from psydac.api.discretization import discretize
from psydac.api.tests.build_domain import build_pretzel
from psydac.api.tests.build_domain import build_pretzel, build_2_patch_domain
from psydac.api.settings import PSYDAC_BACKEND_GPYCCEL
from psydac.fem.plotting_utilities import plot_field_2d as plot_field

Expand Down Expand Up @@ -99,18 +99,7 @@ def run_poisson_2d(solution, f, domain, ncells=None, degree=None, filename=None,
#------------------------------------------------------------------------------
def test_poisson_2d_2_patches_dirichlet_0():

A = Square('A',bounds1=(0.5, 1.), bounds2=(0, np.pi/2))
B = Square('B',bounds1=(0.5, 1.), bounds2=(np.pi/2, np.pi))

mapping_1 = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)
mapping_2 = PolarMapping('M2',2, c1= 0., c2= 0., rmin = 0., rmax=1.)

D1 = mapping_1(A)
D2 = mapping_2(B)

connectivity = [((0,1,1),(1,1,-1))]
patches = [D1,D2]
domain = Domain.join(patches, connectivity, 'domain')
domain = build_2_patch_domain()

x,y = domain.coordinates
solution = x**2 + y**2
Expand All @@ -127,18 +116,7 @@ def test_poisson_2d_2_patches_dirichlet_0():
#------------------------------------------------------------------------------
def test_poisson_2d_2_patches_dirichlet_1():

A = Square('A',bounds1=(0.5, 1.), bounds2=(0, np.pi/2))
B = Square('B',bounds1=(0.5, 1.), bounds2=(np.pi/2, np.pi))

mapping_1 = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)
mapping_2 = PolarMapping('M2',2, c1= 0., c2= 0., rmin = 0., rmax=1.)

D1 = mapping_1(A)
D2 = mapping_2(B)

connectivity = [((0,1,1),(1,1,-1))]
patches = [D1,D2]
domain = Domain.join(patches, connectivity, 'domain')
domain = build_2_patch_domain()

x,y = domain.coordinates
solution = sin(pi*x)*sin(pi*y)
Expand All @@ -153,7 +131,7 @@ def test_poisson_2d_2_patches_dirichlet_1():
assert ( abs(h1_error - expected_h1_error) < 1e-7 )

#------------------------------------------------------------------------------
def test_poisson_2d_2_patches_dirichlet_2():
def test_poisson_2d_3_patches_dirichlet_2():

mapping_1 = IdentityMapping('M1', 2)
mapping_2 = PolarMapping ('M2', 2, c1 = 0., c2 = 0.5, rmin = 0., rmax=1.)
Expand Down Expand Up @@ -189,15 +167,15 @@ def test_poisson_2d_2_patches_dirichlet_2():
#------------------------------------------------------------------------------
def test_poisson_2d_2_patches_dirichlet_3():

domain = build_pretzel()
domain = build_2_patch_domain()
x,y = domain.coordinates
solution = x**2 + y**2
solution = (2.654-x)**2 + (1.1-y)**2
f = -4

l2_error, h1_error, uh = run_poisson_2d(solution, f, domain, ncells=[2**2,2**2], degree=[2,2])

expected_l2_error = 0.009824734742537082
expected_h1_error = 0.10615177751279731
expected_l2_error = 0.0014599905413109973
expected_h1_error = 0.035873834713380987

assert ( abs(l2_error - expected_l2_error) < 1e-7)
assert ( abs(h1_error - expected_h1_error) < 1e-7 )
Expand Down Expand Up @@ -297,6 +275,22 @@ def test_poisson_2d_4_patch_dirichlet_0():
assert ( abs(l2_error - expected_l2_error) < 1e-7 )
assert ( abs(h1_error - expected_h1_error) < 1e-7 )

def test_poisson_2d_bretzel_dirichlet_0():

domain = build_pretzel()

x,y = domain.coordinates
solution = x**2 + y**2
f = -4

l2_error, h1_error, uh = run_poisson_2d(solution, f, domain, ncells=[2**2,2**2], degree=[2,2])

expected_l2_error = 0.009824734742571888
expected_h1_error = 0.10615177751253213

assert ( abs(l2_error - expected_l2_error) < 1e-7 )
assert ( abs(h1_error - expected_h1_error) < 1e-7 )

###############################################################################
# PARALLEL TESTS
###############################################################################
Expand All @@ -305,18 +299,7 @@ def test_poisson_2d_4_patch_dirichlet_0():
@pytest.mark.mpi
def test_poisson_2d_2_patches_dirichlet_parallel_0():

A = Square('A',bounds1=(0.5, 1.), bounds2=(0, np.pi/2))
B = Square('B',bounds1=(0.5, 1.), bounds2=(np.pi/2, np.pi))

mapping_1 = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)
mapping_2 = PolarMapping('M2',2, c1= 0., c2= 0., rmin = 0., rmax=1.)

D1 = mapping_1(A)
D2 = mapping_2(B)

connectivity = [((0,1,1),(1,1,-1))]
patches = [D1, D2]
domain = Domain.join(patches, connectivity, 'domain')
domain = build_2_patch_domain()

x,y = domain.coordinates
solution = sin(pi*x)*sin(pi*y)
Expand Down
15 changes: 5 additions & 10 deletions psydac/api/tests/test_2d_multipatch_poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ def run_poisson_2d(solution, f, domain, ncells, degree):

kappa = 10**3

#expr_I =- dot(grad(plus(u)),nn)*minus(v) + dot(grad(minus(v)),nn)*plus(u) - kappa*plus(u)*minus(v)\
# + dot(grad(minus(u)),nn)*plus(v) - dot(grad(plus(v)),nn)*minus(u) - kappa*plus(v)*minus(u)\
# - dot(grad(plus(v)),nn)*plus(u) + kappa*plus(u)*plus(v)\
# - dot(grad(minus(v)),nn)*minus(u) + kappa*minus(u)*minus(v)

expr_I =- 0.5*dot(grad(plus(u)),nn)*minus(v) + 0.5*dot(grad(minus(v)),nn)*plus(u) - kappa*plus(u)*minus(v)\
+ 0.5*dot(grad(minus(u)),nn)*plus(v) - 0.5*dot(grad(plus(v)),nn)*minus(u) - kappa*plus(v)*minus(u)\
- 0.5*dot(grad(minus(v)),nn)*minus(u) - 0.5*dot(grad(minus(u)),nn)*minus(v) + kappa*minus(u)*minus(v)\
Expand Down Expand Up @@ -83,7 +78,7 @@ def test_poisson_2d_2_patch_dirichlet_0():
A = Square('A',bounds1=(0, 0.5), bounds2=(0, 1))
B = Square('B',bounds1=(0.5, 1.), bounds2=(0, 1))

connectivity = [((0,0,1),(1,0,-1))]
connectivity = [((0,0,1),(1,0,-1)), 1]
patches = [A,B]
domain = Domain.join(patches, connectivity, 'domain')

Expand All @@ -105,7 +100,7 @@ def test_poisson_2d_2_patch_dirichlet_1():
A = Square('A',bounds1=(0, 0.5), bounds2=(0, 1))
B = Square('B',bounds1=(0.5, 1.), bounds2=(0, 1))

connectivity = [((0,0,1),(1,0,-1))]
connectivity = [((0,0,1),(1,0,-1)), 1]
patches = [A,B]
domain = Domain.join(patches, connectivity, 'domain')

Expand All @@ -126,7 +121,7 @@ def test_poisson_2d_2_patch_dirichlet_2():
A = Square('A',bounds1=(0, 0.5), bounds2=(0, 1))
B = Square('B',bounds1=(0.5, 1.), bounds2=(0, 1))

connectivity = [((0,0,1),(1,0,-1))]
connectivity = [((0,0,1),(1,0,-1)), 1]
patches = [A,B]
domain = Domain.join(patches, connectivity, 'domain')

Expand Down Expand Up @@ -155,7 +150,7 @@ def test_poisson_2d_2_patch_dirichlet_3():
D1 = M1(A)
D2 = M2(B)

connectivity = [((0,0,1),(1,0,1))]
connectivity = [((0,0,1),(1,0,1)), 1]
patches = [D1,D2]
domain = Domain.join(patches, connectivity, 'domain')

Expand All @@ -182,7 +177,7 @@ def test_poisson_2d_2_patch_dirichlet_4():
D1 = M1(A)
D2 = M2(B)

connectivity = [((0,0,-1),(1,0,-1))]
connectivity = [((0,0,-1),(1,0,-1)), 1]
patches = [D1,D2]
domain = Domain.join(patches, connectivity, 'domain')

Expand Down
Loading
Loading