From 10b2198ec535a826b4efe9f551b643479bcd3582 Mon Sep 17 00:00:00 2001 From: Bhargav Akula Date: Sun, 5 Apr 2026 16:22:08 -0400 Subject: [PATCH 1/2] reverted earlier changes in the compute_saturation method in the Water class --- lib/simulation.py | 22 +++++++++++----------- lib/test.py | 2 +- lib/water.py | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/simulation.py b/lib/simulation.py index 399ffab..41827d4 100644 --- a/lib/simulation.py +++ b/lib/simulation.py @@ -1475,17 +1475,17 @@ def run(self): ## STEP 2.7: Updating the cummulative oil captured, Production rate, and the residual oil in place # arrays for exporting to CSV files - if (t_cal == 0): - self.COC[0,t_cal] = ocut - else: - self.COC[0,t_cal] = self.COC[0,t_cal - 1] + ocut - - self.ProdRate[0,t_cal] = ocut/dt - self.CROIP[0,t_cal] = ROIP - - t_cal += 1 - - self._export_results() + # if (t_cal == 0): + # self.COC[0,t_cal] = ocut + # else: + # self.COC[0,t_cal] = self.COC[0,t_cal - 1] + ocut + # + # self.ProdRate[0,t_cal] = ocut/dt + # self.CROIP[0,t_cal] = ROIP + # + # t_cal += 1 + # + # self._export_results() except Exception as e: print(e) diff --git a/lib/test.py b/lib/test.py index 129c773..cfe09e8 100644 --- a/lib/test.py +++ b/lib/test.py @@ -51,7 +51,7 @@ "simulation_id": 1, "model_type": MODEL["No_Shear_Thinning"], "reservoir_geometry": GEOMETRY["Rectilinear"], - "permeability": PERMEABILITY["Homogeneous"], + "permeability": PERMEABILITY["Heterogeneous"], "polymer_type": POLYMER["Xanthane"], "polymer_concentration": 0.001, "surfactant_type": SURFACTANT["Alkyl_Ether_Sulfate"], diff --git a/lib/water.py b/lib/water.py index e972933..825426f 100644 --- a/lib/water.py +++ b/lib/water.py @@ -580,7 +580,7 @@ def compute_water_saturation( + g1 * (1 - f[cnt][i]) + ( (D_g[cnt][i] + D_g[cnt][i + 1]) / (dx**2) - + (D_g[cnt + 1][i] + D_g[cnt][i]) / (dy**2) + + (D_g[cnt + 1][i] + D_g[cnt][i]) / (dx**2) ) * surfactant.concentration_matrix[cnt][i] - (D_g[cnt][i] + D_g[cnt][i + 1]) @@ -595,7 +595,7 @@ def compute_water_saturation( BB[j][i] = ( 1 / dt_array[cnt][i] - - (D_s[cnt][i] + D_s[cnt][i + 1]) / (dx**2) + - (D_s[cnt+1][i] + D_s[cnt][i + 1]) / (dx**2) - (D_s[cnt + 1][i] + D_s[cnt][i]) / (dy**2) ) @@ -730,7 +730,7 @@ def compute_water_saturation( * surfactant.concentration_matrix[cnt - 1][i] ) - BB[j][i - 1] = (D_s[cnt][i] + D_s[cnt][i - 1]) / (dx**2) + BB[j][i - 1] = (D_s[cnt][i] + D_s[cnt][i - 1]) / (dy**2) BB[j][i] = ( 1 / dt_array[cnt][i] @@ -1037,7 +1037,7 @@ def compute_water_saturation( warnings.warn(f"BiCGSTAB: convergence issue (info={info}) in water saturation solver") Qnew = Qnew_flat = Qnew_flat.reshape(m, n) - Qnew[Qnew < 0] = 0 + Qnew[Qnew > 1] = 1 self.water_saturation = Qnew From 809adc0efae1f8a5722f8092fe42fc3d4cad4e45 Mon Sep 17 00:00:00 2001 From: Bhargav Akula Date: Sun, 5 Apr 2026 16:32:41 -0400 Subject: [PATCH 2/2] un-commented code for updating COC, ProdRate, and CROIP --- lib/simulation.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/simulation.py b/lib/simulation.py index 41827d4..399ffab 100644 --- a/lib/simulation.py +++ b/lib/simulation.py @@ -1475,17 +1475,17 @@ def run(self): ## STEP 2.7: Updating the cummulative oil captured, Production rate, and the residual oil in place # arrays for exporting to CSV files - # if (t_cal == 0): - # self.COC[0,t_cal] = ocut - # else: - # self.COC[0,t_cal] = self.COC[0,t_cal - 1] + ocut - # - # self.ProdRate[0,t_cal] = ocut/dt - # self.CROIP[0,t_cal] = ROIP - # - # t_cal += 1 - # - # self._export_results() + if (t_cal == 0): + self.COC[0,t_cal] = ocut + else: + self.COC[0,t_cal] = self.COC[0,t_cal - 1] + ocut + + self.ProdRate[0,t_cal] = ocut/dt + self.CROIP[0,t_cal] = ROIP + + t_cal += 1 + + self._export_results() except Exception as e: print(e)