From 7e3341093bfc66fabd3e551fee4431967fec26e3 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 6 Nov 2024 11:04:04 -0600 Subject: [PATCH 1/2] Switching to ndarray for matrices. --- src/openmc_cad_adapter/gqs.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/openmc_cad_adapter/gqs.py b/src/openmc_cad_adapter/gqs.py index 6eeb775..b2ddf60 100644 --- a/src/openmc_cad_adapter/gqs.py +++ b/src/openmc_cad_adapter/gqs.py @@ -27,16 +27,14 @@ def characterize_general_quadratic( surface ): #s surface j = surface.coefficients['j'] k = surface.coefficients['k'] #coefficient matrix - Aa = np.matrix([ - [a, d/2, f/2], - [d/2, b, e/2], - [f/2, e/2, c]]) + Aa = np.asarray([[a, d/2, f/2], + [d/2, b, e/2], + [f/2, e/2, c]]) #hessian matrix - Ac = np.matrix([ - [a, d/2, f/2, g/2], - [d/2, b, e/2, h/2], - [f/2, e/2, c, j/2], - [g/2, h/2, j/2, k]]) + Ac = np.asarray([[a, d/2, f/2, g/2], + [d/2, b, e/2, h/2], + [f/2, e/2, c, j/2], + [g/2, h/2, j/2, k]]) rank_Aa = matrix_rank( Aa ) rank_Ac = matrix_rank( Ac ) @@ -68,7 +66,7 @@ def characterize_general_quadratic( surface ): #s surface #Update the constant using the resulting translation K_ = k + (g/2)*dx + (h/2)*dy + (j/2)*dz - K_ = K_[0,0] + K_ = K_[0] if rank_Aa == 2 and rank_Ac == 3 and S == 1: delta = -1 if K_ * signs[0] else 1 From 8b57d91a5bdb4fbd026f34e9866b611b6c0f4c1d Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 6 Nov 2024 11:06:42 -0600 Subject: [PATCH 2/2] Addressing another warning from coefficient case for planes in OpenMC --- test/test_local.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test_local.py b/test/test_local.py index 095fddd..d17d551 100644 --- a/test/test_local.py +++ b/test/test_local.py @@ -23,12 +23,12 @@ def wrapper(*args, **kwargs): @reset_openmc_ids def test_planes(request, run_in_tmpdir): - plane1 = openmc.Plane(A=1.0, B=1.0, C=0.0, D=-5.0) - plane2 = openmc.Plane(A=1.0, B=1.0, C=0.0, D=5.0) - plane3 = openmc.Plane(A=0.0, B=1.0, C=1.0, D=-5.0) - plane4 = openmc.Plane(A=0.0, B=1.0, C=1.0, D=5.0) - plane5 = openmc.Plane(A=1.0, B=0.0, C=1.0, D=-5.0) - plane6 = openmc.Plane(A=1.0, B=0.0, C=1.0, D=5.0) + plane1 = openmc.Plane(a=1.0, b=1.0, c=0.0, d=-5.0) + plane2 = openmc.Plane(a=1.0, b=1.0, c=0.0, d=5.0) + plane3 = openmc.Plane(a=0.0, b=1.0, c=1.0, d=-5.0) + plane4 = openmc.Plane(a=0.0, b=1.0, c=1.0, d=5.0) + plane5 = openmc.Plane(a=1.0, b=0.0, c=1.0, d=-5.0) + plane6 = openmc.Plane(a=1.0, b=0.0, c=1.0, d=5.0) g = openmc.Geometry([openmc.Cell(region=+plane1 & -plane2 & +plane3 & -plane4 & +plane5 & -plane6)]) to_cubit_journal(g, world=(500, 500, 500), filename='plane.jou') diff_gold_file('plane.jou')