Ejemplo n.º 1
0
    def __init__(self, problem, mesh, chemicalTransportModule = None,
                 mechanicalModule = None, elasticityLaw = None, MechaFrequency = None, algorithm = None) :
        """
        We give here the chemical transport module.
 
        The elasticity is driven by the porosity change and is defined through the elasticityLaw parameter
        
        can be :    None or "userdefined" 
        """
        if isInstance(problem, THMCProblem):
            self.problem = THMCProblem
        else:
            raise Warning(" the problem class should be THMC instead of "+str(problem.__class__.__name__))
        self.ChemicalTransportModule = ChemicalTransportModule
        ChemicalTransportModule.__init__(self)
        self.calculationTimes            = None
        self.density                     = None
        self.gravity                     = None
        self.matrixCompressibilityFactor = None
        self.porosity                    = None
        self.simulationType              = "Steady"
        self.sifFileName                 = "test.sif"
        self.timeStepIntervals           = None
        self.sourceField                 = None
        
        self.setCouplingAlgorithm(algorithm)
        self.setData (problem, trace = 0, mesh = mesh, algorithm = self.algorithm)
        #
        #
        #
        self.userPermeabilityLaw = None
        self.waterDynamicViscosity = 1.e-3  # kg/(m*s)
        ind= -1
        #
        # We check if a permeability law has been introduced by the user.
        #
        if self.userProcessing:
            for method in self.processingList:
                if isinstance(method, IntrinsicPermeabilityLaw) or "PermeabilityLaw" in method :
                    ind = self.processingList.index(method)
                    self.userPermeabilityLaw = method
                    print(" WD dbg user permeability law", method)
                    break
                    pass
                pass
            self.permeabilityLaw = method
            self.userPermeabilityLaw = True
            if ind>=0:
                del(self.processingList[ind])
                pass
            pass       
        elif permeabilityLaw != None and isinstance(permeabilityLaw, IntrinsicPermeabilityLaw):
            self.permeabilityLaw = permeabilityLaw
            pass
        else:
            raise Warning(" a permeability law should be associated to the algorithm")
        #
        # The hydraulic frequency corresponds to the frequency of the Darcy velocity evaluation.
        # For the moment hydraulic and chemistry share the same time step.
        # If hydraulic frequency is zero, Darcy velocity is evaluated only once.
        #
        if hydraulicFrequency == None:
            self.hydraulicFrequency = 0
            pass
        else:
            if type(hydraulicFrequency) == IntType:
                self.hydraulicFrequency = hydraulicFrequency
                pass
            else:
                raise Warning(" check the hydraulicFrequency setting,\n"\
                              +"it should be None or an integer")

        print(" WD dbg self.userPermeabilityLaw", self.userPermeabilityLaw)
        if (permeabilityLaw.lower() == "userdefined") or (self.userPermeabilityLaw != None):
            if (self.userPermeabilityLaw == None):
                if self.userProcessing == True:
                    raise Warning(" You have to set or to define a permeability law")
                pass
            pass
        elif (permeabilityLaw != None):
                                                                                            #
                                                                                            # available laws are described
                                                                                            # in physicalaws.py
                                                                                            #
            if isinstance(permeabilityLaw, IntrinsicPermeabilityLaw):
                self.permeabilityLaw = permeabilityLaw
                print(" WD permeabilityLaw ", self.permeabilityLaw)
                pass
            pass
        else:
            raise Warning(" You have to set or to define a permeability law")
        #
        # We have now a permeability and a hydraulic frequency
        #
        self.setUserPermeability()
Ejemplo n.º 2
0
    def __init__(self,
                 problem,
                 mesh,
                 permeabilityLaw=None,
                 hydraulicFrequency=None,
                 algorithm=None):
        """
        We give here the chemical transport module.
 
        The permeability law is by default the Kozeny one.
        
        But we can also introduce a user permeability law. The permeability law
        
        can be :    None or
                    "userdefined" or 
                    a permeability law predefined through python modules, Kozeny or Verma-Pruess

        """
        self.ChemicalTransportModule = ChemicalTransportModule
        ChemicalTransportModule.__init__(self)
        self.setCouplingAlgorithm(algorithm)
        self.setData(problem, trace=0, mesh=mesh, algorithm=self.algorithm)
        #
        #
        #
        self.userPermeabilityLaw = None
        self.waterDynamicViscosity = 1.e-3  # kg/(m*s)
        ind = -1
        #
        # We check if a permeability law has been introduced by the user.
        #
        if self.userProcessing:
            for method in self.processingList:
                if isinstance(method, IntrinsicPermeabilityLaw
                              ) or "PermeabilityLaw" in method:
                    ind = self.processingList.index(method)
                    self.userPermeabilityLaw = method
                    print " WD dbg user permeability law", method
                    break
                pass
            self.permeabilityLaw = method
            self.userPermeabilityLaw = True
            if ind >= 0:
                del (self.processingList[ind])
                pass
            pass
        elif permeabilityLaw != None and isinstance(permeabilityLaw,
                                                    IntrinsicPermeabilityLaw):
            self.permeabilityLaw = permeabilityLaw
            pass
        else:
            raise Warning, " a permeability law should be associated to the algorithm"
        #
        # The hydraulic frequency corresponds to the frequency of the Darcy velocity evaluation.
        # For the moment hydraulic and chemistry share the same time step.
        # If hydraulic frequency is zero, Darcy velocity is evaluated only once.
        #
        if hydraulicFrequency == None:
            self.hydraulicFrequency = 0
            pass
        else:
            if type(hydraulicFrequency) == IntType:
                self.hydraulicFrequency = hydraulicFrequency
                pass
            else:
                raise Warning, " check the hydraulicFrequency setting,\n"\
                              +"it should be None or an integer"

        print " WD dbg self.userPermeabilityLaw", self.userPermeabilityLaw
        if (permeabilityLaw.lower()
                == "userdefined") or (self.userPermeabilityLaw != None):
            if (self.userPermeabilityLaw == None):
                if self.userProcessing == True:
                    raise Warning, " You have to set or to define a permeability law"
                pass
            pass
        elif (permeabilityLaw != None):
            #
            # available laws are described
            # in physicalaws.py
            #
            if isinstance(permeabilityLaw, IntrinsicPermeabilityLaw):
                self.permeabilityLaw = permeabilityLaw
                print " WD permeabilityLaw ", self.permeabilityLaw
            pass
        else:
            raise Warning, " You have to set or to define a permeability law"
        #
        # We have now a permeability and a hydraulic frequency
        #
        self.setUserPermeability()
Ejemplo n.º 3
0
    def __init__(self,
                 problem,
                 mesh,
                 chemicalTransportModule=None,
                 mechanicalModule=None,
                 elasticityLaw=None,
                 MechaFrequency=None,
                 algorithm=None):
        """
        We give here the chemical transport module.
 
        The elasticity is driven by the porosity change and is defined through the elasticityLaw parameter
        
        can be :    None or "userdefined" 
        """
        if isInstance(problem, THMCProblem):
            self.problem = THMCProblem
        else:
            raise Warning(" the problem class should be THMC instead of " +
                          str(problem.__class__.__name__))
        self.ChemicalTransportModule = ChemicalTransportModule
        ChemicalTransportModule.__init__(self)
        self.calculationTimes = None
        self.density = None
        self.gravity = None
        self.matrixCompressibilityFactor = None
        self.porosity = None
        self.simulationType = "Steady"
        self.sifFileName = "test.sif"
        self.timeStepIntervals = None
        self.sourceField = None

        self.setCouplingAlgorithm(algorithm)
        self.setData(problem, trace=0, mesh=mesh, algorithm=self.algorithm)
        #
        #
        #
        self.userPermeabilityLaw = None
        self.waterDynamicViscosity = 1.e-3  # kg/(m*s)
        ind = -1
        #
        # We check if a permeability law has been introduced by the user.
        #
        if self.userProcessing:
            for method in self.processingList:
                if isinstance(method, IntrinsicPermeabilityLaw
                              ) or "PermeabilityLaw" in method:
                    ind = self.processingList.index(method)
                    self.userPermeabilityLaw = method
                    print(" WD dbg user permeability law", method)
                    break
                    pass
                pass
            self.permeabilityLaw = method
            self.userPermeabilityLaw = True
            if ind >= 0:
                del (self.processingList[ind])
                pass
            pass
        elif permeabilityLaw != None and isinstance(permeabilityLaw,
                                                    IntrinsicPermeabilityLaw):
            self.permeabilityLaw = permeabilityLaw
            pass
        else:
            raise Warning(
                " a permeability law should be associated to the algorithm")
        #
        # The hydraulic frequency corresponds to the frequency of the Darcy velocity evaluation.
        # For the moment hydraulic and chemistry share the same time step.
        # If hydraulic frequency is zero, Darcy velocity is evaluated only once.
        #
        if hydraulicFrequency == None:
            self.hydraulicFrequency = 0
            pass
        else:
            if type(hydraulicFrequency) == IntType:
                self.hydraulicFrequency = hydraulicFrequency
                pass
            else:
                raise Warning(" check the hydraulicFrequency setting,\n"\
                              +"it should be None or an integer")

        print(" WD dbg self.userPermeabilityLaw", self.userPermeabilityLaw)
        if (permeabilityLaw.lower()
                == "userdefined") or (self.userPermeabilityLaw != None):
            if (self.userPermeabilityLaw == None):
                if self.userProcessing == True:
                    raise Warning(
                        " You have to set or to define a permeability law")
                pass
            pass
        elif (permeabilityLaw != None):
            #
            # available laws are described
            # in physicalaws.py
            #
            if isinstance(permeabilityLaw, IntrinsicPermeabilityLaw):
                self.permeabilityLaw = permeabilityLaw
                print(" WD permeabilityLaw ", self.permeabilityLaw)
                pass
            pass
        else:
            raise Warning(" You have to set or to define a permeability law")
        #
        # We have now a permeability and a hydraulic frequency
        #
        self.setUserPermeability()
Ejemplo n.º 4
0
    def __init__(self, problem, mesh, permeabilityLaw = None, hydraulicFrequency = None, algorithm = None) :
        """
        We give here the chemical transport module.
 
        The permeability law is by default the Kozeny one.
        
        But we can also introduce a user permeability law. The permeability law
        
        can be :    None or
                    "userdefined" or 
                    a permeability law predefined through python modules, Kozeny or Verma-Pruess

        """
        self.ChemicalTransportModule = ChemicalTransportModule
        ChemicalTransportModule.__init__(self)
        self.setCouplingAlgorithm(algorithm)
        self.setData (problem, trace = 0, mesh = mesh, algorithm = self.algorithm)
        #
        #
        #
        self.userPermeabilityLaw = None
        self.waterDynamicViscosity = 1.e-3  # kg/(m*s)
        ind= -1
        #
        # We check if a permeability law has been introduced by the user.
        #
        if self.userProcessing:
            for method in self.processingList:
                if isinstance(method, IntrinsicPermeabilityLaw) or "PermeabilityLaw" in method :
                    ind = self.processingList.index(method)
                    self.userPermeabilityLaw = method
                    print " WD dbg user permeability law", method
                    break
                pass
            self.permeabilityLaw = method
            self.userPermeabilityLaw = True
            if ind>=0:
                del(self.processingList[ind])
                pass
            pass               
        elif permeabilityLaw != None and isinstance(permeabilityLaw, IntrinsicPermeabilityLaw):
            self.permeabilityLaw = permeabilityLaw
            pass
        else:
            raise Warning, " a permeability law should be associated to the algorithm"
        #
        # The hydraulic frequency corresponds to the frequency of the Darcy velocity evaluation.
        # For the moment hydraulic and chemistry share the same time step.
        # If hydraulic frequency is zero, Darcy velocity is evaluated only once.
        #
        if hydraulicFrequency == None:
            self.hydraulicFrequency = 0
            pass
        else:
            if type(hydraulicFrequency) == IntType:
                self.hydraulicFrequency = hydraulicFrequency
                pass
            else:
                raise Warning, " check the hydraulicFrequency setting,\n"\
                              +"it should be None or an integer"

        print " WD dbg self.userPermeabilityLaw", self.userPermeabilityLaw
        if (permeabilityLaw.lower() == "userdefined") or (self.userPermeabilityLaw != None):
            if (self.userPermeabilityLaw == None):
                if self.userProcessing == True:
                    raise Warning, " You have to set or to define a permeability law"
                pass
            pass
        elif (permeabilityLaw != None):
                                                                                            #
                                                                                            # available laws are described
                                                                                            # in physicalaws.py
                                                                                            #
            if isinstance(permeabilityLaw, IntrinsicPermeabilityLaw):
                self.permeabilityLaw = permeabilityLaw
                print " WD permeabilityLaw ", self.permeabilityLaw
            pass
        else:
            raise Warning, " You have to set or to define a permeability law"
        #
        # We have now a permeability and a hydraulic frequency
        #
        self.setUserPermeability()