Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use branch "real_coord" of SymPDE #445

Open
wants to merge 7 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion psydac/api/tests/test_2d_biharmonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from psydac.api.discretization import discretize

x,y,z = symbols('x1, x2, x3')
x,y,z = symbols('x1, x2, x3', real=True)
#==============================================================================
def get_boundaries(*args):

Expand Down
8 changes: 4 additions & 4 deletions psydac/api/tests/test_2d_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def run_helmholtz_2d(solution, kappa, e_w_0, dx_e_w_0, domain, ncells=None, degr
l2norm = Norm(error, domain, kind='l2')
h1norm = SemiNorm(error, domain, kind='h1')


#+++++++++++++++++++++++++++++++
# 2. Discretization
#+++++++++++++++++++++++++++++++
Expand All @@ -237,7 +238,6 @@ def run_helmholtz_2d(solution, kappa, e_w_0, dx_e_w_0, domain, ncells=None, degr
Vh = discretize(V, domain_h, degree=degree)

equation_h = discretize(equation, domain_h, [Vh, Vh], backend=backend)

l2norm_h = discretize(l2norm, domain_h, Vh, backend=backend)
h1norm_h = discretize(h1norm, domain_h, Vh, backend=backend)

Expand Down Expand Up @@ -322,7 +322,7 @@ def run_maxwell_2d(uex, f, alpha, domain, *, ncells=None, degree=None, filename=
###############################################################################
def test_complex_biharmonic_2d():
# This test solve the biharmonic problem with homogeneous dirichlet condition without a mapping
x, y, z = symbols('x1, x2, x3')
x, y, z = symbols('x1, x2, x3', real=True)
solution = (sin(pi * x)**2 * sin(pi * y)**2 + 1j * sin(2*pi * x)**2 * sin(2*pi * y)**2) * exp(pi * 1j * (x**2+y**2))
f = laplace(laplace(solution))

Expand All @@ -343,7 +343,7 @@ def test_complex_biharmonic_2d():
def test_complex_biharmonic_2d_mapping():
# This test solve the biharmonic problem with homogeneous dirichlet condition with a mapping

x, y, z = symbols('x, y, z')
x, y, z = symbols('x, y, z', real=True)
filename = os.path.join(mesh_dir, 'collela_2d.h5')

factor=2.5
Expand Down Expand Up @@ -450,7 +450,7 @@ def test_complex_helmholtz_2d(plot_sol=False):
u_err = [(u1 - u2) for u1, u2 in zip(u_vals, uh_vals)]

my_small_plot(
title=r'approximation of solution $u$',
title=r'Approximation of solution $u$',
vals=[u_vals, uh_vals, u_err],
titles=[r'$u^{ex}(x,y)$', r'$u^h(x,y)$', r'$|(u^{ex}-u^h)(x,y)|$'],
xx=xx,
Expand Down
2 changes: 1 addition & 1 deletion psydac/api/tests/test_2d_laplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from psydac.api.discretization import discretize

x,y,z = symbols('x1, x2, x3')
x,y,z = symbols('x1, x2, x3', real=True)
#==============================================================================
def get_boundaries(*args):

Expand Down
3 changes: 2 additions & 1 deletion psydac/api/tests/test_2d_mapping_biharmonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from mpi4py import MPI
from sympy import pi, cos, sin, symbols
from sympy.abc import x, y
import pytest
import os
import numpy as np
Expand All @@ -43,6 +42,8 @@
base_dir = os.path.join(base_dir, '..', '..', '..')
mesh_dir = os.path.join(base_dir, 'mesh')
# ...
x,y = symbols('x,y', real=True)

#==============================================================================
def get_boundaries(*args):

Expand Down
3 changes: 2 additions & 1 deletion psydac/api/tests/test_2d_mapping_laplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from mpi4py import MPI
from sympy import pi, cos, sin, symbols
from sympy.abc import x, y
import pytest
import os
import numpy as np
Expand All @@ -43,6 +42,8 @@
base_dir = os.path.join(base_dir, '..', '..', '..')
mesh_dir = os.path.join(base_dir, 'mesh')
# ...
x,y = symbols('x,y', real=True)

#==============================================================================
def get_boundaries(*args):

Expand Down
3 changes: 2 additions & 1 deletion psydac/api/tests/test_2d_mapping_poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import os
from mpi4py import MPI
from sympy import pi, cos, sin, symbols
from sympy.abc import x, y
import pytest
import numpy as np

Expand All @@ -44,6 +43,8 @@
base_dir = os.path.join(base_dir, '..', '..', '..')
mesh_dir = os.path.join(base_dir, 'mesh')

x, y = symbols('x, y', real=True)

# backend to activate multi threading
PSYDAC_BACKEND_GPYCCEL_WITH_OPENMP = PSYDAC_BACKEND_GPYCCEL.copy()
PSYDAC_BACKEND_GPYCCEL_WITH_OPENMP['openmp'] = True
Expand Down
2 changes: 1 addition & 1 deletion psydac/api/tests/test_2d_poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from psydac.api.discretization import discretize
from psydac.api.settings import PSYDAC_BACKEND_GPYCCEL

x,y,z = symbols('x1, x2, x3')
x,y,z = symbols('x1, x2, x3', real=True)

# backend to activate multi threading
PSYDAC_BACKEND_GPYCCEL_WITH_OPENMP = PSYDAC_BACKEND_GPYCCEL.copy()
Expand Down
2 changes: 1 addition & 1 deletion psydac/api/tests/test_api_1d_compatible_spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def run_system_1_1d_dir(f0, sol, ncells, degree):
def test_api_system_1_1d_dir_1():

from sympy import symbols
x1 = symbols('x1')
x1 = symbols('x1', real=True)

f0 = -(2*pi)**2*sin(2*pi*x1)
u = sin(2*pi*x1)
Expand Down
4 changes: 2 additions & 2 deletions psydac/api/tests/test_api_2d_compatible_spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def run_maxwell_time_harmonic_2d_dir(uex, f, alpha, ncells, degree):
###############################################################################
def test_poisson_mixed_form_2d_dir_1():
from sympy import symbols
x1, x2 = symbols('x1, x2')
x1, x2 = symbols('x1, x2', real=True)

f0 = -2*x1*(1-x1) -2*x2*(1-x2)
u = x1*(1-x1)*x2*(1-x2)
Expand Down Expand Up @@ -509,7 +509,7 @@ def test_stokes_2d_dir_non_homogeneous(scipy):
#------------------------------------------------------------------------------
def test_maxwell_time_harmonic_2d_dir_1():
from sympy import symbols
x,y,z = symbols('x1, x2, x3')
x,y,z = symbols('x1, x2, x3', real=True)

alpha = 1.
uex = Tuple(sin(pi*y), sin(pi*x)*cos(pi*y))
Expand Down
4 changes: 2 additions & 2 deletions psydac/api/tests/test_api_2d_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
# coordinates (r, theta), but with reversed order: hence x1=theta and x2=r

from mpi4py import MPI
from sympy import pi, cos, sin, log, exp, lambdify
from sympy.abc import x, y
from sympy import pi, cos, sin, log, exp, lambdify, symbols
import pytest
import os

Expand Down Expand Up @@ -46,6 +45,7 @@
base_dir = os.path.join(base_dir, '..', '..', '..')
mesh_dir = os.path.join(base_dir, 'mesh')
# ...
x, y = symbols('x, y', real=True)

#------------------------------------------------------------------------------
def run_field_test(filename, f):
Expand Down
2 changes: 1 addition & 1 deletion psydac/api/tests/test_api_2d_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_api_system_1_2d_dir_1():

from sympy import symbols

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

Fe = Tuple(sin(pi*x1)*sin(pi*x2), sin(pi*x1)*sin(pi*x2))
f0 = Tuple(2*pi**2*sin(pi*x1)*sin(pi*x2),
Expand Down
2 changes: 1 addition & 1 deletion psydac/api/tests/test_api_2d_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def run_vector_poisson_2d_dir(solution, f, ncells, degree):
def test_api_vector_poisson_2d_dir_1():

from sympy import symbols
x1, x2 = symbols('x1, x2')
x1, x2 = symbols('x1, x2', real=True)

u1 = sin(pi*x1)*sin(pi*x2)
u2 = sin(pi*x1)*sin(pi*x2)
Expand Down
7 changes: 2 additions & 5 deletions psydac/api/tests/test_api_2d_vector_mapping.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: UTF-8 -*-

import os
from sympy import Tuple, Matrix
from sympy import Tuple, Matrix, symbols
from sympy import pi, sin

from sympde.calculus import grad, dot, inner
Expand All @@ -24,6 +24,7 @@
base_dir = os.path.join(base_dir, '..', '..', '..')
mesh_dir = os.path.join(base_dir, 'mesh')
# ...
x,y = symbols('x,y', real=True)

#==============================================================================
def run_vector_poisson_2d_dir(filename, solution, f):
Expand Down Expand Up @@ -86,8 +87,6 @@ def run_vector_poisson_2d_dir(filename, solution, f):
def test_api_vector_poisson_2d_dir_identity():
filename = os.path.join(mesh_dir, 'identity_2d.h5')

from sympy.abc import x,y

u1 = sin(pi*x)*sin(pi*y)
u2 = sin(pi*x)*sin(pi*y)
solution = Tuple(u1, u2)
Expand All @@ -108,8 +107,6 @@ def test_api_vector_poisson_2d_dir_identity():
def test_api_vector_poisson_2d_dir_collela():
filename = os.path.join(mesh_dir, 'collela_2d.h5')

from sympy.abc import x,y

u1 = sin(pi*x)*sin(pi*y)
u2 = sin(pi*x)*sin(pi*y)
solution = Tuple(u1, u2)
Expand Down
4 changes: 2 additions & 2 deletions psydac/api/tests/test_api_2d_vector_multipatch_mapping.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: UTF-8 -*-

import os
from sympy import Tuple, Matrix
from sympy import Tuple, Matrix, symbols
from sympy import pi, sin

from sympde.calculus import grad, dot, inner, Transpose
Expand Down Expand Up @@ -101,7 +101,7 @@ def run_vector_poisson_2d_dir(filename, solution, f):
def test_api_vector_poisson_2d_dir_identity():
filename = os.path.join(mesh_dir, 'multipatch/square.h5')

from sympy.abc import x,y
x,y = symbols('x,y', real=True)

u1 = sin(pi*x)*sin(pi*y)
u2 = sin(pi*x)*sin(pi*y)
Expand Down
10 changes: 5 additions & 5 deletions psydac/api/tests/test_api_3d_scalar.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def run_poisson_3d_dirneu(solution, f, boundary, ncells, degree, comm=None):
def test_api_poisson_3d_dir_1():

from sympy import symbols
x1, x2, x3 = symbols('x1, x2, x3')
x1, x2, x3 = symbols('x1, x2, x3', real=True)

solution = sin(pi*x1)*sin(pi*x2)*sin(pi*x3)
f = 3*pi**2*sin(pi*x1)*sin(pi*x2)*sin(pi*x3)
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_api_poisson_3d_dir_1():
def test_api_poisson_3d_dirneu_2():

from sympy import symbols
x1, x2, x3 = symbols('x1, x2, x3')
x1, x2, x3 = symbols('x1, x2, x3', real=True)

solution = sin(0.5*pi*x1)*sin(pi*x2)*sin(pi*x3)
f = (9./4.)*pi**2*solution
Expand All @@ -212,7 +212,7 @@ def test_api_poisson_3d_dirneu_2():
def test_api_poisson_3d_dirneu_13():

from sympy import symbols
x1, x2, x3 = symbols('x1, x2, x3')
x1, x2, x3 = symbols('x1, x2, x3', real=True)

solution = cos(0.5*pi*x1)*cos(0.5*pi*x2)*sin(pi*x3)
f = (3./2.)*pi**2*solution
Expand All @@ -232,7 +232,7 @@ def test_api_poisson_3d_dirneu_13():
def test_api_poisson_3d_dirneu_24():

from sympy import symbols
x1, x2, x3 = symbols('x1, x2, x3')
x1, x2, x3 = symbols('x1, x2, x3', real=True)

solution = sin(0.5*pi*x1)*sin(0.5*pi*x2)*sin(pi*x3)
f = (3./2.)*pi**2*solution
Expand Down Expand Up @@ -300,7 +300,7 @@ def test_api_poisson_3d_dirneu_24():
def test_api_poisson_3d_dir_1_parallel():

from sympy import symbols
x1, x2, x3 = symbols('x1, x2, x3')
x1, x2, x3 = symbols('x1, x2, x3', real=True)

solution = sin(pi*x1)*sin(pi*x2)*sin(pi*x3)
f = 3*pi**2*sin(pi*x1)*sin(pi*x2)*sin(pi*x3)
Expand Down
18 changes: 9 additions & 9 deletions psydac/api/tests/test_api_3d_scalar_mapping.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: UTF-8 -*-

from mpi4py import MPI
from sympy import pi, cos, sin
from sympy import pi, cos, sin, symbols
import pytest
import os

Expand Down Expand Up @@ -240,7 +240,7 @@ def test_api_poisson_3d_dir_collela():

filename = os.path.join(mesh_dir, 'collela_3d.h5')

from sympy.abc import x,y,z
x,y,z = symbols('x,y,z', real=True)

solution = sin(pi*x)*sin(pi*y)*sin(pi*z)
f = 3*pi**2*sin(pi*x)*sin(pi*y)*sin(pi*z)
Expand All @@ -258,7 +258,7 @@ def test_api_poisson_3d_dir_collela():
def test_api_poisson_3d_dirneu_identity_2():
filename = os.path.join(mesh_dir, 'identity_3d.h5')

from sympy.abc import x,y,z
x,y,z = symbols('x,y,z', real=True)

solution = sin(0.5*pi*x)*sin(pi*y)*sin(pi*z)
f = (9./4.)*pi**2*solution
Expand All @@ -276,7 +276,7 @@ def test_api_poisson_3d_dirneu_identity_2():
def test_api_poisson_3d_dirneu_identity_13():
filename = os.path.join(mesh_dir, 'identity_3d.h5')

from sympy.abc import x,y,z
x,y,z = symbols('x,y,z', real=True)

solution = cos(0.5*pi*x)*cos(0.5*pi*y)*sin(pi*z)
f = (3./2.)*pi**2*solution
Expand All @@ -295,7 +295,7 @@ def test_api_poisson_3d_dirneu_identity_13():
def test_api_poisson_3d_dirneu_identity_24():
filename = os.path.join(mesh_dir, 'identity_3d.h5')

from sympy.abc import x,y,z
x,y,z = symbols('x,y,z', real=True)

solution = sin(0.5*pi*x)*sin(0.5*pi*y)*sin(pi*z)
f = (3./2.)*pi**2*solution
Expand Down Expand Up @@ -358,7 +358,7 @@ def test_api_poisson_3d_dirneu_identity_24():
def test_api_poisson_3d_dirneu_collela_2():
filename = os.path.join(mesh_dir, 'collela_3d.h5')

from sympy.abc import x,y,z
x,y,z = symbols('x,y,z', real=True)

solution = sin(0.25*pi*(x+1.))*sin(pi*y)*sin(pi*z)
f = (33./16.)*pi**2*solution
Expand Down Expand Up @@ -397,7 +397,7 @@ def test_api_poisson_3d_dirneu_collela_2():
def test_api_poisson_3d_dirneu_collela_24():
filename = os.path.join(mesh_dir, 'collela_3d.h5')

from sympy.abc import x,y,z
x,y,z = symbols('x,y,z', real=True)

solution = sin(0.25*pi*(x+1.))*sin(0.25*pi*(y+1.))*sin(pi*z)
f = (9./8.)*pi**2*solution
Expand Down Expand Up @@ -459,7 +459,7 @@ def test_api_poisson_3d_dirneu_collela_24():
def test_api_laplace_3d_neu_identity():
filename = os.path.join(mesh_dir, 'identity_3d.h5')

from sympy.abc import x,y,z
x,y,z = symbols('x,y,z', real=True)

solution = cos(pi*x)*cos(pi*y)*cos(pi*z)
f = (3.*pi**2 + 1.)*solution
Expand Down Expand Up @@ -500,7 +500,7 @@ def test_api_poisson_3d_dir_collela():

filename = os.path.join(mesh_dir, 'collela_3d.h5')

from sympy.abc import x,y,z
x,y,z = symbols('x,y,z', real=True)

solution = sin(pi*x)*sin(pi*y)*sin(pi*z)
f = 3*pi**2*sin(pi*x)*sin(pi*y)*sin(pi*z)
Expand Down
2 changes: 1 addition & 1 deletion psydac/api/tests/test_api_3d_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def run_vector_poisson_3d_dir(solution, f, ncells, degree):
def test_api_vector_poisson_3d_dir_1():

from sympy import symbols
x1, x2, x3 = symbols('x1, x2, x3')
x1, x2, x3 = symbols('x1, x2, x3', real=True)

u1 = sin(pi*x1)*sin(pi*x2)*sin(pi*x3)
u2 = sin(pi*x1)*sin(pi*x2)*sin(pi*x3)
Expand Down
6 changes: 3 additions & 3 deletions psydac/api/tests/test_api_3d_vector_mapping.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: UTF-8 -*-

import os
from sympy import Tuple, Matrix
from sympy import Tuple, Matrix, symbols
from sympy import pi, sin

from sympde.calculus import grad, dot, inner
Expand Down Expand Up @@ -85,7 +85,7 @@ def run_vector_poisson_3d_dir(filename, solution, f):
def test_api_vector_poisson_3d_dir_identity():
filename = os.path.join(mesh_dir, 'identity_3d.h5')

from sympy.abc import x,y,z
x,y,z = symbols('x,y,z', real=True)

u1 = sin(pi*x)*sin(pi*y)*sin(pi*z)
u2 = sin(pi*x)*sin(pi*y)*sin(pi*z)
Expand All @@ -109,7 +109,7 @@ def test_api_vector_poisson_3d_dir_identity():
def test_api_vector_poisson_3d_dir_collela():
filename = os.path.join(mesh_dir, 'collela_3d.h5')

from sympy.abc import x,y,z
x,y,z = symbols('x,y,z', real=True)

u1 = sin(pi*x)*sin(pi*y)*sin(pi*z)
u2 = sin(pi*x)*sin(pi*y)*sin(pi*z)
Expand Down
Loading