예제 #1
0
 def _modelMemoryUse(self):
     """
 Model allocated memory.
 """
     Material._modelMemoryUse(self)
     self.perfLogger.logFields('Materials', self.initialFields())
     return
예제 #2
0
파일: ModelLoader.py 프로젝트: rosedu/hfall
 def saveMaterials(self):
     for m in self.parser.object.materials:
         self.saveTextures(m)
         material = Material(m.name)
         if m.textureMap1:
             material.texture = self.textureMng.get(m.textureMap1.name)
         self.materialMng.add(material)
예제 #3
0
def generate_flatpin_bandstructure(mat, Lp,Aname,Na, Li, Ln,Dname,Nd, Va):
    
    # The Material class will find the bulk energy levels
    mp=Material(mat,{Aname:Na})
    mn=Material(mat,{Dname:Nd})
    
    # Band edges far on the p and n side
    Ecp=mp.Ec-mp.EBulk-Va/2
    Evp=mp.Ev-mp.EBulk-Va/2
    Ecn=mn.Ec-mn.EBulk+Va/2
    Evn=mn.Ev-mn.EBulk+Va/2
    
    # x-grid for the calculation
    x=np.linspace(-Lp-Li/2,Ln+Li/2,50000)
    return {"x":x,\
            
        # np.piecewise linear functions for the conduction band and valence band
        "Ec": np.piecewise(x,
            [x<-Li/2, (x>=-Li/2)&(x<Li/2), (x>=Li/2)],
            [lambda x: Ecp, lambda x: Ecp+(Ecn-Ecp)*(x+Li/2)/Li, lambda x: Ecn]),\
        "Ev": np.piecewise(x,
            [x<-Li/2, (x>=-Li/2)&(x<Li/2), (x>=Li/2)],
            [lambda x: Evp, lambda x: Evp+(Evn-Evp)*(x+Li/2)/Li, lambda x: Evn]),\
        
        # The Fermi levels, only given in the p and n regions
        "EB": np.piecewise(x,
            [x<-Li/2, (x>=-Li/2)&(x<Li/2), (x>=Li/2)],
            [lambda x: -Va/2, lambda x: np.NaN, lambda x: Va/2]),\
        
        # The reverse bias
        "Vr": -Va,
        
        # The material
        "material": mp}
예제 #4
0
def buildScene():
    """creates all the Objects in the Scene"""
    cam = Camera.Camera(Vector((0, 1.8, 10)), Vector((0, 3, 0)),
                        Vector((0, 1, 0)), 45, 300, 400)
    lightlist = []
    lightlist.append(Vector((30, 30, 50)))

    objectlist = []
    plane = Plane(Vector((0, 0, 0)), Vector((0, 1, 0)),
                  CheckerboardMaterial(0.5, 0.8, 1))
    sphere1 = Sphere(Vector((-1.5, 3, 0)), 1,
                     Material(0.3, 0.4, 0.1, Vector((255, 0, 0))))
    sphere2 = Sphere(Vector((1.5, 3, 0)), 1,
                     Material(0.3, 0.4, 0.1, Vector((0, 255, 0))))
    sphere3 = Sphere(Vector((0, 5.5, 0)), 1,
                     Material(0.3, 0.4, 0.1, Vector((0, 0, 255))))
    triangle = Triangle(Vector((-1.5, 3, 0)), Vector((1.5, 3, 0.1)),
                        Vector((0, 5.5, 0)),
                        Material(0.2, 0.4, 1, Vector((255, 255, 0))))
    objectlist.append(plane)
    objectlist.append(sphere1)
    objectlist.append(sphere2)
    objectlist.append(sphere3)
    objectlist.append(triangle)

    renderScene(cam, objectlist, lightlist)
예제 #5
0
    def __init__(self):
        self.width = 400
        self.height = 400
        self.e = np.array([0, 1.8, 10])
        self.c = np.array([0, 3, 0])
        self.up = np.array([0, 1, 0])
        self.fov = 45
        self.image = np.zeros((self.height, self.width, 3))
        self.background = np.array([0, 0, 0])

        self.camera = Camera(self.e, self.c, self.up, self.fov, 1, self.height,
                             self.width)
        self.light = Light(np.array([30, 30, 10]), np.array([255, 255, 255]))

        reflecting = True
        checkerboard = True
        self.objectlist = [
            Sphere(np.array([0, 3, 1]), 1,
                   Material(np.array([255, 0, 0]), reflecting)),
            Sphere(np.array([-1.5, 0.5, 1]), 1,
                   Material(np.array([0, 255, 0]), reflecting)),
            Sphere(np.array([1.5, 0.5, 1]), 1,
                   Material(np.array([0, 0, 255]), reflecting)),
            Triangle(np.array([1.5, 0.5, 0.5]), np.array([0, 3, 0.5]),
                     np.array([-1.5, 0.5, 0.5]),
                     Material(np.array([255, 255, 0]), False))
        ]
        if checkerboard:
            plane = Plane(np.array([0, -1, 0]), np.array([0, 1, 0]),
                          CheckerBoardMaterial(False))
        else:
            plane = Plane(np.array([0, -1, 0]), np.array([0, 1, 0]),
                          Material(np.array([128, 128, 128]), False))

        self.objectlist.append(plane)
예제 #6
0
 def _modelMemoryUse(self):
   """
   Model allocated memory.
   """
   Material._modelMemoryUse(self)
   self.perfLogger.logFields('Materials', self.initialFields())
   return
예제 #7
0
    def __init__(self, x, y):

        self.x = x
        self.y = y
        self.base_object = {}
        self.food_on_map = Food()
        self.material_on_map = Material()
        self.symbol = "X"
예제 #8
0
def main():
    print 'Testing Tube'
    a = Tube(np.array([5., 6.]),
             np.array([0.10, 0.10]),
             np.array([10., 10]),
             mat=Material(matname='heavySteel'))
    print 'Area and PSEUDOMass of tube a', a.Area, a.pseudomass
    b = Tube(3., 0.10, 10., mat=Material(matname='heavySteel'))
    print 'Area and PSEUDOMass of tube b', b.Area, b.pseudomass
예제 #9
0
    def __init__(self, obj, system):
        Material.__init__(self, obj, system)

        obj.addProperty("App::PropertyFloat", "Young", "Solid",
                        "Young's modulus").Young = 0.0
        obj.addProperty("App::PropertyFloat", "Shear", "Solid",
                        "Shear modulus").Shear = 0.0
        obj.addProperty("App::PropertyFloat", "Poisson", "Solid",
                        "Poisson's ratio").Poisson = 0.0
예제 #10
0
파일: MaterialSolid.py 프로젝트: FRidh/Sea
 def onChanged(self, obj, prop):
     Material.onChanged(self, obj, prop)
     
     if prop == 'Young':
         obj.Proxy.young = obj.Young
     elif prop == 'Shear':
         obj.Proxy.shear = obj.Shear
     elif prop == 'Poisson':
         obj.Proxy.poisson = obj.Poisson
예제 #11
0
    def onChanged(self, obj, prop):
        Material.onChanged(self, obj, prop)

        if prop == 'Young':
            obj.Proxy.young = obj.Young
        elif prop == 'Shear':
            obj.Proxy.shear = obj.Shear
        elif prop == 'Poisson':
            obj.Proxy.poisson = obj.Poisson
예제 #12
0
def fill_material_list(index, list):
    for i in range(len(list)):
        material_list[index].append(
            Material(list[i].get(), workstation_buffer_list[index],
                     material_type_list[index]))
        workstation_buffer_list[index].products.append(
            Material(list[i].get(), workstation_buffer_list[index],
                     material_type_list[index]))

    display_material()
예제 #13
0
 def _configure(self):
   """
   Setup members using inventory.
   """
   Material._configure(self)
   self.output = self.inventory.output
   from pylith.utils.NullComponent import NullComponent
   if not isinstance(self.inventory.dbInitialStress, NullComponent):
     self.dbInitialStress(self.inventory.dbInitialStress)
   if not isinstance(self.inventory.dbInitialStrain, NullComponent):
     self.dbInitialStrain(self.inventory.dbInitialStrain)
   return
예제 #14
0
 def _configure(self):
     """
 Setup members using inventory.
 """
     Material._configure(self)
     self.output = self.inventory.output
     from pylith.utils.NullComponent import NullComponent
     if not isinstance(self.inventory.dbInitialStress, NullComponent):
         self.dbInitialStress(self.inventory.dbInitialStress)
     if not isinstance(self.inventory.dbInitialStrain, NullComponent):
         self.dbInitialStrain(self.inventory.dbInitialStrain)
     return
예제 #15
0
    def __init__(self):
        self.__material = Material(None)
        self.__previousMaterial = Material(None)

        glEnable(GL_DEPTH_TEST)
        glEnable(GL_TEXTURE_2D)
        glEnable(GL_LIGHTING)
        glEnable(GL_LIGHT0)
        glEnable(GL_AUTO_NORMAL)
        glEnable(GL_NORMALIZE)
        glEnable(GL_CULL_FACE)

        glClearDepth(1.0)
예제 #16
0
def _check_default_material(self, name):
    test_material = Material()
    print("\nExpected:")
    print(test_material)
    print("\nGot:")
    print(getattr(world, name))
    assert getattr(world, name) == test_material
예제 #17
0
    def __init__(self,
                 fanout,
                 depth,
                 spread=default_spread,
                 rootColor=default_rootColor,
                 edgeColor=default_edgeColor,
                 scale=default_scale,
                 actor=None):
        Component.__init__(self, actor)
        self.fanout = fanout
        self.depth = depth
        self.spread = spread
        self.rootColor = rootColor
        self.edgeColor = edgeColor
        self.scale = scale
        self.rootScale = self.scale  # NOTE this will also apply to children
        #self.childScale = np.float32([1.0, 1.0, 1.0])  # NOTE this will get compounded if the radial tree is a true hierarchy, better to use scale = 1 (default)

        # Recursively generate radial tree
        treeRoot = self.createRadialTree(
            self.fanout, self.depth, self.spread,
            isRoot=True)  # creates full hierarchy and returns root actor
        treeRoot.components['Transform'] = Transform(
            rotation=np.random.uniform(-pi / 2, pi / 2, size=3),
            scale=self.rootScale,
            actor=treeRoot
        )  # NOTE random rotation ensures child vectors are not always generated close to the same canonical vectors
        treeRoot.components['Material'] = Material(color=self.rootColor,
                                                   actor=treeRoot)
        treeRoot.components['Mesh'] = Mesh.getMesh(src=self.treeRootModelFile,
                                                   actor=treeRoot)

        # Attach this hierarchy to current actor
        self.actor.children.append(treeRoot)
예제 #18
0
class Ground():
    def __init__(self, x, y):

        self.x = x
        self.y = y
        self.base_object = {}
        self.food_on_map = Food()
        self.material_on_map = Material()
        self.symbol = "X"

    def build_construction(self, building_class, fraction):  #budowanie
        """Buduje budynek, dodaje jego symbol i wartość do słownika i zwraca ten słownik."""

        self.building = building_class
        self.building.build(fraction)  #zbudowanie budynku
        self.building_dict = {}
        self.building = self.building.add_building(
            fraction)  #dodanie do słownika danych budynku
        return self.building

    def update_object_new(
            self):  #zaktualizowanie słownika na obszarze przy rysowaniu mapy
        """Metoda aktualizująca słownik pola o losowe wartości jedzenia i materiałów."""

        self.base_object.update(self.food_on_map.generate())
        self.base_object.update(self.material_on_map.generate())

    def update_object(
            self, obj):  #aktualizowanie oobszaru na mapie np. przy budowaniu
        """Metoda aktualizująca słownik o zadaną wartość."""

        self.base_object.update(obj)
예제 #19
0
    def __init__(self, primitive, vertices, indices):
        '''
        @param vertices: Arreglo numpy unidimensional con los datos de vertices, en el formato (X, Y, Z, NX, NY, NZ, TU, TV), todos
        de tipo numpy.float32. 
        @param indices: Arreglo numpy unidimencional con la informacion de indexacion de la geometria. 
        '''
        self.__material = Material(None)
        self.__vertices = vertices
        self.__indices = indices
        self.__primitive = primitive

        # inicializa el buffer de vertices
        size = vertices.size * 4

        bufferId = glGenBuffers(1)
        glBindBuffer(GL_ARRAY_BUFFER, bufferId)
        glBufferData(GL_ARRAY_BUFFER, vertices.size * 4, vertices,
                     GL_STATIC_DRAW)

        # inicializa el buffer de indices
        if indices is None:
            ibufferId = 0
        else:
            ibufferId = glGenBuffers(1)
            glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibufferId)
            glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size * 4, indices,
                         GL_STATIC_DRAW)

        self.__bufferId = bufferId
        self.__ibufferId = ibufferId
예제 #20
0
파일: ModelLoader.py 프로젝트: rosedu/hfall
 def saveMaterials(self):
     for m in self.parser.object.materials:
         self.saveTextures(m)
         material = Material(m.name)
         material.ambient = m.ambientColor + [0]
         material.diffuse = m.diffuseColor + [0]
         material.specular = m.specularColor + [0]
         if m.textureMap1:
             material.texture = self.textureMng.get(m.textureMap1.name)
         if m.bumpMap:
             material.bump = self.textureMng.get(m.bumpMap.name)
         material.init()
         self.materialMng.add(material)
예제 #21
0
def output_bgf(name, atoms):
    from Material import Material
    from vimmLib import save_file
    mat = Material(name)
    for atom in atoms:
        mat.add_atom(atom)
    mat.bonds_from_distance()
    save_file(name + '.bgf', mat)
    return
예제 #22
0
 def AddMaterial(self, PK, name, quantity, vendor, unitCost):
     """
     This will add a material to this Product's list of materials. If the material already exists,
     then its quantity will be added to the first material object.
     @param PK           The primary key (string) for the material in the database.
     @param name         A string representing the name of the material.
     @param quantity     An integer representing the amount of <some material> needed for a single one of this product.
                             The material's quantity will be static and won't be changed along with the Product's quantity!
     @param vendor       A string representing the name of the vendor that supplies this material.
     @param unitCost     The cost for a single one of this material. A float or integer is assumed.
     """
     material = self.GetMaterial(PK)
     if (material == None):
         self.materials.append(Material(PK, name, quantity, vendor, unitCost))
     else:
         material.quantity += quantity
예제 #23
0
 def __init__(self,
              D,
              t,
              Lgth=np.NaN,
              Kbuck=1.,
              mat=Material(name='ASTM992 steel')):
     self.D = D
     self.t = t
     self.L = Lgth * np.ones(
         np.size(D))  #this makes sure we exapnd Lght if D,t, arrays
     self.Kbuck = Kbuck * np.ones(
         np.size(D))  #this makes sure we exapnd Kbuck if D,t, arrays
     self.mat = mat
     if np.size(D) > 1 and type(
             mat
     ) != np.ndarray:  #in this case I need to make sure we have a list of materials
         import copy
         self.mat = np.array([copy.copy(mat) for i in xrange(np.size(D))])
예제 #24
0
def simple_loader(geo):
    from Material import Material
    from Atom import Atom
    from Utilities import path_split, cleansym
    from Element import sym2no, symbol
    from NumWrap import array
    material = Material("vimm")
    for sym, xyz in geo:
        sym = sym
        atno = sym2no[sym]
        xyz = array(xyz)
        material.add_atom(Atom(atno, xyz, sym, sym))
    material.bonds_from_distance()
    return material
예제 #25
0
def import_bd(filename, xmin=-1e10, xmax=1e10, center=0):
    with open(filename) as f:
        data = []
        for l in f:
            mo=re.match("\s*([\d\.e+-]+)\s+([\d\.e+-]+)\s+([\d\.e+-]+)\s+([\d\.e+-]+)\s+"\
                        "([\d\.e+-]+)\s+([\d\.e+-]+)\s+([\d\.e+-]+)\s+([\d\.e+-]+)\s+", l)
            if mo:
                x = float(mo.groups()[0])
                if (x >= xmin and x <= xmax):
                    data += [[float(a) for a in mo.groups()]]
                    data[-1][0] = (x - center) / 1e8
        data = np.array(data)
        #print data
        bd = {}
        bd["x"] = data[:, 0]
        bd["Ec"] = data[:, 1]
        bd["Ev"] = data[:, 2]
        bd["F"] = data[:, 3]
        bd["Ef"] = data[:, 4]
        bd["n"] = data[:, 5]
        bd["p"] = data[:, 6]
        bd["material"] = Material("GaN")
    return bd
예제 #26
0
파일: MaterialSolid.py 프로젝트: FRidh/Sea
    def execute(self, obj):
        Material.execute(self, obj)
 

####class MaterialSolid(Material):
    ####"""
    ####Solid material class
    ####"""

    ##### Elastic moduli
    ####_young = None
    ####_bulk = None
    ####_shear = None
    ####_poisson = None
    ####_isotropic = True     # Whether the material is isotropic or not.    

    #####_tensile_strength_break = None
    #####_tensile_strength_yield = None
    #####_tensile_strength_ultimate = None
    
    #####_tensile_elongation_break = None
    #####_tensile_elongation_yield = None
    #####_tensile_elongation_ultimate = None

    ####def _get_isotropic(self):
        ####"""
        ####Return whether the solid is isotropic or not.
        ####"""        
        #####if self._isotropic is not None:
        ####return self._isotropic
    
    ####def _set_isotropic(self, x):
        ####"""
        ####Set whether the solid is isotropic or not.
        
        ####:param x: is a boolean
        ####"""
        ####if type(x) is bool:   # Perhaps use a try here?
            ####self._isotropic = x

    ####isotropic = property(fget=_get_isotropic, fset=_set_isotropic)
    ####"""
    ####Isotropic material or not.
    ####"""
    
    ####def elastic_moduli_given(self):
        ####"""
        ####Returns the amount of elastic module that were specified.
        ####"""
        ####return (bool(self._young) + bool(self._bulk) + bool(self._shear) + bool(self._poisson))

    
    ####def _del_elastic_moduli(attr):
        ####def del_attr(self):
            ####setattr(self, attr, None)    # Check first whether it can actually be deleted? E.g. when it has not been set at all.
        ####return del_attr
    

    ####def _set_elastic_moduli(attr):
        ####def set_attr(self, x):
            ####if self.elastic_moduli_given() < 2: #and isinstance(x, float):
                ####setattr(self, attr, x)            
            ####else:
                ####warnings.warn('Two elastic moduli have already been set. Please delete one before adding a new one.')
        ####return set_attr
        
  
    ####def _get_elastic_moduli(attr):
        ####"""Retrieve the value of the elastic modulus. Check first whether the value is stored. If not, calculate it from two given moduli."""
        ####def get_attr(self):
            ####if getattr(self, attr) is not None:
                ####return getattr(self, attr) # then we should return it instead of trying to calculate it.
            
            ####elif self.isotropic and self.elastic_moduli_given() >= 2:          # But only when isotropic!!!
                ##### Calculate Bulk
                ####if bool(attr =='_bulk' and self._young and self._shear):
                    ####return (self.young * self.shear) / (9.0 * self.shear - 3.0 * self.young)
                ####elif bool(attr =='_bulk' and self._young and self._poisson):
                    ####return (self.young) / (3.0 - 6.0 * self.poisson)
                ####elif bool(attr =='_bulk' and self._shear and self._poisson):
                    ####return 2.0 * self.shear * (1.0 + self.poisson) / (3.0 - 6.0 * self.poisson)
                ##### Calculate Young
                ####elif bool(attr =='_young' and self._bulk and self._shear):
                    ####return 9.0 * self.bulk * self.shear / (3.0 * self.bulk + self.shear)
                ####elif bool(attr =='_young' and self._bulk and self._poisson):
                    ####return 3.0 * self.bulk * (1.0 - 2.0 * self.poisson)
                ####elif bool(attr =='_young' and self._shear and self._poisson):
                    ####return 2.0 * self.shear * (1.0 + self.poisson)                
                ##### Calculate Shear
                ####elif bool(attr =='_shear' and self._bulk and self._young):
                    ####return 3.0 * self.bulk * self.young / (9 * self.bulk - self.young)
                ####elif bool(attr =='_shear' and self._bulk and self._poisson):
                    ####return 3.0 * self.bulk * (1.0 - 2.0 * self.poisson) / (2.0 + 2.0 * self.poisson)
                ####elif bool(attr =='_shear' and self._young and self._poisson):
                    ####return self.young / (2.0 + 2.0 * self.poisson)
                ##### Calculate Poisson
                ####elif bool(attr =='_poisson' and self._bulk and self._young):
                    ####return ( 3.0 * self.bulk - self.young) / (6.0 * self.bulk)                 
                ####elif bool(attr =='_poisson' and self._bulk and self._shear):
                    ####return (3.0 * self.bulk - 2.0 * self.shear) / (6.0 * self.bulk + 2.0 * self.shear)
                ####elif bool(attr =='_poisson' and self._young and self._shear):
                    ####return (self.young) / (2.0*self.shear) - 1.0
                ####else:
                    ####ValueError
            ####else:
                ####warnings.warn('The modulus was not given for this material and could not be calculated either.')
                    
        ####return get_attr

    ####young = property(fget=_get_elastic_moduli('_young'), fset=_set_elastic_moduli('_young'), fdel=_del_elastic_moduli('_young'))         # Young's modulus, or Tensile modulus
    ####"""
    ####Young's modulus :math:`E`. 
    ####The value can be set or calculated when the material is isotropic and elastic_moduli_given equals two.
    ####"""
    
    ####bulk = property(fget=_get_elastic_moduli('_bulk'), fset=_set_elastic_moduli('_bulk'), fdel=_del_elastic_moduli('_bulk'))            # Bulk modulus
    ####"""
    ####Bulk modulus :math:`K`
    ####The value can be set or calculated when the material is isotropic and elastic_moduli_given equals two.
    ####"""
    
    ####shear = property(fget=_get_elastic_moduli('_shear'), fset=_set_elastic_moduli('_shear'), fdel=_del_elastic_moduli('_shear'))         # Shear modulus
    ####"""
    ####Shear modulus :math:`G`
    ####The value can be set or calculated when the material is isotropic and elastic_moduli_given equals two.
    ####"""
    
    ####poisson = property(fget=_get_elastic_moduli('_poisson'), fset=_set_elastic_moduli('_poisson'), fdel=_del_elastic_moduli('_poisson'))   # Poisson modulus
    ####"""
    ####Poisson ratio :math:`\\nu`
    ####The value can be set or calculated when the material is isotropic and elastic_moduli_given equals two.
    ####"""
        
예제 #27
0
 def __init__(self, name="elasticmaterial"):
     """
 Constructor.
 """
     Material.__init__(self, name)
     return
예제 #28
0
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 22 06:06:01 2017

@author: Loukit
"""

from Material import Material, ElasticMaterial
import numpy as np

m1 = ElasticMaterial('threed', 10e6, 0.2, 1e7)
elastic = np.zeros((6, 6))
m2.ElasticityMatrix(elastic)
print(elastic)

m1 = ElasticMaterial('threed', 10e6, 0.2, 1e7)
print(m1.sigY)

m2 = Material.newMaterial('elastic', 'threed')
m2.setElasticProperties(10e6, 0.2, 1e7)
예제 #29
0
def workbench(name,
              loading_cycles=None,
              copy=True,
              film_coefficient=0.0,
              sink_temperature=0.0,
              temperature_list=[],
              thermal_strain_list=[0.0, -0.0],
              heat_flux=0.0,
              film_coefficient_outer=0.0,
              film_coefficient_inner=0.0,
              emissivity=0.95,
              sink_temperature_inner=293.15,
              sink_temperature_outer=293.15,
              outer_temperature=293.15):
    """
    某试件对应的边界条件下的数值模拟。
    """
    experiment_log = ExperimentLog(ExperimentLogFile)
    experiment_log.output(name)
    regular = r'.*'
    load_type = experiment_log.obtainItem(name, 'load_type', regular)[0]
    regular = r'\d+\.?\d*'
    temperature_mode = experiment_log.obtainItem(name, 'temperature_mode',
                                                 regular)
    if temperature_list == []:
        if len(temperature_mode) == 1:
            temperature_list = [
                float(temperature_mode[0]),
                float(temperature_mode[0])
            ]
        if len(temperature_mode) == 2:
            temperature_list = [
                float(temperature_mode[0]),
                float(temperature_mode[1])
            ]
    d_out = float(experiment_log.obtainItem(name, 'd_out', regular)[0])
    gauge_length = float(
        experiment_log.obtainItem(name, 'gauge_length', regular)[0])
    axial_strain = float(
        experiment_log.obtainItem(name, 'axial_strain', regular)[0])
    angel_strain = float(
        experiment_log.obtainItem(name, 'angel_strain', regular)[0])
    equivalent_strain = float(
        experiment_log.obtainItem(name, 'equivalent_strain', regular)[0])
    period = float(experiment_log.obtainItem(name, 'period', regular)[0])
    axial_temperature_phase = float(
        experiment_log.obtainItem(name, 'axial_temperature_phase', regular)[0])
    life = float(experiment_log.obtainItem(name, 'comments', regular)[0])
    #==============================================================================
    # material
    #==============================================================================
    material = Material()
    material.setName(name='IN718')
    material.setTemperature(temperature=650.0)
    material.setMonotonic(youngs_modulus=167100.0,
                          poisson_ratio=0.2886,
                          yield_stress=1064.0)
    material.setCyclicAxial(sigma_f=1034.0,
                            b=-0.04486,
                            epsilon_f=0.11499,
                            c=-0.52436)
    material.setCyclicTorsion(tau_f=1034.0 / np.sqrt(3),
                              b0=-0.04486,
                              gamma_f=0.11499 * np.sqrt(3),
                              c0=-0.52436)
    predicted_life = material.calculateMansonCoffinLife(equivalent_strain /
                                                        100.0)
    #==============================================================================
    # experiment
    #==============================================================================
    exp_full_name = ExperimentDirectory + name + '.csv'
    if os.path.exists(exp_full_name):
        exp = ExperimentData(exp_full_name)
        experimental_life = exp.total_axial_count
    else:
        print('%s is not existed' % exp_full_name)
#==============================================================================
# load
#==============================================================================
    temperature_mean = (temperature_list[0] + temperature_list[1]) / 2.0
    temperature_min = min(temperature_list)
    temperature_max = max(temperature_list)
    load = Load(runing_time=[0],
                temperature=[temperature_mean],
                axial_strain=[0],
                shear_strain=[0],
                first_cycle_shift=1)
    axial_strain = axial_strain / 100.0
    shear_strain = np.deg2rad(angel_strain) * d_out / 2.0 / gauge_length
    if loading_cycles == None:
        loading_cycles = min(int(predicted_life / 4.0), 5000)
    use_exp_data = True
    thermal_strain_min = min(thermal_strain_list) / 100.0
    thermal_strain_max = max(thermal_strain_list) / 100.0
    #==============================================================================
    # Diamond path TMF IP
    #==============================================================================
    if load_type == 'cyclic diamond path' and axial_temperature_phase == 0.0:
        use_exp_data = False
        load.setLoadBiaxial(
            int(loading_cycles),
            [0, period / 4.0, period / 2.0, period / 4.0 * 3.0, period], [
                temperature_mean, temperature_max, temperature_mean,
                temperature_min, temperature_mean
            ], [0, axial_strain, 0, -1 * axial_strain, 0],
            [-1 * shear_strain, 0, shear_strain, 0, -1 * shear_strain])
#==============================================================================
# Proportional path TMF IP
#==============================================================================
    if load_type == 'cyclic proportional path' and axial_temperature_phase == 0.0:
        use_exp_data = False
        load.setLoadBiaxial(
            int(loading_cycles),
            [0, period / 4.0, period / 2.0, period / 4.0 * 3.0, period], [
                temperature_mean, temperature_max, temperature_mean,
                temperature_min, temperature_mean
            ], [0, axial_strain, 0, -1 * axial_strain, 0],
            [0, shear_strain, 0, -1 * shear_strain, 0])
#==============================================================================
# Uniaxial TMF IP
#==============================================================================
    if load_type == 'cyclic tension compression' and axial_temperature_phase == 0.0:
        use_exp_data = False
        load.setLoadBiaxial(
            int(loading_cycles),
            [0, period / 4.0, period / 2.0, period / 4.0 * 3.0, period], [
                temperature_mean, temperature_max, temperature_mean,
                temperature_min, temperature_mean
            ], [0, axial_strain * 1, 0, -1 * axial_strain * 1, 0],
            [0, shear_strain, 0, -1 * shear_strain, 0])
#==============================================================================
# Uniaxial TMF OP
#==============================================================================
    if load_type == 'cyclic tension compression' and axial_temperature_phase == 180.0:
        use_exp_data = False
        load.setLoadBiaxial(
            int(loading_cycles),
            [0, period / 4.0, period / 2.0, period / 4.0 * 3.0, period], [
                temperature_mean, temperature_min, temperature_mean,
                temperature_max, temperature_mean
            ], [0, axial_strain, 0, -1 * axial_strain, 0],
            [0, shear_strain, 0, -1 * shear_strain, 0])
#==============================================================================
# Uniaxial TMF 90
#==============================================================================
    if load_type == 'cyclic tension compression' and axial_temperature_phase == 90.0:
        use_exp_data = False
        load.setLoadBiaxial(
            int(loading_cycles),
            [0, period / 4.0, period / 2.0, period / 4.0 * 3.0, period], [
                temperature_min, temperature_mean, temperature_max,
                temperature_mean, temperature_min
            ], [0, axial_strain, 0, -1 * axial_strain, 0],
            [0, shear_strain, 0, -1 * shear_strain, 0])
#==============================================================================
# load from experiment data
#==============================================================================
    if use_exp_data:
        if loading_cycles == None:
            load.setLoadFromExperiment(exp, runing_time=None)
        else:
            load.setLoadFromExperiment(exp,
                                       runing_time=period * loading_cycles)


#==============================================================================
# load of convection
#==============================================================================
    load.setConvection(film_coefficient, sink_temperature)
    #==============================================================================
    # load of thermal
    #==============================================================================
    load.setThermal(heat_flux, film_coefficient_outer, film_coefficient_inner,
                    emissivity, sink_temperature_inner, sink_temperature_outer,
                    outer_temperature)
    #==============================================================================
    # Step
    #==============================================================================
    #    step = Step(predefined_temperature = int(exp.initial_temperature),
    #              time_period = int(load.total_runing_time), initial_inc = 0.005,
    #              min_inc = 0.0001, max_inc = 5, nonlinear = 'ON')
    step = Step(predefined_temperature=temperature_mean,
                time_period=int(load.total_runing_time),
                initial_inc=0.00001,
                min_inc=0.00000001,
                max_inc=period / 40.0,
                nonlinear='OFF')
    #==============================================================================
    # UMAT
    #==============================================================================
    #    umat = UMAT(UMATDirectory = 'F:\\GitHub\\umat\\',
    #                UMATMainFile = 'MAIN_IN718.for',
    #                ParameterFortranFile = 'PARAMETERS_IN718_TMF.for',
    #                OutputFortranFile = 'OUTPUT.for',
    #                OutputTextFile = name + '_output.txt')

    umat = UMAT(UMATDirectory='F:\\GitHub\\umat\\',
                UMATMainFile='MAIN_IN718.for',
                ParameterFortranFile='PARAMETERS_SS304.for',
                OutputFortranFile='OUTPUT.for',
                OutputTextFile=name + '_output.txt')

    #    umat = UMAT(UMATDirectory = 'F:\\UMAT\\Fangjie\\',
    #                UMATMainFile = 'AO304Tanakav6VariDamageMyisokin3.for',
    #                ParameterFortranFile = 'PARAMETERS_SS304.for',
    #                OutputFortranFile = 'OUTPUT.for',
    #                OutputTextFile = name + '_output.txt')

    #    umat = UMAT(UMATDirectory = 'F:\\UMAT\\SS304\\',
    #                UMATMainFile = 'MAIN_SS304.for',
    #                ParameterFortranFile = 'PARAMETERS_SS304.for',
    #                OutputFortranFile = 'OUTPUT.for',
    #                OutputTextFile = name + '_output.txt')
    #==============================================================================
    # Job
    #==============================================================================
    job = Job(JobName=name, UMAT=umat, Step=step, Load=load, copy=copy)

    #    job.allProc()
    job.createDirectory()
    job.copyFiles()
    job.creatBatchFile()
    job.createAbaqusCAE()
    job.createAbaqusInput()
    job.run()
    job.autoPostProc()
예제 #30
0
    spacegroup = 'all'
    machinelearning = 'FOREST'
    
    groups = {'triclinic':[1,2], 'monoclinic':[3,15], 'orthorhombic':[16,74], 'tetragonal':[75,142],\
              'trigonal':[143,167], 'hexagonal':[168,194], 'cubic':[195,230], 'all':[0,230]}

    limits = groups[spacegroup]
    File   = open(dataFile, "r")
    data   = json.load(File)
    materials = []

    data = shuffle(data)
    # adding materials that are in the spacegroup to a list
    for elem in range(len(data)):
        curr = data[elem]
        material = Material(curr['formula'])
        material.getSpacegroup(curr)
        if limits[0]<material.spacegroup and limits[1]>material.spacegroup:
            material.separateElements()
            material.setData(curr)
            material.setValence()
            material.setAverages()
            materials.append(material)

    # shuffle, split, and scale the data
    size_70p = int(np.floor(len(materials)*0.7))                      # gets index at 70% of material vector length
    size_90p = int(np.floor(len(materials)*0.9))                      # gets index at 90% of material vector length

    # split material vector into train, test, and validate vectors
    train = Set(materials[0:size_70p])
    test  = Set(materials[size_70p+1:size_90p])
예제 #31
0
파일: Import.py 프로젝트: jmanek/pySG
	def obj(fp):
		
		node = Node()
		node.mesh = Mesh()
		with open(fp) as f:
			material = None
			for line in f:
				line = line.strip().split(' ', 1)
				if len(line) == 1: continue
				key, line = line[0], line[1].lstrip()
				if '#' in key: continue
				if 'vn' in key:
					line = line.split(' ')
					node.mesh.addNormal(line[0], line[1], line[2])
				elif 'vt' in key:
					line = line.split(' ')
					node.mesh.addTexCoord(line[0], line[1])
				elif 'usemtl' in key:
					material = None
					for mat in node.materials:
						if line == mat.name:
							material = mat
					if material is None:
						material = Material()
						material.name = line
						node.materials[material] = set()

				elif 'f' in key:
					line = line.split(' ')
					face = Face()
					if material is not None: node.materials[material].add(face)
					# f v//vn 
					if '//' in line[0]:
						line = [int(i) for l in line for i in l.split('//')]
						face.vA = line[0]
						face.vB = line[2]
						face.vC = line[4]
						face.vnA = line[1]
						face.vnB = line[3]
						face.vnC = line[5]
					# f v/vt
					elif line[0].count('/') == 1:
						line = [int(i) for l in line for i in l.split('/')]
						face.vA = line[0]
						face.vB = line[2]
						face.vC = line[4]
						face.vtA = line[1]
						face.vtB = line[3]
						face.vtC = line[5]
					# f v/vt/vn
					elif line[0].count('/') == 2:
						line = [int(i) for l in line for i in l.split('/')]
						face.vA = line[0]
						face.vB = line[3]
						face.vC = line[6]
						face.vtA = line[1]
						face.vtB = line[4]
						face.vtC = line[7]
						face.vnA = line[2]
						face.vnB = line[5]
						face.vnC = line[8]
					# f v
					else:
						face.vA = int(line[0])
						face.vB = int(line[1])
						face.vC = int(line[2])	

					node.mesh.faces.append(face)
				elif 'v' in key:
					line = line.split(' ')
					node.mesh.addVertex(line[0], line[1], line[2])


		if os.path.isfile(fp.replace('.obj', '.mtl')):
			with open(fp.replace('.obj', '.mtl')) as f:
				material = None
				for line in f:
					line = line.strip().split(' ', 1)
					if len(line) == 1: continue
					key, line = line[0], line[1].lstrip()
					if '#' in key: continue
					if 'newmtl' in key:
						for mat in node.materials:
							if mat.name == line: material = mat
					if 'map_Kd' in key:
						material.diffuseMap = line
					elif 'map_Ka' in key:
						material.ambientMap = line
					elif 'Ka' in key:
						line = line.split(' ')
						material.ambient = Color(line[0], line[1], line[2])
					elif 'Kd' in key:
						line = line.split(' ')
						material.diffuse = Color(line[0], line[1], line[2])
		return node
예제 #32
0
lightDirection = Vector(0, -1, 0)
lightColor = Vector(255, 255, 255)

light = DirectionalLight(lightColor, 1, lightDirection)
light2 = DirectionalLight(Vector(0, 0, 255), 1, Vector(1, 0, 0))
light3 = PointLight(Vector(255, 247, 222), .3, Point3D(.2, .2, .5))

sphereCenter = Point3D(0,0,-.2)
sphereRadius = .5
sphereMaterialColor = Vector(255, 255, 255)
sphere2MaterialColor = Vector(0,255,255)
sphereMaterialSpecularColor = Vector(0, 255, 255)
sphereMaterialSpecularStrength = .5

sphereMaterial = Material(
    sphere2MaterialColor, sphereMaterialSpecularColor, sphereMaterialSpecularStrength,.0)

sphereMaterial2 = Material(
    Vector(64, 64, 64), sphereMaterialSpecularColor, sphereMaterialSpecularStrength, .5)

#sphereMaterial3 = Material(
    #Vector(0, 255, 0), sphereMaterialSpecularColor, sphereMaterialSpecularStrength, 0)

sphere = Sphere(sphereMaterial2, sphereCenter, sphereRadius)
#sphere2 = Sphere(sphereMaterial, Point3D(.2, .2, .5), .1)
#sphere3 = Sphere(sphereMaterial2, Point3D(-.2, -.1, .5), .1)
#sphere4 = Sphere(sphereMaterial3, Point3D(0, -.1, .5), .1)

lights = [light, light3]
objects = [sphere]
#objects = [sphere, sphere2, sphere3, sphere4]
예제 #33
0
    def __init__(self, mat_name,
                acceptor_name, Na, p_len,
                i_len, sigma,
                donor_name, Nd, n_len,
                Va, sigma_name="Si"):
        
        # The Material class will find the bulk energy levels
        mp=Material(mat_name,{acceptor_name: Na})
        mn=Material(mat_name,{donor_name: Nd})
        
        # Band edges far on the p and n side
        Ecp=mp.Ec-mp.mu_bulk-Va/2
        Evp=mp.Ev-mp.mu_bulk-Va/2
        Ecn=mn.Ec-mn.mu_bulk+Va/2
        Evn=mn.Ev-mn.mu_bulk+Va/2    
        
        Vr=-Va
        
        Edsigma=materialparameters[mat_name]["dopants"][sigma_name]["E"]
        
        
        #minfield=000 #V/cm
        def Fp(dEFIp):
            intrhodEFI=-mp.intrho(EFn=mn.mu_bulk-(Ecp-Ecn)-dEFIp,EFp=mp.mu_bulk-dEFIp)
#            print (intrhodEFI,mn.mu_bulk-(Ecp-Ecn)-dEFIp,mp.mu_bulk-dEFIp)
            intrhodEFI=intrhodEFI*(intrhodEFI>0)
            
            #if np.all(np.abs(np.sqrt((2/mn.eps)*intrhodEFI))<minfield): return 0*dEFIp
            #return np.sign(mp.rho(mp.mu_bulk-dEFIp))*np.sqrt((2/mp.eps)*intrhodEFI)
            return np.sign(dEFIp)*np.sqrt((2/mp.eps)*intrhodEFI)
        def Fn(dEFIn,x=0):
            intrhodEFI=-mn.intrho(EFn=mn.mu_bulk-dEFIn,EFp=mp.mu_bulk+(Ecp-Ecn)-dEFIn)
            intrhodEFI=intrhodEFI*(intrhodEFI>0)
            
            #if np.all(np.abs(np.sqrt((2/mn.eps)*intrhodEFI))<minfield): return 0*dEFIn
            #return -np.sign(mn.rho(mn.mu_bulk-dEFIn))*np.sqrt((2/mn.eps)*intrhodEFI)
            #print(x,"    ",dEFIn,"    ",-np.sign(dEFIn)*np.sqrt((2/mn.eps)*intrhodEFI))
            return -np.sign(dEFIn)*np.sqrt((2/mn.eps)*intrhodEFI)
        
        def FDiff(dEFIp):
            fp=Fp(dEFIp)
            dEFIn=dEFIp+fp*i_len+Ecp-Ecn
            fn=Fn(dEFIn)
#            sigma_eff=sigma*(1/(1+2*np.exp((mn.mu_bulk-dEFIn-mn.Ec+Edsigma)/kT)))
#            print ("srat",1/(1+2*np.exp((mn.mu_bulk-dEFIn-mn.Ec+Edsigma)/kT)))
            dF=q*sigma/mn.eps
#            dF=q*sigma_eff/mn.eps
#            print("dF: ",dF/1e6)
            return np.abs(fn-fp-dF)
            
        dEFIp_bracket=[-(Ecp-Ecn),-Nd/(Nd+Na)*(Ecp-Ecn)]
        res=sciopt.minimize_scalar(FDiff,bracket=dEFIp_bracket)
        dEFIp=res.x
        fp=Fp(dEFIp)
        dEFIn=dEFIp+fp*i_len+Ecp-Ecn
        fn=Fn(dEFIn)
        
        print("dEFIp: ",dEFIp)
        print("dEFIn: ",dEFIn)
        print ("Fn: ",fn/1e6," MV/cm")
        print ("Fp: ",fp/1e6," MV/cm")
        
        
        from scipy.integrate import odeint
        
        # x-grid for calculation
        nr=1000
        ni=500
        nl=1000
        xr=np.concatenate([[0],np.logspace(-10,np.log10(n_len),nr)])
        xi=np.linspace(0,-i_len,ni) if i_len else np.array([0])
        xl=np.concatenate([xi,-np.logspace(-10,np.log10(p_len),nl)-i_len])
        x=np.concatenate([xl[::-1],xr[1:]])        
        
        Ecr=Ecn+np.ravel(odeint(\
            lambda E,x: Fn(E,x),\
            dEFIn,xr,rtol=1e-10,atol=1e-8))
        print('int\'d r')
        
        
#        something,fo=odeint(\
#            lambda E,x: Fn(E,x),\
#            dEFIn,xr,rtol=1e-10,atol=1e-8,hmax=1e-7,full_output=1)#,printmessg=1)
#        Ecr=Ecn+np.ravel(something)
#        print('int r')
#        print(fo)
        
        
        FpdEFIp=Fp(dEFIp)
        Ecl=Ecp+np.ravel(odeint(\
            lambda E,x: np.choose(x<-i_len,[FpdEFIp+0*x,Fp(E)]),\
            dEFIp+i_len*fp,xl,rtol=1e-10,atol=1e-8,hmax=1e-7))
        print('int\'d l')
        
        rhor=mn.rho(EFn=-(Ecr-Ecn-mn.mu_bulk),EFp=-(Ecr-Ecn-mp.mu_bulk-(Ecp-Ecn))) ;  print("cheating rhor EFp near junction")
        rhol=np.choose(xl<-i_len,[[0]*len(xl),mp.rho(EFn=-(Ecl-Ecp-mn.mu_bulk+(Ecp-Ecn)),EFp=-(Ecl-Ecp-mp.mu_bulk))]); print("cheating rhol EFn far from junction")
        #rhol=np.choose(xl<-i_len,[[0]*len(xl),mp.rho(EFn=-(Ecl-Ecp-mp.mu_bulk),EFp=-(Ecl-Ecp-mp.mu_bulk))]); print("cheating BAD rhol EFn")
        Fr=Fn(Ecr-Ecn)
        Fl=np.choose(xl<-i_len,[(Fp(dEFIp))+0*xl,Fp(Ecl-Ecp)])
        Ec=np.concatenate([Ecl[:0:-1],Ecr])
        mu=(x<0)*(Vr/2)+(x>0)*(-Vr/2)+np.choose(x==0,[0,np.nan])
        rho=np.concatenate([rhol[:0:-1],[np.nan],rhor[1:]])
        with warnings.catch_warnings():
            warnings.simplefilter("ignore",RuntimeWarning)
            rho=rho*(abs(rho)/q>1e11)
        F=np.concatenate([Fl[:0:-1],[(Fl[0]+Fr[0])/2],Fr[1:]])
        Ev=Ec-mn.Eg
        
        self.x=x+i_len/2
        self.Ec=np.ravel(Ec)
        self.Ev=np.ravel(Ev)
        self.mu=mu
        self.F=F
        self.rho=rho
        self.Vr=Vr
        self.mp=mp
        self.mn=mn
예제 #34
0
 def __init__(self, obj, system):
     Material.__init__(self, obj, system)
예제 #35
0
파일: Main.py 프로젝트: JkbLskw/CG
def main():
    e = Point(-3, 5.75, 3)
    c = Point(-2.25, 6, 1)
    up = Vector(0, 1, 0)
    fov = 45

    aspectRatio = WIDTH / HEIGHT

    light = Light(Point(30, 30, 10), Color((1, 0.85, 0.85)))

    white = Color((1, 1, 1))
    dark = Color((0.2, 0.2, 0.2))
    black = Color((0.1, 0.1, 0.1))
    dark_black = Color((0, 0, 0))
    gold = Color((0.831372, 0.686274, 0.215686))
    red = Color((1, 0, 0))
    green = Color((0, 1, 0))
    blue = Color((0, 0, 1))
    yellow = Color((1, 1, 0))
    gray = Color((0.5, 0.5, 0.5))
    checkerBoard = CheckerBoardMaterial()

    backgroundColor = dark_black
    environmentColor = Color((0.5, 0.5, 0.5))

    sphere1 = Spehre(
        Point(3, 2, -10), 2,
        Material(white, gloss=0.05, specularComp=0.25, diffusComp=0.75))
    sphere2 = Spehre(Point(0, 5, -10), 2, Material(black, gloss=0.3))
    sphere3 = Spehre(
        Point(-3, 8, -10), 2,
        Material(white, gloss=0.05, specularComp=0.25, diffusComp=0.75))

    sphere4 = Spehre(
        Point(-3, 2, -10), 2,
        Material(white, gloss=0.05, specularComp=0.25, diffusComp=0.75))
    sphere5 = Spehre(
        Point(3, 8, -10), 2,
        Material(white, gloss=0.05, specularComp=0.25, diffusComp=0.75))

    triangle01 = Triangle(
        Point(0, 7, -10), Point(5, 7, -10), Point(2.5, 13.5, -15),
        Material(gold, gloss=0.15, specularComp=0.25, diffusComp=0.75))
    triangle02 = Triangle(
        Point(0, 7, -20), Point(0, 7, -10), Point(2.5, 13.5, -15),
        Material(gold, gloss=0.15, specularComp=0.25, diffusComp=0.75))
    triangle03 = Triangle(
        Point(5, 7, -10), Point(5, 7, -20), Point(2.5, 13.5, -15),
        Material(gold, gloss=0.15, specularComp=0.25, diffusComp=0.75))
    triangle04 = Triangle(
        Point(0, 7, -20), Point(5, 7, -20), Point(2.5, 13.5, -15),
        Material(gold, gloss=0.15, specularComp=0.25, diffusComp=0.75))
    triangle11 = Triangle(
        Point(0, 7, -10), Point(5, 7, -10), Point(2.5, 0.5, -15),
        Material(gold, gloss=0.15, specularComp=0.25, diffusComp=0.75))
    triangle12 = Triangle(
        Point(0, 7, -20), Point(0, 7, -10), Point(2.5, 0.5, -15),
        Material(gold, gloss=0.15, specularComp=0.25, diffusComp=0.75))
    triangle13 = Triangle(
        Point(5, 7, -10), Point(5, 7, -20), Point(2.5, 0.5, -15),
        Material(gold, gloss=0.15, specularComp=0.25, diffusComp=0.75))
    triangle14 = Triangle(
        Point(0, 7, -20), Point(5, 7, -20), Point(2.5, 0.5, -15),
        Material(gold, gloss=0.15, specularComp=0.25, diffusComp=0.75))

    plane = Plane(Point(0, 0, 0), Vector(0, 1, 0),
                  Material(checkerBoard, gloss=0.15))

    objectList = [
        triangle01, triangle02, triangle03, triangle04, triangle11, triangle12,
        triangle13, triangle14, plane
    ]

    cams = []
    cam = Camera(e, c, up, WIDTH, HEIGHT, aspectRatio, backgroundColor,
                 objectList, image, light, fov, environmentColor)
    cams.append(cam)

    pool = mp.Pool(processes=4)
    results = pool.map(render, cams)

    results[0].show()
    results[0].save('temp.png', 'png')
예제 #36
0
    self.far = 50
    self.transform.position = V3(0., 0, -1.)
    self.speed = V3.zero()
    self.LookAt = V3.zero()


presenter = Presenter(400, 300)
presenter.bind(scene)

scene.loadtexture(0, 't4puc-rio.jpeg')
scene.createLight(V4(5., 5., 0., 1.), V4(0.7, 0.7, 0.5, 1.0),
                  V4(0.5, 0.5, 0.5, 1.0))

plane = scene.createPlane()
plane.transform.position = V3(0, 0, 0)
#plane.material = Material(1,1,1)
plane.textures = [0, 0]
plane.material = Material(1, 0.0, 0.0)
plane.i = 0.2


def updatep(self, dt):
    self.faces[0][2] = [0, math.sin(self.i), 0]
    self.i += 0.2


plane.update = types.MethodType(updatep, plane)
scene.camera.start = types.MethodType(startCam, scene.camera)

presenter.show()
예제 #37
0
파일: MaterialSolid.py 프로젝트: FRidh/Sea
    def __init__(self, obj, system):
        Material.__init__(self, obj, system)

        obj.addProperty("App::PropertyFloat", "Young", "Solid", "Young's modulus").Young=0.0
        obj.addProperty("App::PropertyFloat", "Shear", "Solid", "Shear modulus").Shear=0.0
        obj.addProperty("App::PropertyFloat", "Poisson", "Solid", "Poisson's ratio").Poisson=0.0
예제 #38
0
 def __init__(self, name="elasticmaterial"):
   """
   Constructor.
   """
   Material.__init__(self, name)
   return
예제 #39
0
파일: __init__.py 프로젝트: xcrx/machining
 def show_material(self):
     material = Material(self)
     material.show()
     screen_center = self.geometry().center()
     widget_center = material.rect().center()
     material.move(screen_center-widget_center)
예제 #40
0
def Vn_vs_VA_curve(NA, ND, sigma, Va):
    pside = Material("GaN", {"Mg": NA})
    Nv = pside.Nv
    EA = pside.dopants.values()[0]['E']
    EVp = pside.Ev - pside.mu_bulk
    NAp = NA * np.log(1 + 4 * np.exp((EVp + EA) / kT))
    Gp = G12(EVp / kT)

    nside = Material("GaN", {"Si": ND})
    Nc = nside.Nc
    ED = nside.dopants.values()[0]['E']
    ECn = nside.Ec - nside.mu_bulk
    NDp = ND * np.log(1 + .5 * np.exp((ECn - ED) / kT))
    Gn = G12(-ECn / kT)

    eps = nside.eps
    Vbi = nside.mu_bulk - pside.mu_bulk

    Sigma = np.sqrt(q * sigma**2 / (2 * eps * kT * NA))

    Vsigma = Vbi - Sigma**2 * kT + (Nc / NA * kT * Gn - NAp / NA * kT -
                                    Nv / NA * Gp * kT)
    print "Vsigma: ", Vsigma

    def Fn_of_Vn(Vn):
        return np.sqrt(2*q*kT*Nc/eps)*\
            np.sqrt(G12((Vn-ECn)/kT)-Gn-NDp/Nc)

    def Fp_of_Vn(Vn, Va):
        Vp = Vn + Vbi - Va
        return -np.sqrt(2*q*kT*Nc/eps)*\
            np.sqrt(NA/Nc*Vp/kT+G12((Vn-ECn)/kT)-NAp/Nc-Nc/Nc*Gp)

    def Vn_of_Va(Vai):
        print ""
        print "VA: ", Vai
        g = SpikedPINJunction("GaN", "Mg", NA, .1e-4, 0 * .005e-4, sigma, "Si",
                              ND, .2e-4, Vai)
        #    g.plot_all()
        Vni = g.Ec[-1] - np.min(g.Ec)
        print "Predicted Fn: " + str(Fn_of_Vn(Vni) / 1e6)
        print "Predicted Fp: " + str(Fp_of_Vn(Vni, Vai) / 1e6)

        if Vni < .3 * kT:
            return np.nan
        return Vni

    Vn = np.vectorize(Vn_of_Va, otypes=['float64'])(Va)

    ind = np.argmin(np.abs(Va))
    alpha_exp, Vn0 = linregress(Va[ind - 2:ind + 3], Vn[ind - 2:ind + 3])[0:2]
    alpha = 1 / ((2 / (np.pi)**.25 * Sigma * np.sqrt(Nc / NA) *
                  ((Vn0 - ECn) / kT)**.25) - 1)

    mpl.figure()
    mpl.plot(Va, Vn, '.')

    LHS = 4 * Nc / NA * Sigma**2 * (G12((Vn - ECn) / kT) - Gn - NDp / Nc)
    RHS = ((Vn + Vsigma - Va) / kT + NDp / NA)**2
    #print "LHS ", LHS
    #print "RHS ", RHS
    print "LHS RHS Error: ", (LHS - RHS) / RHS

    S = (32 / (15 * np.sqrt(np.pi)) * (Nc / NA) * Sigma**2)**.4
    DV = Va - Vsigma - NDp / NA * kT

    Vnpre = kT * ((1 / S) * (DV / kT)**.8 + ECn / kT) / (1 + (4 / (5 * S) *
                                                              (kT / DV)**.2))

    return Vn, Vnpre, Vsigma
예제 #41
0
파일: Bolsista.py 프로젝트: SigmaTrab/sigma
 def postar_material(self, nome, conteudo, disciplina):
     um_material = Material(nome, conteudo, self.nome)
     disciplina.incluir_material(um_material)
     return disciplina