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
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
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__( 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__(self, sigma): from Foam.finiteVolume import volSymmTensorField try: volSymmTensorField.ext_isinstance( sigma ) except TypeError: raise AssertionError( "args[ argc ].__class__ != volSymmTensorField" ) from Foam.OpenFOAM import IOobject, word, fileName IOdictionary.__init__(self, IOobject( word( "rheologyProperties" ), fileName( sigma.time().constant() ), sigma.db(), IOobject.MUST_READ, IOobject.NO_WRITE ) ) self.sigma_ = sigma self.typeName = word( "rheologyModel" ) from Foam.OpenFOAM import Switch self.planeStress_ = Switch( self.lookup( word( "planeStress" ) ) ) from materialModels.rheologyModel.rheologyLaws import rheologyLaw self.lawPtr_ = rheologyLaw.New( word( "law" ), self.sigma_, self.subDict( word( "rheology" ) ) ) pass
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 )
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