mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Merge pull request #2417 from pshriwise/spherical-mesh-fixes
Spherical to Cartesian coordinate conversion correction for VTK files
This commit is contained in:
commit
341cb9eb11
2 changed files with 141 additions and 17 deletions
|
|
@ -446,7 +446,7 @@ class RegularMesh(StructuredMesh):
|
|||
if self._width is not None:
|
||||
self._width = None
|
||||
warnings.warn("Unsetting width attribute.")
|
||||
|
||||
|
||||
if self.lower_left is not None and any(np.isclose(self.lower_left, upper_right)):
|
||||
raise ValueError("Mesh cannot have zero thickness in any dimension")
|
||||
|
||||
|
|
@ -1533,9 +1533,9 @@ class SphericalMesh(StructuredMesh):
|
|||
|
||||
pts_cartesian = np.copy(pts_spherical)
|
||||
r, theta, phi = pts_spherical[:, 0], pts_spherical[:, 1], pts_spherical[:, 2]
|
||||
pts_cartesian[:, 0] = r * np.sin(phi) * np.cos(theta)
|
||||
pts_cartesian[:, 1] = r * np.sin(phi) * np.sin(theta)
|
||||
pts_cartesian[:, 2] = r * np.cos(phi)
|
||||
pts_cartesian[:, 0] = r * np.sin(theta) * np.cos(phi)
|
||||
pts_cartesian[:, 1] = r * np.sin(theta) * np.sin(phi)
|
||||
pts_cartesian[:, 2] = r * np.cos(theta)
|
||||
|
||||
return super().write_data_to_vtk(
|
||||
points=pts_cartesian,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue