示例#1
0
    def _init__fvPatch__dictionary(self, *args):
        if len(args) != 2:
            raise AssertionError("len( args ) != 1")
        argc = 0

        from Foam.finiteVolume import fvPatch
        try:
            fvPatch.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != fvPatch")
        patch = args[argc]
        argc = argc + 1

        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != dictionary")
        dict_ = args[argc]

        self.patch_ = patch
        from Foam.OpenFOAM import word
        self.neighbourRegionName_ = word(
            dict_.lookup(word("neighbourRegionName")))
        self.neighbourPatchName_ = word(
            dict_.lookup(word("neighbourPatchName")))
        self.neighbourFieldName_ = word(
            dict_.lookup(word("neighbourFieldName")))
        self.localRegion_ = self.patch_.boundaryMesh().mesh()

        return self
示例#2
0
 def _init__with_2_param( self, *args ):
     if len(args) != 2:
        raise AssertionError( "len( args ) != 2" )
     argc = 0
     
     from Foam.finiteVolume import fvMesh
     try:
         fvMesh.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != fvMesh" )
     mesh = args[ argc ]; argc +=1
     
     from Foam.OpenFOAM import dictionary
     try:
         dictionary.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != dictionary" )
     dict_ = args[ argc ]
     PtrList_TypeBase.__init__( self )
     from Foam.OpenFOAM import polyPatchID, word, readLabel, readScalar
     self.patchID_ = polyPatchID( dict_.lookup( word( "patch" ) ), mesh.boundaryMesh() )
     self.faceIndex_ = readLabel( dict_.lookup( word( "face" ) ) )
     self.dir_ = self.getDir( dict_ )
     self.value_ = readScalar( dict_.lookup( word( "value" ) ) )
     self.checkPatchFace(mesh)
示例#3
0
    def _init__with_2_param(self, *args):
        if len(args) != 2:
            raise AssertionError("len( args ) != 2")
        argc = 0

        from Foam.finiteVolume import fvMesh
        try:
            fvMesh.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != fvMesh")
        mesh = args[argc]
        argc += 1

        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != dictionary")
        dict_ = args[argc]
        PtrList_TypeBase.__init__(self)
        from Foam.OpenFOAM import polyPatchID, word, readLabel, readScalar
        self.patchID_ = polyPatchID(dict_.lookup(word("patch")),
                                    mesh.boundaryMesh())
        self.faceIndex_ = readLabel(dict_.lookup(word("face")))
        self.dir_ = self.getDir(dict_)
        self.value_ = readScalar(dict_.lookup(word("value")))
        self.checkPatchFace(mesh)
示例#4
0
    def _init__fvPatch__DimensionedField_scalar_volMesh__dictionary(
            self, *args):
        if len(args) != 3:
            raise AssertionError("len( args ) != 3")
        argc = 0

        from Foam.finiteVolume import fvPatch
        try:
            fvPatch.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != fvPatch")
        p = args[argc]
        argc += 1

        from Foam.finiteVolume import DimensionedField_scalar_volMesh
        try:
            DimensionedField_scalar_volMesh.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError(
                "args[ argc ].__class__ != DimensionedField_scalar_volMesh")
        iF = args[argc]
        argc += 1

        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != dictionary")
        dict_ = args[argc]

        fixedValueFvPatchScalarField.__init__(self, p, iF, dict_)

        return self
示例#5
0
 def _init__fvPatch__dictionary( self, *args ):
     if len ( args ) != 2 :
        raise AssertionError( "len( args ) != 1" )
     argc = 0
     
     from Foam.finiteVolume import fvPatch
     try:
         fvPatch.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != fvPatch" )
     patch = args [ argc ]; argc = argc + 1
     
     from Foam.OpenFOAM import dictionary
     try:
         dictionary.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != dictionary" )
     dict_ = args[ argc ]
     
     self.patch_ = patch
     from Foam.OpenFOAM import word
     self.neighbourRegionName_ = word( dict_.lookup( word( "neighbourRegionName" ) ) )
     self.neighbourPatchName_ = word( dict_.lookup( word( "neighbourPatchName" ) ) )
     self.neighbourFieldName_ = word( dict_.lookup( word( "neighbourFieldName" ) ) )
     self.localRegion_ = self.patch_.boundaryMesh().mesh()
     
     return self
示例#6
0
    def __init__(self, name, sigma, dict_):

        from Foam.OpenFOAM import word, dictionary
        from Foam.finiteVolume import volSymmTensorField
        try:
            name = word(str(name))
        except ValueError:
            raise AttributeError("The second arg is not string")

        try:
            volSymmTensorField.ext_isinstance(sigma)
        except TypeError:
            raise AssertionError("sigma != volSymmTensorField")

        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance(dict_)
        except TypeError:
            raise AssertionError("dict_ != dictionary")

        rheologyLaw.__init__(self, name, sigma, dict_)

        from Foam.OpenFOAM import dimensionedScalar
        self.rho_ = dimensionedScalar(dict_.lookup(word("rho")))
        self.E_ = dimensionedScalar(dict_.lookup(word("E")))
        self.nu_ = dimensionedScalar(dict_.lookup(word("nu")))
        pass
示例#7
0
 def _init__fvPatch__DimensionedField_scalar_volMesh__dictionary( self, *args ):
     if len( args ) != 3 :
        raise AssertionError( "len( args ) != 3" )
     argc = 0
     
     from Foam.finiteVolume import fvPatch        
     try:
         fvPatch.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != fvPatch" )
     p = args[ argc ]; argc += 1
     
     from Foam.finiteVolume import DimensionedField_scalar_volMesh
     try:
         DimensionedField_scalar_volMesh.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != DimensionedField_scalar_volMesh" )
     iF = args[ argc ]; argc += 1
     
     from Foam.OpenFOAM import dictionary
     try:
         dictionary.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != dictionary" )
     dict_ = args[ argc ]
     
     fixedValueFvPatchScalarField.__init__( self, p, iF, dict_ )
     
     return self
示例#8
0
 def __init__( self, name, sigma, dict_ ):
     
     from Foam.OpenFOAM import word, dictionary
     from Foam.finiteVolume import volSymmTensorField
     try:
         name = word( str( name ) )
     except ValueError:
        raise AttributeError("The second arg is not string")
    
     try:
         volSymmTensorField.ext_isinstance( sigma )
     except TypeError:
         raise AssertionError( "sigma != volSymmTensorField" )
        
     from Foam.OpenFOAM import dictionary
     try:
         dictionary.ext_isinstance( dict_ )
     except TypeError:
         raise AssertionError( "dict_ != dictionary" )
                 
     rheologyLaw.__init__( self, name, sigma, dict_ )
     
     from Foam.OpenFOAM import dimensionedScalar
     self.rho_ = dimensionedScalar( dict_.lookup(word( "rho" ) ) )
     self.E_ = dimensionedScalar( dict_.lookup( word( "E" ) ) )
     self.nu_ = dimensionedScalar( dict_.lookup( word( "nu" ) ) )
     pass
示例#9
0
    def _init__fvPatch__DimensionedField_scalar_volMesh__dictionary(
            self, *args):
        if len(args) != 3:
            raise AssertionError("len( args ) != 3")
        argc = 0

        from Foam.finiteVolume import fvPatch
        try:
            fvPatch.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != fvPatch")
        p = args[argc]
        argc += 1

        from Foam.finiteVolume import DimensionedField_scalar_volMesh
        try:
            DimensionedField_scalar_volMesh.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError(
                "args[ argc ].__class__ != DimensionedField_scalar_volMesh")
        iF = args[argc]
        argc += 1

        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != dictionary")
        dict_ = args[argc]
        argc += 1

        mixedFvPatchScalarField.__init__(self, p, iF)
        from Foam.OpenFOAM import word
        self.neighbourFieldName_ = word(
            dict_.lookup(word("neighbourFieldName")))
        self.KName_ = word(dict_.lookup(word("K")))

        from Foam.finiteVolume import fvPatchScalarField
        from Foam.OpenFOAM import word, scalarField, readBool
        fvPatchScalarField.ext_assign(
            self, scalarField(word("value"), dict_, p.size()))

        if dict_.found(word("refValue")):
            #Full restart
            self.refValue().ext_assign(
                scalarField(word("refValue"), dict_, p.size()))
            self.refGrad().ext_assign(
                scalarField(word("refGradient"), dict_, p.size()))
            self.valueFraction().ext_assign(
                scalarField(word("valueFraction"), dict_, p.size()))
        else:
            # Start from user entered data. Assume fixedValue.
            self.refValue().ext_assign(self)
            self.refGrad().ext_assign(0.0)
            self.valueFraction().ext_assign(1.0)
            pass

        return self
示例#10
0
    def _init__fvPatch__DimensionedField_scalar_volMesh__dictionary( self, *args ) :
        if len( args ) != 3 :
            raise AssertionError( "len( args ) != 3" )
        argc = 0
        
        from Foam.finiteVolume import fvPatch        
        try:
            fvPatch.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != fvPatch" )
        p = args[ argc ]; argc += 1
        
        from Foam.finiteVolume import DimensionedField_scalar_volMesh
        try:
            DimensionedField_scalar_volMesh.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != DimensionedField_scalar_volMesh" )
        iF = args[ argc ]; argc += 1
        
        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != dictionary" )
        dict_ = args[ argc ]; argc += 1
        
        mixedFvPatchScalarField.__init__( self, p, iF )
        from Foam.OpenFOAM import word
        self.neighbourFieldName_ = word( dict_.lookup( word( "neighbourFieldName" ) ) )
        self.KName_ = word( dict_.lookup( word( "K" ) ) )
       
        from Foam.finiteVolume import fvPatchScalarField
        from Foam.OpenFOAM import word, scalarField, readBool
        fvPatchScalarField.ext_assign( self, scalarField( word( "value" ), dict_, p.size() ) )
        
        if dict_.found( word( "refValue" ) ) :
            #Full restart
            self.refValue().ext_assign( scalarField( word( "refValue" ), dict_, p.size() ) )
            self.refGrad().ext_assign( scalarField( word( "refGradient" ), dict_, p.size() ) )
            self.valueFraction().ext_assign( scalarField( word( "valueFraction" ), dict_, p.size() ) )
            self.fixesValue_ = readBool( dict_.lookup( word( "fixesValue" ) ) )
        else:
            # Start from user entered data. Assume fixedValue.
            self.refValue().ext_assign( self )
            self.refGrad().ext_assign( 0.0 )
            self.valueFraction().ext_assign( 1.0 )
            self.fixesValue_ = True
            pass

        return self
    def _init__fvPatch__DimensionedField_scalar_volMesh__dictionary(
            self, *args):
        if len(args) != 3:
            raise AssertionError("len( args ) != 3")
        argc = 0

        from Foam.finiteVolume import fvPatch
        try:
            fvPatch.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != fvPatch")
        p = args[argc]
        argc += 1

        from Foam.finiteVolume import DimensionedField_scalar_volMesh
        try:
            DimensionedField_scalar_volMesh.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError(
                "args[ argc ].__class__ != DimensionedField_scalar_volMesh")
        iF = args[argc]
        argc += 1

        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != dictionary")
        dict_ = args[argc]

        fixedGradientFvPatchScalarField.__init__(self, p, iF)
        from chtMultiRegionFlux.r1_5.coupleManager import coupleManager
        self.coupleManager_ = coupleManager(p, dict_)
        from Foam.OpenFOAM import word
        self.KName_ = word(dict_.lookup(word("K")))

        if dict_.found(word("value")):
            from Foam.finiteVolume import fvPatchScalarField
            from Foam.OpenFOAM import scalarField
            fvPatchScalarField.ext_assign(
                self, scalarField(word("value"), dict_, p.size()))
            pass
        else:
            self.evaluate()
            pass

        return self
    def _init__fvPatch__DimensionedField_scalar_volMesh__dictionary(self, *args):
        if len(args) != 3:
            raise AssertionError("len( args ) != 3")
        argc = 0

        from Foam.finiteVolume import fvPatch

        try:
            fvPatch.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != fvPatch")
        p = args[argc]
        argc += 1

        from Foam.finiteVolume import DimensionedField_scalar_volMesh

        try:
            DimensionedField_scalar_volMesh.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != DimensionedField_scalar_volMesh")
        iF = args[argc]
        argc += 1

        from Foam.OpenFOAM import dictionary

        try:
            dictionary.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != dictionary")
        dict_ = args[argc]

        fixedGradientFvPatchScalarField.__init__(self, p, iF)

        if dict_.found(word("gradient")):
            from Foam.OpenFOAM import scalarField

            self.gradient().ext_assign(scalarField(word("gradient"), dict_, p.size()))
            fixedGradientFvPatchScalarField.updateCoeffs(self)
            fixedGradientFvPatchScalarField.evaluate()
            pass
        else:
            self.ext_assign(self.patchInternalField())
            self.gradient().ext_assign(0.0)
            pass

        return self
示例#13
0
    def _init__fvPatch__DimensionedField_vector_volMesh__dictionary(
            self, *args):
        if len(args) != 3:
            raise AssertionError("len( args ) != 3")
        argc = 0

        from Foam.finiteVolume import fvPatch
        try:
            fvPatch.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != fvPatch")
        p = args[argc]
        argc += 1

        from Foam.finiteVolume import DimensionedField_vector_volMesh
        try:
            DimensionedField_vector_volMesh.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError(
                "args[ argc ].__class__ != DimensionedField_Vector_volMesh")
        iF = args[argc]
        argc += 1

        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != dictionary")
        dict_ = args[argc]
        argc += 1

        fixedGradientFvPatchVectorField.__init__(self, p, iF)

        from Foam.OpenFOAM import word
        from Foam.OpenFOAM import vectorField, vector, scalarField
        self.UName_ = word(dict_.lookup(word("U")))
        self.rheologyName_ = word(dict_.lookup(word("rheology")))
        self.traction_ = vectorField(word("traction"), dict_, p.size())
        self.pressure_ = scalarField(word("pressure"), dict_, p.size())

        self.ext_assign(self.patchInternalField())
        self.gradient().ext_assign(vector.zero)

        ext_Info() << "rf: " << self.rheologyName_ << nl

        return self
示例#14
0
    def _init__fvPatch__DimensionedField_scalar_volMesh__dictionary(
            self, *args):
        if len(args) != 3:
            raise AssertionError("len( args ) != 3")
        argc = 0

        from Foam.finiteVolume import fvPatch
        try:
            fvPatch.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != fvPatch")
        p = args[argc]
        argc += 1

        from Foam.finiteVolume import DimensionedField_scalar_volMesh
        try:
            DimensionedField_scalar_volMesh.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError(
                "args[ argc ].__class__ != DimensionedField_scalar_volMesh")
        iF = args[argc]
        argc += 1

        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != dictionary")
        dict_ = args[argc]
        argc += 1

        mixedFvPatchScalarField.__init__(self, p, iF)

        if dict_.found(word("value")):
            self.ext_assign(scalarField(word("value"), dict_, p.size()))
            pass
        else:
            self.ext_assign(self.patchInternalField())
            pass

        self.refValue().ext_assign(self)
        self.refGrad().ext_assign(0.0)
        self.valueFraction().ext_assign(0.0)

        return self
示例#15
0
    def __init__(self, name, sigma, dict_):
        from Foam.OpenFOAM import word, dictionary
        from Foam.finiteVolume import volSymmTensorField
        try:
            name = word(str(name))
        except ValueError:
            raise AttributeError("The second arg is not string")

        try:
            volSymmTensorField.ext_isinstance(sigma)
        except TypeError:
            raise AssertionError("sigma != volSymmTensorField")

        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance(dict_)
        except TypeError:
            raise AssertionError("dict_ != dictionary")

        rheologyLaw.__init__(self, name, sigma, dict_)

        from Foam.OpenFOAM import IOobject, fileName
        from Foam.finiteVolume import volScalarField
        self.materials_ = volScalarField(
            IOobject(word("materials"),
                     fileName(self.mesh().time().timeName()), self.mesh(),
                     IOobject.MUST_READ, IOobject.AUTO_WRITE), self.mesh())

        from Foam.OpenFOAM import PtrList_entry
        lawEntries = PtrList_entry(dict_.lookup(word("laws")))

        for lawI in range(lawEntries.size()):
            self.append(
                rheologyLaw.New(lawEntries[lawI].keyword(), sigma,
                                lawEntries[lawI].dict()))

        from Foam.OpenFOAM import SMALL
        if self.materials_.ext_min().value() < 0 or self.materials_.ext_max(
        ).value() > (len(self) + SMALL):
            raise IOError(" Invalid definition of material indicator field.")

        pass
 def _init__fvPatch__DimensionedField_scalar_volMesh__dictionary( self, *args ):
     if len( args ) != 3 :
         raise AssertionError( "len( args ) != 3" )
     argc = 0
     
     from Foam.finiteVolume import fvPatch        
     try:
         fvPatch.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != fvPatch" )
     p = args[ argc ]; argc += 1
     
     from Foam.finiteVolume import DimensionedField_scalar_volMesh
     try:
         DimensionedField_scalar_volMesh.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != DimensionedField_scalar_volMesh" )
     iF = args[ argc ]; argc += 1
     
     from Foam.OpenFOAM import dictionary
     try:
         dictionary.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != dictionary" )
     dict_ = args[ argc ]
     
     fixedValueFvPatchScalarField.__init__( self, p, iF )
     from chtMultiRegionFlux.r1_5.coupleManager import coupleManager
     self.coupleManager_ = coupleManager( p, dict_ )
     from Foam.OpenFOAM import word
     self.KName_ = word( dict_.lookup( word( "K" ) ) )
     
     if dict_.found( word( "value" ) ):
        from Foam.finiteVolume import fvPatchScalarField
        from Foam.OpenFOAM import scalarField
        fvPatchScalarField.ext_assign( self, scalarField( word( "value" ), dict_, p.size() ) )
        pass
     else:
        self.evaluate()
        pass
     
     return self
示例#17
0
    def __init__( self, name, sigma, dict_ ):
        from Foam.OpenFOAM import word, dictionary
        from Foam.finiteVolume import volSymmTensorField
        try:
            name = word( str( name ) )
        except ValueError:
           raise AttributeError("The second arg is not string")
       
        try:
            volSymmTensorField.ext_isinstance( sigma )
        except TypeError:
            raise AssertionError( "sigma != volSymmTensorField" )
           
        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance( dict_ )
        except TypeError:
            raise AssertionError( "dict_ != dictionary" )

        rheologyLaw.__init__(self, name, sigma, dict_ )
      
        from Foam.OpenFOAM import IOobject, fileName
        from Foam.finiteVolume import volScalarField
        self.materials_ = volScalarField( IOobject( word( "materials" ),
                                                    fileName( self.mesh().time().timeName() ),
                                                    self.mesh(),
                                                    IOobject.MUST_READ,
                                                    IOobject.AUTO_WRITE ),
                                          self.mesh() )
           
        from Foam.OpenFOAM import PtrList_entry
        lawEntries = PtrList_entry( dict_.lookup( word("laws") ) )
                
        for lawI in range( lawEntries.size() ):
            self.append( rheologyLaw.New( lawEntries[lawI].keyword(), sigma, lawEntries[lawI].dict() ) )
            
        from Foam.OpenFOAM import SMALL
        if self.materials_.ext_min().value() < 0 or self.materials_.ext_max().value() > (len(self) + SMALL):
           raise IOError(" Invalid definition of material indicator field.")
        
        pass
示例#18
0
    def _init__fvPatch__DimensionedField_vector_volMesh__dictionary( self, *args ) :
        if len( args ) != 3 :
            raise AssertionError( "len( args ) != 3" )
        argc = 0
        
        from Foam.finiteVolume import fvPatch
        try:
            fvPatch.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != fvPatch" )
        p = args[ argc ]; argc += 1

        from Foam.finiteVolume import DimensionedField_vector_volMesh
        try:
            DimensionedField_vector_volMesh.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != DimensionedField_Vector_volMesh" )
        iF = args[ argc ]; argc += 1
        
        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != dictionary" )
        dict_ = args[ argc ]; argc += 1

        fixedGradientFvPatchVectorField.__init__( self, p, iF )
       
        from Foam.OpenFOAM import word
        from Foam.OpenFOAM import vectorField, vector, scalarField
        self.UName_ = word( dict_.lookup( word( "U" ) ) )
        self.rheologyName_ = word( dict_.lookup( word( "rheology" ) ) )
        self.traction_ = vectorField( word( "traction" ) , dict_, p.size() )
        self.pressure_ = scalarField( word( "pressure" ), dict_, p.size() )
        
        self.ext_assign( self.patchInternalField() )
        self.gradient().ext_assign( vector.zero )
        
        ext_Info() << "rf: " << self.rheologyName_ << nl
        
        return self
示例#19
0
 def getDir( self, dict_ ):
     from Foam.OpenFOAM import dictionary
     try:
         dictionary.ext_isinstance( dict_ )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != dictionary" )
     
     from Foam.OpenFOAM import word
     dirName = str( word( dict_.lookup( word( "direction" ) ) ) )
     
     if dirName == "x" or dirName == "X":
        from Foam.OpenFOAM import vector
        return vector.X
     elif dirName == "y" or dirName == "Y":
        from Foam.OpenFOAM import vector
        return vector.Y
     elif dirName == "z" or dirName == "Z":
        from Foam.OpenFOAM import vector
        return vector.Z
     else:
        raise IOError("Direction %s not recognize. Use x,y or z " %dirName )
    def _init__fvPatch__DimensionedField_scalar_volMesh__dictionary( self, *args ):
        if len( args ) != 3 :
           raise AssertionError( "len( args ) != 3" )
        argc = 0
        
        from Foam.finiteVolume import fvPatch        
        try:
            fvPatch.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != fvPatch" )
        p = args[ argc ]; argc += 1
        
        from Foam.finiteVolume import DimensionedField_scalar_volMesh
        try:
            DimensionedField_scalar_volMesh.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != DimensionedField_scalar_volMesh" )
        iF = args[ argc ]; argc += 1
        
        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != dictionary" )
        dict_ = args[ argc ]
        
        fixedGradientFvPatchScalarField.__init__( self, p, iF )
        
        if dict_.found( word( "gradient" ) ):
           from Foam.OpenFOAM import scalarField
           self.gradient().ext_assign( scalarField( word( "gradient" ) , dict_, p.size() ) )
           fixedGradientFvPatchScalarField.updateCoeffs( self )
           fixedGradientFvPatchScalarField.evaluate()
           pass
        else:
           self.ext_assign( self.patchInternalField() )
           self.gradient().ext_assign( 0.0 )
           pass

        return self
    def _init__fvPatch__DimensionedField_scalar_volMesh__dictionary( self, *args ) :
        if len( args ) != 3 :
            raise AssertionError( "len( args ) != 3" )
        argc = 0
        
        from Foam.finiteVolume import fvPatch        
        try:
            fvPatch.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != fvPatch" )
        p = args[ argc ]; argc += 1
        
        from Foam.finiteVolume import DimensionedField_scalar_volMesh
        try:
            DimensionedField_scalar_volMesh.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != DimensionedField_scalar_volMesh" )
        iF = args[ argc ]; argc += 1
        
        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance( args[ argc ] )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != dictionary" )
        dict_ = args[ argc ]; argc += 1
        
        mixedFvPatchScalarField.__init__( self, p, iF )
        
        if dict_.found( word( "value" ) ):
           self.ext_assign( scalarField( word( "value" ), dict_, p.size() ) )
           pass
        else:
           self.ext_assign( self.patchInternalField() )
           pass
        
        self.refValue().ext_assign( self )
        self.refGrad().ext_assign( 0.0 )
        self.valueFraction().ext_assign( 0.0 )

        return self
示例#22
0
    def getDir(self, dict_):
        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance(dict_)
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != dictionary")

        from Foam.OpenFOAM import word
        dirName = str(word(dict_.lookup(word("direction"))))

        if dirName == "x" or dirName == "X":
            from Foam.OpenFOAM import vector
            return vector.X
        elif dirName == "y" or dirName == "Y":
            from Foam.OpenFOAM import vector
            return vector.Y
        elif dirName == "z" or dirName == "Z":
            from Foam.OpenFOAM import vector
            return vector.Z
        else:
            raise IOError("Direction %s not recognize. Use x,y or z " %
                          dirName)
示例#23
0
 def __init__( self, name, sigma, dict_ ):
     from Foam.OpenFOAM import word, dictionary
     from Foam.finiteVolume import volSymmTensorField 
     
     try:
         name = word( str( name ) )
     except ValueError:
        raise AttributeError("The second arg is not string")
     
     from Foam.finiteVolume import volSymmTensorField
     try:
         volSymmTensorField.ext_isinstance( sigma )
     except TypeError:
         raise AssertionError( "sigma != volSymmTensorField" )
        
     from Foam.OpenFOAM import dictionary
     try:
         dictionary.ext_isinstance( dict_ )
     except TypeError:
         raise AssertionError( "dict_ != dictionary" )
       
     self.name_ = name
     self.sigma_ = sigma
     pass         
示例#24
0
    def New( name, sigma, dict_ ):
        from Foam.OpenFOAM import dictionary, word
        from Foam.finiteVolume import volSymmTensorField 
        try:
            name = word( str( name ) )
        except ValueError:
           raise AttributeError("The second arg is not string")
       
        try:
            volSymmTensorField.ext_isinstance( sigma )
        except TypeError:
            raise AssertionError( "sigma != volSymmTensorField" )
           
        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance( dict_ )
        except TypeError:
            raise AssertionError( "dict_ != dictionary" )
           
        rheoTypeName = dict_.lookup( word( "type" ) )
        
        from Foam.OpenFOAM import ext_Info, nl
        
        key = str( word( rheoTypeName ) )
        
        ext_Info() << "Selecting rheology model " << key << nl

        from materialModels.rheologyModel.rheologyLaws import addDictionaryConstructorTable
        if addDictionaryConstructorTable.dictionaryTable.has_key( key ):

           className = addDictionaryConstructorTable.dictionaryTable[ key ]

           return className( name, sigma, dict_ )
        else:
        
          raise IOError("Unknown rheologyLaw type  - %s.\n " %key )