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

GQ test and updates #12

Merged
merged 2 commits into from
Nov 6, 2024
Merged
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
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
19 changes: 19 additions & 0 deletions test/gold/ellipsoid.jou
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
set echo off
set info off
set warning off
graphics pause
set journal off
set default autosize off
#CELL 1
sphere radius 1
#{ id1 = Id("body") }
body { id1 } scale x 1.0 y 0.7071067811865476 z 0.5773502691896257
body { None } name "Cell_1"
group "mat:void" add body { None }
graphics flush
set default autosize on
zoom reset
set echo on
set info on
set warning on
set journal on
7 changes: 7 additions & 0 deletions test/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,10 @@ 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')
diff_gold_file('ellipsoid.jou')
Loading