From 9d66cb24248c2e7bea5028e5cdc7eafc895c9efa Mon Sep 17 00:00:00 2001 From: shankinsMechEng <134628078+shankinsMechEng@users.noreply.github.com> Date: Mon, 25 Mar 2024 16:23:33 -0600 Subject: [PATCH] Fixed bug with vtk fill code. The check for periodic wasn't fully defined. --- .../fierro_gui/Explicit_SGH_WInput.py | 2 +- python/FIERRO-GUI/fierro_gui/FIERRO_GUI.ui | 4 +-- .../Simulation_Parameters/Geometry.h | 33 +++---------------- 3 files changed, 8 insertions(+), 31 deletions(-) diff --git a/python/FIERRO-GUI/fierro_gui/Explicit_SGH_WInput.py b/python/FIERRO-GUI/fierro_gui/Explicit_SGH_WInput.py index b3a899447..e17eaba46 100644 --- a/python/FIERRO-GUI/fierro_gui/Explicit_SGH_WInput.py +++ b/python/FIERRO-GUI/fierro_gui/Explicit_SGH_WInput.py @@ -39,7 +39,7 @@ def Explicit_SGH_WInput(self): f' q2: {self.TMaterialsSGH.item(i,3).text()}' + '\n' \ f' q1ex: {self.TMaterialsSGH.item(i,4).text()}' + '\n' \ f' q2ex: {self.TMaterialsSGH.item(i,5).text()}' + '\n' \ - ' global_vars:' + '\n' \ + ' eos_global_vars:' + '\n' \ f' - {self.TMaterialsSGH.item(i,6).text()}' + '\n' \ f' - {self.TMaterialsSGH.item(i,7).text()}' + '\n' \ f' - {self.TMaterialsSGH.item(i,8).text()}' + '\n' \ diff --git a/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.ui b/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.ui index 859ff5f4e..4c6338f7e 100644 --- a/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.ui +++ b/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.ui @@ -2044,7 +2044,7 @@ li.checked::marker { content: "\2612"; } QFrame::NoFrame - 3 + 9 @@ -3561,7 +3561,7 @@ li.checked::marker { content: "\2612"; } - 2 + 0 diff --git a/src/Parallel-Solvers/Simulation_Parameters/Geometry.h b/src/Parallel-Solvers/Simulation_Parameters/Geometry.h index 96a7710a0..24bee6141 100644 --- a/src/Parallel-Solvers/Simulation_Parameters/Geometry.h +++ b/src/Parallel-Solvers/Simulation_Parameters/Geometry.h @@ -95,16 +95,6 @@ struct Volume : Yaml::ValidatedYaml { case VOLUME_TYPE::stl_to_voxel: fill_this = false; // default is no, don't fill it - -// orig_x = x1; -// orig_y = y1; -// orig_z = z1; -// std::cout << "ORIGIN INFO: " << orig_x << "," << orig_y << "," << orig_z << std::endl; - -// voxel_dx = (x2-x1)/((double)num_voxel_x); -// voxel_dy = (y2-y1)/((double)num_voxel_y); -// voxel_dz = (z2-z1)/((double)num_voxel_z); -// std::cout << voxel_dx << voxel_dy << voxel_dz << std::endl; // find the closest element in the voxel mesh to this element i0_real = (elem_coords[0] - orig_x)/(voxel_dx); @@ -131,25 +121,13 @@ struct Volume : Yaml::ValidatedYaml { } // end if // check for periodic - if (elem_coords[0] > num_voxel_x*voxel_dx || elem_coords[1] > num_voxel_y*voxel_dy || elem_coords[2] > num_voxel_z*voxel_dz) { + if (elem_coords[0] > num_voxel_x*voxel_dx+orig_x || elem_coords[1]> num_voxel_y*voxel_dy+orig_y || elem_coords[2] >num_voxel_z*voxel_dz+orig_z || elem_coords[0] < orig_x ||elem_coords[1] < orig_y || elem_coords[2] < orig_z) { fill_this = false; } return fill_this; case VOLUME_TYPE::vtk: fill_this = false; // default is no, don't fill it - - // Get variables from vtk file -// std::cout << "voxel dx: " << voxel_dx << std::endl; -// std::cout << "voxel dy: " << voxel_dy << std::endl; -// std::cout << "voxel dz: " << voxel_dz << std::endl; -// std::cout << "origin x: " << orig_x << std::endl; -// std::cout << "origin y: " << orig_y << std::endl; -// std::cout << "origin z: " << orig_z << std::endl; -// std::cout << "number of voxels x: " << num_voxel_x << std::endl; -// std::cout << "number of voxels y: " << num_voxel_y << std::endl; -// std::cout << "number of voxels z: " << num_voxel_z << std::endl; -// auto [voxel_elem_values, voxel_dx, voxel_dy, voxel_dz, orig_x, orig_y, orig_z, num_voxel_x, num_voxel_y, num_voxel_z] = user_voxel_init(stl_file_path); // find the closest element in the voxel mesh to this element i0_real = (elem_coords[0] - orig_x)/(voxel_dx); @@ -176,7 +154,7 @@ struct Volume : Yaml::ValidatedYaml { } // end if // check for periodic - if (elem_coords[0] > num_voxel_x*voxel_dx || elem_coords[1] > num_voxel_y*voxel_dy || elem_coords[2] > num_voxel_z*voxel_dz) { + if (elem_coords[0] > num_voxel_x*voxel_dx+orig_x || elem_coords[1] > num_voxel_y*voxel_dy+orig_y || elem_coords[2] > num_voxel_z*voxel_dz+orig_z || elem_coords[0] < orig_x || elem_coords[1] < orig_y || elem_coords[2] < orig_z) { fill_this = false; } return fill_this; @@ -474,10 +452,9 @@ std::tuple, double, double, double, double, double, double, size_t, double dz = Lz/((double) num_elems_k); // element mesh origin - double orig_x = pt_coords_x(0); - double orig_y = pt_coords_y(0); - double orig_z = pt_coords_z(0); - + double orig_x = 0.5 * (pt_coords_x(0) + pt_coords_x(1)); + double orig_y = 0.5 * (pt_coords_y(0) + pt_coords_y(1)); + double orig_z = 0.5 * (pt_coords_z(0) + pt_coords_z(1)); // look for CELLS i = 0;