Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
31 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
4a25359
lower conv order in projector tests for low regularity functions
campospinto Mar 19, 2026
deb5a36
Merge branch 'devel' into shorter_CI
yguclu Mar 25, 2026
46a64c7
Don't run test_build_derham_mapping.py in parallel
yguclu Mar 25, 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
2 changes: 1 addition & 1 deletion psydac/api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@
'pyccel-intel' : PSYDAC_BACKEND_IPYCCEL,
'pyccel-pgi' : PSYDAC_BACKEND_PGPYCCEL,
'pyccel-nvidia': PSYDAC_BACKEND_NVPYCCEL,
}
}
Comment thread
yguclu marked this conversation as resolved.
Outdated
25 changes: 22 additions & 3 deletions psydac/api/tests/test_2d_multipatch_mapping_maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,25 @@ def test_maxwell_2d_2_patch_dirichlet_0():
#------------------------------------------------------------------------------
def test_maxwell_2d_2_patch_dirichlet_1():

domain = build_pretzel()
# domain = build_pretzel() # a lot of patches, takes a long time
Comment thread
yguclu marked this conversation as resolved.
Outdated

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))]
Comment thread
campospinto marked this conversation as resolved.
Outdated
patches = [D1,D2]
domain = Domain.join(patches, connectivity, 'domain')

x,y = domain.coordinates

omega = 1.5
Expand All @@ -158,8 +176,9 @@ def test_maxwell_2d_2_patch_dirichlet_1():

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

expected_l2_error = 1.5941322657006822


expected_l2_error = 0.06335070876243 # 1.5941322657006822
print(l2_error, abs(l2_error - expected_l2_error))
assert abs(l2_error - expected_l2_error) < 1e-7

#------------------------------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions psydac/feec/tests/test_commuting_projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@pytest.mark.parametrize('bc', [True, False])
@pytest.mark.parametrize('p', [2, 3])
@pytest.mark.parametrize('Nq', [5])
@pytest.mark.parametrize('Nel', [5, 6])
@pytest.mark.parametrize('Nel', [5]) #, 6])
def test_3d_commuting_pro_1(Nel, Nq, p, bc, m):

fun1 = lambda xi1, xi2, xi3 : np.sin(xi1)*np.sin(xi2)*np.sin(xi3)
Expand Down Expand Up @@ -103,7 +103,7 @@ def test_3d_commuting_pro_1(Nel, Nq, p, bc, m):
@pytest.mark.parametrize('bc', [True, False])
@pytest.mark.parametrize('p', [2, 3])
@pytest.mark.parametrize('Nq', [7])
@pytest.mark.parametrize('Nel', [5, 6])
@pytest.mark.parametrize('Nel', [5]) #, 6])
def test_3d_commuting_pro_2(Nel, Nq, p, bc, m):

fun1 = lambda xi1, xi2, xi3 : np.sin(xi1)*np.sin(xi2)*np.sin(xi3)
Expand Down Expand Up @@ -195,7 +195,7 @@ def test_3d_commuting_pro_2(Nel, Nq, p, bc, m):
@pytest.mark.parametrize('bc', [True, False])
@pytest.mark.parametrize('p', [2, 3])
@pytest.mark.parametrize('Nq', [7])
@pytest.mark.parametrize('Nel', [5, 6])
@pytest.mark.parametrize('Nel', [5]) #, 6])
def test_3d_commuting_pro_3(Nel, Nq, p, bc, m):

fun1 = lambda xi1, xi2, xi3 : np.sin(xi1)*np.sin(xi2)*np.sin(xi3)
Expand Down Expand Up @@ -278,7 +278,7 @@ def test_3d_commuting_pro_3(Nel, Nq, p, bc, m):
# 2D tests
#==============================================================================
@pytest.mark.mpi
@pytest.mark.parametrize('Nel', [8, 12])
@pytest.mark.parametrize('Nel', [8]) #, 12])
@pytest.mark.parametrize('Nq', [5])
@pytest.mark.parametrize('p', [2,3])
@pytest.mark.parametrize('bc', [True, False])
Expand Down Expand Up @@ -351,7 +351,7 @@ def test_2d_commuting_pro_1(Nel, Nq, p, bc, m):
assert norm2_e1 < 1e-12

@pytest.mark.mpi
@pytest.mark.parametrize('Nel', [8, 12])
@pytest.mark.parametrize('Nel', [8]) #, 12])
@pytest.mark.parametrize('Nq', [5])
@pytest.mark.parametrize('p', [2,3])
@pytest.mark.parametrize('bc', [True, False])
Expand Down Expand Up @@ -424,7 +424,7 @@ def test_2d_commuting_pro_2(Nel, Nq, p, bc, m):
assert norm2_e0 < 1e-12

@pytest.mark.mpi
@pytest.mark.parametrize('Nel', [8, 12])
@pytest.mark.parametrize('Nel', [8]) #, 12])
@pytest.mark.parametrize('Nq', [8])
@pytest.mark.parametrize('p', [2,3])
@pytest.mark.parametrize('bc', [True, False])
Expand Down Expand Up @@ -504,7 +504,7 @@ def test_2d_commuting_pro_3(Nel, Nq, p, bc, m):
assert norm2_e3 < 1e-12

@pytest.mark.mpi
@pytest.mark.parametrize('Nel', [8, 12])
@pytest.mark.parametrize('Nel', [8]) #, 12])
@pytest.mark.parametrize('Nq', [8])
@pytest.mark.parametrize('p', [2,3])
@pytest.mark.parametrize('bc', [True, False])
Expand Down
6 changes: 3 additions & 3 deletions psydac/feec/tests/test_commuting_projections_dual.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import pytest


@pytest.mark.parametrize('Nel', [8, 12])
@pytest.mark.parametrize('Nel', [8]) #, 12])
@pytest.mark.parametrize('Nq', [5])
@pytest.mark.parametrize('p', [2, 3])
@pytest.mark.parametrize('bc', [True, False])
Expand Down Expand Up @@ -58,7 +58,7 @@ def test_transpose_div_3d(Nel, Nq, p, bc, m):
assert error < 2e-10


@pytest.mark.parametrize('Nel', [8, 12])
@pytest.mark.parametrize('Nel', [8]) #, 12])
@pytest.mark.parametrize('Nq', [6])
@pytest.mark.parametrize('p', [2, 3])
@pytest.mark.parametrize('bc', [True, False])
Expand Down Expand Up @@ -116,7 +116,7 @@ def test_transpose_curl_3d(Nel, Nq, p, bc, m):
assert error < 2e-9


@pytest.mark.parametrize('Nel', [8, 12])
@pytest.mark.parametrize('Nel', [8]) #, 12])
@pytest.mark.parametrize('Nq', [6])
@pytest.mark.parametrize('p', [2, 3])
@pytest.mark.parametrize('bc', [True, False])
Expand Down
2 changes: 1 addition & 1 deletion psydac/feec/tests/test_feec_conf_projectors_cart_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_polynomial_function(degree, hom_bc_axes, domain):
@pytest.mark.parametrize('nc', [5])
@pytest.mark.parametrize('reg', [0])
@pytest.mark.parametrize('hom_bc', [False, True])
@pytest.mark.parametrize('domain_name', ["1patch", "4patch_nc", "2patch_nc"])
@pytest.mark.parametrize('domain_name', ["1patch", "4patch_nc"]) #, "2patch_nc"])
@pytest.mark.parametrize("nonconforming, full_mom_pres",
[(True, True), (False, True)])

Expand Down
83 changes: 43 additions & 40 deletions psydac/feec/tests/test_global_projectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_L2_projector_1d(domain, ncells, degree, periodic, nquads, multiplicity)
assert maxnorm_error <= 1e-3

#==============================================================================
@pytest.mark.parametrize('ncells', [[200,200]])
@pytest.mark.parametrize('ncells', [[57,64]])
@pytest.mark.parametrize('degree', [[2,2], [2,3], [3,3]])
@pytest.mark.parametrize('periodic', [[False, False], [True, True]])
@pytest.mark.parametrize('multiplicity', [(1, 1), (2, 2)])
Expand All @@ -114,15 +114,14 @@ def test_derham_projector_2d_hdiv(ncells, degree, periodic, multiplicity):

domain = Square('Omega', bounds1 = (0,2*np.pi), bounds2 = (0,2*np.pi))
domain_h = discretize(domain, ncells=ncells, periodic=periodic)
#change multiplicity if higher than degree to avoid problems (case p<m doesn't work)

# change multiplicity cannot be higher than the degree (otherwise splines are discontinuous)
Comment thread
yguclu marked this conversation as resolved.
Outdated
multiplicity = [min(m, p) for p, m in zip(degree, multiplicity)]

derham = Derham(domain, ["H1", "Hdiv", "L2"])
derham_h = discretize(derham, domain_h, degree=degree, get_H1vec_space = True, multiplicity=multiplicity)
P0, P1, P2, PX = derham_h.projectors(nquads=[2*p+1 for p in degree])

# Projector onto H1 space (1D interpolation)

# Function to project
f1 = lambda xi1, xi2 : np.sin( xi1 + 0.5 ) * np.cos( xi2 + 0.3 )
f2 = lambda xi1, xi2 : np.cos( xi1 + 0.5 ) * np.sin( xi2 - 0.2 )
Expand All @@ -144,19 +143,19 @@ def test_derham_projector_2d_hdiv(ncells, degree, periodic, multiplicity):
# Test if max-norm of error is <= TOL
maxnorm_error = abs(vals_u0 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 1e-3
assert maxnorm_error <= 1e-2
maxnorm_error = abs(vals_u1_1 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 1e-3
assert maxnorm_error <= 1e-2
maxnorm_error = abs(vals_u2 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 1e-3
assert maxnorm_error <= 1e-2
maxnorm_error = abs(vals_ux_1 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 1e-3
assert maxnorm_error <= 1e-2

#==============================================================================
@pytest.mark.parametrize('ncells', [[200,200]])
@pytest.mark.parametrize('ncells', [[50,66]])
@pytest.mark.parametrize('degree', [[2,2], [2,3], [3,3]])
@pytest.mark.parametrize('periodic', [[False, False], [True, True]])
@pytest.mark.parametrize('multiplicity', [(1, 1), (2, 2)])
Expand All @@ -166,16 +165,15 @@ def test_derham_projector_2d_hdiv_2(ncells, degree, periodic, multiplicity):
domain = Square('Omega', bounds1 = (0,1), bounds2 = (0,1))
domain_h = discretize(domain, ncells=ncells, periodic=periodic)

# change multiplicity cannot be higher than the degree (otherwise splines are discontinuous)
Comment thread
yguclu marked this conversation as resolved.
Outdated
multiplicity = [min(m, p) for p, m in zip(degree, multiplicity)]

derham = Derham(domain, ["H1", "Hdiv", "L2"])
derham_h = discretize(derham, domain_h, degree=degree, get_H1vec_space = True, multiplicity=multiplicity)
P0, P1, P2, PX = derham_h.projectors()

# Projector onto H1 space (1D interpolation)

# Function to project
f1 = lambda xi1, xi2 : xi1**2*(xi1-1.)**2
#function C0 restricted to [0,1] with periodic BC (0 at x1=0 and x1=1)
f2 = lambda xi1, xi2 : xi2**2*(xi2-1.)**2

# Compute the projection
Expand Down Expand Up @@ -207,7 +205,7 @@ def test_derham_projector_2d_hdiv_2(ncells, degree, periodic, multiplicity):
assert maxnorm_error <= 1e-3

#==============================================================================
@pytest.mark.parametrize('ncells', [[200,200]])
@pytest.mark.parametrize('ncells', [[62,58]])
@pytest.mark.parametrize('degree', [[2,2], [2,3], [3,3]])
@pytest.mark.parametrize('periodic', [[False, False], [True, False] ,[True, True]])
@pytest.mark.parametrize('multiplicity', [[1,1],[2,2]])
Expand All @@ -217,8 +215,10 @@ def test_derham_projector_2d_hcurl(ncells, degree, periodic, multiplicity):
domain = Square('Omega', bounds1 = (0,2*np.pi), bounds2 = (0,2*np.pi))
domain_h = discretize(domain, ncells=ncells, periodic=periodic)

multiplicity = [min(m,p) for p, m in zip (degree, multiplicity)]
derham = Derham(domain, ["H1", "Hdiv", "L2"])
# change multiplicity cannot be higher than the degree (otherwise splines are discontinuous)
Comment thread
yguclu marked this conversation as resolved.
Outdated
multiplicity = [min(m, p) for p, m in zip (degree, multiplicity)]

derham = Derham(domain, ["H1", "Hcurl", "L2"])
derham_h = discretize(derham, domain_h, degree=degree, get_H1vec_space = True, multiplicity=multiplicity)
P0, P1, P2, PX = derham_h.projectors()

Expand All @@ -243,19 +243,19 @@ def test_derham_projector_2d_hcurl(ncells, degree, periodic, multiplicity):
# Test if max-norm of error is <= TOL
maxnorm_error = abs(vals_u0 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 1e-3
assert maxnorm_error <= 1e-2
maxnorm_error = abs(vals_u1_1 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 1e-3
assert maxnorm_error <= 1e-2
maxnorm_error = abs(vals_u2 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 1e-3
assert maxnorm_error <= 1e-2
maxnorm_error = abs(vals_ux_1 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 1e-3
assert maxnorm_error <= 1e-2

#==============================================================================
@pytest.mark.parametrize('ncells', [[20,20,20]])
@pytest.mark.parametrize('ncells', [[10,9,12]])
@pytest.mark.parametrize('degree', [[2,2,2], [2,3,2], [3,3,3]])
@pytest.mark.parametrize('periodic', [[False, False, False], [True, True, True]])
@pytest.mark.parametrize('multiplicity', [[1,1,1], [1,2,2], [2,2,2]])
Expand Down Expand Up @@ -296,49 +296,52 @@ def test_derham_projector_3d(ncells, degree, periodic, multiplicity):
# Test if max-norm of error is <= TOL
maxnorm_error = abs(vals_u0 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 0.01
assert maxnorm_error <= 0.05

maxnorm_error = abs(vals_u1_1 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 0.01
assert maxnorm_error <= 0.05

maxnorm_error = abs(vals_u2_1 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 0.05
assert maxnorm_error <= 0.2

maxnorm_error = abs(vals_u3 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 0.05
assert maxnorm_error <= 0.2

maxnorm_error = abs(vals_ux_1 - vals_f).max()
print(ncells, maxnorm_error)
assert maxnorm_error <= 0.02
assert maxnorm_error <= 0.05

#==============================================================================
if __name__ == '__main__':

domain = (0, 2*np.pi)
degree = 3
degrees = [[2,2,2], [2,3,2], [3,3,3]] #3
periodic = True
ncells = [10, 20, 40, 80, 160, 320, 640]
mult = [[1,1,1], [1,2,2], [2,2,2]]

for nc in ncells:
test_derham_projector_2d_hdiv([nc, nc], [degree, degree], [periodic, periodic], [2, 2])
# for nc in ncells:
# test_derham_projector_2d_hdiv([nc, nc], [degree, degree], [periodic, periodic], [2, 2])

for nc in ncells:
test_H1_projector_1d(domain, nc, degree, periodic, multiplicity = 2)
# for nc in ncells:
# test_H1_projector_1d(domain, nc, degree, periodic, multiplicity = 2)

nquads = degree
for nc in ncells:
test_L2_projector_1d(domain, nc, degree, periodic, nquads)
# nquads = degree
# for nc in ncells:
# test_L2_projector_1d(domain, nc, degree, periodic, nquads)

for nc in ncells:
test_derham_projector_2d_hdiv_2([nc, nc], [degree, degree], [periodic, periodic])
test_derham_projector_2d_hdiv([nc, nc], [degree, degree], [periodic, periodic], 2)
# for nc in ncells:
# test_derham_projector_2d_hdiv_2([nc, nc], [degree, degree], [periodic, periodic])
# test_derham_projector_2d_hdiv([nc, nc], [degree, degree], [periodic, periodic], 2)

for nc in ncells :
test_derham_projector_2d_hcurl([nc, nc], [degree, degree], [periodic, periodic])
# for nc in ncells :
# test_derham_projector_2d_hcurl([nc, nc], [degree, degree], [periodic, periodic])

for nc in ncells[:3] :
test_derham_projector_3d([nc, nc, nc], [degree, degree, degree], [periodic, periodic, periodic])
for nc in ncells[:3]:
for deg in degrees:
for m in mult:
test_derham_projector_3d([nc, nc, nc], deg, [periodic, periodic, periodic], multiplicity=m)
Comment thread
yguclu marked this conversation as resolved.
Outdated