Ejemplo n.º 1
0
def GetMagnMaterCompMvsH(MeshH, ind, cmpnH, cmpnM):
    #Extracting Magnetization vs Field Strength magnetic material data
    hMin = MeshH[0]
    hMax = MeshH[1]
    nh = MeshH[2]
    hStep = (hMax - hMin) / (nh - 1)
    #M = [0]*nh
    #sCmpnM = 'm' + cmpnM
    #h = hMin
    #H = [0,0,0]
    #for i in range(nh):
    #    if(cmpnH == 'x'): H[0] = h
    #    elif(cmpnH == 'y'): H[1] = h
    #    elif(cmpnH == 'z'): H[2] = h
    #    M[i] = rad.MatMvsH(ind, sCmpnM, H)
    #    h += hStep
    #A more compact way:
    if (cmpnH == 'x'):
        M = [
            rad.MatMvsH(ind, 'm' + cmpnM, [hMin + i * hStep, 0, 0])
            for i in range(nh)
        ]
    elif (cmpnH == 'y'):
        M = [
            rad.MatMvsH(ind, 'm' + cmpnM, [0, hMin + i * hStep, 0])
            for i in range(nh)
        ]
    elif (cmpnH == 'z'):
        M = [
            rad.MatMvsH(ind, 'm' + cmpnM, [0, 0, hMin + i * hStep])
            for i in range(nh)
        ]
    else:
        M = None
    return M
Ejemplo n.º 2
0
def GetMagnMaterCompMvsH(MeshH, ind, cmpnH, cmpnM):
    #Extracting Magnetization vs Field Strength magnetic material data
    hMin = MeshH[0]
    hMax = MeshH[1]
    nh = MeshH[2]
    hStep = (hMax - hMin) / (nh - 1)
    M = [0] * nh
    sCmpnM = 'm' + cmpnM
    h = hMin
    H = [0, 0, 0]
    for i in range(nh):
        if (cmpnH == 'x'): H[0] = h
        elif (cmpnH == 'y'): H[1] = h
        elif (cmpnH == 'z'): H[2] = h
        M[i] = rad.MatMvsH(ind, sCmpnM, H)
        h += hStep
    return M
Ejemplo n.º 3
0
#rad.ObjDrwOpenGL(mag01)

trf01 = rad.TrfPlSym([0,10,0], [0,1,0])
trf02 = rad.TrfRot([0,10,0], [0,0,1], 1.)
trf03 = rad.TrfTrsl([30,10,0])
trf04 = rad.TrfInv()
trf05 = rad.TrfCmbL(trf01, trf04)
trf06 = rad.TrfCmbR(trf01, trf04)

#rad.TrfMlt(mag01, trf03, 3)
rad.TrfOrnt(mag01, trf06)

#rad.ObjDrwOpenGL(mag01)

matNdFeB = rad.MatStd('NdFeB')
M = rad.MatMvsH(matNdFeB, 'M', [0,0,0])
print('NdFeB material index:', matNdFeB, ' Magnetization:', M)

matLin01 = rad.MatLin([0.1,0.2],1.1)
matLin02 = rad.MatLin([0.1,0.2],[0,0,1.1])
print('Linear material indexes:', matLin01, matLin02)

dmp = rad.UtiDmp([mag01, trf02], 'bin')
#print(dmp)

elemsRest = rad.UtiDmpPrs(dmp)
print('Indexes of restored elements:', elemsRest)
#rad.ObjDrwOpenGL(elemsRest[0])

print(rad.UtiDmp(elemsRest[0], 'asc'))
print(rad.UtiDmp(elemsRest[1], 'asc'))