Skip to content

Commit

Permalink
Fixed bug with vtk fill code. The check for periodic wasn't fully def…
Browse files Browse the repository at this point in the history
…ined.
  • Loading branch information
shankinsMechEng committed Mar 25, 2024
1 parent 9de2eab commit 9d66cb2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 31 deletions.
2 changes: 1 addition & 1 deletion python/FIERRO-GUI/fierro_gui/Explicit_SGH_WInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -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' \
Expand Down
4 changes: 2 additions & 2 deletions python/FIERRO-GUI/fierro_gui/FIERRO_GUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,7 @@ li.checked::marker { content: "\2612"; }
<enum>QFrame::NoFrame</enum>
</property>
<property name="currentIndex">
<number>3</number>
<number>9</number>
</property>
<widget class="QWidget" name="TitlePage">
<property name="minimumSize">
Expand Down Expand Up @@ -3561,7 +3561,7 @@ li.checked::marker { content: &quot;\2612&quot;; }
<item alignment="Qt::AlignTop">
<widget class="QStackedWidget" name="BasicGeometries">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="BoxProperties">
<layout class="QVBoxLayout" name="verticalLayout_35">
Expand Down
33 changes: 5 additions & 28 deletions src/Parallel-Solvers/Simulation_Parameters/Geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -474,10 +452,9 @@ std::tuple<CArray<bool>, 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;
Expand Down

0 comments on commit 9d66cb2

Please sign in to comment.