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 '----------------------------------------------------------------------'
solver.computeDs() solver.makeAM() solver.solve(tol) solver.makeN() solver.computeCoeffs() solver.computeCurrents() if abs(solver.keff_old - solver.keff) < 1.0e-8: print solve_method + ": Converged in " + str(iteration) + " iterations --- k_eff = " + str(solver.keff)[ 0:10 ] break elif solve_method == "diffusion": solver.computeDs() solver.makeAM() solver.solve(tol) print "DIFFUSION: --- k_eff = " + str(solver.keff)[0:10] if solve_method == "NEM4" or solve_method == "NEM2": pttr.plotFlux(solver) # pttr.plotCurrent(solver) stop = time.time() print "Ran time " + str(stop - start)[0:5] + " seconds" print "----------------------------------------------------------------------"