Esempio n. 1
0
def do_ho_smooth(rots, ms, pc_opts):
    print('test 3d, rots  = ', rots)
    sys.stdout.flush()
    geo, mesh = gen_beam(dim = 3, maxh = 0.35, lens = [5,1,1], nref = 0, comm = ngsolve.mpi_world)
    V, a, f = setup_elast(mesh, order = 2, rotations = rots, f_vol = ngsolve.CoefficientFunction( (0, -0.005, 0) ), diri = "left")
    pc_opts["ngs_amg_rots"]  =  rots
    if not rots:
        pc_opts["ngs_amg_reg_mats"] = True
        pc_opts["ngs_amg_reg_rmats"] = True
    c  =  ngs_amg.elast_3d(a, **pc_opts)
    Solve(a, f, c, ms = ms)
Esempio n. 2
0
def do_ho_smooth_nodalp2(rots, ms, pc_opts, order = 3):
    print('test 3d with nodalp2, order  = ', order, 'rots  = ', rots)
    sys.stdout.flush()
    geo, mesh = gen_beam(dim = 3, maxh = 0.35, lens = [5,1,1], nref = 0, comm = ngsolve.mpi_world)
    V, a, f = setup_elast(mesh, order = order, rotations = rots, f_vol = ngsolve.CoefficientFunction( (0, -0.005, 0) ), diri = "left",
                          fes_opts = {"nodalp2" : True} )
    print('V ndof', V.ndof)
    pc_opts["ngs_amg_rots"] = rots
    pc_opts["ngs_amg_first_aaf"] = 0.1
    if order  ==  2:
        pc_opts["ngs_amg_lo"] = False
    else:
        pc_opts["ngs_amg_on_dofs"] = "select"
        pc_opts["ngs_amg_subset"] = "nodalp2"
    if rots is False:
        pc_opts["ngs_amg_reg_mats"] = True
        pc_opts["ngs_amg_reg_rmats"] = True
    c = ngs_amg.elast_3d(a, **pc_opts)
    Solve(a, f, c, ms = ms)
Esempio n. 3
0
    "ngs_amg_enable_redist": True,
    "ngs_amg_first_aaf": 0.025
}

gfu = ngsolve.GridFunction(V)
a.Assemble()
f.Assemble()
gfu.vec.data = a.mat.Inverse(V.FreeDofs()) * f.vec

#ngsolve.Draw(mesh, deformation = ngsolve.CoefficientFunction((gfu[0], gfu[1], gfu[2])), name="defo")
ngsolve.Draw(mesh,
             deformation=ngsolve.CoefficientFunction((gfu[0], gfu[1])),
             name="defo")
ngsolve.Draw(gfu[2], mesh, name="rot")
# for i in range(6):
#     ngsolve.Draw(gfu[i], mesh, name="comp_"+str(i))

# ngsolve.Draw(gfu, name="sol")

# # c = ngsolve.Preconditioner(a, "ngs_amg.elast3d", **pc_opts)
c = ngs_amg.elast_3d(a, **pc_opts)
pt = 0  #100 * 1024 * 1024
with ngsolve.TaskManager(pajetrace=pt):
    Solve(a, f, c, ms=40)

# if ngsolve.mpi_world.rank == 1:
#SetNumThreads(5)

#from bftester_vec import shape_test
#shape_test(mesh, maxh, V, a, c, 6)