Пример #1
0
def test_gfc3d():
    data_files = ('CubeH8.hdf5', 'LMGC_GlobalFrictionContactProblem00046.hdf5')
    mark_as_failed = False

    for d in data_files:
        full_path = data_dir + d
        if os.path.isfile(full_path):

            fcp = sn.globalFrictionContact_fclib_read(full_path)
            for s in solvers:
                res = solve_global(fcp, s)
                if res:
                    print('Solver {:} on problem {:} failed with info = {:}'.format(sn.solver_options_id_to_name(s), d, res))
                    mark_as_failed = True
                else:
                    print('Solver {:} on problem {:} is ok'.format(sn.solver_options_id_to_name(s), d))

            fcp_reduced = condensed_from_global(fcp)
            for s in solvers_reduced1:
                res = solve_reduced(fcp_reduced, s)
                if res:
                    print('Solver {:} on problem {:} in reduced form failed with info = {:}'.format(sn.solver_options_id_to_name(s), d, res))
                    mark_as_failed = True
                else:
                    print('Solver {:} on problem {:} is ok'.format(sn.solver_options_id_to_name(s), d))

    assert mark_as_failed is False
Пример #2
0
def test_gfc3d():
    data_files = ('LMGC_GFC3D_CubeH8.hdf5',
                  'LMGC_GlobalFrictionContactProblem00046.hdf5')
    mark_as_failed = False

    for d in data_files:
        full_path = data_dir + d
        if os.path.isfile(full_path):

            fcp = sn.globalFrictionContact_fclib_read(full_path)
            for s in solvers:
                res = solve_global(fcp, s)
                if res:
                    print('Solver {:} on problem {:} failed with info = {:}'.
                          format(sn.solver_options_id_to_name(s), d, res))
                    mark_as_failed = True
                else:
                    print('Solver {:} on problem {:} is ok'.format(
                        sn.solver_options_id_to_name(s), d))

            fcp_reduced = condensed_from_global(fcp)
            for s in solvers_reduced1:
                res = solve_reduced(fcp_reduced, s)
                if res:
                    print(
                        'Solver {:} on problem {:} in reduced form failed with info = {:}'
                        .format(sn.solver_options_id_to_name(s), d, res))
                    mark_as_failed = True
                else:
                    print('Solver {:} on problem {:} is ok'.format(
                        sn.solver_options_id_to_name(s), d))

    assert mark_as_failed is False
Пример #3
0
def test_fc3d():
    data_files = ['Capsules-i125-1213.hdf5']
    mark_as_failed = False

    for d in data_files:
        full_path = data_dir + d
        if os.path.isfile(full_path):

            fcp = sn.frictionContact_fclib_read(full_path)
            for s in solvers_reduced2:
                res = solve_reduced(fcp, s)
                if res:
                    print('Solver {:} on problem {:} failed with info = {:}'.format(sn.solver_options_id_to_name(s), d, res))
                    mark_as_failed = True
                else:
                    print('Solver {:} on problem {:} is ok'.format(sn.solver_options_id_to_name(s), d))

    assert mark_as_failed is False
Пример #4
0
def test_fc3d():
    data_files = ['Capsules-i125-1213.hdf5']
    mark_as_failed = False

    for d in data_files:
        full_path = data_dir + d
        if os.path.isfile(full_path):
            sn.numerics_set_verbose(1)
            fcp = sn.frictionContact_fclib_read(full_path)
            for s in solvers_reduced3:
                res = solve_reduced(fcp, s)
                if res:
                    print('Solver {:} on problem {:} failed with info = {:}'.
                          format(sn.solver_options_id_to_name(s), d, res))
                    mark_as_failed = True
                else:
                    print('Solver {:} on problem {:} is ok'.format(
                        sn.solver_options_id_to_name(s), d))

    assert mark_as_failed is False
Пример #5
0
title = "SpheresBox"
description = """
Spheres in a box, generation with lmgc90 granulo_Random
number of spheres: {0}
radius min       : {1}
radius max       : {2}
box size x       : {3}
box size y       : {4}
box size z       : {5}
Moreau TimeStepping: h={6}, theta={7}
One Step non smooth problem: {8}, maxiter={9}, tol={10}
""".format(nb_laid_particles,
           mkspheres.radius_min,
           mkspheres.radius_max,
           lx, ly, lz,
           hstep, theta, sn.solver_options_id_to_name(solver),
           itermax,
           tolerance)

mathInfo = ""

friction_contact_trace_params = FrictionContactTraceParams(
    dump_itermax=10000, dump_probability=None,
    fileName=fileName, title=title,
    description=description, mathInfo=mathInfo)

# Create solver options
options = sk.solver_options_create(sn.SICONOS_FRICTION_3D_NSGS)
options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = itermax
options.dparam[sn.SICONOS_DPARAM_TOL] = tolerance
hstep = 1e-2
itermax = 1000
dump_probability = .02
theta = 0.50
tolerance = 1e-12

if not os.path.exists('box_stacks'):
    os.mkdir('box_stacks')

fileName = "./Box_stacks/Box_Stacks"
title = "Box_stacks"
description = """
Box stacks with Bullet collision detection
Moreau TimeStepping: h={0}, theta = {1}
One Step non smooth problem: {2}, maxiter={3}, tol={4}
""".format(hstep, theta, Numerics.solver_options_id_to_name(solver),
           itermax,
           tolerance)

mathInfo = ""

friction_contact_trace_params = FrictionContactTraceParams(
    dump_itermax=20, dump_probability=None,
    fileName=fileName, title=title,
    description=description, mathInfo=mathInfo)

    
# Load and run the simulation
with MechanicsHdf5Runner(mode='r+') as io:
    io.run(t0=0,
           T=step*hstep,
solver = sn.SICONOS_GLOBAL_FRICTION_3D_ADMM

dump_probability = .02
theta = 0.50

if not os.path.exists('box_stacks'):
    os.mkdir('box_stacks')

fileName = "./Box_stacks/Box_Stacks"
title = "Box_stacks"
description = """
Box stacks with Bullet collision detection
Moreau TimeStepping: h={0}, theta = {1}
One Step non smooth problem: {2}, maxiter={3}, tol={4}
""".format(hstep, theta, sn.solver_options_id_to_name(solver), itermax,
           tolerance)

mathInfo = ""

friction_contact_trace_params = FrictionContactTraceParams(
    dump_itermax=20,
    dump_probability=None,
    fileName=fileName,
    title=title,
    description=description,
    mathInfo=mathInfo)

options = sk.solver_options_create(solver)
options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = itermax
options.dparam[sn.SICONOS_DPARAM_TOL] = tolerance
Пример #8
0
solver = sn.SICONOS_FRICTION_3D_NSGS
fileName = "spheres-in-a-box-{0}".format(nb_laid_particles)
title = "SpheresBox"
description = """
Spheres in a box, generation with lmgc90 granulo_Random
number of spheres: {0}
radius min       : {1}
radius max       : {2}
box size x       : {3}
box size y       : {4}
box size z       : {5}
Moreau TimeStepping: h={6}, theta={7}
One Step non smooth problem: {8}, maxiter={9}, tol={10}
""".format(nb_laid_particles, mkspheres.radius_min,
           mkspheres.radius_max, lx, ly, lz, hstep, theta,
           sn.solver_options_id_to_name(solver), itermax, tolerance)

mathInfo = ""

friction_contact_trace_params = FrictionContactTraceParams(
    dump_itermax=10000,
    dump_probability=None,
    fileName=fileName,
    title=title,
    description=description,
    mathInfo=mathInfo)

# Create solver options
options = sk.solver_options_create(sn.SICONOS_FRICTION_3D_NSGS)
options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = itermax
options.dparam[sn.SICONOS_DPARAM_TOL] = tolerance