Skip to content

Commit

Permalink
fixed basic runtime issues with the compres() function within the sim…
Browse files Browse the repository at this point in the history
…ulation class
  • Loading branch information
bhargavakula01 committed Jan 22, 2025
1 parent 6c00d1e commit af359f5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
15 changes: 9 additions & 6 deletions lib/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ def __init__(self, sim_id, polymer, surfactant, init_water_saturation, resevoir_
self.plt_type = plt_type #types of plots to generate

### DEPENDENT VARIABLES OF SIMULATION CLASS:
_phi_ = 0
_phi_ = None
@property
def phi(self):
if(self._phi_ is None):
self._phi_ = self.get_phi_value()
return self._phi_

_water_saturation_vector_form_ = 0
_water_saturation_vector_form_ = None
@property
def water_saturation(self): #vector version
return self._water_saturation_vector_form_
Expand All @@ -82,7 +82,7 @@ def water_saturation(self): #vector version
def water_saturation(self, value):
self._water_saturation_vector_form_ = value

_aqueous_viscosity_ = 0
_aqueous_viscosity_ = None
@property
def aqueous_viscosity(self):
return self._aqueous_viscosity_
Expand All @@ -91,7 +91,7 @@ def aqueous_viscosity(self):
def aqueous_viscosity(self, value):
self._aqueous_viscosity_ = value

_oleic_mobility_ = 0
_oleic_mobility_ = None
@property
def oleic_mobility(self):
return self._oleic_mobility_
Expand All @@ -100,7 +100,7 @@ def oleic_mobility(self):
def oleic_mobility(self, value):
self._oleic_mobility_ = value

_aqueous_mobility_ = 0
_aqueous_mobility_ = None
@property
def aqueous_mobility(self):
return self._aqueous_mobility_
Expand Down Expand Up @@ -215,7 +215,10 @@ def initial_concentration_matrix(self):
:rtype: List
"""
try:
if(self.polymer is not None and self.surfactant is not None and self.water_saturation is not None):
if(self.polymer is not None and self.surfactant is not None and self.init_water_saturation_scalar is not None):
# scalar quantities of concentration for surfactant and polymer
# scalar quantity of initial water saturation (fraction of pore space filled with water)
print("reaches here")
s_0 = self.init_water_saturation_scalar
c_0 = self.polymer.initial_concentration
g_0 = self.surfactant.concentration
Expand Down
30 changes: 29 additions & 1 deletion tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,48 @@ def test_compute_viscosity(): #tested



def test_compute_resid_saturations(): #currently testing
def test_compute_resid_saturations(): #tested
"""
This function will test the function that determines that residual saturations
"""

test_sim_object = initializing_simulation()

#setting up mesh
sog = 29 #test value for size of grid
test_sim_object.mesh.m = sog
test_sim_object.mesh.n = sog
test_sim_object.mesh.calculate_spacing

print(test_sim_object.mesh.dx)

####calculating parameters for compvis function:

# Determining U:
u = np.zeros(( test_sim_object.mesh.n + 1, test_sim_object.mesh.m + 1 ))

# Determining V:
v = u

#Determining X and Y:
[x, y] = np.meshgrid(
np.arange(test_sim_object.mesh.left, test_sim_object.mesh.right + test_sim_object.mesh.dx, test_sim_object.mesh.dx),
np.arange(test_sim_object.mesh.bottom, test_sim_object.mesh.top + test_sim_object.mesh.dy, test_sim_object.mesh.dy))

#Determining beta1:
beta1 = 15000


# Need to implement method to calculate sigma (using the IFT vs surfactant concentration relationship)
test_sim_object.phi
test_sim_object.initial_concentration_matrix()

c0_array = test_sim_object.polymer.vec_concentration * np.ones((sog+1, sog + 1))
test_sim_object.compvis(u, v, x, y, beta1, c0_array)

#Inital concentration matrix for surfactant:
print( test_sim_object.surfactant.vec_concentration )

test_sim_object.compres(u, v)

pass
Expand Down

0 comments on commit af359f5

Please sign in to comment.