Beispiel #1
0
def main():
    
    start = time.time()

    # set default values
    tol = 1.e-8
    cell_size    = 10.0
    solve_method = 'NEM4'
    iterations = 100

    # create mesh
    mesh = Mesh([cell_size,cell_size], [cell_size])
    
    # create fuel
    fuel = Material(2, 'fuel')
    fuel.setSigmaA([0.005, 0.10])
    fuel.setD([1.5, 0.40])
    fuel.setNuSigmaF([0.005, 0.15])
    fuel.setChi([1.0, 0.0])
    fuel.setSigmaS(np.array([[0.0, 0.02],[0.0, 0.0]]))
    
    # create fuel
    moderator = Material(2, 'moderator')
    moderator.setSigmaA([0.0, 0.01])
    moderator.setD([1.5, 0.20])
    moderator.setSigmaS(np.array([[0.0, 0.025],[0.0, 0.0]]))
    
    if solve_method == 'NEM4':
        order = 4
    else:
        order = 2
  
    # add materials to cells
    mesh.cells[0].setMaterial(fuel, order)
    mesh.cells[1].setMaterial(moderator, order)
#     mesh = mesh.refineMesh(.1)
    mesh.makeSurfaces()
    
    # plot the mesh
    pttr.plotMesh(mesh)
    
    # create solver
    solver = Solver(mesh, solve_method)   

    # solve the matrix problem to get flux profile and keff
    solver.solve(tol, iterations)
         
    # plot the flux    
    pttr.plotFlux(solver)
    pttr.plotCellFlux(solver)
    pttr.plotCurrent(solver)

    stop = time.time()
    
    print 'Ran time ' + str(stop-start)[0:5] + ' seconds'

    print '----------------------------------------------------------------------'
Beispiel #2
0
for cell in mesh.cells[99:106]: cell.setMaterial(fuel1bin,order)
for cell in mesh.cells[106:108]: cell.setMaterial(fuel2bin,order)
for cell in mesh.cells[108:110]: cell.setMaterial(reflector,order)
mesh.cells[110].setMaterial(fuel1bo,order)
for cell in mesh.cells[111:115]: cell.setMaterial(fuel1bin,order)
for cell in mesh.cells[115:117]: cell.setMaterial(fuel1bo,order)
for cell in mesh.cells[117:119]: cell.setMaterial(fuel2bin,order)
for cell in mesh.cells[119:121]: cell.setMaterial(reflector,order)

mesh = mesh.refineMesh(3.0)
mesh.makeSurfaces()

# plot the mesh
pttr.plotMesh(mesh)

# create solver
solver = Solver(mesh, solve_method)   

# solve the matrix problem to get flux profile and keff
solver.solve(tol, iterations)

pttr.plotCellFlux(solver)
if solve_method == 'NEM4' or solve_method == 'NEM2':
    pttr.plotFlux(solver)

stop = time.time()

print 'Ran time ' + str(stop-start)[0:5] + ' seconds'

print '----------------------------------------------------------------------'