Example #1
0
def createList(property, propertyClass):
    """
    a utility to fill a property as two lists . First one contains species name and second one property  .
    """
    speciesList = ['ALL']
    speciesProperty = [None]
    if type(property) != ListType:
        if isInstance(property,propertyClass):
            speciesProperty[0] = property
    elif type(property) is ListType:
        for item in property:
            #print " item ",property.__class__
            if isInstance(item,propertyClass):
                speciesProperty[0] = item
            elif type(item) is TupleType:
                (prop, spec) = item
                if type(prop) != ListType:
                    if not isinstance(prop,propertyClass):
                        raise Exception(" problem  with property list definition")
                    pass
                if type(spec) is StringType:
                    spec = Species(spec)
                    pass
                if not isInstance(spec,[Species,Element]):
                    raise Exception("sped in the ceation list is not of the right type")
                speciesList.append(spec.name)
                speciesProperty.append(prop)
                pass
            pass
        pass
    return speciesList, speciesProperty
Example #2
0
def createList(property, propertyClass):
    """
    a utility to fill a property as two lists . First one contains species name and second one property  .
    """
    speciesList = ["ALL"]
    speciesProperty = [None]
    if type(property) != ListType:
        if isInstance(property, propertyClass):
            speciesProperty[0] = property
    elif type(property) is ListType:
        for item in property:
            # print " item ",property.__class__
            if isInstance(item, propertyClass):
                speciesProperty[0] = item
            elif type(item) is TupleType:
                (prop, spec) = item
                if type(prop) != ListType:
                    if not isinstance(prop, propertyClass):
                        raise Exception(" problem  with property list definition")
                    pass
                if type(spec) is StringType:
                    spec = Species(spec)
                    pass
                if not isInstance(spec, [Species, Element]):
                    raise Exception("sped in the ceation list is not of the right type")
                speciesList.append(spec.name)
                speciesProperty.append(prop)
                pass
            pass
        pass
    return speciesList, speciesProperty
Example #3
0
    def __init__(self,alpha,beta,gamma, V1 = None, V2= None, V3 = None):
        """Constructor of the class."""

        verifyType(alpha,float)
        
        verifyType(beta,float)
        
        verifyType(gamma,float)
                                                                                            #
                                                                                            # Diagonal terms
                                                                                            #        
        if (not V1 and (not V2) and (not V3)):
            self.value = [[alpha],[0., beta], [0.,0.,gamma]]
            pass
                                                                                            #
                                                                                            # vector terms
                                                                                            #
        elif ((V1 and (not V2) and (not V3)) or
             (V1 and V2 and (not V3)) or
             ((not V1) and V2 and V3) or
             ((not V1) and (not V2) and V3) or
             (V1 and (not V2) and V3) or
             ((not V1) and V2 and (not V3))):
                raise Exception("to define a tensor you give 3 diagonal terms or 6 for an isotropic one")
        if V1 : 
            if ((type(V1) is float) and
                (type(V2) is float) and
                (type(V3) is float)):
                #case of 6 scalars
                self.value = [[alpha],[V1, beta], [V2,V3,gamma]]
                pass
            elif ((isInstance(V1,Vector)) and
                  (isInstance(V2,Vector)) and
                  (isInstance(V3,Vector))):
                # case of 3 scalars and 3 vectors
                if V1.__len != V2.__len:
                    raise Warning(" dimensionality error in Tensor3D ")
                if V2.__len != V3.__len:
                    raise Warning(" dimensionality error in Tensor3D ")
                
                V1.verifyUnitary()
                V2.verifyUnitary()
                V3.verifyUnitary()
                V3.verifyEquals(V1.cross(V2))
                t = Tensor3D(alpha,beta, gamma)
                     
                Kxx = t.VectorTensorVector(V1,V1)
                Kyy = t.VectorTensorVector(V2,V2)
                Kxy = t.VectorTensorVector(V1,V2)
                Kxz = t.VectorTensorVector(V1,V3)
                Kyz = t.VectorTensorVector(V2, V3)
                Kzz = t.VectorTensorVector(V3,V3)
                self.value = [[Kxx],[Kxy, Kyy], [Kxz,Kyz, Kzz] ]
                pass
            else:
                raise Exception(" defining a 3D tensor, you have to enter scalars or vectors")
Example #4
0
    def __init__(self, alpha, beta, gamma, V1=None, V2=None, V3=None):
        """Constructor of the class."""

        verifyType(alpha, float)

        verifyType(beta, float)

        verifyType(gamma, float)
        #
        # Diagonal terms
        #
        if (not V1 and (not V2) and (not V3)):
            self.value = [[alpha], [0., beta], [0., 0., gamma]]
            pass
            #
            # vector terms
            #
        elif ((V1 and (not V2) and (not V3)) or (V1 and V2 and (not V3))
              or ((not V1) and V2 and V3) or ((not V1) and (not V2) and V3)
              or (V1 and (not V2) and V3) or ((not V1) and V2 and (not V3))):
            raise Exception(
                "to define a tensor you give 3 diagonal terms or 6 for an isotropic one"
            )
        if V1:
            if ((type(V1) is float) and (type(V2) is float)
                    and (type(V3) is float)):
                #case of 6 scalars
                self.value = [[alpha], [V1, beta], [V2, V3, gamma]]
                pass
            elif ((isInstance(V1, Vector)) and (isInstance(V2, Vector))
                  and (isInstance(V3, Vector))):
                # case of 3 scalars and 3 vectors
                if V1.__len != V2.__len:
                    raise Warning(" dimensionality error in Tensor3D ")
                if V2.__len != V3.__len:
                    raise Warning(" dimensionality error in Tensor3D ")

                V1.verifyUnitary()
                V2.verifyUnitary()
                V3.verifyUnitary()
                V3.verifyEquals(V1.cross(V2))
                t = Tensor3D(alpha, beta, gamma)

                Kxx = t.VectorTensorVector(V1, V1)
                Kyy = t.VectorTensorVector(V2, V2)
                Kxy = t.VectorTensorVector(V1, V2)
                Kxz = t.VectorTensorVector(V1, V3)
                Kyz = t.VectorTensorVector(V2, V3)
                Kzz = t.VectorTensorVector(V3, V3)
                self.value = [[Kxx], [Kxy, Kyy], [Kxz, Kyz, Kzz]]
                pass
            else:
                raise Exception(
                    " defining a 3D tensor, you have to enter scalars or vectors"
                )
Example #5
0
    def __init__(self, zone, value, rate=None):
        """constructor with :
        - zone : Mesh support
        - value : a PhysicalQuantity or a list of couple (PhysicalQuantity,species)
                  or a ChemicalState
        - OPTIONAL :
        --> rate : FlowRate
        """
        memberShip(zone, [CartesianMesh])
        self.zone = zone

        self.value_species = None
        self.value_property = None
        self.value = None
        if value:
            memberShip(value,[PhysicalQuantity,ChemicalState])
            if (isInstance(value, PhysicalQuantity) or
                type(value) is types.ListType): 
                self.value_species,self.value_property  = createList(value, PhysicalQuantity)
                pass
            else:
                self.value = value
                pass
            pass

        if rate: memberShip(value, Flowrate)
        self.rate = rate
        return
Example #6
0
    def __init__(self, zone, value=None):
        """
        constructor with :
        - zone : object CartesianMesh
        - OPTINAL :
        --> value : a PhysicalQuantity or a list of couple (PhysicalQuantity,species)
                    or a ChemicalState
        """
        if type(zone) is types.ListType:
            verifyClassList(zone,[CartesianMesh])
            pass
        else:
            memberShip(zone,[CartesianMesh])
            pass
        self.zone = zone

        self.value_species = None
        self.value_property = None
        self.value = None
        if value:
            memberShip(value,[PhysicalQuantity,ChemicalState])
            if (isInstance(value, PhysicalQuantity) or type(value) is types.ListType): 
                self.value_species, self.value_property = createList(value, PhysicalQuantity)
                pass
            else:
                self.value = value
                pass
            pass
Example #7
0
    def __init__(self, zone, value, rate=None):
        """constructor with :
        - zone : Mesh support
        - value : a PhysicalQuantity or a list of couple (PhysicalQuantity,species)
                  or a ChemicalState
        - OPTIONAL :
        --> rate : FlowRate
        """
        memberShip(zone, [CartesianMesh])
        self.zone = zone

        self.value_species = None
        self.value_property = None
        self.value = None
        if value:
            memberShip(value,[PhysicalQuantity,ChemicalState])
            if (isInstance(value, PhysicalQuantity) or
                type(value) is types.ListType): 
                self.value_species,self.value_property  = createList(value, PhysicalQuantity)
                pass
            else:
                self.value = value
                pass
            pass

        if rate: memberShip(value, Flowrate)
        self.rate = rate
        return
Example #8
0
    def __init__(self, zone, value=None):
        """
        constructor with :
        - zone : object CartesianMesh
        - OPTINAL :
        --> value : a PhysicalQuantity or a list of couple (PhysicalQuantity,species)
                    or a ChemicalState
        """
        if type(zone) is types.ListType:
            verifyClassList(zone,[CartesianMesh])
            pass
        else:
            memberShip(zone,[CartesianMesh])
            pass
        self.zone = zone

        self.value_species = None
        self.value_property = None
        self.value = None
        if value:
            memberShip(value,[PhysicalQuantity,ChemicalState])
            if (isInstance(value, PhysicalQuantity) or type(value) is types.ListType): 
                self.value_species, self.value_property = createList(value, PhysicalQuantity)
                pass
            else:
                self.value = value
                pass
            pass
Example #9
0
 def getBody(self):
     """
     To retrieve the domain
     """
     if isInstance(self.body, Body):
         return self.body
     else:
         return None
Example #10
0
 def getZone(self):
     """
     to retrieve the domain
     
     """
     if isInstance(self.body,Body):
         return self.body
     else:
         return None
Example #11
0
    def __init__(self, body = None, value = None, description = None):
        """
        domain can be a region of the domain, it could also be a simple body associated to .
        """
        if isInstance(body,[CartesianMesh, Body]):
            pass
        else:
            memberShip(body.support,[CartesianMesh, Body])
            pass
        self.body   = body
        self.zone = body
        self.domain = body
        
#        if domain !=None:
#            if isinstance(domain,Region):
#                memberShip(domain.support,[CartesianMesh, Body])
#            elif isinstance(domain,Body):
#                pass
#            elif isinstance(domain,CartesianMesh):
#                pass
#        self.domain = domain
        #
        #
        #
        if not isinstance(value,(Head,Pressure)):
            pass
        else:
            #print "dbg CommonInitialCondition",value
            if type(value) == None:
                self.value = Head(0.0,"m")
                pass
            elif isinstance(value,Head):
                self.value = value
                pass
            else:
                raise Exception(" to modify, the pressure must be scaled to be entered as a head")
        if not isinstance(value,(Displacement)):
            pass
        else:
            #print "dbg CommonInitialCondition",value
            if type(value) == None:
                self.value = Displacement(0.0,"m")
                pass
            elif isinstance(value,Displacement):
                self.value = value
                pass
            else:
                raise Exception(" to modify, the pressure must be scaled to be entered as a head")
        if description == None:
            self.description = None
            pass
        else:
            self.description = description
            pass
        return None
Example #12
0
def verifyPressureBoundaryConditions(boundaryConditions, density,
                                     gravity):
    """raise an exception if pressure boundary conditions have
    been set without setting value of gravity and density"""
    for boundary in boundaryConditions:
        value= boundary.getValue()
        if (isInstance(value,[Pressure,PressureGradient])):
            if ((density is None) or
                (gravity is None)):
                raise Warning("Pressure or PressureGradient boundary condition used without set density and gravity")
            pass
        pass
    pass
Example #13
0
    def __init__(self, alpha, beta, V1=None, V2=None):
        """Constructor of the class."""
        verifyType(alpha, float)
        verifyType(beta, float)
        if (not V1 and (not V2)):
            # case of two scalars
            self.value = [[alpha], [0., beta]]
            pass
        elif ((V1 and (not V2)) or ((not V1) and V2)):
            #case of 3 scalars
            if V1:
                verifyType(V1, float)
                self.value = [[alpha], [V1, beta]]
                pass
            else:
                verifyType(V2, float)
                self.value = [[alpha], [V2, beta]]
                pass
            pass
        elif ((isInstance(V1, Vector)) and (isInstance(V2, Vector))):
            #case of 4 scalars
            if V1.__len__ != V2.__len__:
                raise Exception(
                    " vectors defing a 2D tensor have not the same dimension")

            V1.verifyUnitary()
            V2.verifyUnitary()
            verifyEqualFloats(V1.cross(V2).getValues()[2], 1.)
            t = Tensor2D(alpha, beta)

            Kxx = t.VectorTensorVector(V1, V1)
            Kyy = t.VectorTensorVector(V2, V2)
            Kxy = t.VectorTensorVector(V1, V2)
            self.value = [[Kxx], [Kxy, Kyy]]
            pass
        else:
            raise Exception(
                " defining a 2D tensor, you have to enter scalars or vectors")
        return
Example #14
0
def verifyPressureBoundaryConditions(boundaryConditions, density, gravity):
    """raise an exception if pressure boundary conditions have
    been set without setting value of gravity and density"""
    for boundary in boundaryConditions:
        value = boundary.getValue()
        if (isInstance(value, [Pressure, PressureGradient])):
            if ((density is None) or (gravity is None)):
                raise Warning(
                    "Pressure or PressureGradient boundary condition used without set density and gravity"
                )
            pass
        pass
    pass
Example #15
0
 def __init__(self,alpha,beta, V1 = None, V2= None):
     """Constructor of the class."""
     verifyType(alpha,float)
     verifyType(beta,float)
     if (not V1 and (not V2)):
         # case of two scalars
         self.value = [[alpha],[0., beta]]
         pass
     elif ((V1 and (not V2)) or ((not V1) and V2)):
         #case of 3 scalars
         if V1:
             verifyType(V1,float)
             self.value = [[alpha],[V1, beta]]
             pass
         else:
             verifyType(V2,float)
             self.value = [[alpha],[V2, beta]]
             pass
         pass
     elif ((isInstance(V1,Vector)) and
           (isInstance(V2,Vector))):
          #case of 4 scalars
          if V1.__len__ != V2.__len__:
              raise Exception(" vectors defing a 2D tensor have not the same dimension")
          
          V1.verifyUnitary()
          V2.verifyUnitary()
          verifyEqualFloats(V1.cross(V2).getValues()[2],1.)
          t = Tensor2D(alpha,beta)
          
          Kxx = t.VectorTensorVector(V1,V1)
          Kyy = t.VectorTensorVector(V2,V2)
          Kxy = t.VectorTensorVector(V1,V2)
          self.value = [[Kxx],[Kxy, Kyy]]
          pass
     else:
          raise Exception(" defining a 2D tensor, you have to enter scalars or vectors")
     return
Example #16
0
def verifyUnknownTypeBoundaryCondition(unknown_list,boundaries) :
    """raise an exception if boundaries support other unknown
    that those defined in unknown_list
    NOT TO BE USE WITH DIFFERENT SPECIES"""
    found = 0
    for boundary in boundaries:
        value= boundary.getValue()
        for unknown in unknown_list:
            if type(unknown) is type :
                if type(value) == type(unknown):
                    found = 1
                    pass
                pass
            elif isInstance(value,unknown):
                found = 1
                pass
            pass
        if not found:
            raise Warning("Given boundary condition is not of correct type")
#        found = 0
        pass
Example #17
0
def verifyUnknownTypeBoundaryCondition(unknown_list, boundaries):
    """raise an exception if boundaries support other unknown
    that those defined in unknown_list
    NOT TO BE USE WITH DIFFERENT SPECIES"""
    found = 0
    for boundary in boundaries:
        value = boundary.getValue()
        for unknown in unknown_list:
            if type(unknown) is type:
                if type(value) == type(unknown):
                    found = 1
                    pass
                pass
            elif isInstance(value, unknown):
                found = 1
                pass
            pass
        if not found:
            raise Warning("Given boundary condition is not of correct type")


#        found = 0
        pass
Example #18
0
    def __init__(self, zone, value, some_classes, some_solid_classes=None):
        """
        Initial condition initialisation with
        - one or several zones 
        - a value instance of a class defined in some_classes
                           or a list of couple (Value,Species)
                           or a list with a defaut value and couples (Value,Species) 
                           for example [c,(c1,species1),(c2,species2)]
        - some_classes : list of possible classes of value (soluble classes)
        - some_solid_classes : list of possible classes of value (solid classes)
        """
        zones = toList(zone)
        #verifyZones(zones)
        self.zone = zone
        if some_solid_classes:
            all_classes = some_classes + some_solid_classes
            pass
        else:
            all_classes = some_classes
            pass

        val_solub = []
        val_solid = []
        self.value_species = []
        self.value_property = []
        self.value_solid_species = []
        self.value_solid_property = []
        value = toList(value)
        for val in value:
            solubOK = 0
            if type(val) is TupleType:
                from datamodel import Species
                memberShip(val[0], all_classes)
                memberShip(val[1], Species)
                for sc in some_classes:
                    if isInstance(val[0], sc):
                        val_solub.append(val)
                        solub0K = 1
                        break
                    pass
                if some_solid_classes and not solubOK:
                    for sc in some_solid_classes:
                        if isInstance(val[0], sc):
                            val_solid.append(val)
                            break
                        pass
                    pass
                pass
            else:
                memberShip(val, all_classes)
                for sc in some_classes:
                    if isInstance(val, sc):
                        val_solub.append(val)
                        solub0K = 1
                        break
                if some_solid_classes and not solubOK:
                    for sc in some_solid_classes:
                        if isInstance(val, sc):
                            val_solid.append(val)
                            break
                    pass
                pass
            pass

        if val_solub:
            from datamodel import createList
            from datamodel import PhysicalQuantity
            self.value_species, self.value_property = createList(
                val_solub, PhysicalQuantity)
            pass
        if val_solid:
            from datamodel import createList
            from datamodel import PhysicalQuantity
            self.value_solid_species, self.value_solid_property = createList(
                val_solid, PhysicalQuantity)
            pass
        return
Example #19
0
    def setProperty(self, keyword, property):
        """
        To set a material property
        """
        #print "dbg property: ",self.name, keyword,property.__class__
        #raw_input("keyword property1")
        keyword = keyword.lower()
        if keyword not in list(self.propdict.keys()):
            print(list(self.propdict.keys()))
            raise Exception(" check the set property function, property: " +
                            keyword)
        #print "dbg property: ",self.name, keyword,property.__class__
        #raw_input("keyword property2")
        if isInstance(
                property,
            [PhysicalLaw, PQuantity, AquiferProperty, SolidProperty]):
            #print "setproperty propClass is ok "
            propClass = property.__class__
            #raw_input("keyword property2 isInstance(property,[PhysicalLaw,PQuantity,AquiferProperty,SolidProperty])")
            pass
        elif type(property) is ListType:
            #
            # if property type is of ListType: :
            #
            # if we have as input :
            # ["Na", Prop('3.7), "Cl", Prop(3.8)]
            # it becomes
            # [("Na", Prop('3.7)), ("CL", Prop(3.8))]
            #
            #raw_input("keyword property3 type(property) is ListType")
            myProperty = []
            aNewProp = []
            for prop in property:
                if len(aNewProp) == 1:
                    aNewProp.append(prop)
                    myProperty.append(tuple(aNewProp))
                    aNewProp = []
                    pass
                from types import StringType
                if type(prop, StringType):
                    if len(aNewProp) != 0:
                        message = "\n\n"
                        message += "Exception catched\n"
                        message += "to improve ...\n"
                        raise Exception(message)
                    aNewProp.append(prop)
                    pass
                pass
            if myProperty:
                property = myProperty
                pass
            #
            #
            property_buf = []
            for prop in property:
                if isInstance(
                        prop,
                    [PhysicalLaw, PQuantity, AquiferProperty, SolidProperty]):
                    property_buf.append(prop)
                    pass
                elif type(prop, TupleType):
                    if isInstance(prop[0], [
                            AquiferProperty, PhysicalLaw, PQuantity,
                            SolidProperty
                    ]):
                        property_buf.append(prop)
                        pass
                    else:
                        property_buf.append((prop[1], prop[0]))
                        pass
                    pass
                else:
                    raise Exception(
                        "object membership should be verified : %s" % prop)
                pass
            property = property_buf
            for prop in property:
                if isInstance(
                        prop,
                    [AquiferProperty, PhysicalLaw, PQuantity, SolidProperty]):
                    propClass = prop.__class__
                    pass
                elif type(prop, TupleType):
                    memberShip(prop[0], [
                        AquiferProperty, PhysicalLaw, PQuantity, SolidProperty
                    ])
                    propClass = prop[0].__class__
                    if propClass == self.propdict[keyword]:
                        PQ = propClass
                        pass
                    elif issubclass(propClass, self.propdict[keyword]):
                        PQ = self.propdict[keyword]
                        ##                        if propClass=='SolubilityByElement':
                        ##                            print 'houla element'
                        ##                            flag='SolubilityByElement'
                        pass

                    key = PQ.__name__
                    key = key[0].lower() + key[1:]
                    if not hasattr(self, key + '_species'):
                        raise Exception("No species allowed for %s" % key)
                    pass
                else:
                    raise Exception(
                        "object membership should be verified : %s" % prop)
                pass
            pass
        else:
            if property:
                raise Exception("object membership should be verified : %s" %
                                property)
            else:
                propClass = self.propdict[keyword]
        #propClass=property.__class__
        #print (" dbg keyword ",keyword)
        #print (" dbg propClass ",propClass)
        #print (" dbg propdict ",self.propdict[keyword])
        if propClass != self.propdict[keyword]:
            if not issubclass(propClass, self.propdict[keyword]):
                raise Exception(" problem with property class ")
        #self.changeProperty(propClass,property)
        self.changeProperty(self.propdict[keyword], property)
Example #20
0
    def __init__(self, name, **properties):

        Generic.__init__(self)

        try:
            type(name) is StringType
        except:
            raise TypeError(" name must be a string")
        self.name = name
        #
        self.propdict = {
            'biotcoefficient': BiotCoefficient,
            'concentrationatsaturation': Concentration,
            'density': Density,
            'effectivediffusion': EffectiveDiffusion,
            'fickairdissouslaw': FickAirDissousLaw,
            'fickvapeurlaw': FickVapeurLaw,
            'hydraulicconductivity': HydraulicConductivity,
            'hydraulicporosity': HydraulicPorosity,
            'intrinsicpermeability': IntrinsicPermeability,
            'intrinsicpermeabilitylaw': IntrinsicPermeabilityLaw,
            'kinematicdispersion': KinematicDispersion,
            'masssolubilitylimit': MassSolubilityLimit,
            'matrixcompressibilityfactor': MatrixCompressibilityFactor,
            'masse_volumique_homogen': SolidDensity,
            'maximumsaturation': MaximumSaturation,
            'permeability': Permeability,
            'permeabilitylaw': PermeabilityLaw,
            'permeabiliteliquide': PermeabilityLaw,
            'permeabilitegaz': PermeabilityLaw,
            'poissonratio': PoissonRatio,
            'porediffusion': PoreDiffusion,
            'porosity': Porosity,
            'poreExpan': PoreExpansivity,
            'porecompressibility': PoreCompressibility,
            'retardationfactor': RetardationFactor,
            'residualsaturation': ResidualSaturation,
            'residualwatercontent': ResidualWaterContent,
            'saturatedwatercontent': SaturatedWaterContent,
            'saturationlaw': SaturationLaw,
            'sharedfactor': SharedFactor,
            'soliddensity': SolidDensity,
            'solubilitylaw': SolubilityLaw,
            'sorptionlaw': SorptionLaw,
            'specificstorage': SpecificStorage,
            'specificheat': SpecificHeat,
            'specificheatcapacity': SpecificHeatCapacity,
            'thermalconductivity': ThermalConductivity,
            'thermalconductivitylaw': ThermalconductivityLaw,
            'tortuosity': Tortuosity,
            'viscosity': Viscosity,
            'youngmodulus': YoungModulus
        }
        for physicalproperty in self.propdict.values():
            if not (issubclass(physicalproperty,PhysicalLaw)+\
                    issubclass(physicalproperty,PQuantity)+\
                    issubclass(physicalproperty,AquiferProperty)+\
                    +issubclass(physicalproperty,SolidProperty)):
                raise Exception(" check the class for %s" % (physicalproperty))
            pass
        self.density = None
        self.tortuosity = None
        self.effectiveDiffusion_species = None
        self.effectiveDiffusion_property = None
        self.kinematicDispersion_species = None
        self.kinematicDispersion_property = None
        self.residualSaturation = None
        self.maximumSaturation = None
        self.residualWaterContent = None
        self.saturatedWaterContent = None
        self.permeability = None
        self.permeabilityLaw = None
        self.intrinsicPermeability = None
        self.poreDiffusion_species = None
        self.poreDiffusion_property = None
        self.hydraulicConductivity = None
        self.hydraulicPorosity = None
        self.viscosity = None
        self.porosity_species = None
        self.porosity_property = None
        self.poreExpansivity = PoreExpansivity(0., unit="1/K")
        self.poreCompressibility = PoreCompressibility(0., unit="1/Pa")
        self.retardationFactor_species = None
        self.retardationFactor_property = None
        self.sharedFactor_species = None
        self.sharedFactor_property = None
        self.saturationLaw = None
        self.solidDensity = None
        ##        self.solubilityLaw = None
        self.solubilityLaw_species = None
        self.solubilityLaw_property = None
        self.sorptionLaw_species = None
        self.sorptionLaw_property = None
        self.specificStorage = SpecificStorage(1., unit="1/s")
        self.matrixCompressibilityFactor = None
        self.massSolubilityLimit_species = None
        self.massSolubilityLimit_property = None
        self.concentration_species = None
        self.concentration_property = None
        self.gk = 0.0
        # Addons THM
        self.fickVapeurLaw = None
        self.fickAirDissousLaw = None
        self.thermalconductivityLaw = None
        self.intrinsicPermeabilityLaw = None
        self.biotCoefficient = None
        self.specificHeat = None
        self.specificHeatCapacity = None
        self.thermalConductivity = None
        self.permeabiliteliquide = None
        self.permeabilitegaz = None
        self.poissonRatio = None
        self.youngModulus = None

        for key in properties:
            #print "key",key,type(key)
            prop = properties[key]
            print("prop", prop, dir(prop))
            self.setProperty(key, prop)
            pass
        #
        # we specify the hydraulic porosity, if any specified
        #
        if "porosity" in properties:
            self.hydraulicPorosity = properties["porosity"]
            pass
        # self.setProperty affecte 2 fois self.permeabilityLaw
        # d'abord a permeabiliteliquide puis  a permeabilitegaz
        # car propdict(permeabiliteliquide) = PermeabilityLaw  et propdict(permeabiliteliquide)= PermeabilityLaw
        # On contourne ce pb
        if 'permeabiliteliquide' in properties:
            self.permeabiliteliquide = properties["permeabiliteliquide"]
            pass
        if 'permeabilitegaz' in properties:
            self.permeabilitegaz = properties["permeabilitegaz"]
            pass
        #
        # if saturation is introduced we also set water contents through
        # the residual and maximum of saturation, and porosity
        #
        if "maximumsaturation" in properties:
            if "porosity" in properties:
                self.saturatedWaterContent = self.porosity * self.maximumSaturation
                pass
            else:
                raise Warning(" constitency problem ")
            if "residualsaturation" in properties:
                self.residualWaterContent = self.porosity * self.residualSaturation
                pass
        elif "saturatedwatercontent" in properties:
            if "porosity" in properties:
                self.maximumSaturation = self.saturatedWaterContent / self.porosity
                pass
            else:
                raise Warning(" constitency problem ")
            if "residualsaturation" in properties:
                self.maximumSaturation = self.saturatedWaterContent / self.porosity
                pass
        # Verification that both permeability and
        # intrinsicpermeability have not been set
        if (self.permeability and self.intrinsicPermeability):
            raise Exception(
                "Material with both permeability and intrinsic permeability can't be defined"
            )

        #verification that both PoreDiffusion and EffectiveDiffusion
        #have not been set
        #print " dbg material we are here "
        if (self.effectiveDiffusion_species and self.poreDiffusion_species):
            raise Exception(
                "Material with both effectiveDiffusion and poreDiffusion can't be defined"
            )

        # verification that if DistributionCoefficient, langmuir
        # or freundlich sorptionLaw is defined, solidDensity
        # should be set
        if self.sorptionLaw_species:
            for prop in self.sorptionLaw_property:
                if isInstance(prop,
                              [DistributionCoefficient, Langmuir, Freundlich]):
                    if not self.solidDensity:
                        raise Exception(
                            "Material defined with DistributionCoefficient, langmuir or freundlich sorptionLaw should also be defined with solidDensity"
                        )
                    pass
                pass
            pass
        return
Example #21
0
    def __init__(self, name, **properties):

        Generic.__init__(self)

        try:
            type(name) is StringType
        except:
            raise TypeError(" name must be a string")
        self.name = name
        #
        self.propdict = {
            "biotcoefficient": BiotCoefficient,
            "concentrationatsaturation": Concentration,
            "density": Density,
            "effectivediffusion": EffectiveDiffusion,
            "fickairdissouslaw": FickAirDissousLaw,
            "fickvapeurlaw": FickVapeurLaw,
            "hydraulicconductivity": HydraulicConductivity,
            "hydraulicporosity": HydraulicPorosity,
            "intrinsicpermeability": IntrinsicPermeability,
            "intrinsicpermeabilitylaw": IntrinsicPermeabilityLaw,
            "kinematicdispersion": KinematicDispersion,
            "masssolubilitylimit": MassSolubilityLimit,
            "matrixcompressibilityfactor": MatrixCompressibilityFactor,
            "masse_volumique_homogen": SolidDensity,
            "maximumsaturation": MaximumSaturation,
            "permeability": Permeability,
            "permeabilitylaw": PermeabilityLaw,
            "permeabiliteliquide": PermeabilityLaw,
            "permeabilitegaz": PermeabilityLaw,
            "poissonratio": PoissonRatio,
            "porediffusion": PoreDiffusion,
            "porosity": Porosity,
            "poreExpan": PoreExpansivity,
            "porecompressibility": PoreCompressibility,
            "retardationfactor": RetardationFactor,
            "residualsaturation": ResidualSaturation,
            "residualwatercontent": ResidualWaterContent,
            "saturatedwatercontent": SaturatedWaterContent,
            "saturationlaw": SaturationLaw,
            "sharedfactor": SharedFactor,
            "soliddensity": SolidDensity,
            "solubilitylaw": SolubilityLaw,
            "sorptionlaw": SorptionLaw,
            "specificstorage": SpecificStorage,
            "specificheat": SpecificHeat,
            "thermalconductivity": ThermalConductivity,
            "thermalconductivitylaw": ThermalconductivityLaw,
            "tortuosity": Tortuosity,
            "viscosity": Viscosity,
            "youngmodulus": YoungModulus,
        }
        for physicalproperty in self.propdict.values():
            if not (
                issubclass(physicalproperty, PhysicalLaw)
                + issubclass(physicalproperty, PQuantity)
                + issubclass(physicalproperty, AquiferProperty)
                + +issubclass(physicalproperty, SolidProperty)
            ):
                raise Exception(" check the class for %s" % (physicalproperty))
            pass
        self.density = None
        self.tortuosity = None
        self.effectiveDiffusion_species = None
        self.effectiveDiffusion_property = None
        self.kinematicDispersion_species = None
        self.kinematicDispersion_property = None
        self.residualSaturation = None
        self.maximumSaturation = None
        self.residualWaterContent = None
        self.saturatedWaterContent = None
        self.permeability = None
        self.permeabilityLaw = None
        self.intrinsicPermeability = None
        self.poreDiffusion_species = None
        self.poreDiffusion_property = None
        self.hydraulicConductivity = None
        self.hydraulicPorosity = None
        self.viscosity = None
        self.porosity_species = None
        self.porosity_property = None
        self.poreExpansivity = PoreExpansivity(0.0, unit="1/K")
        self.poreCompressibility = PoreCompressibility(0.0, unit="1/Pa")
        self.retardationFactor_species = None
        self.retardationFactor_property = None
        self.sharedFactor_species = None
        self.sharedFactor_property = None
        self.saturationLaw = None
        self.solidDensity = None
        ##        self.solubilityLaw = None
        self.solubilityLaw_species = None
        self.solubilityLaw_property = None
        self.sorptionLaw_species = None
        self.sorptionLaw_property = None
        self.specificStorage = SpecificStorage(1.0)
        self.matrixCompressibilityFactor = None
        self.massSolubilityLimit_species = None
        self.massSolubilityLimit_property = None
        self.concentration_species = None
        self.concentration_property = None
        self.gk = 0.0
        # Addons THM
        self.fickVapeurLaw = None
        self.fickAirDissousLaw = None
        self.thermalconductivityLaw = None
        self.intrinsicPermeabilityLaw = None
        self.biotCoefficient = None
        self.specificHeat = None
        self.specificHeatCapacity = None
        self.thermalConductivity = None
        self.permeabiliteliquide = None
        self.permeabilitegaz = None
        self.poissonRatio = None
        self.youngModulus = None

        for key in properties:
            # print "key",key,type(key)
            prop = properties[key]
            print("prop", prop, dir(prop))
            self.setProperty(key, prop)
            pass
        #
        # we specify the hydraulic porosity, if any specified
        #
        if "porosity" in properties:
            self.hydraulicPorosity = properties["porosity"]
            pass
        # self.setProperty affecte 2 fois self.permeabilityLaw
        # d'abord a permeabiliteliquide puis  a permeabilitegaz
        # car propdict(permeabiliteliquide) = PermeabilityLaw  et propdict(permeabiliteliquide)= PermeabilityLaw
        # On contourne ce pb
        if "permeabiliteliquide" in properties:
            self.permeabiliteliquide = properties["permeabiliteliquide"]
            pass
        if "permeabilitegaz" in properties:
            self.permeabilitegaz = properties["permeabilitegaz"]
            pass
        #
        # if saturation is introduced we also set water contents through
        # the residual and maximum of saturation, and porosity
        #
        if "maximumsaturation" in properties:
            if "porosity" in properties:
                self.saturatedWaterContent = self.porosity * self.maximumSaturation
                pass
            else:
                raise Warning(" constitency problem ")
            if "residualsaturation" in properties:
                self.residualWaterContent = self.porosity * self.residualSaturation
                pass
        elif "saturatedwatercontent" in properties:
            if "porosity" in properties:
                self.maximumSaturation = self.saturatedWaterContent / self.porosity
                pass
            else:
                raise Warning(" constitency problem ")
            if "residualsaturation" in properties:
                self.maximumSaturation = self.saturatedWaterContent / self.porosity
                pass
        # Verification that both permeability and
        # intrinsicpermeability have not been set
        if self.permeability and self.intrinsicPermeability:
            raise Exception("Material with both permeability and intrinsic permeability can't be defined")

        # verification that both PoreDiffusion and EffectiveDiffusion
        # have not been set
        # print " dbg material we are here "
        if self.effectiveDiffusion_species and self.poreDiffusion_species:
            raise Exception("Material with both effectiveDiffusion and poreDiffusion can't be defined")

        # verification that if DistributionCoefficient, langmuir
        # or freundlich sorptionLaw is defined, solidDensity
        # should be set
        if self.sorptionLaw_species:
            for prop in self.sorptionLaw_property:
                if isInstance(prop, [DistributionCoefficient, Langmuir, Freundlich]):
                    if not self.solidDensity:
                        raise Exception(
                            "Material defined with DistributionCoefficient, langmuir or freundlich sorptionLaw should also be defined with solidDensity"
                        )
                    pass
                pass
            pass
        return
Example #22
0
    def __init__(self, boundary, btype, value, bcdict, porosity = None, description = None):
        """
        Boundary condition initialisation with :
        
        - one boundary

        - a boundary condition type.
          We verify that it's a key of bcdict dictionnary
        - a boundary condition value. Value depend of boundary condition type.
        
        - bcdict : a dictionnary with key = type of boundary condition and value = Possible class of boundary condition value
        
        All boundary conditions satisfy that format. It should enable the lecture of hydraulic, mechanical and chemical-transport boundary conditions.
        
        Exemple: bcdict = {'Flux': [class chemistry.ChemicalState , class PhysicalQuantities.HeadGradient],
                   'Dirichlet': [class chemistry.ChemicalState, class PhysicalQuantities.Head,\
                         class PhysicalQuantities.Displacement, class PhysicalQuantities.NormalForce], 
                   'Neumann': [class chemistry.ChemicalState, class PhysicalQuantities.HeadGradient]}
        
        """   
        self.value = None       
        self.value_species = None
        #print " here we are 1, bcdict ", bcdict
        #print " here we are 2, bcdict ", bcdict.keys()
        #print value
        #raw_input()
        #print("dbg bcdict ",list(bcdict.keys()))
        if isInstance(boundary,[CartesianMesh, Body]):
            pass
        else:
            memberShip(boundary.support,[CartesianMesh, Body])
            pass

        self.boundary = boundary
        if type(btype) != StringType: raise TypeError(" type should be a string ")
        if btype not in list(bcdict.keys()): 
            print("bcdict.keys():",list(bcdict.keys()))
            print("btype : ",btype)
            raise Exception(" check the boundary condition type ")
        self.type = btype
        print("value: ",type(value.__class__.__name__),value.__class__.__name__)
        #print "dbg bcdict ",bcdict.keys()
        #raw_input( "valuefffffffff     fff")
        #if value.__class__.__name__ == 'Head':
        #    print "valueeeee Head",value.__class__.__name__
        #else:
        #    print "valueeeef",value.__class__.__name__
        if isinstance(value,ListType):
            print(" value is of type ListType")
            for val in value:
                if isinstance(val,Displacement):
                    self.value = {"Displacement":val.getValue()}
                    pass
                elif isinstance(val,NormalForce):
                    if self.value != None:
                        self.value["NormalForce"] = val.getValue()
                        pass
                    else:
                        self.value = {"NormalForce":val.getValue()}
                        pass
                elif isinstance(value,Head):
                    valeurs=toList (val)
                    for vale in valeurs:
                        if type(val) is TupleType:
                            checked = val[0] 
                            for i in range(1,len(val)):
                                memberShip(val[i], Species)
                                pass
                            pass
                        else:
                            checked = val
                            pass
                        pass
                    pass

        elif isinstance(value,Displacement):
            print(" value is of type Displacement")
            self.value = {"Displacement":value.getValue()}
            pass
        elif isinstance(value,NormalForce):
            print(" value is of type NormalForce")
            if self.value != None:
                self.value["NormalForce"] = value.getValue()
                pass
            else:
                self.value = {"NormalForce":value.getValue()}
                pass
            pass
            
        elif isinstance(value,Head):
            print(" value is of type Head")
            from datamodel import Species
            value=toList (value)
            for val in value:
                if type(val) is TupleType:
                    checked = val[0] 
                    for i in range(1,len(val)):
                        memberShip(val[i], Species)
                        pass
                    pass
                else:
                    checked = val
                    pass
                for definedType in bcdict:
                    if btype == definedType:
                        memberShip(checked, bcdict[btype])
                        #raw_input("here we are")
                        pass
                    pass
                pass
            if not self.value_species:
                from PhysicalQuantities import PhysicalQuantity
                from species import createList
                print(value)
                self.value_species, self.value_property = createList(value, PhysicalQuantity)
                pass

        if description == None:
            self.description = None
            pass
        else:
            self.description = description
            pass
        return None
Example #23
0
    def __init__(self, zone, value,some_classes,some_solid_classes=None):
        """
        Initial condition initialisation with
        - one or several zones 
        - a value instance of a class defined in some_classes
                           or a list of couple (Value,Species)
                           or a list with a defaut value and couples (Value,Species) 
                           for example [c,(c1,species1),(c2,species2)]
        - some_classes : list of possible classes of value (soluble classes)
        - some_solid_classes : list of possible classes of value (solid classes)
        """
        zones=toList(zone)
        #verifyZones(zones)
        self.zone = zone
        if some_solid_classes:
            all_classes = some_classes + some_solid_classes
            pass
        else:
            all_classes = some_classes
            pass

        val_solub=[]
        val_solid=[]     
        self.value_species=[] 
        self.value_property=[]
        self.value_solid_species=[]
        self.value_solid_property=[]
        value = toList(value)
        for val in value:
            solubOK = 0
            if type(val) is TupleType:
                from datamodel import  Species
                memberShip(val[0], all_classes)
                memberShip(val[1], Species)
                for sc in some_classes:
                    if isInstance(val[0], sc):
                        val_solub.append(val)
                        solub0K = 1
                        break
                    pass            
                if some_solid_classes and not solubOK:
                    for sc in some_solid_classes:
                        if isInstance(val[0], sc):
                            val_solid.append(val)
                            break
                        pass
                    pass
                pass
            else:
                memberShip(val, all_classes)
                for sc in some_classes:
                    if isInstance(val, sc):
                        val_solub.append(val)
                        solub0K = 1
                        break            
                if some_solid_classes and not solubOK:
                    for sc in some_solid_classes:
                        if isInstance(val, sc):
                            val_solid.append(val)
                            break
                    pass
                pass
            pass

        if val_solub:
            from datamodel import createList
            from datamodel import PhysicalQuantity
            self.value_species, self.value_property = createList(val_solub, PhysicalQuantity)
            pass
        if val_solid:
            from datamodel import createList
            from datamodel import PhysicalQuantity
            self.value_solid_species, self.value_solid_property = createList(val_solid, PhysicalQuantity)
            pass
        return
Example #24
0
    def __init__(self,
                 boundary,
                 btype,
                 value,
                 bcdict,
                 porosity=None,
                 description=None):
        """
        Boundary condition initialisation with :
        
        - one boundary

        - a boundary condition type.
          We verify that it's a key of bcdict dictionnary
        - a boundary condition value. Value depend of boundary condition type.
        
        - bcdict : a dictionnary with key = type of boundary condition and value = Possible class of boundary condition value: 
        
            As an example, we can have for bcdict.keys() : ['Flux', 'Dirichlet', 'Neumann']
        
        All boundary conditions satisfy that format. It should enable the lecture of hydraulic, mechanical and chemical-transport boundary conditions.
        
        Exemple: bcdict = {'Flux': [class chemistry.ChemicalState , class PhysicalQuantities.HeadGradient],
                   'Dirichlet': [class chemistry.ChemicalState, class PhysicalQuantities.Head, class PhysicalQuantities.Pressure,\
                         class PhysicalQuantities.Displacement, class PhysicalQuantities.NormalForce], 
                   'Neumann': [class chemistry.ChemicalState, class PhysicalQuantities.HeadGradient]}
        
        """
        self.value = None
        self.value_species = None
        #print (" here we are 1, bcdict ", bcdict)
        #print (" here we are 2, bcdict ", bcdict.keys())
        #print value
        #raw_input()
        #print("dbg bcdict ",list(bcdict.keys()))
        if isInstance(boundary, [CartesianMesh, Body]):
            pass
        else:
            memberShip(boundary.support, [CartesianMesh, Body])
            pass
        self.boundary = boundary
        if type(btype) != StringType:
            raise TypeError(" type should be a string ")
        if btype not in list(bcdict.keys()):
            print("bcdict.keys() are:", list(bcdict.keys()))
            print("and btype %s is not in bdict: " % (btype))
            raise Exception(" check the boundary condition type ")
        self.type = btype
        print("debug commonproblem CommonBoundaryCondition value: ",
              type(value.__class__.__name__), value.__class__.__name__)
        #print "dbg bcdict ",bcdict.keys()
        #raw_input( "valuefffffffff     fff")
        #if value.__class__.__name__ == 'Head':
        #    print "valueeeee Head",value.__class__.__name__
        #else:
        #    print "valueeeef",value.__class__.__name__
        if isinstance(value, (ListType, TupleType)):
            #print(" debug commonproblem CommonBoundaryCondition, value is of type ListType", type(value), value)
            for val in value:
                print(
                    "debug commonproblem CommonBoundaryCondition, debug val: ",
                    val)
                if isinstance(val, Displacement):
                    self.value = {"Displacement": val.getValue()}
                    pass
                elif isinstance(val, NormalForce):
                    if self.value != None:
                        self.value["NormalForce"] = val.getValue()
                        pass
                    else:
                        self.value = {"NormalForce": val.getValue()}
                        pass
                elif isinstance(val, (Head, Pressure)):
                    valeurs = toList(val)
                    for vale in valeurs:
                        if type(val) is TupleType:
                            checked = val[0]
                            for i in range(1, len(val)):
                                memberShip(val[i], Species)
                                pass
                            pass
                        else:
                            checked = val
                            pass
                        pass
                    print("dbg commonproblem %s\n" %
                          (val.__class__.__name__.lower()))
                    if self.value != None:
                        self.value[
                            val.__class__.__name__.lower()] = val.getValue()
                    else:
                        self.value = {
                            val.__class__.__name__.lower(): val.getValue()
                        }
                    pass
                elif isinstance(val, Temperature):
                    if self.value != None:
                        self.value[
                            val.__class__.__name__.lower()] = val.getValue()
                    else:
                        self.value = {
                            val.__class__.__name__.lower(): val.getValue()
                        }
                    pass
                pass
            print("debug commonproblem CommonBoundaryCondition: ", self.value)
            pass
        elif isinstance(value, Displacement):
            #print("debug commonproblem  value is of type Displacement")
            self.value = {"Displacement": value.getValue()}
            pass
        elif isinstance(value, NormalForce):
            #print("debug commonproblem  value is of type NormalForce")
            if self.value != None:
                self.value["NormalForce"] = value.getValue()
                pass
            else:
                self.value = {"NormalForce": value.getValue()}
                pass
            pass

        elif isinstance(value, (Head, Pressure)):
            print("debug commonproblem  value is of type Head or Pressure")
            from datamodel import Species
            value = toList(value)
            #print("debug commonproblem  value is of type Head or Pressure: ", value)
            #print("debug commonproblem  value is of type Head or Pressure: ", bcdict)
            for val in value:
                if type(val) is TupleType:
                    checked = val[0]
                    for i in range(1, len(val)):
                        memberShip(val[i], Species)
                        pass
                    pass
                else:
                    checked = val
                    pass
                for definedType in bcdict:
                    if btype == definedType:
                        memberShip(checked, bcdict[btype])
                        #raw_input("here we are")
                        pass
                    pass
                pass
            if not self.value_species:
                from PhysicalQuantities import PhysicalQuantity
                from species import createList
                print(value)
                self.value_species, self.value_property = createList(
                    value, PhysicalQuantity)
                pass
            self.value = {
                value[0].__class__.__name__.lower(): value[0].getValue()
            }
        #print(" dbg commonproblem: valeur de self.value",self.value)
        #raw_input("dbg commonproblem: CommonBoundaryCondition")
        if description == None:
            self.description = None
            pass
        else:
            self.description = description
            pass
        return None
Example #25
0
    def __init__(self, body=None, value=None, description=None):
        """
        domain can be a region of the domain, it could also be a simple body associated to.
        """
        if isInstance(body, [CartesianMesh, Body]):
            pass
        else:
            memberShip(body.support, [CartesianMesh, Body])
            pass
        self.body = body
        self.zone = body
        self.domain = body
        #        if domain !=None:
        #            if isinstance(domain,Region):
        #                memberShip(domain.support,[CartesianMesh, Body])
        #            elif isinstance(domain,Body):
        #                pass
        #            elif isinstance(domain,CartesianMesh):
        #                pass
        #        self.domain = domain
        #
        #
        #
        print(" the value for initial condition is: ", type(value), value,
              value.__class__.__name__)
        #raw_input(__name__+": the value for initial condition is")
        if isinstance(value, PhysicalQuantity):
            if not isinstance(value, (Head, Pressure)):
                pass
            else:
                #print "dbg CommonInitialCondition",value
                if type(value) == None:
                    self.value = Head(0.0, "m")
                    pass
                elif isinstance(value, Head):
                    self.value = value
                    pass
                else:
                    self.value = value
                    #raise Exception(" to modify, the pressure must be scaled to be entered as a head")
            if not isinstance(value, (Displacement)):
                pass
            else:
                #print "dbg CommonInitialCondition",value
                if type(value) == None:
                    self.value = Displacement(0.0, "m")
                    pass
                elif isinstance(value, Displacement):
                    self.value = value
                    pass
        elif type(value) in [ListType, TupleType]:
            self.value = {}
            for val in value:
                if isinstance(val,
                              (Head, Pressure, Displacement, Temperature)):
                    print(" value val.__class__.__name__ ",
                          val.__class__.__name__)
                    self.value[val.__class__.__name__] = val
                else:
                    pass
                    #raise Warning("check the way a value of type "+val.__class__.__name__+" can be treated")
                pass

        if description == None:
            print(dir(body))
            self.description = "CommonInitialCondition stretched over the body "
            pass
        else:
            self.description = description
            pass
        return None
Example #26
0
    def setProperty(self, keyword, property):
        """
        To set a material property
        """
        # print "dbg property: ",self.name, keyword,property.__class__
        # raw_input("keyword property1")
        keyword = keyword.lower()
        if keyword not in list(self.propdict.keys()):
            print(list(self.propdict.keys()))
            raise Exception(" check the set property function, property: " + keyword)
        # print "dbg property: ",self.name, keyword,property.__class__
        # raw_input("keyword property2")
        if isInstance(property, [PhysicalLaw, PQuantity, AquiferProperty, SolidProperty]):
            # print "setproperty propClass is ok "
            propClass = property.__class__
            # raw_input("keyword property2 isInstance(property,[PhysicalLaw,PQuantity,AquiferProperty,SolidProperty])")
            pass
        elif type(property) is ListType:
            #
            # if property type is of ListType: :
            #
            # if we have as input :
            # ["Na", Prop('3.7), "Cl", Prop(3.8)]
            # it becomes
            # [("Na", Prop('3.7)), ("CL", Prop(3.8))]
            #
            # raw_input("keyword property3 type(property) is ListType")
            myProperty = []
            aNewProp = []
            for prop in property:
                if len(aNewProp) == 1:
                    aNewProp.append(prop)
                    myProperty.append(tuple(aNewProp))
                    aNewProp = []
                    pass
                from types import StringType

                if type(prop, StringType):
                    if len(aNewProp) != 0:
                        message = "\n\n"
                        message += "Exception catched\n"
                        message += "to improve ...\n"
                        raise Exception(message)
                    aNewProp.append(prop)
                    pass
                pass
            if myProperty:
                property = myProperty
                pass
            #
            #
            property_buf = []
            for prop in property:
                if isInstance(prop, [PhysicalLaw, PQuantity, AquiferProperty, SolidProperty]):
                    property_buf.append(prop)
                    pass
                elif type(prop, TupleType):
                    if isInstance(prop[0], [AquiferProperty, PhysicalLaw, PQuantity, SolidProperty]):
                        property_buf.append(prop)
                        pass
                    else:
                        property_buf.append((prop[1], prop[0]))
                        pass
                    pass
                else:
                    raise Exception("object membership should be verified : %s" % prop)
                pass
            property = property_buf
            for prop in property:
                if isInstance(prop, [AquiferProperty, PhysicalLaw, PQuantity, SolidProperty]):
                    propClass = prop.__class__
                    pass
                elif type(prop, TupleType):
                    memberShip(prop[0], [AquiferProperty, PhysicalLaw, PQuantity, SolidProperty])
                    propClass = prop[0].__class__
                    if propClass == self.propdict[keyword]:
                        PQ = propClass
                        pass
                    elif issubclass(propClass, self.propdict[keyword]):
                        PQ = self.propdict[keyword]
                        ##                        if propClass=='SolubilityByElement':
                        ##                            print 'houla element'
                        ##                            flag='SolubilityByElement'
                        pass

                    key = PQ.__name__
                    key = key[0].lower() + key[1:]
                    if not hasattr(self, key + "_species"):
                        raise Exception("No species allowed for %s" % key)
                    pass
                else:
                    raise Exception("object membership should be verified : %s" % prop)
                pass
            pass
        else:
            if property:
                raise Exception("object membership should be verified : %s" % property)
            else:
                propClass = self.propdict[keyword]
        # propClass=property.__class__
        # print (" dbg keyword ",keyword)
        # print (" dbg propClass ",propClass)
        # print (" dbg propdict ",self.propdict[keyword])
        if propClass != self.propdict[keyword]:
            if not issubclass(propClass, self.propdict[keyword]):
                raise Exception(" problem with property class ")
        # self.changeProperty(propClass,property)
        self.changeProperty(self.propdict[keyword], property)