def run():

    #-----------------------------------------------------------------------------#
    # Input
    #-----------------------------------------------------------------------------#
    inp = InputDB.Create()
    inp.put_str("equation", "dd")
    inp.put_str("problem_type", "eigenvalue")
    inp.put_int("number_groups", 7)
    #
    inp.put_str("inner_solver", "SI")
    inp.put_int("inner_max_iters", 100)
    inp.put_dbl("inner_tolerance", 1e-9)
    inp.put_int("inner_print_level", 0)
    inp.put_int("inner_print_interval", 10)
    #
    inp.put_str("outer_solver", "GS")
    inp.put_int("outer_max_iters", 100)
    inp.put_dbl("outer_tolerance", 1e-9)
    inp.put_int("outer_print_level", 0)
    inp.put_int("outer_print_interval", 1)
    #
    inp.put_str("eigen_solver", "PI")
    inp.put_int("eigen_max_iters", 1000)
    inp.put_dbl("eigen_tolerance", 1e-9)
    inp.put_int("eigen_print_level", 2)
    inp.put_int("eigen_print_interval", 1)
    inp.put_dbl("eigen_pi_omega", 1.0)
    #
    inp.put_str("bc_west", "reflect")
    inp.put_str("bc_east", "reflect")
    inp.put_str("bc_south", "reflect")
    inp.put_str("bc_north", "reflect")
    #
    #inp.put_str("quad_type",                      "quadruplerange")
    inp.put_int("quad_number_polar_octant", 5)
    inp.put_int("quad_number_azimuth_octant", 10)
    #
    db = InputDB.Create("callow_db")
    db.put_dbl("linear_solver_atol", 1e-9)
    db.put_dbl("linear_solver_rtol", 1e-9)
    db.put_str("linear_solver_type", "petsc")
    db.put_int("linear_solver_maxit", 5000)
    db.put_int("linear_solver_gmres_restart", 30)
    db.put_int("linear_solver_monitor_level", 0)
    db.put_str("pc_type", "petsc_pc")
    db.put_str("petsc_pc_type", "lu")
    db.put_str("eigen_solver_type", "slepc")
    db.put_int("eigen_solver_monitor_level", 2)
    inp.put_spdb("inner_solver_db", db)
    inp.put_spdb("inner_pc_db", db)
    inp.put_spdb("outer_solver_db", db)
    inp.put_spdb("eigen_solver_db", db)
    #-----------------------------------------------------------------------------#
    # Material
    #-----------------------------------------------------------------------------#
    mat = get_materials()
    #-----------------------------------------------------------------------------#
    # Geometry
    #-----------------------------------------------------------------------------#
    pins = get_pins(7, True)
    mesh = pins[3].mesh()
    #-----------------------------------------------------------------------------#
    # Solve
    #-----------------------------------------------------------------------------#
    start = time.time()
    solver = Eigen2D(inp, mat, mesh)
    solver.solve()
    print "elapsed = ", time.time() - start
    #-----------------------------------------------------------------------------#
    # Plot
    #-----------------------------------------------------------------------------#
    try:
        state = solver.state()
        silo = SiloOutput(mesh)
        silo.initialize("c5g7pin.silo")
        silo.write_scalar_flux(state)
        silo.finalize()
    except:
        print "Silo error?"
Example #2
0
def run() :

  #-----------------------------------------------------------------------------#
  # Input 
  #-----------------------------------------------------------------------------#
  inp = InputDB.Create()
  inp.put_str("equation",                       "dd")
  inp.put_str("problem_type",                   "eigenvalue")
  inp.put_int("number_groups",                  7)
  #
  inp.put_str("inner_solver",                   "SI")
  inp.put_int("inner_max_iters",                100)
  inp.put_dbl("inner_tolerance",                1e-9)
  inp.put_int("inner_print_level",              0)
  inp.put_int("inner_print_interval",           10)
  #
  inp.put_str("outer_solver",                   "GS")
  inp.put_int("outer_max_iters",                100)
  inp.put_dbl("outer_tolerance",                1e-9)
  inp.put_int("outer_print_level",              0)
  inp.put_int("outer_print_interval",           1)
  #
  inp.put_str("eigen_solver",                   "PI")
  inp.put_int("eigen_max_iters",                1000)
  inp.put_dbl("eigen_tolerance",                1e-9)
  inp.put_int("eigen_print_level",              2)
  inp.put_int("eigen_print_interval",           1)
  inp.put_dbl("eigen_pi_omega",                 1.0)
  #
  inp.put_str("bc_west",                        "reflect")
  inp.put_str("bc_east",                        "reflect")
  inp.put_str("bc_south",                       "reflect")
  inp.put_str("bc_north",                       "reflect")
  #
  inp.put_str("quad_type",                      "quadruplerange")
  inp.put_int("quad_number_polar_octant",       5)
  inp.put_int("quad_number_azimuth_octant",     10)
  #
  db = InputDB.Create("callow_db")
  db.put_dbl("linear_solver_atol",              1e-9);
  db.put_dbl("linear_solver_rtol",              1e-9);
  db.put_str("linear_solver_type",              "petsc");
  db.put_int("linear_solver_maxit",             5000);
  db.put_int("linear_solver_gmres_restart",     30);
  db.put_int("linear_solver_monitor_level",     0);
  db.put_str("pc_type",                         "petsc_pc");
  db.put_str("petsc_pc_type",                   "lu");
  db.put_str("eigen_solver_type",               "slepc");
  db.put_int("eigen_solver_monitor_level",      2);
  inp.put_spdb("inner_solver_db",               db)
  inp.put_spdb("inner_pc_db",                   db)
  inp.put_spdb("outer_solver_db",               db)
  inp.put_spdb("eigen_solver_db",               db)
  #-----------------------------------------------------------------------------#
  # Material
  #-----------------------------------------------------------------------------#
  mat = get_materials()
  #-----------------------------------------------------------------------------#
  # Geometry
  #-----------------------------------------------------------------------------#
  pins = get_pins(7, True)
  mesh = pins[3].mesh()
  #-----------------------------------------------------------------------------#
  # Solve
  #-----------------------------------------------------------------------------#
  start = time.time()
  solver = Eigen2D(inp, mat, mesh)
  solver.solve()
  print "elapsed = ", time.time() - start
  #-----------------------------------------------------------------------------#
  # Plot
  #-----------------------------------------------------------------------------#
  try :
    state = solver.state()
    silo = SiloOutput(mesh)
    silo.initialize("c5g7pin.silo")
    silo.write_scalar_flux(state)
    silo.finalize()
  except :
    print "Silo error?"
inp.put_str("bc_left",                  "reflect")
inp.put_str("bc_right",                 "reflect")
inp.put_str("bc_bottom",                "reflect")
inp.put_str("bc_top",                   "reflect")
#-----------------------------------------------------------------------------#
# Material
#-----------------------------------------------------------------------------#
mat = get_materials()
for m in range(0, 7) :
  for g in range(0, 7) :
    mat.set_diff_coef(m, g, 1.0/(3.0*mat.sigma_t(m, g)))
mat.finalize()
#-----------------------------------------------------------------------------#
# Geometry
#-----------------------------------------------------------------------------#
pins = get_pins(7, True)
mesh = pins[0].mesh()
#-----------------------------------------------------------------------------#
# State
#-----------------------------------------------------------------------------#
state = State.Create(inp, mesh)
#-----------------------------------------------------------------------------#
# Execute
#-----------------------------------------------------------------------------#
Manager.initialize(sys.argv)
solver = DiffusionEigensolver(inp, mat, mesh, state)
t = time.time()
solver.solve()
print "elapsed = ", time.time()-t
#-----------------------------------------------------------------------------#
# Wrap Up