Esempio n. 1
0
#
inp.put_str("bc_left",                  "vacuum")
inp.put_str("bc_right",                 "vacuum")
inp.put_str("bc_bottom",                "vacuum")
inp.put_str("bc_top",                   "vacuum")
#
inp.put_str("quad_type",                "quadruplerange")
inp.put_int("quad_order",               2)
#-----------------------------------------------------------------------------#
# Material
#-----------------------------------------------------------------------------#
mat = get_materials()
#-----------------------------------------------------------------------------#
# Geometry
#-----------------------------------------------------------------------------#
core = get_core(7, True)
mesh = core.mesh()
#-----------------------------------------------------------------------------#
# Execute
#-----------------------------------------------------------------------------#
execute = Execute2D(sys.argv)
execute.initialize(inp, mat, mesh)
t = time.time()
execute.solve()
print "elapsed = ", time.time()-t
#-----------------------------------------------------------------------------#
# Post-Process
#-----------------------------------------------------------------------------#

#-----------------------------------------------------------------------------#
# Wrap Up
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", "GMRES")
    inp.put_int("inner_max_iters", 1)
    inp.put_dbl("inner_tolerance", 1e-3)
    inp.put_int("inner_print_level", 0)
    inp.put_int("inner_print_interval", 10)
    #
    inp.put_str("outer_solver", "GMRES")
    inp.put_int("outer_max_iters", 0)
    inp.put_dbl("outer_tolerance", 1e-4)
    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-6)
    inp.put_int("eigen_print_level", 2)
    inp.put_int("eigen_print_interval", 1)
    #
    inp.put_str("bc_west", "reflect")
    inp.put_str("bc_east", "vacuum")
    inp.put_str("bc_south", "reflect")
    inp.put_str("bc_north", "vacuum")
    #
    inp.put_str("quad_type", "quadruplerange")
    inp.put_int("quad_number_polar_octant", 3)
    inp.put_int("quad_number_azimuth_octant", 6)
    #
    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
    #-----------------------------------------------------------------------------#
    core = get_core(7, True)
    mesh = core.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("c5g7core.silo")
        silo.write_scalar_flux(state)
        silo.finalize()
    except:
        print "Silo error?"
Esempio n. 3
0
inp.put_str("bc_left", "reflect")
inp.put_str("bc_right", "vacuum")
inp.put_str("bc_bottom", "reflect")
inp.put_str("bc_top", "vacuum")
#-----------------------------------------------------------------------------#
# 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
#-----------------------------------------------------------------------------#
core = get_core(7, True)
mesh = core.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
#-----------------------------------------------------------------------------#
# Plot
Esempio n. 4
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",                   "GMRES")
  inp.put_int("inner_max_iters",                1)
  inp.put_dbl("inner_tolerance",                1e-3)
  inp.put_int("inner_print_level",              0)
  inp.put_int("inner_print_interval",           10)
  #
  inp.put_str("outer_solver",                   "GMRES")
  inp.put_int("outer_max_iters",                0)
  inp.put_dbl("outer_tolerance",                1e-4)
  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-6)
  inp.put_int("eigen_print_level",              2)
  inp.put_int("eigen_print_interval",           1)
  #
  inp.put_str("bc_west",                        "reflect")
  inp.put_str("bc_east",                        "vacuum")
  inp.put_str("bc_south",                       "reflect")
  inp.put_str("bc_north",                       "vacuum")
  #
  inp.put_str("quad_type",                      "quadruplerange")
  inp.put_int("quad_number_polar_octant",       3)
  inp.put_int("quad_number_azimuth_octant",     6)
  #
  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
  #-----------------------------------------------------------------------------#
  core = get_core(7, True)
  mesh = core.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("c5g7core.silo")
    silo.write_scalar_flux(state)
    silo.finalize()
  except :
    print "Silo error?"