@@ -95,8 +95,6 @@ def __init__(
9595 if _sgcr is not None :
9696 self .sgcr = _sgcr
9797
98- if not isinstance (tag , str ):
99- tag = ""
10098 self .swirr = swirr
10199 self .swl = max (swl , swirr ) # Cannot allow swl < swirr. Warn?
102100 if not np .isclose (sorw , 0 ) and sorw < 1 / SWINTEGERS :
@@ -622,10 +620,9 @@ def add_simple_J(self, a=5, b=-1.5, poro_ref=0.25, perm_ref=100, drho=300, g=9.8
622620 assert perm_ref > 0.0
623621
624622 if self .swl < epsilon :
625- logger . error (
626- "swl must larger than zero to avoid infinite capillary pressure"
623+ raise ValueError (
624+ "swl must be larger than zero to avoid infinite capillary pressure"
627625 )
628- raise ValueError
629626
630627 if b > 0 :
631628 logger .warning (
@@ -688,13 +685,12 @@ def add_simple_J_petro(self, a, b, poro_ref=0.25, perm_ref=100, drho=300, g=9.81
688685 assert perm_ref > 0.0
689686
690687 if self .swl < epsilon :
691- logger . error (
692- "swl must larger than zero to avoid infinite capillary pressure"
688+ raise ValueError (
689+ "swl must be larger than zero to avoid infinite capillary pressure"
693690 )
694- raise ValueError
695691
696692 if b > 0 :
697- logger . warning (
693+ raise ValueError (
698694 "positive b will give increasing capillary pressure with saturation"
699695 )
700696
@@ -743,8 +739,7 @@ def add_normalized_J(self, a, b, poro, perm, sigma_costau):
743739 assert isinstance (sigma_costau , (int , float ))
744740
745741 if b < 0 and np .isclose (self .swirr , self .swl ):
746- logger .error ("swl must be set larger than swirr to avoid infinite p_c" )
747- raise ValueError ("swl must be larger than swirr" )
742+ raise ValueError ("swl must be larger than swirr to avoid infinite p_c" )
748743
749744 if abs (b ) < 0.01 :
750745 logger .warning (
@@ -794,36 +789,27 @@ def add_skjaeveland_pc(self, cw, co, aw, ao, swr=None, sor=None):
794789 Returns false if error occured.
795790
796791 """ # noqa
797- inputerror = False # Flag to be able to catch all errors
798792 if cw < 0 :
799- logger .error ("cw must be larger or equal to zero" )
800- inputerror = True
793+ raise ValueError ("cw must be larger or equal to zero" )
801794 if co > 0 :
802- logger .error ("co must be less than zero" )
803- inputerror = True
795+ raise ValueError ("co must be less than zero" )
804796 if aw <= 0 :
805- logger .error ("aw must be larger than zero" )
806- inputerror = True
797+ raise ValueError ("aw must be larger than zero" )
807798 if ao <= 0 :
808- logger .error ("ao must be larger than zero" )
809- inputerror = True
799+ raise ValueError ("ao must be larger than zero" )
810800
811801 if swr is None :
812802 swr = self .swirr
813803 if sor is None :
814804 sor = self .sorw
815805
816806 if swr >= 1 - sor :
817- logger .error ("swr (swirr) must be less than 1 - sor" )
818- inputerror = True
807+ raise ValueError ("swr (swirr) must be less than 1 - sor" )
819808 if swr < 0 or swr > 1 :
820- logger .error ("swr must be contained in [0,1]" )
821- inputerror = True
809+ raise ValueError ("swr must be contained in [0,1]" )
822810 if sor < 0 or sor > 1 :
823- logger .error ("sor must be contained in [0,1]" )
824- inputerror = True
825- if inputerror :
826- return
811+ raise ValueError ("sor must be contained in [0,1]" )
812+
827813 self .pccomment = (
828814 "-- Skjæveland correlation for Pc;\n "
829815 + "-- cw=%g, co=%g, aw=%g, ao=%g, swr=%g, sor=%g\n "
@@ -846,13 +832,9 @@ def add_skjaeveland_pc(self, cw, co, aw, ao, swr=None, sor=None):
846832 self .table ["swnpc" ] ** aw
847833 ) + co / (self .table ["sonpc" ] ** ao )
848834
849- # From 1-sor, the pc is not defined. We want to extrapolate constantly,
850- # but with a twist as Eclipse does not non-monotone capillary pressure:
851- self .table ["pc" ].fillna (value = self .table ["pc" ].min (), inplace = True )
852- nanrows = self .table ["sw" ] > 1 - sor - epsilon
853- self .table .loc [nanrows , "pc" ] = (
854- self .table .loc [nanrows , "pc" ] - self .table .loc [nanrows , "sw" ]
855- ) # Just deduct sw to make it monotone..
835+ # From 1-sor, the pc is not defined. Extrapolate constantly, and let
836+ # the non-monotonocity be fixed in the output generators.
837+ self .table ["pc" ].fillna (method = "ffill" , inplace = True )
856838
857839 def add_LET_pc_pd (self , Lp , Ep , Tp , Lt , Et , Tt , Pcmax , Pct ):
858840 # pylint: disable=line-too-long
@@ -1046,6 +1028,9 @@ def selfcheck(self, mode="SWOF"):
10461028 if not (self .table ["pc" ].diff ().dropna ().round (10 ) < epsilon ).all ():
10471029 logger .error ("pc data not strictly decreasing" )
10481030 error = True
1031+ if "pc" in self .table .columns and np .isnan (self .table ["pc" ]).any ():
1032+ logger .error ("pc data contains NaN" )
1033+ error = True
10491034 if "pc" in self .table .columns and np .isinf (self .table ["pc" ].max ()):
10501035 logger .error ("pc goes to infinity. Maybe swirr=swl?" )
10511036 error = True
0 commit comments