Ejemplo n.º 1
0
 def __init__(self,fileName):
     Generic.__init__(self)
     if type(fileName) not in [StringType,noneType]:
         raise Exception(" the XmlVtkUnstructured class argument has to be a String ")
     else:
         if ".vtu" not in fileName:
             if "." in fileName:
                 fileName.replace(".","").append(".vtu")
                 pass
             pass
         self.fileName = fileName
Ejemplo n.º 2
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
Ejemplo n.º 3
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