From 7fbaecf0e53dba1c0d4f06b3abd5de3058475eff Mon Sep 17 00:00:00 2001 From: Frederik Schnack Date: Wed, 20 Sep 2023 11:48:46 +0200 Subject: [PATCH] make Codacy happy --- psydac/feec/multipatch/examples/ppc_test_cases.py | 14 ++++++++------ psydac/feec/multipatch/examples_nc/__init__.py | 0 .../multipatch/examples_nc/hcurl_eigen_pbms_dg.py | 4 ++-- .../multipatch/examples_nc/hcurl_eigen_pbms_nc.py | 4 ++-- .../multipatch/examples_nc/hcurl_eigen_testcase.py | 10 +++++++--- .../examples_nc/timedomain_maxwell_nc.py | 6 +++--- psydac/feec/multipatch/utils_conga_2d.py | 2 +- 7 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 psydac/feec/multipatch/examples_nc/__init__.py diff --git a/psydac/feec/multipatch/examples/ppc_test_cases.py b/psydac/feec/multipatch/examples/ppc_test_cases.py index ddfd6659d..339d1f015 100644 --- a/psydac/feec/multipatch/examples/ppc_test_cases.py +++ b/psydac/feec/multipatch/examples/ppc_test_cases.py @@ -102,7 +102,12 @@ def get_Gaussian_beam(x_0, y_0, domain=None): return Tuple(E, 0), B def get_Gaussian_beam2(x_0, y_0, domain=None): - # return E = cos(k*x) exp( - x^2 + y^2 / 2 sigma^2) v + """ + Gaussian beam + Beam inciding from the left, centered and normal to wall: + x: axial normalized distance to the beam's focus + y: radial normalized distance to the center axis of the beam + """ x,y = domain.coordinates @@ -113,11 +118,8 @@ def get_Gaussian_beam2(x_0, y_0, domain=None): t = [(x-x0)*cos(theta) - (y - y0) * sin(theta), (x-x0)*sin(theta) + (y-y0) * cos(theta)] - ## Gaussian beam - '''Beam inciding from the left, centered and normal to wall: - x: axial normalized distance to the beam's focus - y: radial normalized distance to the center axis of the beam - ''' + + EW0 = 1.0 # amplitude at the waist k0 = 2 * pi # free-space wavenumber diff --git a/psydac/feec/multipatch/examples_nc/__init__.py b/psydac/feec/multipatch/examples_nc/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/psydac/feec/multipatch/examples_nc/hcurl_eigen_pbms_dg.py b/psydac/feec/multipatch/examples_nc/hcurl_eigen_pbms_dg.py index 682ff3226..0fba6297d 100644 --- a/psydac/feec/multipatch/examples_nc/hcurl_eigen_pbms_dg.py +++ b/psydac/feec/multipatch/examples_nc/hcurl_eigen_pbms_dg.py @@ -30,8 +30,8 @@ from psydac.feec.multipatch.non_matching_multipatch_domain_utilities import create_square_domain from psydac.api.postprocessing import OutputManager, PostProcessManager -def hcurl_solve_eigen_pbm_dg(ncells=[[2,2], [2,2]], degree=[3,3], domain=[[0, np.pi],[0, np.pi]], domain_name='refined_square', backend_language='pyccel-gcc', mu=1, nu=0, gamma_h=0, - generalized_pbm=False, sigma=None, ref_sigmas=[], nb_eigs_solve=8, nb_eigs_plot=5, skip_eigs_threshold=1e-7, +def hcurl_solve_eigen_pbm_dg(ncells=np.array([[8, 4], [4, 4]]), degree=(3,3), domain=([0, np.pi],[0, np.pi]), domain_name='refined_square', backend_language='pyccel-gcc', mu=1, nu=0, gamma_h=0, + generalized_pbm=False, sigma=5, ref_sigmas=None, nb_eigs_solve=8, nb_eigs_plot=5, skip_eigs_threshold=1e-7, plot_dir=None, hide_plots=True, m_load_dir="",): diags = {} diff --git a/psydac/feec/multipatch/examples_nc/hcurl_eigen_pbms_nc.py b/psydac/feec/multipatch/examples_nc/hcurl_eigen_pbms_nc.py index a99d601a2..77d7b1db9 100644 --- a/psydac/feec/multipatch/examples_nc/hcurl_eigen_pbms_nc.py +++ b/psydac/feec/multipatch/examples_nc/hcurl_eigen_pbms_nc.py @@ -33,8 +33,8 @@ from psydac.api.postprocessing import OutputManager, PostProcessManager -def hcurl_solve_eigen_pbm_nc(ncells=[[2,2], [2,2]], degree=[3,3], domain=[[0, np.pi],[0, np.pi]], domain_name='refined_square', backend_language='pyccel-gcc', mu=1, nu=0, gamma_h=0, - generalized_pbm=False, sigma=None, ref_sigmas=[], nb_eigs_solve=8, nb_eigs_plot=5, skip_eigs_threshold=1e-7, +def hcurl_solve_eigen_pbm_nc(ncells=np.array([[8, 4], [4, 4]]), degree=(3,3), domain=([0, np.pi],[0, np.pi]), domain_name='refined_square', backend_language='pyccel-gcc', mu=1, nu=0, gamma_h=0, + generalized_pbm=False, sigma=5, ref_sigmas=None, nb_eigs_solve=8, nb_eigs_plot=5, skip_eigs_threshold=1e-7, plot_dir=None, hide_plots=True, m_load_dir=None,): diags = {} diff --git a/psydac/feec/multipatch/examples_nc/hcurl_eigen_testcase.py b/psydac/feec/multipatch/examples_nc/hcurl_eigen_testcase.py index 853d33816..6e4defabf 100644 --- a/psydac/feec/multipatch/examples_nc/hcurl_eigen_testcase.py +++ b/psydac/feec/multipatch/examples_nc/hcurl_eigen_testcase.py @@ -116,9 +116,13 @@ case_dir = 'eigenpbm_'+operator+'_'+method ref_case_dir = case_dir -cb_min_sol = None -cb_max_sol = None - +ref_sigmas = None +sigma = None +nb_eigs_solve = None +nb_eigs_plot = None +skip_eigs_threshold = None +diags = None +eigenvalues = None if domain_name == 'refined_square': assert domain == [[0, np.pi],[0, np.pi]] diff --git a/psydac/feec/multipatch/examples_nc/timedomain_maxwell_nc.py b/psydac/feec/multipatch/examples_nc/timedomain_maxwell_nc.py index fb662b54c..0fd1c0e11 100644 --- a/psydac/feec/multipatch/examples_nc/timedomain_maxwell_nc.py +++ b/psydac/feec/multipatch/examples_nc/timedomain_maxwell_nc.py @@ -484,9 +484,6 @@ def is_plotting_time(nt, *, dt=dt, Nt=Nt, plot_time_ranges=plot_time_ranges): # f0_c = np.zeros(V1h.nbasis) - def source_enveloppe(tau): - return 1 - if source_omega is not None: f0_harmonic = f0 f0 = None @@ -494,6 +491,9 @@ def source_enveloppe(tau): # use source enveloppe for smooth transition from 0 to 1 def source_enveloppe(tau): return (special.erf((tau/25)-2)-special.erf(-2))/2 + else: + def source_enveloppe(tau): + return 1 t_stamp = time_count(t_stamp) tilde_f0_c = f0_c = None diff --git a/psydac/feec/multipatch/utils_conga_2d.py b/psydac/feec/multipatch/utils_conga_2d.py index 8be53b4f8..23046ed32 100644 --- a/psydac/feec/multipatch/utils_conga_2d.py +++ b/psydac/feec/multipatch/utils_conga_2d.py @@ -192,7 +192,7 @@ def get_Vh_diags_for(v=None, v_ref=None, M_m=None, print_diags=True, msg='error return diags -def write_diags_to_file(diags, script_filename, diag_filename, params={}): +def write_diags_to_file(diags, script_filename, diag_filename, params=None): print(' -- writing diags to file {} --'.format(diag_filename)) if not os.path.exists(diag_filename): open(diag_filename, 'w')