Skip to content

Commit

Permalink
Updates to GQ characterization, imports, and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pshriwise committed Nov 6, 2024
1 parent 828f3c3 commit 576c4db
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
26 changes: 19 additions & 7 deletions src/openmc_cad_adapter/gqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,32 @@ def find_type( rAa, rAc, delta, S, D ):
if gq_type == ONE_SHEET_HYPERBOLOID:
if abs( K_) < equivalence_tol:
K_ = 0
return ELLIPTIC_CONE
gq_type = ELLIPTIC_CONE
if gq_type == TWO_SHEET_HYPERBOLOID:
if abs( K_) < equivalence_tol:
K_ = 0
return ELLIPTIC_CONE
gq_type = ELLIPTIC_CONE
if gq_type == ELLIPSOID:
if abs( A_) < equivalence_tol:
A_ = 0
return ELLIPTIC_CYLINDER
gq_type = ELLIPTIC_CYLINDER
elif abs( B_) < equivalence_tol:
B_ = 0
return ELLIPTIC_CYLINDER
gq_type = ELLIPTIC_CYLINDER
elif abs( C_) < equivalence_tol:
C_ = 0
return ELLIPTIC_CYLINDER
else:
return (gq_type, A_, B_, C_, K_, translation, rotation_matrix)
gq_type = ELLIPTIC_CYLINDER

return (gq_type, A_, B_, C_, K_, translation, rotation_matrix)


__all__ = ["characterize_general_quadratic",
"ELLIPSOID",
"ONE_SHEET_HYPERBOLOID",
"TWO_SHEET_HYPERBOLOID",
"ELLIPTIC_CONE",
"ELLIPTIC_PARABOLOID",
"HYPERBOLIC_PARABOLOID",
"ELLIPTIC_CYLINDER",
"HYPERBOLIC_CYLINDER",
"PARABOLIC_CYLINDER"]
14 changes: 1 addition & 13 deletions src/openmc_cad_adapter/to_cubit_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import sys
import warnings

from numpy.linalg import matrix_rank
import numpy as np

try:
Expand All @@ -18,18 +17,7 @@
from openmc.surface import Halfspace, Quadric
from openmc.lattice import Lattice, HexLattice

from .gqs import (
characterize_general_quadratic,
ELLIPSOID,
ONE_SHEET_HYPERBOLOID,
TWO_SHEET_HYPERBOLOID,
ELLIPTIC_CONE,
ELLIPTIC_PARABOLOID,
HYPERBOLIC_PARABOLOID,
ELLIPTIC_CYLINDER,
HYPERBOLIC_CYLINDER,
PARABOLIC_CYLINDER
)
from .gqs import *
from .cubit_util import emit_get_last_id, reset_cubit_ids, new_variable
from .geom_util import rotate, move
from .cubit_util import emit_get_last_id, reset_cubit_ids, new_variable
Expand Down
6 changes: 6 additions & 0 deletions test/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,9 @@ def test_general_cone(request, run_in_tmpdir):
cone = openmc.Cone(x0=0.0, y0=0.0, z0=0.0, r2=6.0, dx=1, dy=1, dz=1)
g = openmc.Geometry([openmc.Cell(region=-cone)])
to_cubit_journal(g, world=(500, 500, 500), filename='cone.jou')

@reset_openmc_ids
def test_gq_ellipsoid(request):
ellipsoid = openmc.Quadric(1, 2, 3, k=1)
g = openmc.Geometry([openmc.Cell(region=-ellipsoid)])
to_cubit_journal(g, world=(500, 500, 500), filename='ellipsoid.jou')

0 comments on commit 576c4db

Please sign in to comment.