예제 #1
0
파일: hw3.py 프로젝트: geogunow/22.213
widths = [30.0, 170.0, 20.0, 170.0, 30.0]
nodes = [30, 170, 20, 170, 30]
N = sum(nodes)

# form all mesh
mesh = []
for i in range(2):
    temp = rk.Mesh()
    temp.setMesh(nodes)
    temp.setWidths(widths)
    temp.setMaterials(mats[i])
    temp.setBoundaryConditions(2,2)
    mesh.append(temp)

# calculate static rod worth
sol1 = rk.solveCritical(mesh[1], 10**-6, 10**-6, 10**6, 2)
sol2 = rk.solveCritical(mesh[0], 10**-6, 10**-6, 10**6, 2)

print "Rod worth part B = ", (sol2.keff/sol1.keff - 1)/beta

# set transient
trans = rk.Transient()
trans_t = [0, 2, 4, 10, 12, 50]
trans_m = [1, 1, 0, 0, 1, 1]
trans.setInterpTimes(trans_t)
meshVector = []
for i in xrange(len(trans_t)):
    meshVector.append(mesh[ trans_m[i] ])
trans.setMeshVector(meshVector)

'''
예제 #2
0
파일: hw4.py 프로젝트: archphy/22.213
trans.setInterpTimes(trans_t)
meshVector = []
for i in xrange(len(trans_t)):
    meshVector.append(mesh[ trans_m[i] ])
trans.setMeshVector(meshVector)

t = np.linspace(0,50,5001)
trans.setCalcTimes(t)

'''
Problem A
'''
mesh_out = mesh[0]
mesh_in = mesh[1]

ans_out = rk.solveCritical(mesh_out, 10**-8, 10**-8, 1000, 2)
ans_in = rk.solveCritical(mesh_in, 10**-8, 10**-8, 1000, 2)

# plot results
x = mesh_out.getX()
plt.plot(x, ans_out.getFlux(1),'bx-')
plt.plot(x, ans_out.getFlux(2),'gx-')
plt.xlabel('Distance (cm)')
plt.ylabel('Normalized Flux')
plt.show()

x = mesh_in.getX()
plt.plot(x, ans_in.getFlux(1),'bx-')
plt.plot(x, ans_in.getFlux(2),'gx-')
plt.xlabel('Distance (cm)')
plt.ylabel('Normalized Flux')
예제 #3
0
파일: hw3.py 프로젝트: archphy/22.213
widths = [30.0, 170.0, 20.0, 170.0, 30.0]
nodes = [30, 170, 20, 170, 30]
N = sum(nodes)

# form all mesh
mesh = []
for i in range(2):
    temp = rk.Mesh()
    temp.setMesh(nodes)
    temp.setWidths(widths)
    temp.setMaterials(mats[i])
    temp.setBoundaryConditions(2, 2)
    mesh.append(temp)

# calculate static rod worth
sol1 = rk.solveCritical(mesh[1], 10 ** -6, 10 ** -6, 10 ** 6, 2)
sol2 = rk.solveCritical(mesh[0], 10 ** -6, 10 ** -6, 10 ** 6, 2)

print "Rod worth part B = ", (sol2.keff / sol1.keff - 1) / beta

# set transient
trans = rk.Transient()
trans_t = [0, 2, 4, 10, 12, 50]
trans_m = [1, 1, 0, 0, 1, 1]
trans.setInterpTimes(trans_t)
meshVector = []
for i in xrange(len(trans_t)):
    meshVector.append(mesh[trans_m[i]])
trans.setMeshVector(meshVector)

"""
예제 #4
0
파일: hw4.py 프로젝트: geogunow/22.213
trans_m = [1, 1, 0, 0, 1, 1]
trans.setInterpTimes(trans_t)
meshVector = []
for i in xrange(len(trans_t)):
    meshVector.append(mesh[trans_m[i]])
trans.setMeshVector(meshVector)

t = np.linspace(0, 50, 5001)
trans.setCalcTimes(t)
'''
Problem A
'''
mesh_out = mesh[0]
mesh_in = mesh[1]

ans_out = rk.solveCritical(mesh_out, 10**-8, 10**-8, 1000, 2)
ans_in = rk.solveCritical(mesh_in, 10**-8, 10**-8, 1000, 2)

# plot results
x = mesh_out.getX()
plt.plot(x, ans_out.getFlux(1), 'bx-')
plt.plot(x, ans_out.getFlux(2), 'gx-')
plt.xlabel('Distance (cm)')
plt.ylabel('Normalized Flux')
plt.show()

x = mesh_in.getX()
plt.plot(x, ans_in.getFlux(1), 'bx-')
plt.plot(x, ans_in.getFlux(2), 'gx-')
plt.xlabel('Distance (cm)')
plt.ylabel('Normalized Flux')